summaryrefslogtreecommitdiffstats
path: root/connection
diff options
context:
space:
mode:
Diffstat (limited to 'connection')
-rw-r--r--connection/xmpp.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/connection/xmpp.py b/connection/xmpp.py
index 4104af7..4facfe8 100644
--- a/connection/xmpp.py
+++ b/connection/xmpp.py
@@ -25,16 +25,44 @@ class MucHandler(MucRoomHandler):
MucRoomHandler.__init__(self)
self.client = client
+ def reply(self, text):
+ self.room_state.send_message(text)
+
+ def get_topic(self):
+ return self.room_state.subject
+
+ def set_topic(self, topic):
+ self.room_state.set_subject(topic)
+
def message_received(self, user, stanza):
- if(user.same_as(self.room_state.me)):
+ if(user == None or user.same_as(self.room_state.me) or stanza.get_body() == None):
return
for mod in self.client.module_manager.modules.itervalues():
- mod.groupchat(stanza.get_from().bare().as_unicode(), stanza.get_from().resource, stanza.get_body(), self.room_state.send_message)
+ mod.groupchat(stanza.get_from().bare().as_unicode(), stanza.get_from().resource, stanza.get_body(), self)
def user_joined(self, user, stanza):
if(not self.room_state.joined or user.same_as(self.room_state.me)):
return
+
+ for mod in self.client.module_manager.modules.itervalues():
+ mod.join(stanza.get_from().bare().as_unicode(), stanza.get_from().resource, stanza.get_show(), stanza.get_status(), self)
+
+ def user_left(self, user, stanza):
+ if(not self.room_state.joined or user.same_as(self.room_state.me)):
+ return
+
+ for mod in self.client.module_manager.modules.itervalues():
+ mod.leave(stanza.get_from().bare().as_unicode(), stanza.get_from().resource, stanza.get_show(), stanza.get_status(), self)
+
+ def subject_changed(self, user, stanza):
+ topic = ''
+ if stanza.get_subject() != None:
+ topic = stanza.get_subject()
+
+ for mod in self.client.module_manager.modules.itervalues():
+ mod.topic(stanza.get_from().bare().as_unicode(), stanza.get_from().resource, topic, self)
+
class PresenceHandler(object):
implements(IPresenceHandlersProvider)