From 71ae73ca7b37123d741eb065dc26d85d12922c43 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 17 Apr 2014 00:02:19 +0200 Subject: Log part messages and show a leave message on /cycle --- src/multiuserchat.py | 4 ++-- src/tabs/muctab.py | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src') 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() -- cgit v1.2.3