diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2010-05-02 23:40:21 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2010-05-02 23:40:21 +0200 |
commit | 323d31514f7e438df5883ad6cb9e17cce6a296b3 (patch) | |
tree | 2efeb977154ca92b0c8a39fe958e91166aca68df /connection | |
parent | 88a78fa5d77a3db1024375fe4c0b654038604edb (diff) | |
download | curunir-323d31514f7e438df5883ad6cb9e17cce6a296b3.tar curunir-323d31514f7e438df5883ad6cb9e17cce6a296b3.zip |
Added topic module
Diffstat (limited to 'connection')
-rw-r--r-- | connection/xmpp.py | 32 |
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) |