From: Marco Barisione Date: Wed, 8 May 2013 14:45:45 +0000 (+0100) Subject: account-settings: don't set the presence on newly created accounts X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=740b695e21016ff7b568b069734b29e780b459e5 account-settings: don't set the presence on newly created accounts What happened before this patch was: 1) tpaw_account_settings_do_create_account() sets the requested presence to the global requested presence in Empathy; 2) If the requested presence is unset, unknown or offline, empathy_connect_new_account() sets it to available; 3) Every process with a TpAccountManager object in memory that was previously used to set the requested presence will try to set the presence on the new account. The first step is a problem as it doesn't work if the account is created by a process that is not Empathy as the other processes have no way of knowing what Empathy's requested presence is. This doesn't matter as, in the third step, both Empathy and gnome-shell (and any other process using a TpAccountManager) will try to set the presence to their own idea of the current requested presence. Of course this is a race condition, see [1], but the behaviour is not changed by this patch. In case there is no process using a TpAccountManager, the second step will still guarantee that the newly created account goes online. [1] https://bugs.freedesktop.org/show_bug.cgi?id=24104 https://bugzilla.gnome.org/show_bug.cgi?id=699492 --- diff --git a/tp-account-widgets/tpaw-account-settings.c b/tp-account-widgets/tpaw-account-settings.c index 3d27a995..bb6e092b 100644 --- a/tp-account-widgets/tpaw-account-settings.c +++ b/tp-account-widgets/tpaw-account-settings.c @@ -23,7 +23,6 @@ #include "tpaw-connection-managers.h" #include "tpaw-keyring.h" -#include "empathy-presence-manager.h" #include "empathy-utils.h" #include "tpaw-utils.h" @@ -1415,27 +1414,12 @@ tpaw_account_settings_do_create_account (TpawAccountSettings *self) { TpawAccountSettingsPriv *priv = GET_PRIV (self); TpAccountRequest *account_req; - TpConnectionPresenceType type; - gchar *status; - gchar *message; - EmpathyPresenceManager *presence_mgr; GHashTableIter iter; gpointer k, v; account_req = tp_account_request_new (priv->account_manager, priv->cm_name, priv->protocol, "New Account"); - presence_mgr = empathy_presence_manager_dup_singleton (); - type = empathy_presence_manager_get_requested_presence (presence_mgr, &status, - &message); - g_object_unref (presence_mgr); - - if (type != TP_CONNECTION_PRESENCE_TYPE_UNSET) - { - tp_account_request_set_requested_presence (account_req, type, - status, message); - } - tp_account_request_set_icon_name (account_req, priv->icon_name); tp_account_request_set_display_name (account_req, priv->display_name);