mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Added MUC invite handler to XEP-0045 plugin.
Originally contributed by damium/romeira, with some modifications. Also, converted tabs to spaces to prepare for future cleanup.
This commit is contained in:
parent
67775fb8bd
commit
988a90a176
1 changed files with 292 additions and 284 deletions
|
@ -108,7 +108,7 @@ class MUCPresence(ElementBase):
|
||||||
|
|
||||||
class xep_0045(base.base_plugin):
|
class xep_0045(base.base_plugin):
|
||||||
"""
|
"""
|
||||||
Impliments XEP-0045 Multi User Chat
|
Implements XEP-0045 Multi User Chat
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def plugin_init(self):
|
def plugin_init(self):
|
||||||
|
@ -121,6 +121,14 @@ class xep_0045(base.base_plugin):
|
||||||
self.xmpp.registerHandler(Callback('MUCPresence', MatchXMLMask("<presence xmlns='%s' />" % self.xmpp.default_ns), self.handle_groupchat_presence))
|
self.xmpp.registerHandler(Callback('MUCPresence', MatchXMLMask("<presence xmlns='%s' />" % self.xmpp.default_ns), self.handle_groupchat_presence))
|
||||||
self.xmpp.registerHandler(Callback('MUCMessage', MatchXMLMask("<message xmlns='%s' type='groupchat'><body/></message>" % self.xmpp.default_ns), self.handle_groupchat_message))
|
self.xmpp.registerHandler(Callback('MUCMessage', MatchXMLMask("<message xmlns='%s' type='groupchat'><body/></message>" % self.xmpp.default_ns), self.handle_groupchat_message))
|
||||||
self.xmpp.registerHandler(Callback('MUCSubject', MatchXMLMask("<message xmlns='%s' type='groupchat'><subject/></message>" % self.xmpp.default_ns), self.handle_groupchat_subject))
|
self.xmpp.registerHandler(Callback('MUCSubject', MatchXMLMask("<message xmlns='%s' type='groupchat'><subject/></message>" % self.xmpp.default_ns), self.handle_groupchat_subject))
|
||||||
|
self.xmpp.registerHandler(Callback('MUCInvite', MatchXPath("{%s}message/{http://jabber.org/protocol/muc#user}x/invite" % self.xmpp.default_ns), self.handle_groupchat_invite))
|
||||||
|
|
||||||
|
def handle_groupchat_invite(self, inv):
|
||||||
|
""" Handle an invite into a muc.
|
||||||
|
"""
|
||||||
|
logging.debug("MUC invite to %s from %s: %s" % (inv['from'], inv["from"], inv))
|
||||||
|
if inv['from'] not in self.rooms.keys():
|
||||||
|
self.xmpp.event("groupchat_invite", inv)
|
||||||
|
|
||||||
def handle_groupchat_presence(self, pr):
|
def handle_groupchat_presence(self, pr):
|
||||||
""" Handle a presence in a muc.
|
""" Handle a presence in a muc.
|
||||||
|
|
Loading…
Reference in a new issue