summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-03-31 00:36:15 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-03-31 00:36:15 +0200
commit63e4833b0934c995ac46fc33f02fad7cc652b454 (patch)
tree9a8cc573cf0fb2b1c3f5828874785f7ccec1efac /src/core.py
parenteac38e03161bdc681ad09719c937aa3463703dbe (diff)
downloadpoezio-63e4833b0934c995ac46fc33f02fad7cc652b454.tar.gz
poezio-63e4833b0934c995ac46fc33f02fad7cc652b454.tar.bz2
poezio-63e4833b0934c995ac46fc33f02fad7cc652b454.tar.xz
poezio-63e4833b0934c995ac46fc33f02fad7cc652b454.zip
Fix a crash on normal messages, and add colors to information messages
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core.py b/src/core.py
index 2ddf143d..04f51b7c 100644
--- a/src/core.py
+++ b/src/core.py
@@ -38,6 +38,7 @@ log = logging.getLogger(__name__)
import multiuserchat as muc
import tabs
+
import xhtml
import windows
import connection
@@ -298,15 +299,15 @@ class Core(object):
return
resource = contact.get_resource_by_fulljid(jid.full)
assert resource
- self.information('%s is offline' % (resource.get_jid()), "Roster")
# If a resource got offline, display the message in the conversation with this
# precise resource.
- self.add_information_message_to_conversation_tab(jid.full, '%s is offline' % (resource.get_jid().full))
+ self.add_information_message_to_conversation_tab(jid.full, '\x195%s is \x191offline' % (resource.get_jid().full))
contact.remove_resource(resource)
# Display the message in the conversation with the bare JID only if that was
# the only resource online (i.e. now the contact is completely disconnected)
if not contact.get_highest_priority_resource(): # No resource left: that was the last one
- self.add_information_message_to_conversation_tab(jid.bare, '%s is offline' % (jid.bare))
+ self.add_information_message_to_conversation_tab(jid.bare, '\x195%s is \x191offline' % (jid.bare))
+ self.information('\x193%s \x195is \x191offline' % (resource.get_jid().bare), "Roster")
self.refresh_window()
def on_got_online(self, presence):
@@ -324,11 +325,11 @@ class Core(object):
resource.set_status(status_message)
resource.set_presence(status)
resource.set_priority(priority)
- self.information("%s is online (%s)" % (resource.get_jid().full, status), "Roster")
- self.add_information_message_to_conversation_tab(jid.full, '%s is online' % (jid.full))
+ self.add_information_message_to_conversation_tab(jid.full, '\x195%s is \x194online' % (jid.full))
if not contact.get_highest_priority_resource():
# No connected resource yet: the user's just connecting
- self.add_information_message_to_conversation_tab(jid.bare, '%s is online' % (jid.bare))
+ self.information("\x193%s \x195is \x194online\x195 (\x190%s\x195)" % (resource.get_jid().bare, status), "Roster")
+ self.add_information_message_to_conversation_tab(jid.bare, '\x195%s is \x194online' % (jid.bare))
contact.add_resource(resource)
def add_information_message_to_conversation_tab(self, jid, msg):
@@ -508,7 +509,7 @@ class Core(object):
remote_nick = roster.get_contact_by_jid(jid.bare).get_name() or jid.user
else:
remote_nick = jid.user
- conversation.get_room().add_message(body, None, remote_nick, False, theme.COLOR_REMOTE_USER)
+ conversation.get_room().add_message(body, nickname=remote_nick, nick_color=theme.COLOR_REMOTE_USER)
if conversation.remote_wants_chatstates is None:
if message['chat_state']:
conversation.remote_wants_chatstates = True