Commit a9a2bccf authored by chriadam's avatar chriadam

[telepathy-sasl-signon] Use g_message to log CredentialsNeedUpdate

Previously, we used g_debug to log the CredentialsNeedUpdate event,
but g_debug output is suppressed by default.  This commit changes
it to use g_message instead, which is not suppressed, to ensure
that the event shows up in the journal logs.

This commit also suppresses some warnings by switching to newer
API to avoid deprecation warnings, and marking some function
parameters as unused.
parent 19ff2057
......@@ -30,6 +30,8 @@
#include <sailfishkeyprovider.h>
#include <string.h>
#include "empathy-debug.h"
#include "empathy-keyring.h"
......@@ -149,16 +151,21 @@ auth_context_done (AuthContext *ctx)
static void
request_password_account_store_cb (AgAccount *account,
const GError *error,
gpointer user_data)
request_password_account_store_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
AgAccount *account = AG_ACCOUNT(source_object);
AuthContext *ctx = user_data;
GError *error = NULL;
if (error != NULL)
if (!ag_account_store_finish (account, res, &error))
DEBUG ("Error setting CredentialsNeedUpdate on account: %s",
g_assert (error != NULL);
DEBUG ("Error setting CredentialsNeedUpdate on account %u: %s",
g_error_free (error);
......@@ -171,21 +178,13 @@ request_password (AuthContext *ctx)
AgAccount *account = ag_account_service_get_account (ctx->service);
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_BOOLEAN);
g_value_set_boolean (&value, TRUE);
GValue fromValue = G_VALUE_INIT;
g_value_init (&fromValue, G_TYPE_STRING);
g_value_set_static_string (&fromValue, "telepathy-sasl-signon");
ag_account_set_value (account, "CredentialsNeedUpdate", &value);
ag_account_set_value (account, "CredentialsNeedUpdateFrom", &fromValue);
ag_account_set_variant (account, "CredentialsNeedUpdate", g_variant_new_boolean(TRUE));
ag_account_set_variant (account, "CredentialsNeedUpdateFrom", g_variant_new_string("telepathy-sasl-signon"));
DEBUG ("telepathy-sasl-signon: setting CredentialsNeedUpdate on service %s for account: %d",
ag_service_get_name(ag_account_service_get_service (ctx->service)), account->id);
g_message ("telepathy-sasl-signon: setting CredentialsNeedUpdate on service %s for account: %u",
ag_service_get_name(ag_account_service_get_service (ctx->service)), account->id);
ag_account_store (account, request_password_account_store_cb, ctx);
ag_account_store_async (account, 0, request_password_account_store_cb, ctx);
static void
......@@ -290,6 +289,7 @@ identity_query_info_cb (SignonIdentity *identity,
AuthContext *ctx = user_data;
gchar *client_secret = 0;
(void)identity; // suppress unused parameter warning
if (error != NULL)
......@@ -318,6 +318,11 @@ identity_query_info_cb (SignonIdentity *identity,
DEBUG ("No username in signon data, falling back to default_credentials_username '%s'", ctx->username);
// after upgrade to glib2.4 use:
// GVariant *params = ag_auth_data_get_login_parameters (ctx->auth_data, NULL);
// g_variant_dict_insert_value (params, g_strdup("ClientId"), g_variant_new_string(ctx->client_id));
// g_variant_dict_insert_value (params, g_strdup("ClientSecret"), g_variant_new_string(client_secret));
// g_variant_dict_insert_value (params, g_strdup(SIGNON_SESSION_DATA_UI_POLICY), g_variant_new_int32(SIGNON_POLICY_NO_USER_INTERACTION));
GHashTable *params = ag_auth_data_get_parameters (ctx->auth_data);
AgService *service = ag_account_service_get_service (ctx->service);
......@@ -334,7 +339,8 @@ identity_query_info_cb (SignonIdentity *identity,
signon_auth_session_process (ctx->session,
signon_auth_session_process (
ag_auth_data_get_mechanism (ctx->auth_data),
......@@ -403,7 +409,7 @@ empathy_uoa_auth_handler_supports (EmpathyUoaAuthHandler *self,
TpAccount *account)
const gchar *provider;
EmpathySaslMechanism mech;
(void)self; // suppress unused parameter warning
g_return_val_if_fail (TP_IS_CHANNEL (channel), FALSE);
g_return_val_if_fail (TP_IS_ACCOUNT (account), FALSE);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment