summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/core.py15
-rw-r--r--src/text_buffer.py1
-rw-r--r--src/xhtml.py2
3 files changed, 9 insertions, 9 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
diff --git a/src/text_buffer.py b/src/text_buffer.py
index 523dcadc..61c08994 100644
--- a/src/text_buffer.py
+++ b/src/text_buffer.py
@@ -45,7 +45,6 @@ class TextBuffer(object):
self.windows.append(win)
def add_message(self, txt, time=None, nickname=None, nick_color=None):
- nick_color = nick_color
msg = Message(txt='%s\x19o'%(txt,), nick_color=nick_color,
time=time or datetime.now(), nickname=nickname, user=None)
self.messages.append(msg)
diff --git a/src/xhtml.py b/src/xhtml.py
index 25d23bf9..55582066 100644
--- a/src/xhtml.py
+++ b/src/xhtml.py
@@ -133,7 +133,7 @@ def shell_colors_to_poezio_colors(string):
elif num == 1:
res += '\x19b'
elif num >= 31 and num <= 37:
- res += '\x19%s' % (num-30,)
+ res += '\x19%d' % (num-30,)
return res
def remove_elinks_indent(string):
lines = string.split('\n')