comparison muc.py @ 256:f14b32e7fdb5

(muc) auto_reconnect must be set in join() not in __init__() because we turn it to False in leave() Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sat, 13 Mar 2010 14:25:34 +0100
parents 9b83cdd51523
children 1a8401d6bc93
comparison
equal deleted inserted replaced
255:38dd27098fef 256:f14b32e7fdb5
30 class ForgotNickname(Exception): pass 30 class ForgotNickname(Exception): pass
31 class UnknownError(Exception): pass 31 class UnknownError(Exception): pass
32 class RemoteServerNotFound(Exception): pass 32 class RemoteServerNotFound(Exception): pass
33 class NotConnected(Exception): pass 33 class NotConnected(Exception): pass
34 34
35 def __init__(self, room_jid, auto_reconnect=True): 35 def __init__(self, room_jid):
36 self.room_jid = room_jid 36 self.room_jid = room_jid
37 self.connected = False 37 self.connected = False
38 self.auto_reconnect = auto_reconnect
39 self.participants = {} 38 self.participants = {}
40 39
41 40
42 def _join(self, callback=None): 41 def _join(self, callback=None):
43 self.callback = callback 42 self.callback = callback
63 for m in self.xmpp_c.mucs: 62 for m in self.xmpp_c.mucs:
64 m.rejoin() 63 m.rejoin()
65 self.xmpp_c.send(stanza) 64 self.xmpp_c.send(stanza)
66 65
67 66
68 def join(self, xmpp_c, nickname, status=None, callback=None): 67 def join(self, xmpp_c, nickname, status=None, callback=None, auto_reconnect=True):
69 """Join room on xmpp_c connection using nickname""" 68 """Join room on xmpp_c connection using nickname"""
70 self.jid = self.room_jid+'/'+nickname 69 self.jid = self.room_jid+'/'+nickname
71 self.nickname = nickname 70 self.nickname = nickname
72 self.status = status 71 self.status = status
72 self.auto_reconnect = auto_reconnect
73 self.xmpp_c = xmpp_c 73 self.xmpp_c = xmpp_c
74 self.xmpp_c.mucs.append(self) 74 self.xmpp_c.mucs.append(self)
75 self._join(callback=callback) 75 self._join(callback=callback)
76 76
77 77