Fixing exception in purple.Purple.__core_ui_ops_ui_prefs_init.
[python-purple] / buddy.pyx
index 5de38f7..9fa9ac3 100644 (file)
--- a/buddy.pyx
+++ b/buddy.pyx
@@ -35,25 +35,36 @@ cdef class Buddy:
 
     def __get_alias(self):
         if self.c_buddy:
-            return <char *>blist.c_purple_buddy_get_alias_only(self.c_buddy)
+            return <char *>blist.purple_buddy_get_alias_only(self.c_buddy)
         else:
             return None
     alias = property(__get_alias)
 
     def __get_name(self):
         if self.c_buddy:
-            return <char *>blist.c_purple_buddy_get_name(self.c_buddy)
+            return <char *>blist.purple_buddy_get_name(self.c_buddy)
         else:
             return None
     name = property(__get_name)
 
+    """
     def __get_online(self): # FIXME
         name = self.name
-        self.c_buddy = blist.c_purple_find_buddy(self.__acc.c_account, name)
-        return status.c_purple_presence_is_online(blist.c_purple_buddy_get_presence(self.c_buddy))
+        self.c_buddy = blist.purple_find_buddy(self.__acc.c_account, name)
+        return status.purple_presence_is_online(blist.purple_buddy_get_presence(self.c_buddy))
     online = property(__get_online)
+    """
 
-    def new_buddy(self, acc, char *scr, char *alias):
+    def new_buddy(self, acc, name, alias):
         self.__acc = acc
-        self.c_buddy = blist.c_purple_buddy_new(<account.PurpleAccount *>\
-                self.__acc.c_account, scr, alias)
+        cdef char *c_name = NULL
+        cdef char *c_alias = NULL
+
+        if name is not None:
+            c_name = name
+
+        if alias is not None:
+            c_alias = alias
+
+        self.c_buddy = blist.purple_buddy_new(<account.PurpleAccount *>\
+                self.__acc.c_account, c_name, c_alias)