# Slixmpp: The Slick XMPP Library# Copyright (C) 2020 Mathieu Pasquet# This file is part of Slixmpp.# See the file LICENSE for copying permission.fromtypingimportIterable,OptionalfromslixmppimportJIDfromslixmpp.pluginsimportBasePluginfromslixmpp.stanzaimportPresencefromslixmpp.xmlstream.matcherimportStanzaPathfromslixmpp.xmlstream.handlerimportCallbackfromslixmpp.plugins.xep_0437importstanza
[docs]defsubscribe(self,service:JID,*,pfrom:Optional[JID]=None):""" Subscribe to room activty on a MUC service. :param JID service: MUC service """pres=self.xmpp.make_presence(pto=service,pfrom=pfrom)pres.enable('rai')pres.send()
[docs]defunsubscribe(self,service:JID,*,pfrom:Optional[JID]=None):""" Unsubscribe from room activty on a MUC service. :param JID service: MUC service """pres=self.xmpp.make_presence(pto=service,pfrom=pfrom,ptype='unavailable',)pres.send()