cleanup to join a gc

This commit is contained in:
Yann Leboulanger 2005-06-13 10:49:48 +00:00
parent 12a1d9e276
commit 0e0323a3f8
3 changed files with 15 additions and 17 deletions

View File

@ -616,20 +616,15 @@ _('You can not join a group chat unless you are connected.')).get_response()
server = self.xml.get_widget('server_entry').get_text()
password = self.xml.get_widget('password_entry').get_text()
jid = '%s@%s' % (room, server)
if jid in self.plugin.windows[self.account]['gc']:
ErrorDialog(_('You are already in room ' + jid)).get_response()
return
if jid in self.recently_groupchat:
self.recently_groupchat.remove(jid)
self.recently_groupchat.insert(0, jid)
if len(self.recently_groupchat) > 10:
self.recently_groupchat = self.recently_groupchat[0:10]
gajim.config.set('recently_groupchat', ' '.join(self.recently_groupchat))
self.plugin.roster.new_room(jid, nickname, self.account)
self.plugin.windows[self.account]['gc'][jid].set_active_tab(jid)
self.plugin.windows[self.account]['gc'][jid].window.present()
gajim.connections[self.account].join_gc(nickname, room, server, password)
self.plugin.roster.join_gc_room(self.account, jid, nickname, password)
self.window.destroy()
class NewMessageDialog:

View File

@ -599,9 +599,7 @@ class Interface:
#Auto join GC windows if neccessary
for bm in bms:
if bm['autojoin'] == '1':
self.roster.join_gc_room(account, bm)
room, server = bm['jid'].split('@')
gajim.connections[account].join_gc(bm['nick'], room, server,
self.roster.join_gc_room(account, bm['jid'], bm['nick'],
bm['password'])
self.roster.make_menu()

View File

@ -241,14 +241,19 @@ class RosterWindow:
model.set_value(iter, 0, img)
model.set_value(iter, 1, name)
def join_gc_room(self, account, bookmark):
jid = bookmark['jid']
self.new_room(jid, bookmark['nick'], account)
self.plugin.windows[account]['gc'][jid].set_active_tab(jid)
self.plugin.windows[account]['gc'][jid].window.present()
def join_gc_room(self, account, room_jid, nick, password):
if room_jid in self.plugin.windows[account]['gc']:
ErrorDialog(_('You are already in room ' + room_jid)).get_response()
return
room, server = room_jid.split('@')
self.new_room(room_jid, nick, account)
self.plugin.windows[account]['gc'][room_jid].set_active_tab(room_jid)
self.plugin.windows[account]['gc'][room_jid].window.present()
gajim.connections[account].join_gc(nick, room, server, password)
def on_bookmark_menuitem_activate(self, widget, account, bookmark):
self.join_gc_room(account, bookmark)
self.join_gc_room(account, bookmark['jid'], bookmark['nick'],
bookmark['password'])
def on_bm_header_changed_state(self, widget, event):
widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state