I have made the following changes intended for : CE:MW:Shared / telepathy-accounts-signon
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/8130 Thank You, John Brooks [This message was auto-generated] --- Request # 8130: Messages from BOSS: State: review at 2013-02-20T07:06:58 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:special:branches:CE:MW:Shared / telepathy-accounts-signon -> CE:MW:Shared / telepathy-accounts-signon changes files: -------------- --- telepathy-accounts-signon.changes +++ telepathy-accounts-signon.changes @@ -0,0 +1,5 @@ +* Tue Feb 19 2013 John Brooks <[email protected]> - 0.0.3 +- Allow telepathy/param-account to be set manually, overriding signon data +- Fall back to the account display name if signon username isn't available +- Prefer facebook and oauth2 authentication over password + old: ---- telepathy-accounts-signon-0.0.2.tar.bz2 new: ---- telepathy-accounts-signon-0.0.3.tar.bz2 spec files: ----------- --- telepathy-accounts-signon.spec +++ telepathy-accounts-signon.spec @@ -1,5 +1,5 @@ Name: telepathy-accounts-signon -Version: 0.0.2 +Version: 0.0.3 Release: 1 Summary: Telepathy providers for libaccounts/libsignon Group: System/Libraries other changes: -------------- ++++++ telepathy-accounts-signon-0.0.2.tar.bz2 -> telepathy-accounts-signon-0.0.3.tar.bz2 --- mcp-account-manager-uoa/mcp-account-manager-uoa.c +++ mcp-account-manager-uoa/mcp-account-manager-uoa.c @@ -268,25 +268,16 @@ return TRUE; } -typedef struct -{ - AgAccount *account; - AgAccountService *service; - McpAccountManagerUoa *self; -} AccountCreateData; - static void -_account_created_signon_cb(SignonIdentity *signon, - const SignonIdentityInfo *info, - const GError *error, - gpointer user_data) +_account_create(McpAccountManagerUoa *self, AgAccountService *service) { - AccountCreateData *data = (AccountCreateData*) user_data; - gchar *username = g_strdup (signon_identity_info_get_username (info)); gchar *account_name = NULL; - gchar *cm_name = _service_dup_tp_value (data->service, "manager"); - gchar *protocol_name = _service_dup_tp_value (data->service, "protocol"); + gchar *cm_name = _service_dup_tp_value (service, "manager"); + gchar *protocol_name = _service_dup_tp_value (service, "protocol"); + gchar *username = _service_dup_tp_value (service, "param-account"); + + g_debug("UOA _account_create: '%s' '%s' '%s'", cm_name, protocol_name, username); if (!tp_str_empty (cm_name) && !tp_str_empty (protocol_name) && @@ -298,28 +289,57 @@ "account", G_TYPE_STRING, username, NULL); - account_name = mcp_account_manager_get_unique_name (data->self->priv->am, + account_name = mcp_account_manager_get_unique_name (self->priv->am, cm_name, protocol_name, params); - _service_set_tp_account_name (data->service, account_name); - - /* Must be stored for CMs */ - _service_set_tp_value (data->service, "param-account", username); - - ag_account_store (data->account, _account_stored_cb, data->self); + _service_set_tp_account_name (service, account_name); g_hash_table_unref (params); } g_free (cm_name); g_free (protocol_name); + g_free (username); if (account_name != NULL) { - if (_add_service (data->self, data->service, account_name)) - g_signal_emit_by_name (data->self, "created", account_name); + if (_add_service (self, service, account_name)) + g_signal_emit_by_name (self, "created", account_name); } g_free (account_name); +} + +typedef struct +{ + AgAccount *account; + AgAccountService *service; + McpAccountManagerUoa *self; +} AccountCreateData; + +static void +_account_created_signon_cb(SignonIdentity *signon, + const SignonIdentityInfo *info, + const GError *error, + gpointer user_data) +{ + AccountCreateData *data = (AccountCreateData*) user_data; + gchar *username = g_strdup (signon_identity_info_get_username (info)); + + g_debug("UOA got account signon info response"); + + if (!tp_str_empty (username)) + { + /* Must be stored for CMs */ + _service_set_tp_value (data->service, "param-account", username); + //ag_account_store (data->account, _account_stored_cb, data->self); + + _account_create (data->self, data->service); + } + else + { + g_debug("UOA has no account name"); + } + g_object_unref (data->service); g_object_unref (data->account); g_object_unref (signon); @@ -360,23 +380,32 @@ * account_name for it. */ if (account_name == NULL) { - /* Request auth data to get the username from signon; it's not available - * from the account. */ - AgAuthData *auth_data = ag_account_service_get_auth_data (service); - guint cred_id = ag_auth_data_get_credentials_id (auth_data); - ag_auth_data_unref(auth_data); - - SignonIdentity *signon = signon_identity_new_from_db (cred_id); - - /* Callback frees/unrefs data */ - AccountCreateData *data = g_new(AccountCreateData, 1); - data->account = account; - data->service = service; - data->self = self; - - DEBUG("UOA querying account info from signon"); - signon_identity_query_info(signon, _account_created_signon_cb, data); - return; + gchar *username = _service_dup_tp_value(service, "param-account"); + if (!username) + { + /* Request auth data to get the username from signon; it's not available + * from the account. */ + AgAuthData *auth_data = ag_account_service_get_auth_data (service); + guint cred_id = ag_auth_data_get_credentials_id (auth_data); + ag_auth_data_unref(auth_data); + + SignonIdentity *signon = signon_identity_new_from_db (cred_id); + + /* Callback frees/unrefs data */ + AccountCreateData *data = g_new(AccountCreateData, 1); + data->account = account; + data->service = service; + data->self = self; + + DEBUG("UOA querying account info from signon"); + signon_identity_query_info(signon, _account_created_signon_cb, data); + return; + } + else + { + _account_create (self, service); + g_free (username); + } } else { --- telepathy-sasl-signon/empathy-sasl-mechanisms.c +++ telepathy-sasl-signon/empathy-sasl-mechanisms.c @@ -37,10 +37,6 @@ } SupportedMech; static SupportedMech supported_mechanisms[] = { - /* XXX: Prefer password authentication over OAUTH for now, - * pending infrastructure support for oauth accounts. */ - { EMPATHY_SASL_MECHANISM_PASSWORD, MECH_PASSWORD }, - { EMPATHY_SASL_MECHANISM_FACEBOOK, MECH_FACEBOOK }, { EMPATHY_SASL_MECHANISM_WLM, MECH_WLM }, { EMPATHY_SASL_MECHANISM_GOOGLE, MECH_GOOGLE }, --- telepathy-sasl-signon/empathy-uoa-auth-handler.c +++ telepathy-sasl-signon/empathy-uoa-auth-handler.c @@ -272,6 +272,13 @@ } ctx->username = g_strdup (signon_identity_info_get_username (info)); + if (!ctx->username || !*ctx->username) + { + g_free(ctx->username); + AgAccount *account = ag_account_service_get_account (ctx->service); + ctx->username = g_strdup (ag_account_get_display_name (account)); + DEBUG ("No username in signon data, falling back to account display name (%s) as username", ctx->username); + } signon_auth_session_process (ctx->session, ag_auth_data_get_parameters (ctx->auth_data),
