Fix encoding errors on status messages

This commit is contained in:
moyamo 2015-12-27 23:09:27 +02:00
parent c40d477667
commit 02a27ecac8

View file

@ -34,7 +34,7 @@ class Buddy():
self.number = number
self.groups = groups
self.image_hash = image_hash if image_hash is not None else ""
self.statusMsg = ""
self.statusMsg = u""
self.lastseen = 0
self.presence = 0
@ -62,7 +62,7 @@ class BuddyList(dict):
for buddy in buddies:
number = buddy.buddyName
nick = buddy.alias
statusMsg = buddy.statusMessage
statusMsg = buddy.statusMessage.decode('utf-8')
groups = [g for g in buddy.group]
image_hash = buddy.iconHash
self[number] = Buddy(self.owner, number, nick, statusMsg,
@ -106,7 +106,7 @@ class BuddyList(dict):
self.logger.debug("%s received statuses of: %s", self.user, contacts)
for number, (status, time) in contacts.iteritems():
buddy = self[number]
buddy.statusMsg = status
buddy.statusMsg = status.decode('utf-8')
self.updateSpectrum(buddy)