From 9a1743f695b95a71c974ad8c7af178ab0dc3d130 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Sun, 13 Jun 2010 13:51:02 +0000 Subject: [PATCH] Private messages! fixed #1077 --- CHANGELOG | 5 ++ src/connection.py | 12 ++++- src/gui.py | 118 +++++++++++++++++++++++++++++++++++++------ src/handler.py | 4 ++ src/multiuserchat.py | 7 +++ src/room.py | 8 ++- src/window.py | 39 +++++++++++--- 7 files changed, 167 insertions(+), 26 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 19624ffb..be3146eb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ For more detailed changelog, see the roadmap: http://codingteam.net/project/poezio/roadmap * Poezio 0.6 - dev +- Private messages are handled - Muc error messages are displayed - Nickname auto-completion - Users status are displayed in the MUC user-list @@ -18,6 +19,10 @@ http://codingteam.net/project/poezio/roadmap - The dates of room history are handled - The way the text is displayed on the screen has been rewritten, this fixes the blink and the slowness-over-ssh problems. +- User lists are ordered +- Messages can be logged in files +- Status changes displays only what has really changed +- Users can be ignored (/ignore, /unignore) - Various Bugfixes * Poezio 0.5.1 - 2 Feb 2010 diff --git a/src/connection.py b/src/connection.py index 5c94b3fa..e20aaab5 100644 --- a/src/connection.py +++ b/src/connection.py @@ -173,7 +173,10 @@ class Connection(threading.Thread): if message.getType() == 'error': self.error_message(message) return - self.handler.emit('room-message', stanza=message) + if message.getType() == 'groupchat': + self.handler.emit('room-message', stanza=message) + else: + self.handler.emit('private-message', stanza=message) raise xmpp.protocol.NodeProcessed def process(self, timeout=10): @@ -213,3 +216,10 @@ def jid_get_domain(jid): if isinstance(jid, basestring): jid = xmpp.JID(jid) return jid.getDomain() + +def is_jid_the_same(a, b): + if isinstance(a, basestring): + a = xmpp.JID(a) + if isinstance(b, basestring): + b = xmpp.JID(b) + return a.bareMatch(b) diff --git a/src/gui.py b/src/gui.py index 685bcb97..b127abb5 100644 --- a/src/gui.py +++ b/src/gui.py @@ -40,6 +40,8 @@ from user import User from room import Room from message import Message +from connection import is_jid_the_same + from common import debug def doupdate(): debug("doupdate") @@ -83,6 +85,8 @@ class Gui(object): 'set': (self.command_set, _("Usage: /set