| 1105 | | def join_gc_room(self, account, room_jid, nick, password, minimize=False, |
| 1106 | | is_continued=False): |
| 1107 | | '''joins the room immediately''' |
| 1108 | | if gajim.interface.msg_win_mgr.has_window(room_jid, account) and \ |
| 1109 | | gajim.gc_connected[account][room_jid]: |
| 1110 | | win = gajim.interface.msg_win_mgr.get_window(room_jid, account) |
| 1111 | | ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid, account) |
| 1112 | | win.set_active_tab(ctrl) |
| 1113 | | dialogs.ErrorDialog(_('You are already in group chat %s') % room_jid) |
| 1114 | | return |
| 1115 | | minimized_control_exists = False |
| 1116 | | if room_jid in gajim.interface.minimized_controls[account]: |
| 1117 | | minimized_control_exists = True |
| 1118 | | invisible_show = gajim.SHOW_LIST.index('invisible') |
| 1119 | | if gajim.connections[account].connected == invisible_show: |
| 1120 | | dialogs.ErrorDialog( |
| 1121 | | _('You cannot join a group chat while you are invisible')) |
| 1122 | | return |
| 1123 | | if minimize and not minimized_control_exists and \ |
| 1124 | | not gajim.interface.msg_win_mgr.has_window(room_jid, account): |
| 1125 | | contact = gajim.contacts.create_contact(jid = room_jid, name = nick) |
| 1126 | | gc_control = GroupchatControl(None, contact, account) |
| 1127 | | gajim.interface.minimized_controls[account][room_jid] = gc_control |
| 1128 | | gajim.connections[account].join_gc(nick, room_jid, password) |
| 1129 | | if password: |
| 1130 | | gajim.gc_passwords[room_jid] = password |
| 1131 | | self.add_groupchat_to_roster(account, room_jid) |
| 1132 | | return |
| 1133 | | if not minimized_control_exists and \ |
| 1134 | | not gajim.interface.msg_win_mgr.has_window(room_jid, account): |
| 1135 | | self.new_room(room_jid, nick, account, is_continued=is_continued) |
| 1136 | | if not minimized_control_exists: |
| 1137 | | gc_win = gajim.interface.msg_win_mgr.get_window(room_jid, account) |
| 1138 | | gc_control = gc_win.get_gc_control(room_jid, account) |
| 1139 | | gc_win.set_active_tab(gc_control) |
| 1140 | | gajim.connections[account].join_gc(nick, room_jid, password) |
| 1141 | | if password: |
| 1142 | | gajim.gc_passwords[room_jid] = password |
| 1143 | | contact = gajim.contacts.get_contact_with_highest_priority(account, \ |
| 1144 | | room_jid) |
| 1145 | | if contact or minimized_control_exists: |
| 1146 | | self.add_groupchat_to_roster(account, room_jid) |