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