]> git.0d.be Git - empathy.git/commitdiff
Do not should "password required" if X-TELEPATHY-PASSWORD is not supported
authorXavier Claessens <xclaesse@gmail.com>
Sat, 1 Oct 2011 11:08:11 +0000 (13:08 +0200)
committerXavier Claessens <xclaesse@gmail.com>
Sat, 1 Oct 2011 11:08:11 +0000 (13:08 +0200)
Messenger XMPP only supports auth via an access token, no password

src/empathy-event-manager.c

index 79b1f60cb7e7861757ae3b0238ee2326c3686df0..da677d42d7f5b4e8579d460ac1dfdc92e634c0cc 100644 (file)
@@ -1128,10 +1128,31 @@ approve_channels (TpSimpleApprover *approver,
     }
   else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_SERVER_AUTHENTICATION)
     {
-      event_manager_add (approval->manager, account, NULL, EMPATHY_EVENT_TYPE_AUTH,
-          GTK_STOCK_DIALOG_AUTHENTICATION, tp_account_get_display_name (account),
-          _("Password required"), approval,
-          event_manager_auth_process_func, NULL);
+      GHashTable *props;
+      const gchar * const *available_mechanisms;
+
+      props = tp_channel_borrow_immutable_properties (channel);
+      available_mechanisms = tp_asv_get_boxed (props,
+          TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_AVAILABLE_MECHANISMS,
+          G_TYPE_STRV);
+
+      if (tp_strv_contains (available_mechanisms, "X-TELEPATHY-PASSWORD"))
+        {
+          event_manager_add (approval->manager, account, NULL,
+              EMPATHY_EVENT_TYPE_AUTH,
+              GTK_STOCK_DIALOG_AUTHENTICATION,
+              tp_account_get_display_name (account),
+              _("Password required"), approval,
+              event_manager_auth_process_func, NULL);
+        }
+      else
+        {
+          GError error = { TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
+              "Support only X-TELEPATHY-PASSWORD auth method" };
+
+          tp_add_dispatch_operation_context_fail (context, &error);
+          return;
+        }
     }
   else
     {