[empathy] When not connected don't apply !offline states but save them



commit aad78d378231d1a8a3c44ffda2ada5e63560a58a
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Thu Aug 27 18:29:51 2009 +0100

    When not connected don't apply !offline states but save them
    
    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 |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index c86b997..b8c7784 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]