Mercurial > xib
comparison muc.py @ 5:cb0daec4b778
Added support for IRC "nick" event, fixed participant.changeNickname(), fixed handling of IRC "namreply" event, removed muc._check() because waiting does not solve the problem if it is blocking incoming messages handling
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 16 Aug 2009 17:59:00 +0200 |
parents | 4c842d23d4ce |
children | 9631f8d9895d |
comparison
equal
deleted
inserted
replaced
4:012593ed4e12 | 5:cb0daec4b778 |
---|---|
86 xmpp_c.UnregisterHandler('presence', self._xmpp_presence_handler) | 86 xmpp_c.UnregisterHandler('presence', self._xmpp_presence_handler) |
87 if self.callback != None: | 87 if self.callback != None: |
88 self.callback(errors) | 88 self.callback(errors) |
89 | 89 |
90 | 90 |
91 def _check(self): | |
92 i = 0 | |
93 while not self.connected: | |
94 i += 1 | |
95 if i > 30: | |
96 raise Exception('Error: connection to room timed out') | |
97 sleep(1) | |
98 | |
99 | |
100 def say(self, message): | 91 def say(self, message): |
101 """Say message in the room""" | 92 """Say message in the room""" |
102 self._check() | |
103 self.xmpp_c.send(xmpp.protocol.Message(to=self.room_jid, typ='groupchat', body=message)) | 93 self.xmpp_c.send(xmpp.protocol.Message(to=self.room_jid, typ='groupchat', body=message)) |
104 | 94 |
105 | 95 |
106 def sayTo(self, to, message): | 96 def sayTo(self, to, message): |
107 """Send a private message""" | 97 """Send a private message""" |
108 self._check() | |
109 self.xmpp_c.send(xmpp.protocol.Message(to=self.room_jid+'/'+to, typ='chat', body=message)) | 98 self.xmpp_c.send(xmpp.protocol.Message(to=self.room_jid+'/'+to, typ='chat', body=message)) |
110 | 99 |
111 | 100 |
112 def change_nick(self, nickname, callback=None): | 101 def change_nick(self, nickname, callback=None): |
113 """Change nickname""" | 102 """Change nickname""" |