diff options
author | mathieui <mathieui@mathieui.net> | 2015-04-14 01:34:24 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-04-14 01:34:24 +0200 |
commit | e78ed92ba36829b89007fe390e8b19b2b59514e3 (patch) | |
tree | 0ca15e976d05689adacfb594e1cae93d3e74a072 /src | |
parent | 64ec234f6b111b1fade558060d0854f256024316 (diff) | |
download | poezio-e78ed92ba36829b89007fe390e8b19b2b59514e3.tar.gz poezio-e78ed92ba36829b89007fe390e8b19b2b59514e3.tar.bz2 poezio-e78ed92ba36829b89007fe390e8b19b2b59514e3.tar.xz poezio-e78ed92ba36829b89007fe390e8b19b2b59514e3.zip |
Fix #2714 (make bare /bookmark use the current room password if there is one)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/commands.py | 6 | ||||
-rw-r--r-- | src/core/core.py | 4 | ||||
-rw-r--r-- | src/core/handlers.py | 2 | ||||
-rw-r--r-- | src/tabs/muctab.py | 3 |
4 files changed, 10 insertions, 5 deletions
diff --git a/src/core/commands.py b/src/core/commands.py index 338590f1..e0e426b2 100644 --- a/src/core/commands.py +++ b/src/core/commands.py @@ -388,13 +388,15 @@ def command_join(self, args, histo_length=None): seconds = int(seconds) else: seconds = 0 + if password: + tab.password = password muc.join_groupchat(self, room, nick, password, histo_length, current_status.message, current_status.show, seconds=seconds) if not tab: - self.open_new_room(room, nick) + self.open_new_room(room, nick, password=password) muc.join_groupchat(self, room, nick, password, histo_length, current_status.message, @@ -448,6 +450,8 @@ def _add_bookmark(self, jid, autojoin, password, method): roomname = tab.name if tab.joined and tab.own_nick != self.own_nick: nick = tab.own_nick + if password is None and tab.password is not None: + password = tab.password elif jid == '*': return _add_wildcard_bookmarks(self, method) else: diff --git a/src/core/core.py b/src/core/core.py index dc4439fd..e5a6a970 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -1242,11 +1242,11 @@ class Core(object): tab.privates.append(new_tab) return new_tab - def open_new_room(self, room, nick, focus=True): + def open_new_room(self, room, nick, *, password=None, focus=True): """ Open a new tab.MucTab containing a muc Room, using the specified nick """ - new_tab = tabs.MucTab(room, nick) + new_tab = tabs.MucTab(room, nick, password=password) self.add_tab(new_tab, focus) self.refresh_window() diff --git a/src/core/handlers.py b/src/core/handlers.py index c7b91bfb..d6bb15c1 100644 --- a/src/core/handlers.py +++ b/src/core/handlers.py @@ -54,7 +54,7 @@ def _join_initial_rooms(self, bookmarks): tab = self.get_tab_by_name(bm.jid, tabs.MucTab) nick = bm.nick if bm.nick else self.own_nick if not tab: - self.open_new_room(bm.jid, nick, False) + self.open_new_room(bm.jid, nick, focus=False) self.initial_joins.append(bm.jid) histo_length = config.get('muc_history_length') if histo_length == -1: diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index 1f202dd0..c84c92cc 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -55,13 +55,14 @@ class MucTab(ChatTab): message_type = 'groupchat' plugin_commands = {} plugin_keys = {} - def __init__(self, jid, nick): + def __init__(self, jid, nick, password=None): self.joined = False ChatTab.__init__(self, jid) if self.joined == False: self._state = 'disconnected' self.own_nick = nick self.name = jid + self.password = password self.users = [] self.privates = [] # private conversations self.topic = '' |