summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-10-05 21:39:24 +0200
committermathieui <mathieui@mathieui.net>2015-10-05 21:39:24 +0200
commit62491a4caad2565ab81b62eedf053569976cbfe1 (patch)
tree58bf52a1449cd864d066abc6e14c7d083f41e6a4 /src/core
parentad107389815c2d943003350a66962e8491fb4c8d (diff)
downloadpoezio-62491a4caad2565ab81b62eedf053569976cbfe1.tar.gz
poezio-62491a4caad2565ab81b62eedf053569976cbfe1.tar.bz2
poezio-62491a4caad2565ab81b62eedf053569976cbfe1.tar.xz
poezio-62491a4caad2565ab81b62eedf053569976cbfe1.zip
Fix #3130 (self-ping & /cycle not using known room password)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/commands.py46
-rw-r--r--src/core/core.py1
2 files changed, 12 insertions, 35 deletions
diff --git a/src/core/commands.py b/src/core/commands.py
index f278e233..256668d6 100644
--- a/src/core/commands.py
+++ b/src/core/commands.py
@@ -355,9 +355,7 @@ def command_join(self, args, histo_length=None):
if room in self.pending_invites:
del self.pending_invites[room]
tab = self.get_tab_by_name(room, tabs.MucTab)
- if len(args) == 2: # a password is provided
- password = args[1]
- if tab and tab.joined: # if we are already in the room
+ if tab is not None and tab.joined: # if we are already in the room
self.focus_tab_named(tab.name)
if tab.own_nick == nick:
self.information('/join: Nothing to do.', 'Info')
@@ -368,47 +366,25 @@ def command_join(self, args, histo_length=None):
if room.startswith('@'):
room = room[1:]
- current_status = self.get_status()
if not histo_length:
histo_length = config.get('muc_history_length')
if histo_length == -1:
histo_length = None
if histo_length is not None:
histo_length = str(histo_length)
+ if len(args) == 2: # a password is provided
+ password = args[1]
if password is None: # try to use a saved password
password = config.get_by_tabname('password', room, fallback=False)
- if tab and not tab.joined:
- if tab.last_connection:
- if tab.last_connection is not None:
- delta = datetime.now() - tab.last_connection
- seconds = delta.seconds + delta.days * 24 * 3600
- else:
- seconds = 0
- seconds = int(seconds)
- else:
- seconds = 0
- # If we didn’t have a password by now (from a bookmark or the
- # explicit argument), just use the password that is stored in the
- # tab because of our last join
- if not password:
- password = tab.password
- muc.join_groupchat(self, room, nick, password,
- histo_length,
- current_status.message,
- current_status.show,
- seconds=seconds)
- # Store in the tab the password we used, for later use
- tab.password = password
- if not tab:
- self.open_new_room(room, nick, password=password)
- muc.join_groupchat(self, room, nick, password,
- histo_length,
- current_status.message,
- current_status.show)
+ if tab is not None:
+ if password:
+ tab.password = password
+ tab.join()
else:
- tab.own_nick = nick
- tab.users = []
- if tab and tab.joined:
+ tab = self.open_new_room(room, nick, password=password)
+ tab.join()
+
+ if tab.joined:
self.enable_private_tabs(room)
tab.state = "normal"
if tab == self.current_tab():
diff --git a/src/core/core.py b/src/core/core.py
index 38a13416..7b078569 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -1265,6 +1265,7 @@ class Core(object):
new_tab = tabs.MucTab(room, nick, password=password)
self.add_tab(new_tab, focus)
self.refresh_window()
+ return new_tab
def open_new_form(self, form, on_cancel, on_send, **kwargs):
"""