[Telepathy-commits] [telepathy-glib/master] Move check_status_available up so the changes actually compile

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Jan 29 04:45:00 PST 2009


---
 telepathy-glib/presence-mixin.c |   95 +++++++++++++++++++--------------------
 1 files changed, 47 insertions(+), 48 deletions(-)

diff --git a/telepathy-glib/presence-mixin.c b/telepathy-glib/presence-mixin.c
index 0c2647b..4967658 100644
--- a/telepathy-glib/presence-mixin.c
+++ b/telepathy-glib/presence-mixin.c
@@ -569,6 +569,53 @@ get_statuses_arguments (const TpPresenceStatusOptionalArgumentSpec *specs)
   return arguments;
 }
 
+static gboolean
+check_status_available (GObject *object,
+                        TpPresenceMixinClass *mixin_cls,
+                        guint i,
+                        GError **error,
+                        gboolean for_self)
+{
+  if (for_self)
+    {
+      if (!mixin_cls->statuses[i].self)
+        {
+          g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+              "cannot set status '%s' on yourself",
+              mixin_cls->statuses[i].name);
+          return FALSE;
+        }
+
+      /* never allow OFFLINE, UNKNOWN or ERROR - if the CM says they're
+       * OK to set on yourself, then it's wrong */
+      switch (mixin_cls->statuses[i].presence_type)
+        {
+        case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+        case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
+        case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+          g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+              "cannot set offline/unknown/error status '%s' on yourself",
+              mixin_cls->statuses[i].name);
+          return FALSE;
+
+        default:
+          break;
+        }
+    }
+
+  if (mixin_cls->status_available
+      && !mixin_cls->status_available (object, i))
+    {
+      DEBUG ("requested status %s is not available",
+          mixin_cls->statuses[i].name);
+      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+          "requested status '%s' is not available on this connection",
+          mixin_cls->statuses[i].name);
+      return FALSE;
+    }
+
+  return TRUE;
+}
 
 /**
  * tp_presence_mixin_get_statuses:
@@ -799,54 +846,6 @@ struct _i_hate_g_hash_table_foreach {
   gboolean retval;
 };
 
-static gboolean
-check_status_available (GObject *object,
-                        TpPresenceMixinClass *mixin_cls,
-                        guint i,
-                        GError **error,
-                        gboolean for_self)
-{
-  if (for_self)
-    {
-      if (!mixin_cls->statuses[i].self)
-        {
-          g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-              "cannot set status '%s' on yourself",
-              mixin_cls->statuses[i].name);
-          return FALSE;
-        }
-
-      /* never allow OFFLINE, UNKNOWN or ERROR - if the CM says they're
-       * OK to set on yourself, then it's wrong */
-      switch (mixin_cls->statuses[i].presence_type)
-        {
-        case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
-        case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
-        case TP_CONNECTION_PRESENCE_TYPE_ERROR:
-          g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-              "cannot set offline/unknown/error status '%s' on yourself",
-              mixin_cls->statuses[i].name);
-          return FALSE;
-
-        default:
-          break;
-        }
-    }
-
-  if (mixin_cls->status_available
-      && !mixin_cls->status_available (object, i))
-    {
-      DEBUG ("requested status %s is not available",
-          mixin_cls->statuses[i].name);
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
-          "requested status '%s' is not available on this connection",
-          mixin_cls->statuses[i].name);
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
 static int
 check_for_status (GObject *object, const gchar *status, GError **error)
 {
-- 
1.5.6.5




More information about the telepathy-commits mailing list