Commit 82f77772 authored by Yann Leboulanger's avatar Yann Leboulanger

don't allow to join a groupchat if we have a contact with the same JID. Fixes #5799

parent a5fc3b77
......@@ -2443,13 +2443,10 @@ def on_join_button_clicked(self, widget):
_('The group chat Jabber ID has not allowed characters.'))
return
if gajim.interface.msg_win_mgr.has_window(room_jid, self.account):
ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
self.account)
if ctrl.type_id != message_control.TYPE_GC:
ErrorDialog(_('This is not a group chat'),
_('%s is not the name of a group chat.') % room_jid)
return
if gajim.contacts.get_contact(self.account, room_jid):
ErrorDialog(_('This is not a group chat'),
_('%s is not the name of a group chat.') % room_jid)
return
if room_jid in self.recently_groupchat:
self.recently_groupchat.remove(room_jid)
self.recently_groupchat.insert(0, room_jid)
......
......@@ -1909,6 +1909,12 @@ def join_gc_room(self, account, room_jid, nick, password, minimize=False,
"""
Join the room immediately
"""
if gajim.contacts.get_contact(account, room_jid):
dialogs.ErrorDialog(_('This is not a group chat'),
_('%s is not the name of a group chat.') % room_jid)
return
if not nick:
nick = gajim.nicks[account]
......@@ -2414,7 +2420,7 @@ def auto_join_bookmarks(self, account):
if not jid in gajim.gc_connected[account]:
# we are not already connected
minimize = bm['minimize'] in ('1', 'true')
gajim.interface.join_gc_room(account, jid, bm['nick'],
self.join_gc_room(account, jid, bm['nick'],
bm['password'], minimize = minimize)
elif jid in self.minimized_controls[account]:
# more or less a hack:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment