From 7046a19af0b3f121b8230318d9d86de170f37b4d Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 2 Sep 2006 11:17:02 +0000 Subject: [PATCH] raise is usefull to know if join was sucesfull or not (in roster_window.py). Fixes #6698 --- src/dialogs.py | 7 +++++-- src/disco.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/dialogs.py b/src/dialogs.py index 528559cc4..d067aac43 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1042,7 +1042,7 @@ class JoinGroupchatWindow: jid = room + '@' + server if jid in gajim.gc_connected[account] and gajim.gc_connected[account][jid]: ErrorDialog(_('You are already in room %s') % jid) - return + raise RuntimeError, 'You are already in this room' self.account = account self.automatic = automatic if nick == '': @@ -2144,7 +2144,10 @@ class InvitationReceivedDialog: def on_accept_button_clicked(self, widget): self.dialog.destroy() room, server = gajim.get_room_name_and_server_from_room_jid(self.room_jid) - JoinGroupchatWindow(self.account, server = server, room = room) + try: + JoinGroupchatWindow(self.account, server = server, room = room) + except RuntimeError: + pass class ProgressDialog: def __init__(self, title_text, during_text, messages_queue): diff --git a/src/disco.py b/src/disco.py index b61d8e3cf..f56f70a1c 100644 --- a/src/disco.py +++ b/src/disco.py @@ -1198,7 +1198,10 @@ class ToplevelAgentBrowser(AgentBrowser): else: room = '' if not gajim.interface.instances[self.account].has_key('join_gc'): - dialogs.JoinGroupchatWindow(self.account, service, room) + try: + dialogs.JoinGroupchatWindow(self.account, service, room) + except RuntimeError: + pass else: gajim.interface.instances[self.account]['join_gc'].window.present() self.window.destroy(chain = True) @@ -1528,7 +1531,10 @@ class MucBrowser(AgentBrowser): else: room = model[iter][1].decode('utf-8') if not gajim.interface.instances[self.account].has_key('join_gc'): - dialogs.JoinGroupchatWindow(self.account, service, room) + try: + dialogs.JoinGroupchatWindow(self.account, service, room) + except RuntimeError: + pass else: gajim.interface.instances[self.account]['join_gc'].window.present() self.window.destroy(chain = True)