add account combobox to join groupchat dialog when we try to join a groupchat from another chat / groupchat. Fixes #3344

This commit is contained in:
Yann Leboulanger 2009-09-02 23:45:16 +02:00
parent a2ca911d80
commit 682d6f838a
4 changed files with 318 additions and 397 deletions

View File

@ -1,365 +1,259 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<?xml version="1.0"?>
<glade-interface>
<widget class="GtkWindow" id="join_groupchat_window">
<property name="border_width">6</property>
<property name="title" translatable="yes">Join Group Chat</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="destroy" handler="on_join_groupchat_window_destroy" last_modification_time="Wed, 02 Mar 2005 12:20:14 GMT"/>
<signal name="key_press_event" handler="on_join_groupchat_window_key_press_event" last_modification_time="Tue, 05 Apr 2005 13:13:40 GMT"/>
<child>
<widget class="GtkVBox" id="vbox28">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkTable" id="table15">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkEntry" id="room_jid_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="activates_default">True</property>
<signal name="changed" handler="on_required_entry_changed" last_modification_time="Sat, 14 Jan 2006 21:51:39 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="nickname_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="activates_default">True</property>
<signal name="changed" handler="on_required_entry_changed" last_modification_time="Sat, 14 Jan 2006 21:51:24 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label143">
<property name="visible">True</property>
<property name="label" translatable="yes">Room:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label142">
<property name="visible">True</property>
<property name="label" translatable="yes">Nickname:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label225">
<property name="visible">True</property>
<property name="label" translatable="yes">Recently:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="recently_combobox">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="changed" handler="on_recently_combobox_changed" last_modification_time="Wed, 06 Apr 2005 22:25:35 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label145">
<property name="visible">True</property>
<property name="label" translatable="yes">Password:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">False</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="activates_default">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="auto_join_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Join this room automatically when I connect</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox12">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">12</property>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Fri, 04 Mar 2005 13:40:16 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="join_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_join_button_clicked" last_modification_time="Wed, 02 Mar 2005 12:19:22 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment25">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox37">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image148">
<property name="visible">True</property>
<property name="stock">gtk-apply</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label146">
<property name="visible">True</property>
<property name="label" translatable="yes">_Join</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkWindow" id="join_groupchat_window">
<property name="border_width">6</property>
<property name="title" translatable="yes">Join Group Chat</property>
<signal name="destroy" handler="on_join_groupchat_window_destroy"/>
<signal name="key_press_event" handler="on_join_groupchat_window_key_press_event"/>
<child>
<widget class="GtkVBox" id="vbox28">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<widget class="GtkTable" id="table15">
<property name="visible">True</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<widget class="GtkEntry" id="room_jid_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="activates_default">True</property>
<signal name="changed" handler="on_required_entry_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="nickname_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
<signal name="changed" handler="on_required_entry_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label143">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Room:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label142">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Nickname:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label225">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Recently:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="recently_combobox">
<property name="visible">True</property>
<signal name="changed" handler="on_recently_combobox_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label145">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="activates_default">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="auto_join_checkbutton">
<property name="label" translatable="yes">Join this room automatically when I connect</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="account_label">
<property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Account</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="account_combobox">
<property name="no_show_all">True</property>
<signal name="changed" handler="on_account_combobox_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox12">
<property name="visible">True</property>
<property name="spacing">12</property>
<property name="layout_style">end</property>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_cancel_button_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="join_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
<signal name="clicked" handler="on_join_button_clicked"/>
<child>
<widget class="GtkAlignment" id="alignment25">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox37">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image148">
<property name="visible">True</property>
<property name="stock">gtk-apply</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label146">
<property name="visible">True</property>
<property name="label" translatable="yes">_Join</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -827,8 +827,7 @@ class ConversationTextview(gobject.GObject):
gajim.interface.instances[self.account]['join_gc'].window.present()
else:
try:
gajim.interface.instances[self.account]['join_gc'] = \
dialogs.JoinGroupchatWindow(self.account, room_jid)
dialogs.JoinGroupchatWindow(account=None, room_jid=room_jid)
except GajimGeneralException:
pass

View File

