static void sasl_status_changed_handler(TpChannel *channel, guint status, const gchar *error, GHashTable *details, gpointer user_data, GObject *weak_object) { HevImpathyServerSASLHandler *self = HEV_IMPATHY_SERVER_SASL_HANDLER(weak_object); HevImpathyServerSASLHandlerPrivate *priv = HEV_IMPATHY_SERVER_SASL_HANDLER_GET_PRIVATE(self); g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__); if(G_N_ELEMENTS(sasl_statuses) <= status) return; if(TP_SASL_STATUS_SERVER_SUCCEEDED == status) { if(priv->save_password) { hev_impathy_keyring_set_account_password_async(priv->account, priv->password, hev_impathy_server_sasl_handler_set_password_handler, NULL); } tp_cli_channel_interface_sasl_authentication_call_accept_sasl( priv->channel, -1, NULL, NULL, NULL, NULL); } else if(TP_SASL_STATUS_SUCCEEDED == status) { tp_cli_channel_call_close(priv->channel, -1, NULL, NULL, NULL, NULL); } }
static void sasl_status_changed_cb (TpChannel *channel, TpSASLStatus status, const gchar *error, GHashTable *details, gpointer user_data, GObject *weak_object) { EmpathyServerSASLHandler *self = EMPATHY_SERVER_SASL_HANDLER (weak_object); EmpathyServerSASLHandlerPriv *priv = EMPATHY_SERVER_SASL_HANDLER (weak_object)->priv; /* buh boh */ if (status >= G_N_ELEMENTS (sasl_statuses)) { DEBUG ("SASL status changed to unknown status"); return; } DEBUG ("SASL status changed to '%s'", sasl_statuses[status]); if (status == TP_SASL_STATUS_SERVER_SUCCEEDED) { if (priv->save_password) { DEBUG ("Saving password in keyring"); empathy_keyring_set_account_password_async (priv->account, priv->password, empathy_server_sasl_handler_set_password_cb, NULL); } DEBUG ("Calling AcceptSASL"); tp_cli_channel_interface_sasl_authentication_call_accept_sasl ( priv->channel, -1, NULL, NULL, NULL, NULL); } else if (status == TP_SASL_STATUS_SUCCEEDED) { DEBUG ("SASL succeeded, calling Close"); tp_cli_channel_call_close (priv->channel, -1, NULL, NULL, NULL, NULL); } else if (status == TP_SASL_STATUS_SERVER_FAILED) { if (!tp_strdiff (error, TP_ERROR_STR_AUTHENTICATION_FAILED)) { g_signal_emit (self, signals[AUTH_PASSWORD_FAILED], 0, priv->password); } } }
static void sasl_status_changed_cb (TpChannel *channel, TpSASLStatus status, const gchar *error, GHashTable *details, gpointer user_data, GObject *weak_object) { printf ("New sasl status: %d\n", status); switch (status) { case TP_SASL_STATUS_SERVER_SUCCEEDED: tp_cli_channel_interface_sasl_authentication_call_accept_sasl ( channel, -1, NULL, NULL, NULL, NULL); break; case TP_SASL_STATUS_SUCCEEDED: case TP_SASL_STATUS_SERVER_FAILED: tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL); break; default: break; } }