summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2017-07-20 23:50:37 +0200
committermathieui <mathieui@mathieui.net>2017-07-20 23:50:37 +0200
commit360b1350b63bbde821586a4f01417f95803f9e3d (patch)
tree4ca68c49d994f26f73b65087241f1c67cd152fe0
parent6fb3151202743d951e4ea0fb98381f81e92b7e6c (diff)
downloadpoezio-360b1350b63bbde821586a4f01417f95803f9e3d.tar.gz
poezio-360b1350b63bbde821586a4f01417f95803f9e3d.tar.bz2
poezio-360b1350b63bbde821586a4f01417f95803f9e3d.tar.xz
poezio-360b1350b63bbde821586a4f01417f95803f9e3d.zip
Fix /server_cycle weirdness
exit the rooms properly, call functions instead of full-blown commands, do not randomly focus stabs, etc
-rw-r--r--poezio/core/commands.py12
-rw-r--r--poezio/tabs/muctab.py30
2 files changed, 18 insertions, 24 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index c4f3bf87..65c8778f 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -665,16 +665,8 @@ class CommandCore:
return self.core.information("No server specified", "Error")
for tab in self.core.get_tabs(tabs.MucTab):
if tab.name.endswith(domain):
- if tab.joined:
- muc.leave_groupchat(tab.core.xmpp,
- tab.name,
- tab.own_nick,
- message)
- tab.joined = False
- if tab.name == domain:
- self.join('"@%s/%s"' %(tab.name, tab.own_nick))
- else:
- self.join('"%s/%s"' %(tab.name, tab.own_nick))
+ tab.leave_room(message)
+ tab.join()
@command_args_parser.quoted(1)
def last_activity(self, args):
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index bb4d21bb..d52d908a 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -563,13 +563,7 @@ class MucTab(ChatTab):
current_status.message,
current_status.show)
- @command_args_parser.quoted(0, 1, [''])
- def command_part(self, args):
- """
- /part [msg]
- """
- arg = args[0]
- msg = None
+ def leave_room(self, message):
if self.joined:
info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
char_quit = get_theme().CHAR_QUIT
@@ -581,12 +575,12 @@ class MucTab(ChatTab):
else:
color = 3
- if arg:
+ if message:
msg = ('\x19%(color_spec)s}%(spec)s\x19%(info_col)s} '
'You (\x19%(color)s}%(nick)s\x19%(info_col)s})'
' left the room'
' (\x19o%(reason)s\x19%(info_col)s})') % {
- 'info_col': info_col, 'reason': arg,
+ 'info_col': info_col, 'reason': message,
'spec': char_quit, 'color': color,
'color_spec': spec_col,
'nick': self.own_nick,
@@ -603,13 +597,21 @@ class MucTab(ChatTab):
self.add_message(msg, typ=2)
self.disconnect()
- muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg)
+ muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, message)
self.core.disable_private_tabs(self.name, reason=msg)
- if self == self.core.current_tab():
- self.refresh()
- self.core.doupdate()
else:
- muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg)
+ muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, message)
+
+ @command_args_parser.quoted(0, 1, [''])
+ def command_part(self, args):
+ """
+ /part [msg]
+ """
+ message = args[0]
+ self.leave_room(message)
+ if self == self.core.current_tab():
+ self.refresh()
+ self.core.doupdate()
@command_args_parser.raw
def command_close(self, msg):