summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-02 01:19:08 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-02 01:19:08 +0000
commit91bb99a19e3c7c3b8dbed5f13954f38b7c52c644 (patch)
tree61cee648700353ffb0815bc189fa0139dfcf688e /src
parentaddde0121a09c0a36c8422a00bd4f9414cf19ed8 (diff)
downloadpoezio-91bb99a19e3c7c3b8dbed5f13954f38b7c52c644.tar.gz
poezio-91bb99a19e3c7c3b8dbed5f13954f38b7c52c644.tar.bz2
poezio-91bb99a19e3c7c3b8dbed5f13954f38b7c52c644.tar.xz
poezio-91bb99a19e3c7c3b8dbed5f13954f38b7c52c644.zip
little cleanup on user leave
Diffstat (limited to 'src')
-rw-r--r--src/gui.py38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/gui.py b/src/gui.py
index 15b0b29e..e6984fe5 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -236,22 +236,7 @@ class Gui(object):
self.on_user_kicked(room, presence, user, from_nick)
# user quit
elif typ == 'unavailable':
- room.users.remove(user)
- hide_exit_join = config.get('hide_exit_join', -1) if config.get('hide_exit_join', -1) >= -1 else -1
- if hide_exit_join == -1 or user.has_talked_since(hide_exit_join):
- if not jid.full:
- leave_msg = _('%(spec)s [%(nick)s] has left the room') % {'nick':from_nick, 'spec':theme.CHAR_QUIT}
- else:
- leave_msg = _('%(spec)s [%(nick)s] (%(jid)s) has left the room') % {'spec':theme.CHAR_QUIT, 'nick':from_nick, 'jid':jid.full}
- if status:
- leave_msg += ' (%s)' % status
- self.add_message_to_room(room, leave_msg, colorized=True)
- private_room = self.get_room_by_name('%s/%s' % (from_room, from_nick))
- if private_room:
- if not status:
- self.add_message_to_room(private_room, _('%(spec)s [%(nick)s] has left the room') % {'nick':from_nick, 'spec':theme.CHAR_QUIT}, colorized=True)
- else:
- self.add_message_to_room(private_room, _('%(spec)s [%(nick)s] has left the room (%(status)s)') % {'nick':from_nick, 'spec':theme.CHAR_QUIT, 'status': status}, colorized=True)
+ self.on_user_leave_groupchat(room, user, jid, status, from_nick, from_room)
# status change
else:
# build the message
@@ -343,6 +328,27 @@ class Gui(object):
kick_msg += _(' Reason: %(reason)s') % {'reason': reason}
self.add_message_to_room(room, kick_msg, colorized=True)
+ def on_user_leave_groupchat(self, room, user, jid, status, from_nick, from_room):
+ """
+ When an user leaves a groupchat
+ """
+ room.users.remove(user)
+ hide_exit_join = config.get('hide_exit_join', -1) if config.get('hide_exit_join', -1) >= -1 else -1
+ if hide_exit_join == -1 or user.has_talked_since(hide_exit_join):
+ if not jid.full:
+ leave_msg = _('%(spec)s [%(nick)s] has left the room') % {'nick':from_nick, 'spec':theme.CHAR_QUIT}
+ else:
+ leave_msg = _('%(spec)s [%(nick)s] (%(jid)s) has left the room') % {'spec':theme.CHAR_QUIT, 'nick':from_nick, 'jid':jid.full}
+ if status:
+ leave_msg += ' (%s)' % status
+ self.add_message_to_room(room, leave_msg, colorized=True)
+ private_room = self.get_room_by_name('%s/%s' % (from_room, from_nick))
+ if private_room:
+ if not status:
+ self.add_message_to_room(private_room, _('%(spec)s [%(nick)s] has left the room') % {'nick':from_nick, 'spec':theme.CHAR_QUIT}, colorized=True)
+ else:
+ self.add_message_to_room(private_room, _('%(spec)s [%(nick)s] has left the room (%(status)s)') % {'nick':from_nick, 'spec':theme.CHAR_QUIT, 'status': status}, colorized=True)
+
def on_message(self, message):
"""
When receiving private message from a muc OR a normal message