summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2010-11-10 04:56:38 +0800
committerLance Stout <lancestout@gmail.com>2010-11-10 05:54:22 +0800
commitb73a8590310c61c8d56b6a6f861c8666b4e71064 (patch)
tree492cbc9c7e93210b346027cc2c7e278b5173f2c0
parent9dbf246f0bfcac2c4ce538431ee629f126c86447 (diff)
downloadslixmpp-b73a8590310c61c8d56b6a6f861c8666b4e71064.tar.gz
slixmpp-b73a8590310c61c8d56b6a6f861c8666b4e71064.tar.bz2
slixmpp-b73a8590310c61c8d56b6a6f861c8666b4e71064.tar.xz
slixmpp-b73a8590310c61c8d56b6a6f861c8666b4e71064.zip
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)
-rw-r--r--sleekxmpp/plugins/xep_0045.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py
index de982356..db41cdb3 100644
--- a/sleekxmpp/plugins/xep_0045.py
+++ b/sleekxmpp/plugins/xep_0045.py
@@ -120,6 +120,7 @@ class xep_0045(base.base_plugin):
registerStanzaPlugin(Presence, MUCPresence)
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('MUCSubject', MatchXMLMask("<message xmlns='%s' type='groupchat'><subject/></message>" % self.xmpp.default_ns), self.handle_groupchat_subject))
def handle_groupchat_presence(self, pr):
""" 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("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):
for nick in self.rooms[room]:
entry = self.rooms[room][nick]