remember with which nickname we entered rooms. Fixes #7334
This commit is contained in:
parent
b0bc8a4958
commit
dc64ac8000
1 changed files with 28 additions and 16 deletions
|
@ -2310,15 +2310,15 @@ class SubscriptionRequestWindow:
|
|||
|
||||
class JoinGroupchatWindow:
|
||||
def __init__(self, account=None, room_jid='', nick='', password='',
|
||||
automatic=False):
|
||||
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 account:
|
||||
if room_jid != '' and room_jid in gajim.gc_connected[account] and\
|
||||
gajim.gc_connected[account][room_jid]:
|
||||
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 == '':
|
||||
|
@ -2382,15 +2382,22 @@ class JoinGroupchatWindow:
|
|||
server_list.append(gajim.connections[account].muc_jid['jabber'])
|
||||
|
||||
self.recently_combobox = self.xml.get_object('recently_combobox')
|
||||
liststore = gtk.ListStore(str)
|
||||
liststore = gtk.ListStore(str, str)
|
||||
self.recently_combobox.set_model(liststore)
|
||||
cell = gtk.CellRendererText()
|
||||
self.recently_combobox.pack_start(cell, True)
|
||||
self.recently_combobox.add_attribute(cell, 'text', 0)
|
||||
self.recently_groupchat = gajim.config.get('recently_groupchat').split()
|
||||
for g in self.recently_groupchat:
|
||||
self.recently_combobox.append_text(g)
|
||||
server = gajim.get_server_from_jid(g)
|
||||
r_jid = gajim.get_jid_without_resource(g)
|
||||
nick = gajim.get_resource_from_jid(g)
|
||||
if nick:
|
||||
show = '%(nick)s on %(room_jid)s' % {'nick': nick,
|
||||
'room_jid': r_jid}
|
||||
else:
|
||||
show = r_jid
|
||||
liststore.append([show, g])
|
||||
server = gajim.get_server_from_jid(r_jid)
|
||||
if server not in server_list and not server.startswith('irc'):
|
||||
server_list.append(server)
|
||||
|
||||
|
@ -2456,16 +2463,19 @@ class JoinGroupchatWindow:
|
|||
self.account = model[iter_][0].decode('utf-8')
|
||||
self.on_required_entry_changed(self._nickname_entry)
|
||||
|
||||
def _set_room_jid(self, room_jid):
|
||||
def _set_room_jid(self, full_jid):
|
||||
room_jid, nick = gajim.get_room_and_nick_from_fjid(full_jid)
|
||||
room, server = gajim.get_name_and_server_from_jid(room_jid)
|
||||
self._room_jid_entry.set_text(room)
|
||||
self.server_comboboxentry.child.set_text(server)
|
||||
if nick:
|
||||
self._nickname_entry.set_text(nick)
|
||||
|
||||
def on_recently_combobox_changed(self, widget):
|
||||
model = widget.get_model()
|
||||
iter_ = widget.get_active_iter()
|
||||
room_jid = model[iter_][0].decode('utf-8')
|
||||
self._set_room_jid(room_jid)
|
||||
full_jid = model[iter_][1].decode('utf-8')
|
||||
self._set_room_jid(full_jid)
|
||||
|
||||
def on_browse_rooms_button_clicked(self, widget):
|
||||
server = self.server_comboboxentry.child.get_text().decode('utf-8')
|
||||
|
@ -2533,13 +2543,15 @@ class JoinGroupchatWindow:
|
|||
ErrorDialog(_('This is not a group chat'),
|
||||
_('%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)
|
||||
self.recently_groupchat.insert(0, room_jid)
|
||||
|
||||
full_jid = room_jid + '/' + nickname
|
||||
if full_jid in self.recently_groupchat:
|
||||
self.recently_groupchat.remove(full_jid)
|
||||
self.recently_groupchat.insert(0, full_jid)
|
||||
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_object('bookmark_checkbutton').get_active():
|
||||
if self.xml.get_object('auto_join_checkbutton').get_active():
|
||||
|
@ -2548,13 +2560,13 @@ class JoinGroupchatWindow:
|
|||
autojoin = '0'
|
||||
# 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, autojoin,
|
||||
'0', password, nickname)
|
||||
gajim.interface.add_gc_bookmark(self.account, name, room_jid,
|
||||
autojoin, '0', password, nickname)
|
||||
|
||||
if self.automatic:
|
||||
gajim.automatic_rooms[self.account][room_jid] = self.automatic
|
||||
|
||||
gajim.interface.join_gc_room(self.account, room_jid, nickname, password)
|
||||
gajim.interface.join_gc_room(self.account, room_jid, nickname, password)
|
||||
|
||||
self.window.destroy()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue