mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Add a groupchat_subject event
Use this event to get notified of the subject changes (or to get the subject of the room when joining one)
This commit is contained in:
parent
9dbf246f0b
commit
b73a859031
1 changed files with 7 additions and 0 deletions
|
@ -120,6 +120,7 @@ class xep_0045(base.base_plugin):
|
||||||
registerStanzaPlugin(Presence, MUCPresence)
|
registerStanzaPlugin(Presence, MUCPresence)
|
||||||
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))
|
||||||
|
|
||||||
def handle_groupchat_presence(self, pr):
|
def handle_groupchat_presence(self, pr):
|
||||||
""" Handle a presence in a muc.
|
""" Handle a presence in a muc.
|
||||||
|
@ -153,6 +154,12 @@ class xep_0045(base.base_plugin):
|
||||||
self.xmpp.event('groupchat_message', msg)
|
self.xmpp.event('groupchat_message', msg)
|
||||||
self.xmpp.event("muc::%s::message" % msg['from'].bare, msg)
|
self.xmpp.event("muc::%s::message" % msg['from'].bare, msg)
|
||||||
|
|
||||||
|
def handle_groupchat_subject(self, msg):
|
||||||
|
""" Handle a message coming from a muc indicating
|
||||||
|
a change of subject (or announcing it when joining the room)
|
||||||
|
"""
|
||||||
|
self.xmpp.event('groupchat_subject', msg)
|
||||||
|
|
||||||
def jidInRoom(self, room, jid):
|
def jidInRoom(self, room, jid):
|
||||||
for nick in self.rooms[room]:
|
for nick in self.rooms[room]:
|
||||||
entry = self.rooms[room][nick]
|
entry = self.rooms[room][nick]
|
||||||
|
|
Loading…
Reference in a new issue