summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-01-30 16:59:41 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-04 13:57:46 +0000
commita9eb0c74c190d172cf3d47fa264ab5fb4a30ce62 (patch)
tree9b6b3125bb4f15523c16a654902a691a840628f5
parentd3fa6dc5b7048f3461755bedb0e666f0d1f50108 (diff)
_mcd_account_reconnect: if the account isn't valid, just disconnect
It is not valid to call _mcd_account_connection_begin() unless the account has a TpProtocol; in particular, if the account is "valid", then we know it does have a TpProtocol. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71093 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r--src/mcd-account.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 79b0cc44..9374751f 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -2664,6 +2664,11 @@ void
_mcd_account_reconnect (McdAccount *self,
gboolean user_initiated)
{
+ DEBUG ("%s", mcd_account_get_unique_name (self));
+
+ /* If the account is disabled, invalid or has offline requested presence,
+ * disconnecting should be a no-op, so we keep this before checking
+ * whether we want to. */
/* FIXME: this isn't quite right. If we've just called RequestConnection
* (possibly with out of date parameters) but we haven't got a Connection
* back from the CM yet, the old parameters will still be used, I think
@@ -2671,32 +2676,28 @@ _mcd_account_reconnect (McdAccount *self,
if (self->priv->connection)
mcd_connection_close (self->priv->connection, NULL);
- _mcd_account_connection_begin (self, user_initiated);
-}
-
-static void
-account_reconnect (TpSvcAccount *service,
- DBusGMethodInvocation *context)
-{
- McdAccount *self = MCD_ACCOUNT (service);
- McdAccountPrivate *priv = self->priv;
-
- DEBUG ("%s", mcd_account_get_unique_name (self));
-
/* if we can't, or don't want to, connect this method is a no-op */
- if (!priv->enabled ||
+ if (!self->priv->enabled ||
!mcd_account_is_valid (self) ||
- priv->req_presence_type == TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
+ self->priv->req_presence_type == TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
{
DEBUG ("doing nothing (enabled=%c, valid=%c and "
"combined presence=%i)",
self->priv->enabled ? 'T' : 'F',
mcd_account_is_valid (self) ? 'T' : 'F',
self->priv->req_presence_type);
- tp_svc_account_return_from_reconnect (context);
return;
}
+ _mcd_account_connection_begin (self, user_initiated);
+}
+
+static void
+account_reconnect (TpSvcAccount *service,
+ DBusGMethodInvocation *context)
+{
+ McdAccount *self = MCD_ACCOUNT (service);
+
/* Reconnect() counts as user-initiated */
_mcd_account_reconnect (self, TRUE);
@@ -4984,11 +4985,6 @@ _mcd_account_connection_begin (McdAccount *account,
/* If we get this far, the account should be valid, so getting the
* protocol should succeed.
- *
- * (FIXME: as far as I can see, this is not necessarily true when
- * _mcd_account_reconnect is called by McdAccountManager? But older
- * MC would have asserted in that situation too, so this is at least
- * not a regression.)
*/
protocol = mcd_account_dup_protocol (account);
g_assert (protocol != NULL);