Fix #2714 (make bare /bookmark use the current room password if there is one)
This commit is contained in:
parent
64ec234f6b
commit
e78ed92ba3
4 changed files with 10 additions and 5 deletions
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
Loading…
Reference in a new issue