X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=conversation_cbs.pxd;h=573ef15a5ca05203bf5d97450e05265f5e70b3a3;hp=884211a63e1ae4169d39c2946d4aa76646c191ed;hb=c2951f59ada56c74f666f005abd656d81e296593;hpb=e336c7f9770751ff9eea750db9a856b86d6b5e14 diff --git a/conversation_cbs.pxd b/conversation_cbs.pxd index 884211a..573ef15 100644 --- a/conversation_cbs.pxd +++ b/conversation_cbs.pxd @@ -42,7 +42,7 @@ cdef void create_conversation(conversation.PurpleConversation *conv): type = conversation.purple_conversation_get_type(conv) - if conversation_cbs.has_key("create-conversation"): + if "create-conversation" in conversation_cbs: ( conversation_cbs["create-conversation"])(name, type) cdef void destroy_conversation(conversation.PurpleConversation *conv): @@ -50,8 +50,9 @@ cdef void destroy_conversation(conversation.PurpleConversation *conv): Called just before a conv is freed. """ debug.purple_debug_info("conversation", "%s", "destroy-conversation\n") - if conversation_cbs.has_key("destroy-conversation"): - ( conversation_cbs["destroy-conversation"])("destroy-conversation: TODO") + if "destroy-conversation" in conversation_cbs: + ( conversation_cbs["destroy-conversation"]) \ + ("destroy-conversation: TODO") cdef void write_chat(conversation.PurpleConversation *conv, const_char *who, \ const_char *message, conversation.PurpleMessageFlags flags, \ @@ -62,7 +63,7 @@ cdef void write_chat(conversation.PurpleConversation *conv, const_char *who, \ @see purple_conv_chat_write() """ debug.purple_debug_info("conversation", "%s", "write-chat\n") - if conversation_cbs.has_key("write-chat"): + if "write-chat" in conversation_cbs: ( conversation_cbs["write-chat"])("write-chat: TODO") cdef void write_im(conversation.PurpleConversation *conv, const_char *who, \ @@ -74,7 +75,8 @@ cdef void write_im(conversation.PurpleConversation *conv, const_char *who, \ @see purple_conv_im_write() """ debug.purple_debug_info("conversation", "%s", "write-im\n") - cdef account.PurpleAccount *acc = conversation.purple_conversation_get_account(conv) + cdef account.PurpleAccount *acc = \ + conversation.purple_conversation_get_account(conv) cdef blist.PurpleBuddy *buddy = NULL cdef char *c_username = NULL cdef char *c_sender_alias = NULL @@ -85,15 +87,16 @@ cdef void write_im(conversation.PurpleConversation *conv, const_char *who, \ else: username = None - if who: - sender = who - buddy = blist.purple_find_buddy(acc, who) + if who == NULL: + who = conversation.purple_conversation_get_name(conv) + + sender = who + buddy = blist.purple_find_buddy(acc, who) + if buddy: c_sender_alias = 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 @@ -102,9 +105,15 @@ cdef void write_im(conversation.PurpleConversation *conv, const_char *who, \ else: message = None - if conversation_cbs.has_key("write-im"): + # FIXME: Maybe we need add more purple flags in the future + if flags & conversation.PURPLE_MESSAGE_SEND: + flag = "SEND" + else: + flag = "RECV" + + if "write-im" in conversation_cbs: ( conversation_cbs["write-im"])(username, sender, \ - sender_alias, message) + sender_alias, message, flag) cdef void write_conv(conversation.PurpleConversation *conv, const_char *name, \ const_char *alias, const_char *message, \ @@ -118,7 +127,7 @@ cdef void write_conv(conversation.PurpleConversation *conv, const_char *name, \ @see purple_conversation_write() """ debug.purple_debug_info("conversation", "%s", "write-conv\n") - if conversation_cbs.has_key("write-conv"): + if "write-conv" in conversation_cbs: ( conversation_cbs["write-conv"])("write-conv: TODO") cdef void chat_add_users(conversation.PurpleConversation *conv, \ @@ -132,7 +141,7 @@ cdef void chat_add_users(conversation.PurpleConversation *conv, \ @see purple_conv_chat_add_users() """ debug.purple_debug_info("conversation", "%s", "chat-add-users\n") - if conversation_cbs.has_key("chat-add-users"): + if "chat-add-users" in conversation_cbs: ( conversation_cbs["chat-add-users"])("chat-add-users: TODO") cdef void chat_rename_user(conversation.PurpleConversation *conv, \ @@ -145,8 +154,9 @@ cdef void chat_rename_user(conversation.PurpleConversation *conv, \ @see purple_conv_chat_rename_user() """ debug.purple_debug_info("conversation", "%s", "chat-rename-user\n") - if conversation_cbs.has_key("chat-rename-user"): - ( conversation_cbs["chat-rename-user"])("chat-rename-user: TODO") + if "chat-rename-user" in conversation_cbs: + ( conversation_cbs["chat-rename-user"]) \ + ("chat-rename-user: TODO") cdef void chat_remove_users(conversation.PurpleConversation *conv, \ glib.GList *users): @@ -155,8 +165,9 @@ cdef void chat_remove_users(conversation.PurpleConversation *conv, \ @param users A GList of const char *s. """ debug.purple_debug_info("conversation", "%s", "chat-remove-users\n") - if conversation_cbs.has_key("chat-remove-users"): - ( conversation_cbs["chat-remove-users"])("chat-remove-users: TODO") + if "chat-remove-users" in conversation_cbs: + ( conversation_cbs["chat-remove-users"]) \ + ("chat-remove-users: TODO") cdef void chat_update_user(conversation.PurpleConversation *conv, \ const_char *user): @@ -165,8 +176,9 @@ cdef void chat_update_user(conversation.PurpleConversation *conv, \ @see purple_conv_chat_user_set_flags() """ debug.purple_debug_info("conversation", "%s", "chat-update-user\n") - if conversation_cbs.has_key("chat-update-user"): - ( conversation_cbs["chat-update-user"])("chat-update-user: TODO") + if "chat-update-user" in conversation_cbs: + ( conversation_cbs["chat-update-user"]) \ + ("chat-update-user: TODO") cdef void present(conversation.PurpleConversation *conv): """ @@ -174,7 +186,7 @@ cdef void present(conversation.PurpleConversation *conv): dialog. """ debug.purple_debug_info("conversation", "%s", "present\n") - if conversation_cbs.has_key("present"): + if "present" in conversation_cbs: ( conversation_cbs["present"])("present: TODO") cdef glib.gboolean has_focus(conversation.PurpleConversation *conv): @@ -183,7 +195,7 @@ cdef glib.gboolean has_focus(conversation.PurpleConversation *conv): conversation has the focus, return TRUE; otherwise, return FALSE. """ debug.purple_debug_info("conversation", "%s", "has-focus\n") - if conversation_cbs.has_key("has-focus"): + if "has-focus" in conversation_cbs: ( conversation_cbs["has-focus"])("has-focus: TODO") return False @@ -193,8 +205,9 @@ cdef glib.gboolean custom_smiley_add(conversation.PurpleConversation *conv, \ Custom smileys (add). """ debug.purple_debug_info("conversation", "%s", "custom-smiley-add\n") - if conversation_cbs.has_key("custom-smiley-add"): - ( conversation_cbs["custom-smiley-add"])("custom-smiley-add: TODO") + if "custom-smiley-add" in conversation_cbs: + ( conversation_cbs["custom-smiley-add"]) \ + ("custom-smiley-add: TODO") return False cdef void custom_smiley_write(conversation.PurpleConversation *conv, \ @@ -203,8 +216,9 @@ cdef void custom_smiley_write(conversation.PurpleConversation *conv, \ Custom smileys (write). """ debug.purple_debug_info("conversation", "%s", "custom-smiley-write\n") - if conversation_cbs.has_key("custom-smiley-write"): - ( conversation_cbs["custom-smiley-write"])("custom-smiley-write: TODO") + if "custom-smiley-write" in conversation_cbs: + ( conversation_cbs["custom-smiley-write"]) \ + ("custom-smiley-write: TODO") cdef void custom_smiley_close(conversation.PurpleConversation *conv, \ const_char *smile): @@ -212,8 +226,9 @@ cdef void custom_smiley_close(conversation.PurpleConversation *conv, \ Custom smileys (close). """ debug.purple_debug_info("conversation", "%s", "custom-smiley-close\n") - if conversation_cbs.has_key("custom-smiley-close"): - ( conversation_cbs["custom-smiley-close"])("custom-smiley-close: TODO") + if "custom-smiley-close" in conversation_cbs: + ( conversation_cbs["custom-smiley-close"]) \ + ("custom-smiley-close: TODO") cdef void send_confirm(conversation.PurpleConversation *conv, \ const_char *message): @@ -223,5 +238,5 @@ cdef void send_confirm(conversation.PurpleConversation *conv, \ is NULL, libpurple will fall back to using purple_request_action(). """ debug.purple_debug_info("conversation", "%s", "send-confirm\n") - if conversation_cbs.has_key("send-confirm"): + if "send-confirm" in conversation_cbs: ( conversation_cbs["send-confirm"])("send-confirm: TODO")