cleanup to join a gc
This commit is contained in:
parent
12a1d9e276
commit
0e0323a3f8
3 changed files with 15 additions and 17 deletions
|
@ -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()
|
server = self.xml.get_widget('server_entry').get_text()
|
||||||
password = self.xml.get_widget('password_entry').get_text()
|
password = self.xml.get_widget('password_entry').get_text()
|
||||||
jid = '%s@%s' % (room, server)
|
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:
|
if jid in self.recently_groupchat:
|
||||||
self.recently_groupchat.remove(jid)
|
self.recently_groupchat.remove(jid)
|
||||||
self.recently_groupchat.insert(0, jid)
|
self.recently_groupchat.insert(0, jid)
|
||||||
if len(self.recently_groupchat) > 10:
|
if len(self.recently_groupchat) > 10:
|
||||||
self.recently_groupchat = self.recently_groupchat[0:10]
|
self.recently_groupchat = self.recently_groupchat[0:10]
|
||||||
gajim.config.set('recently_groupchat', ' '.join(self.recently_groupchat))
|
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.roster.join_gc_room(self.account, jid, nickname, password)
|
||||||
self.plugin.windows[self.account]['gc'][jid].window.present()
|
|
||||||
gajim.connections[self.account].join_gc(nickname, room, server, password)
|
|
||||||
|
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
class NewMessageDialog:
|
class NewMessageDialog:
|
||||||
|
|
|
@ -599,9 +599,7 @@ class Interface:
|
||||||
#Auto join GC windows if neccessary
|
#Auto join GC windows if neccessary
|
||||||
for bm in bms:
|
for bm in bms:
|
||||||
if bm['autojoin'] == '1':
|
if bm['autojoin'] == '1':
|
||||||
self.roster.join_gc_room(account, bm)
|
self.roster.join_gc_room(account, bm['jid'], bm['nick'],
|
||||||
room, server = bm['jid'].split('@')
|
|
||||||
gajim.connections[account].join_gc(bm['nick'], room, server,
|
|
||||||
bm['password'])
|
bm['password'])
|
||||||
self.roster.make_menu()
|
self.roster.make_menu()
|
||||||
|
|
||||||
|
|
|
@ -241,14 +241,19 @@ class RosterWindow:
|
||||||
model.set_value(iter, 0, img)
|
model.set_value(iter, 0, img)
|
||||||
model.set_value(iter, 1, name)
|
model.set_value(iter, 1, name)
|
||||||
|
|
||||||
def join_gc_room(self, account, bookmark):
|
def join_gc_room(self, account, room_jid, nick, password):
|
||||||
jid = bookmark['jid']
|
if room_jid in self.plugin.windows[account]['gc']:
|
||||||
self.new_room(jid, bookmark['nick'], account)
|
ErrorDialog(_('You are already in room ' + room_jid)).get_response()
|
||||||
self.plugin.windows[account]['gc'][jid].set_active_tab(jid)
|
return
|
||||||
self.plugin.windows[account]['gc'][jid].window.present()
|
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):
|
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):
|
def on_bm_header_changed_state(self, widget, event):
|
||||||
widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state
|
widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state
|
||||||
|
|
Loading…
Add table
Reference in a new issue