summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-04-17 00:02:19 +0200
committermathieui <mathieui@mathieui.net>2014-04-17 00:02:19 +0200
commit71ae73ca7b37123d741eb065dc26d85d12922c43 (patch)
tree7af26c9f10485d3a65faf0f02ffc6e8fe68df587 /src
parent214904f19900996b47d9c42bb7240853ef88fe89 (diff)
downloadpoezio-71ae73ca7b37123d741eb065dc26d85d12922c43.tar.gz
poezio-71ae73ca7b37123d741eb065dc26d85d12922c43.tar.bz2
poezio-71ae73ca7b37123d741eb065dc26d85d12922c43.tar.xz
poezio-71ae73ca7b37123d741eb065dc26d85d12922c43.zip
Log part messages and show a leave message on /cycle
Diffstat (limited to 'src')
-rw-r--r--src/multiuserchat.py4
-rw-r--r--src/tabs/muctab.py9
2 files changed, 6 insertions, 7 deletions
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index 93fde819..d1921100 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -64,7 +64,7 @@ def change_nick(core, jid, nick, status=None, show=None):
core.events.trigger('changing_nick', presence)
presence.send()
-def join_groupchat(core, jid, nick, passwd='', maxhistory=None, status=None, show=None, seconds=0):
+def join_groupchat(core, jid, nick, passwd='', maxhistory=None, status=None, show=None, seconds=None):
xmpp = core.xmpp
stanza = xmpp.makePresence(pto='%s/%s' % (jid, nick), pstatus=status, pshow=show)
x = ET.Element('{http://jabber.org/protocol/muc}x')
@@ -72,7 +72,7 @@ def join_groupchat(core, jid, nick, passwd='', maxhistory=None, status=None, sho
passelement = ET.Element('password')
passelement.text = passwd
x.append(passelement)
- if seconds:
+ if seconds is not None:
history = ET.Element('{http://jabber.org/protocol/muc}history')
history.attrib['seconds'] = str(seconds)
x.append(history)
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py
index 7c4ba1d0..c2f7925a 100644
--- a/src/tabs/muctab.py
+++ b/src/tabs/muctab.py
@@ -340,12 +340,11 @@ class MucTab(ChatTab):
def command_cycle(self, arg):
"""/cycle [reason]"""
- if self.joined:
- muc.leave_groupchat(self.core.xmpp, self.get_name(), self.own_nick, arg)
+ self.command_part(arg)
self.disconnect()
+ self.user_win.pos = 0
self.core.disable_private_tabs(self.name)
self.core.command_join('"/%s"' % self.own_nick)
- self.user_win.pos = 0
def command_recolor(self, arg):
"""
@@ -414,8 +413,6 @@ class MucTab(ChatTab):
arg = arg.strip()
msg = None
if self.joined:
- self.disconnect()
- muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg)
info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
char_quit = get_theme().CHAR_QUIT
spec_col = dump_tuple(get_theme().COLOR_QUIT_CHAR)
@@ -447,6 +444,8 @@ class MucTab(ChatTab):
}
self.add_message(msg, typ=2)
+ self.disconnect()
+ muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg)
self.core.disable_private_tabs(self.name, reason=msg)
if self == self.core.current_tab():
self.refresh()