X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=account_cbs.pxd;h=d314040f6d910f5b602849b07a4b752396334bd6;hp=2ca1414f5b42bb8e1feb622834a64d95478b3c38;hb=7b635b4096c7de4b55ac0026be6b49be85f453a1;hpb=2a0862580362384e379dc404be98b8a6619e32d3 diff --git a/account_cbs.pxd b/account_cbs.pxd index 2ca1414..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): @@ -70,15 +95,40 @@ cdef void status_changed(account.PurpleAccount *account, \ if account_cbs.has_key("status-changed"): ( account_cbs["status-changed"])("status-changed: TODO") -cdef void request_add(account.PurpleAccount *account, \ +cdef void request_add(account.PurpleAccount *c_account, \ const_char *remote_user, const_char *id, const_char *alias, \ - const_char *message): + const_char *c_message): """ Someone we don't have on our list added us; prompt to add them. """ + cdef connection.PurpleConnection *gc = \ + account.purple_account_get_connection(c_account) + debug.purple_debug_info("account", "%s", "request-add\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("request-add"): - ( account_cbs["request-add"])("request-add: TODO") + ( account_cbs["request-add"])( \ + ( remote_user, remote_alias), \ + (username, protocol_id), message) cdef void *request_authorize(account.PurpleAccount *c_account, \ const_char *remote_user, const_char *id, const_char *alias, \