Handle correctly disconnections

When we are disconnected from the server and we reconnect,
do not reopen the MUCs in double.
This commit is contained in:
Florent Le Coz 2011-01-10 17:40:07 +01:00
parent 8e7b678506
commit cb96bf4280

View file

@ -256,6 +256,9 @@ class Core(object):
""" """
When we are disconnected from remote server When we are disconnected from remote server
""" """
for tab in self.tabs:
if isinstance(tab, tabs.MucTab):
tab.get_room().disconnect()
self.information(_("Disconnected from server.")) self.information(_("Disconnected from server."))
def on_failed_auth(self, event): def on_failed_auth(self, event):
@ -296,6 +299,8 @@ class Core(object):
nick = config.get('default_nick', '') nick = config.get('default_nick', '')
if nick == '': if nick == '':
nick = default nick = default
tab = self.get_tab_by_name(jid.bare)
if not tab:
self.open_new_room(jid.bare, nick, False) self.open_new_room(jid.bare, nick, False)
muc.join_groupchat(self.xmpp, jid.bare, nick) muc.join_groupchat(self.xmpp, jid.bare, nick)
# if not self.xmpp.anon: # if not self.xmpp.anon: