From bc7fc5f02d54299586980471034678381fd099b0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 31 Jul 2007 20:54:51 +0000 Subject: Cope with arbitrary Unicode in nicknames by making Buddy.props.nick 'object' rather than 'str' and coercing to unicode when set. See also --- diff --git a/NEWS b/NEWS index 4450fa0..b2b3c96 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +* Cope with arbitrary Unicode in nicknames, bug#2611 (smcv) + Snapshot ce62f752b2 * Text channel creation minor fixes (smcv) diff --git a/src/buddy.py b/src/buddy.py index acba884..fcd3ba8 100644 --- a/src/buddy.py +++ b/src/buddy.py @@ -148,7 +148,8 @@ class Buddy(ExportedGObject): gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_READWRITE), _PROP_ICON : (object, None, None, gobject.PARAM_READABLE), - _PROP_NICK : (str, None, None, None, + # Must be a unicode object or None + _PROP_NICK : (object, None, None, gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_READWRITE), _PROP_COLOR : (str, None, None, None, @@ -260,6 +261,8 @@ class Buddy(ExportedGObject): self._icon = str(value) self.IconChanged(self._icon) elif pspec.name == _PROP_NICK: + if value is not None: + value = unicode(value) self._nick = value elif pspec.name == _PROP_COLOR: self._color = value @@ -486,6 +489,8 @@ class Buddy(ExportedGObject): changed_props = {} if _PROP_NICK in properties: nick = properties[_PROP_NICK] + if nick is not None: + nick = unicode(nick) if nick != self._nick: self._nick = nick changed_props[_PROP_NICK] = nick -- cgit v0.9.1