add auto join checkbutton in join room dialog. fixes #2056

This commit is contained in:
Yann Leboulanger 2007-01-02 01:38:58 +00:00
parent 08f21700ad
commit 7945ceac83
2 changed files with 40 additions and 1 deletions

View File

@ -30,7 +30,7 @@
<child>
<widget class="GtkTable" id="table15">
<property name="visible">True</property>
<property name="n_rows">4</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -230,6 +230,28 @@
<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>

View File

@ -1236,6 +1236,23 @@ class JoinGroupchatWindow:
gajim.config.set('recently_groupchat',
' '.join(self.recently_groupchat))
if self.xml.get_widget('auto_join_checkbutton').get_active():
# create the bookmark-dict
# is it already bookmarked ?
room_jid_bookmarked = False
for bmdict in gajim.connections[self.account].bookmarks:
if bmdict['jid'] == room_jid:
room_jid_bookmarked = True
break
if not room_jid_bookmarked:
name = gajim.get_nick_from_jid(room_jid)
bmdict = { 'name': name, 'jid': room_jid, 'autojoin': u'1',
'password': password, 'nick': nickname,
'print_status': gajim.config.get('print_status_in_muc')}
gajim.connections[self.account].bookmarks.append(bmdict)
gajim.connections[self.account].store_bookmarks()
if self.automatic:
gajim.automatic_rooms[self.account][room_jid] = self.automatic
gajim.interface.roster.join_gc_room(self.account, room_jid, nickname,