Updated changes made on python-purple branch.
[python-purple] / blist_cbs.pxd
index 2e535a2..52847dc 100644 (file)
@@ -26,11 +26,13 @@ blist_cbs = {}
 
 cdef void __group_node_cb(blist.PurpleBlistNode *node, object callback):
     cdef blist.PurpleGroup *group = <blist.PurpleGroup *>node
-    cdef char *name = NULL
+    cdef char *c_name = NULL
 
-    name = <char *> blist.c_purple_group_get_name(group)
-    if name == NULL:
-        name = ""
+    c_name = <char *> blist.c_purple_group_get_name(group)
+    if c_name == NULL:
+        name = None
+    else:
+        name = c_name
 
     currentsize = blist.c_purple_blist_get_group_size(group, False)
     totalsize = blist.c_purple_blist_get_group_size(group, True)
@@ -43,11 +45,13 @@ cdef void __group_node_cb(blist.PurpleBlistNode *node, object callback):
 
 cdef void __contact_node_cb(blist.PurpleBlistNode *node, object callback):
     cdef blist.PurpleContact *contact = <blist.PurpleContact *>node
-    cdef char *alias = NULL
+    cdef char *c_alias = NULL
 
-    alias = <char *> blist.c_purple_contact_get_alias(contact)
-    if alias == NULL:
-        alias = ""
+    c_alias = <char *> blist.c_purple_contact_get_alias(contact)
+    if c_alias == NULL:
+        alias = None
+    else:
+        alias = c_alias
 
     try:
         callback(node.type, alias, contact.totalsize, contact.currentsize, \
@@ -57,15 +61,20 @@ cdef void __contact_node_cb(blist.PurpleBlistNode *node, object callback):
 
 cdef void __buddy_node_cb(blist.PurpleBlistNode *node, object callback):
     cdef blist.PurpleBuddy *buddy = <blist.PurpleBuddy *>node
-    cdef char *name = NULL
-    cdef char *alias = NULL
+    cdef char *c_name = NULL
+    cdef char *c_alias = NULL
 
-    name = <char *> blist.c_purple_buddy_get_name(buddy)
-    if name == NULL:
-        name = ""
-    alias = <char *> blist.c_purple_buddy_get_alias_only(buddy)
-    if alias == NULL:
-        alias = ""
+    c_name = <char *> blist.c_purple_buddy_get_name(buddy)
+    if c_name == NULL:
+        name = None
+    else:
+        name = c_name
+
+    c_alias = <char *> blist.c_purple_buddy_get_alias_only(buddy)
+    if c_alias == NULL:
+        alias = None
+    else:
+        alias = c_alias
 
     try:
         callback(node.type, name, alias)
@@ -74,11 +83,13 @@ cdef void __buddy_node_cb(blist.PurpleBlistNode *node, object callback):
 
 cdef void __chat_node_cb(blist.PurpleBlistNode *node, object callback):
     cdef blist.PurpleChat *chat = <blist.PurpleChat *>node
-    cdef char *name = NULL
+    cdef char *c_name = NULL
 
-    name = <char *> blist.c_purple_chat_get_name(chat)
-    if name == NULL:
-        name = ""
+    c_name = <char *> blist.c_purple_chat_get_name(chat)
+    if c_name == NULL:
+        name = None
+    else:
+        name = c_name
 
     try:
         callback(node.type, name)
@@ -117,7 +128,7 @@ cdef void new_node (blist.PurpleBlistNode *node):
 cdef void show (blist.PurpleBuddyList *list):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "show\n")
     try:
-        (<object>blist_cbs["show"])("show")
+        (<object>blist_cbs["show"])("show: TODO")
     except KeyError:
         pass
 
@@ -157,23 +168,23 @@ cdef void remove (blist.PurpleBuddyList *list, blist.PurpleBlistNode *node):
 cdef void destroy (blist.PurpleBuddyList *list):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "destroy\n")
     try:
-        (<object>blist_cbs["destroy"])("destroy")
+        (<object>blist_cbs["destroy"])("destroy: TODO")
     except KeyError:
         pass
 
 cdef void set_visible (blist.PurpleBuddyList *list, glib.gboolean show):
-    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "set_visible\n")
+    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "set-visible\n")
     try:
-        (<object>blist_cbs["set_visible"])("set_visible")
+        (<object>blist_cbs["set_visible"])("set-visible: TODO")
     except KeyError:
         pass
 
 cdef void request_add_buddy (account.PurpleAccount *acc,
                              const_char *username, const_char *group,
                              const_char *alias):
-    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "request_add_buddy\n")
+    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "request-add-buddy\n")
     try:
-        (<object>blist_cbs["request_add_buddy"])("request_add_buddy")
+        (<object>blist_cbs["request-add-buddy"])("request-add-buddy: TODO")
     except KeyError:
         pass
 
@@ -182,13 +193,13 @@ cdef void request_add_chat (account.PurpleAccount *acc,
                             const_char *name):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "request_add_chat\n")
     try:
-        (<object>blist_cbs["request_add_chat"])("request_add_chat")
+        (<object>blist_cbs["request-add-chat"])("request-add-chat: TODO")
     except KeyError:
         pass
 
 cdef void request_add_group ():
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "request_add_group\n")
     try:
-        (<object>blist_cbs["request_add_chat"])("request_add_group")
+        (<object>blist_cbs["request-add-chat"])("request-add-group: TODO")
     except KeyError:
         pass