feat: Allow specifying XEP-0449's access model

This commit is contained in:
PapaTutuWawa 2023-01-02 17:52:55 +01:00
parent 2a3449d0f2
commit f37cbd1616

View File

@ -252,10 +252,11 @@ class StickersManager extends XmppManagerBase {
); );
} }
/// Publishes the StickerPack [pack] to the PubSub node of [jid]. /// Publishes the StickerPack [pack] to the PubSub node of [jid]. If specified, then
/// [accessModel] will be used as the PubSub node's access model.
/// ///
/// On success, returns true. On failure, returns a PubSubError. /// On success, returns true. On failure, returns a PubSubError.
Future<Result<PubSubError, bool>> publishStickerPack(JID jid, StickerPack pack) async { Future<Result<PubSubError, bool>> publishStickerPack(JID jid, StickerPack pack, { String? accessModel }) async {
assert(pack.id != '', 'The sticker pack must have an id'); assert(pack.id != '', 'The sticker pack must have an id');
final pm = getAttributes().getManagerById<PubSubManager>(pubsubManager)!; final pm = getAttributes().getManagerById<PubSubManager>(pubsubManager)!;
@ -264,8 +265,9 @@ class StickersManager extends XmppManagerBase {
stickersXmlns, stickersXmlns,
pack.toXML(), pack.toXML(),
id: pack.id, id: pack.id,
options: const PubSubPublishOptions( options: PubSubPublishOptions(
maxItems: 'max', maxItems: 'max',
accessModel: accessModel,
), ),
); );
} }