]> git.0d.be Git - empathy.git/commitdiff
When not connected don't apply !offline states but save them
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Thu, 27 Aug 2009 17:29:51 +0000 (18:29 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Thu, 27 Aug 2009 20:11:49 +0000 (21:11 +0100)
When we're not connected to a network don't allow setting the status to
anything else then offline, but when a status is set do save it so it can be
applied as soon as soon as we get network connectivity

libempathy/empathy-idle.c

index c86b997afc929860ca69b73173cae349c509ef22..b8c7784d704605ef5020dd704782dbf888c4cc64 100644 (file)
@@ -570,17 +570,19 @@ empathy_idle_set_presence (EmpathyIdle *idle,
                status = NULL;
        }
 
-       if (!empathy_connectivity_is_online (priv->connectivity)) {
+       if (state != TP_CONNECTION_PRESENCE_TYPE_OFFLINE &&
+                       !empathy_connectivity_is_online (priv->connectivity)) {
                DEBUG ("Empathy is not online");
 
+               priv->saved_state = state;
                if (tp_strdiff (priv->status, status)) {
-                       g_free (priv->status);
-                       priv->status = NULL;
+                       g_free (priv->saved_status);
+                       priv->saved_status = NULL;
                        if (!EMP_STR_EMPTY (status)) {
-                               priv->status = g_strdup (status);
+                               priv->saved_status = g_strdup (status);
                        }
-                       g_object_notify (G_OBJECT (idle), "status");
                }
+               return;
        }
 
        empathy_idle_do_set_presence (idle, state, status);