If write_im get buddy NULL take it from conversation name
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 21:21:55 +0000 (21:21 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:20 +0000 (17:11 -0400)
If write_im get buddy NULL take it from conversation name
Fixing buddy's alias to work as utf-8 unicode

Signed-off-by: Ragner Magalhaes <ragner.magalhaes@indt.org.br>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1450 596f6dd7-e928-0410-a184-9e12fd12cf7e

conversation_cbs.pxd

index 884211a..f85ac1c 100644 (file)
@@ -85,15 +85,16 @@ cdef void write_im(conversation.PurpleConversation *conv, const_char *who, \
     else:
         username = None
 
-    if who:
-        sender = <char *> who
-        buddy = blist.purple_find_buddy(acc, <char *> who)
+    if who == NULL:
+        who = conversation.purple_conversation_get_name(conv)
+
+    sender = <char *> who
+    buddy = blist.purple_find_buddy(acc, <char *> who)
+    if buddy:
         c_sender_alias = <char *> blist.purple_buddy_get_alias_only(buddy)
-    else:
-        sender = None
 
     if c_sender_alias:
-        sender_alias = c_sender_alias
+        sender_alias = unicode(c_sender_alias, 'utf-8')
     else:
         sender_alias = None