From 7b635b4096c7de4b55ac0026be6b49be85f453a1 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 21:27:55 +0000 Subject: [PATCH 1/1] Implemented notify_added callback. FIXES: - Implemented notify_added callback. Signed-off-by: Bruno Abinader Acked-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1465 596f6dd7-e928-0410-a184-9e12fd12cf7e --- account_cbs.pxd | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/account_cbs.pxd b/account_cbs.pxd index 8f8a800..d314040 100644 --- a/account_cbs.pxd +++ b/account_cbs.pxd @@ -50,16 +50,41 @@ def call_deny_cb(): c_request_authorize_deny_cb = NULL c_request_authorize_user_data = NULL -cdef void notify_added(account.PurpleAccount *account, \ +cdef void notify_added(account.PurpleAccount *c_account, \ const_char *remote_user, const_char *id, const_char *alias, \ - const_char *message): + const_char *c_message): """ A buddy who is already on this account's buddy list added this account to their buddy list. """ + cdef connection.PurpleConnection *gc = \ + account.purple_account_get_connection(c_account) + debug.purple_debug_info("account", "%s", "notify-added\n") + + if alias: + remote_alias = alias + else: + remote_alias = None + + if id: + username = id + elif connection.purple_connection_get_display_name(gc) != NULL: + username = connection.purple_connection_get_display_name(gc) + else: + username = account.purple_account_get_username(c_account) + + protocol_id = account.purple_account_get_protocol_id(c_account) + + if c_message: + message = c_message + else: + message = None + if account_cbs.has_key("notify-added"): - ( account_cbs["notify-added"])("notify-added: TODO") + ( account_cbs["notify-added"])( \ + ( remote_user, remote_alias), \ + (username, protocol_id), message) cdef void status_changed(account.PurpleAccount *account, \ status.PurpleStatus *status): -- 1.7.9.5