summaryrefslogtreecommitdiff
path: root/telepathy-glib/presence-mixin.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2009-01-29 12:45:00 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2009-01-29 12:45:00 +0000
commit64a21de0c546616daba458969d0a9347f07dfa77 (patch)
tree7bb04dd73dd70ae4ab477ebb7f4ecb7e945b15f4 /telepathy-glib/presence-mixin.c
parent7860dd4e110f1b9dcf4188f1c74c947deda38eba (diff)
downloadtelepathy-glib-64a21de0c546616daba458969d0a9347f07dfa77.tar.gz
Move check_status_available up so the changes actually compile
Diffstat (limited to 'telepathy-glib/presence-mixin.c')
-rw-r--r--telepathy-glib/presence-mixin.c95
1 files changed, 47 insertions, 48 deletions
diff --git a/telepathy-glib/presence-mixin.c b/telepathy-glib/presence-mixin.c
index 0c2647b79..4967658ed 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)
{