Updated callback strings to comply with libpurple.
[python-purple] / conversation_cbs.pxd
index 4688985..1a4aefe 100644 (file)
@@ -28,17 +28,27 @@ conversation_cbs = {}
 
 cdef void create_conversation (conversation.PurpleConversation *conv):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "create_conversation\n")
+                         "create-conversation\n")
+    cdef char *c_name = NULL
+
+    c_name = <char *> conversation.c_purple_conversation_get_name(conv)
+    if c_name == NULL:
+        name = None
+    else:
+        name = c_name
+
+    type = conversation.c_purple_conversation_get_type(conv)
+
     try:
-        (<object>conversation_cbs["create_conversation"])("create_conversation")
+        (<object>conversation_cbs["create-conversation"])(name, type)
     except KeyError:
         pass
 
 cdef void destroy_conversation (conversation.PurpleConversation *conv):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "destroy_conversation\n")
+                         "destroy-conversation\n")
     try:
-        (<object>conversation_cbs["destroy_conversation"])("destroy_conversation")
+        (<object>conversation_cbs["destroy-conversation"])("destroy-conversation: TODO")
     except KeyError:
         pass
 
@@ -46,18 +56,32 @@ cdef void write_chat (conversation.PurpleConversation *conv, const_char *who,
                       const_char *message, conversation.PurpleMessageFlags flags,
                       time_t mtime):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "write_chat\n")
+                         "write-chat\n")
     try:
-        (<object>conversation_cbs["write_chat"])("write_chat")
+        (<object>conversation_cbs["write-chat"])("write-chat: TODO")
     except KeyError:
         pass
 
 cdef void write_im (conversation.PurpleConversation *conv, const_char *who,
                     const_char *message, conversation.PurpleMessageFlags flags,
                     time_t mtime):
-    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write_im\n")
+    debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write-im\n")
+    cdef account.PurpleAccount *acc = conversation.c_purple_conversation_get_account(conv)
+    cdef char *c_username = NULL
+
+    c_username = <char *> account.c_purple_account_get_username(acc)
+    if c_username == NULL:
+        username = None
+    else:
+        username = c_username
+
+    if who:
+        sender = <char *> who
+    else:
+        sender = None
+
     try:
-        (<object>conversation_cbs["write_im"])("write_im")
+        (<object>conversation_cbs["write-im"])(username, sender, <char *> message)
     except KeyError:
         pass
 
@@ -65,18 +89,18 @@ cdef void write_conv (conversation.PurpleConversation *conv, const_char *name,
                       const_char *alias, const_char *message,
                       conversation.PurpleMessageFlags flags, time_t mtime):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "write_conv\n")
+                         "write-conv\n")
     try:
-        (<object>conversation_cbs["write_conv"])("write_conv")
+        (<object>conversation_cbs["write-conv"])("write-conv: TODO")
     except KeyError:
         pass
 
 cdef void chat_add_users (conversation.PurpleConversation *conv,
                           glib.GList *cbuddies, glib.gboolean new_arrivals):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "chat_add_users\n")
+                         "chat-add-users\n")
     try:
-        (<object>conversation_cbs["chat_add_users"])("chat_add_users")
+        (<object>conversation_cbs["chat-add-users"])("chat-add-users: TODO")
     except KeyError:
         pass
 
@@ -84,27 +108,27 @@ cdef void chat_rename_user (conversation.PurpleConversation *conv,
                             const_char *old_name, const_char *new_name,
                             const_char *new_alias):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "chat_rename_user\n")
+                         "chat-rename-user\n")
     try:
-        (<object>conversation_cbs["chat_rename_user"])("chat_rename_user")
+        (<object>conversation_cbs["chat-rename-user"])("chat-rename-user: TODO")
     except KeyError:
         pass
 
 cdef void chat_remove_users (conversation.PurpleConversation *conv,
                              glib.GList *users):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "chat_remove_users\n")
+                         "chat-remove-users\n")
     try:
-        (<object>conversation_cbs["chat_remove_users"])("chat_remove_users")
+        (<object>conversation_cbs["chat-remove-users"])("chat-remove-users: TODO")
     except KeyError:
         pass
 
 cdef void chat_update_user (conversation.PurpleConversation *conv,
                             const_char *user):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "chat_update_user\n")
+                         "chat-update-user\n")
     try:
-        (<object>conversation_cbs["chat_update_user"])("chat_update_user")
+        (<object>conversation_cbs["chat-update-user"])("chat-update-user: TODO")
     except KeyError:
         pass
 
@@ -112,15 +136,15 @@ cdef void present (conversation.PurpleConversation *conv):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
                          "present\n")
     try:
-        (<object>conversation_cbs["present"])("present")
+        (<object>conversation_cbs["present"])("present: TODO")
     except KeyError:
         pass
 
 cdef glib.gboolean has_focus (conversation.PurpleConversation *conv):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "has_focus\n")
+                         "has-focus\n")
     try:
-        (<object>conversation_cbs["has_focus"])("has_focus")
+        (<object>conversation_cbs["has-focus"])("has-focus: TODO")
         return False
     except KeyError:
         return False
@@ -128,9 +152,9 @@ cdef glib.gboolean has_focus (conversation.PurpleConversation *conv):
 cdef glib.gboolean custom_smiley_add (conversation.PurpleConversation *conv,
                                       const_char *smile, glib.gboolean remote):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "custom_smiley_add\n")
+                         "custom-smiley-add\n")
     try:
-        (<object>conversation_cbs["custom_smiley_add"])("custom_smiley_add")
+        (<object>conversation_cbs["custom-smiley-add"])("custom-smiley-add: TODO")
         return False
     except KeyError:
         return False
@@ -139,9 +163,9 @@ cdef void custom_smiley_write (conversation.PurpleConversation *conv,
                                const_char *smile, const_guchar *data,
                                glib.gsize size):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "custom_smiley_write\n")
+                         "custom-smiley-write\n")
     try:
-        (<object>conversation_cbs["custom_smiley_write"])("custom_smiley_write")
+        (<object>conversation_cbs["custom-smiley-write"])("custom-smiley-write: TODO")
     except KeyError:
         pass
 
@@ -149,17 +173,17 @@ cdef void custom_smiley_write (conversation.PurpleConversation *conv,
 cdef void custom_smiley_close (conversation.PurpleConversation *conv,
                                const_char *smile):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "custom_smiley_close\n")
+                         "custom-smiley-close\n")
     try:
-        (<object>conversation_cbs["custom_smiley_close"])("custom_smiley_close")
+        (<object>conversation_cbs["custom-smiley-close"])("custom-smiley-close: TODO")
     except KeyError:
         pass
 
 cdef void send_confirm (conversation.PurpleConversation *conv,
                         const_char *message):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
-                         "send_confirm\n")
+                         "send-confirm\n")
     try:
-        (<object>conversation_cbs["send_confirm"])("send_confirm")
+        (<object>conversation_cbs["send-confirm"])("send-confirm: TODO")
     except KeyError:
         pass