@ -1893,28 +1893,42 @@ class SubscriptionRequestWindow:
class JoinGroupchatWindow:
def __init__(self, account, room_jid='', nick='', password='',
def __init__(self, account=None, room_jid='', nick='', password='',
automatic=False):
'''automatic is a dict like {'invities': []}
If automatic is not empty, this means room must be automaticaly configured
and when done, invities must be automatically invited'''
if room_jid != '':
if room_jid in gajim.gc_connected[account] and\
gajim.gc_connected[account][room_jid]:
self.xml = gtkgui_helpers.get_glade('join_groupchat_window.glade')
if account:
if room_jid != '' and room_jid in gajim.gc_connected[account] and\
gajim.gc_connected[account][room_jid]:
ErrorDialog(_('You are already in group chat %s') % room_jid)
raise GajimGeneralException, 'You are already in this group chat'
if nick == '':
nick = gajim.nicks[account]
if gajim.connections[account].connected < 2:
ErrorDialog(_('You are not connected to the server'),
_('You can not join a group chat unless you are connected.'))
raise GajimGeneralException, 'You must be connected to join a groupchat'
else:
account_label = self.xml.get_widget('account_label')
account_combobox = self.xml.get_widget('account_combobox')
account_label.set_no_show_all(False)
account_combobox.set_no_show_all(False)
liststore = gtk.ListStore(str)
account_combobox.set_model(liststore)
cell = gtk.CellRendererText()
account_combobox.pack_start(cell, True)
account_combobox.add_attribute(cell, 'text', 0)
for acct in [a for a in gajim.connections if \
gajim.account_is_connected(a)]:
account_combobox.append_text(acct)
account_combobox.set_active(-1)
self.account = account
self.automatic = automatic
if nick == '':
nick = gajim.nicks[self.account]
if gajim.connections[account].connected < 2:
ErrorDialog(_('You are not connected to the server'),
_('You can not join a group chat unless you are connected.'))
raise GajimGeneralException, 'You must be connected to join a groupchat'
self._empty_required_widgets = []
self.xml = gtkgui_helpers.get_glade('join_groupchat_window.glade')
self.window = self.xml.get_widget('join_groupchat_window')
self._room_jid_entry = self.xml.get_widget('room_jid_entry')
self._nickname_entry = self.xml.get_widget('nickname_entry')
@ -1925,11 +1939,13 @@ class JoinGroupchatWindow:
if password:
self._password_entry.set_text(password)
self.xml.signal_autoconnect(self)
# now add us to open windows
gajim.interface.instances[account]['join_gc'] = self
if len(gajim.connections) > 1:
title = _('Join Group Chat with account %s') % account
else:
title = None
if account:
# now add us to open windows
gajim.interface.instances[account]['join_gc'] = self
if len(gajim.connections) > 1:
title = _('Join Group Chat with account %s') % account
if title is None:
title = _('Join Group Chat')
self.window.set_title(title)
@ -1957,15 +1973,16 @@ class JoinGroupchatWindow:
if len(self._empty_required_widgets):
self.xml.get_widget('join_button').set_sensitive(False)
if not gajim.connections[account].private_storage_supported:
if account and not gajim.connections[account].private_storage_supported:
self.xml.get_widget('auto_join_checkbutton').set_sensitive(False)
self.window.show_all()
def on_join_groupchat_window_destroy(self, widget):
'''close window'''
# remove us from open windows
del gajim.interface.instances[self.account]['join_gc']
if self.account and 'join_gc' in gajim.interface.instances[self.account]:
# remove us from open windows
del gajim.interface.instances[self.account]['join_gc']
def on_join_groupchat_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE
@ -1978,8 +1995,14 @@ class JoinGroupchatWindow:
else:
if widget in self._empty_required_widgets:
self._empty_required_widgets.remove(widget)
if len(self._empty_required_widgets) == 0:
self.xml.get_widget('join_button').set_sensitive(True)
if len(self._empty_required_widgets) == 0 and self.account:
self.xml.get_widget('join_button').set_sensitive(True)
def on_account_combobox_changed(self, widget):
model = widget.get_model()
iter_ = widget.get_active_iter()
self.account = model[iter_][0].decode('utf-8')
self.on_required_entry_changed(self._nickname_entry)
def on_recently_combobox_changed(self, widget):
model = widget.get_model()
@ -1993,6 +2016,11 @@ class JoinGroupchatWindow:
def on_join_button_clicked(self, widget):
'''When Join button is clicked'''
if not self.account:
ErrorDialog(_('Invalid Account'),
_('You have to choose an account from which you want to join the '
'groupchat.'))
return
nickname = self._nickname_entry.get_text().decode('utf-8')
room_jid = self._room_jid_entry.get_text().decode('utf-8')
password = self._password_entry.get_text().decode('utf-8')
@ -2000,25 +2028,26 @@ class JoinGroupchatWindow:
nickname = helpers.parse_resource(nickname)
except Exception:
ErrorDialog(_('Invalid Nickname'),
_('The nickname has not allowed characters.'))
_('The nickname has not allowed characters.'))
return
user, server, resource = helpers.decompose_jid(room_jid)
if not user or not server or resource:
ErrorDialog(_('Invalid group chat Jabber ID'),
_('The group chat Jabber ID has not allowed characters.'))
_('The group chat Jabber ID has not allowed characters.'))
return
try:
room_jid = helpers.parse_jid(room_jid)
except Exception:
ErrorDialog(_('Invalid group chat Jabber ID'),
_('The group chat Jabber ID has not allowed characters.'))
_('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)
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)
_('%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)
@ -2026,13 +2055,13 @@ class JoinGroupchatWindow:
if len(self.recently_groupchat) > 10:
self.recently_groupchat = self.recently_groupchat[0:10]
gajim.config.set('recently_groupchat',
' '.join(self.recently_groupchat))
' '.join(self.recently_groupchat))
if self.xml.get_widget('auto_join_checkbutton').get_active():
# Add as bookmark, with autojoin and not minimized
name = gajim.get_nick_from_jid(room_jid)
gajim.interface.add_gc_bookmark(self.account, name, room_jid, '1', \
'0', password, nickname)
'0', password, nickname)
if self.automatic:
gajim.automatic_rooms[self.account][room_jid] = self.automatic

View File

@ -1592,9 +1592,8 @@ class GroupchatControl(ChatControlBase):
window.present()
else:
try:
gajim.interface.instances[self.account]['join_gc'] =\
dialogs.JoinGroupchatWindow(self.account,
room_jid = room_jid, nick=nick)
dialogs.JoinGroupchatWindow(account=None, room_jid=room_jid,
nick=nick)
except GajimGeneralException:
pass
self.clear(self.msg_textview)