From f34d3172a11190ebfd8030deb5771a55fdb57476 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 21 Sep 2011 17:44:41 +0200 Subject: Fixes #2251 --- src/core.py | 12 ++++++++++++ src/tabs.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core.py b/src/core.py index 96531e5f..3cdc7592 100644 --- a/src/core.py +++ b/src/core.py @@ -1325,6 +1325,18 @@ class Core(object): r.users = [] self.enable_private_tabs(room) + def get_bookmark_nickname(self, room_name): + """ + Returns the nickname associated with a bookmark + or the default nickname + """ + bookmarks = config.get('rooms', '').split(':') + jid = JID(room_name) + for bookmark in bookmarks: + if JID(bookmark).bare == jid.bare: + return JID(bookmark).resource + return self.own_nick + def command_bookmark(self, arg): """ /bookmark [room][/nick] diff --git a/src/tabs.py b/src/tabs.py index 5c141f51..24f347ba 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -453,7 +453,7 @@ class MucTab(ChatTab): muc.leave_groupchat(self.core.xmpp, self.get_name(), self.get_room().own_nick, arg) self.get_room().disconnect() self.core.disable_private_tabs(self.get_room().name) - self.core.command_join('/', "0") + self.core.command_join('/%s' % self.core.get_bookmark_nickname(self.get_room().name), '0') self.user_win.pos = 0 def command_recolor(self, arg): -- cgit v1.2.3