Added more properties to account and buddy.
[python-purple] / signal_cbs.pxd
index 4b0885a..64c66d1 100644 (file)
@@ -22,43 +22,43 @@ cimport purple
 signal_cbs = {}
 
 cdef void signal_buddy_signed_off_cb (blist.PurpleBuddy *buddy):
-    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "signal",
-                         "buddy_signed_off\n")
-
     if buddy.server_alias:
         name = buddy.server_alias
+    elif buddy.alias:
+        name = buddy.alias
     else:
-        if buddy.alias:
-            name = buddy.alias
-        else:
-            name = buddy.name
+        name = buddy.name
 
     try:
-        (<object>signal_cbs["buddy_signed_off"])(name, buddy.name)
+        (<object> signal_cbs["buddy-signed-off"])(name, buddy.name)
     except KeyError:
         pass
 
 cdef glib.gboolean signal_receiving_im_msg_cb (account.PurpleAccount *account,
-                                        char **sender,
-                                        char **message,
-                                        conversation.PurpleConversation *conv,
-                                        conversation.PurpleMessageFlags *flags):
-    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "signal",
-                         "receivinv_im_msg_cb\n")
-
+        char **sender, char **message, conversation.PurpleConversation *conv,
+        conversation.PurpleMessageFlags *flags):
     cdef blist.PurpleBuddy *buddy = blist.c_purple_find_buddy(account, sender[0])
 
     if buddy.server_alias:
         name = buddy.server_alias
+    elif buddy.alias:
+        name = buddy.alias
     else:
-        if buddy.alias:
-            name = buddy.alias
-        else:
-            name = buddy.name
+        name = buddy.name
 
-    stripped_msg = util.c_purple_markup_strip_html(message[0])
+    stripped = util.c_purple_markup_strip_html(message[0])
 
     try:
-        return (<object>signal_cbs["receiving_im_msg"])(sender[0], name, stripped_msg)
+        return (<object> signal_cbs["receiving-im-msg"])(sender[0], name, stripped)
     except KeyError:
         return False
+
+cdef void jabber_receiving_xmlnode_cb (connection.PurpleConnection *gc,
+        xmlnode.xmlnode **packet, glib.gpointer null):
+
+    message = xmlnode.xmlnode_to_str(packet[0], NULL)
+
+    try:
+        (<object> signal_cbs["jabber-receiving-xmlnode"])(message)
+    except KeyError:
+        pass