soc.2009.telepathy: 93d5578d: Moved some functions from telepathy.c to...

sttwister at gmail.com sttwister at gmail.com
Mon Dec 21 14:40:40 EST 2009


-----------------------------------------------------------------
Revision: 93d5578df62cd684ce0f52fb648f2b2280f5432f
Ancestor: 80d08346ceb8c29239415b6039eba621ff8a21c2
Author: sttwister at gmail.com
Date: 2009-12-21T18:47:44
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/93d5578df62cd684ce0f52fb648f2b2280f5432f

Modified files:
        libpurple/protocols/telepathy/telepathy.c
        libpurple/protocols/telepathy/telepathy_utils.c
        libpurple/protocols/telepathy/telepathy_utils.h

ChangeLog: 

Moved some functions from telepathy.c to telepathy_utils.c

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	609938ac396e87907cd69e2239d35fee36caaf6a
+++ libpurple/protocols/telepathy/telepathy.c	9de6965324b3d68f3002580dee064a9e4f69eda5
@@ -1108,67 +1108,6 @@ static PurplePluginInfo telepathy_info =
 };                               
 
 /**
- * Transforms a Telepathy option name to a human-readable format.
- *
- * @param telepathy_name  The original Telepathy name.
- * @param dbus_type       The DBus type of the option.
- * @param purple_type_out An output parameter containing the option type.
- *
- * @return The human-readable format of the option.
- */
-/* TODO: Handle "as" types */
-static gchar *
-get_human_name(const gchar *telepathy_name,
-               const gchar *dbus_type,
-               PurplePrefType *purple_type_out)
-{
-	int i;
-
-	/* map the type */
-	if (g_strcmp0(dbus_type, "s") == 0)
-		*purple_type_out = PURPLE_PREF_STRING;
- 	else if (g_strcmp0(dbus_type, "i") == 0 || g_strcmp0(dbus_type, "n") == 0 || g_strcmp0(dbus_type, "q") == 0)
-		*purple_type_out = PURPLE_PREF_INT;
- 	else if (g_strcmp0(dbus_type, "b") == 0)
-		*purple_type_out = PURPLE_PREF_BOOLEAN;
-	else
-	{
-		purple_debug_warning("telepathy", "Unknown DBus signature \"%s\" for option \"%s\"\n",
-			dbus_type, telepathy_name);
-		return NULL;
-	}
-
-	/* check for a standard specification name */
-	for (i = 0; options[i].telepathy_name != NULL; ++i)
-	{
-		if (g_strcmp0(options[i].telepathy_name, telepathy_name) == 0 &&
-				g_strcmp0(options[i].dbus_type, dbus_type) == 0)
-			return g_strdup(_(options[i].human_name));
-	}
-
-	/* non-standard parameter, beatuify the name a bit */
-	return telepathy_transform_param_name(telepathy_name);
-}
-
-/**
- * Returns the integer value contained in a GValue.
- *
- * @param value     The GValue containing the integer.
- * @param signature The DBus signature of the integer contained in value.
- */
-static int
-get_int_value(const GValue *value,
-              const gchar *signature)
-{
-	if (g_strcmp0(signature, "q") == 0)
-		return g_value_get_uint(value);
-	else if (g_strcmp0(signature, "i") == 0 || g_strcmp0(signature, "n") == 0)
-		return g_value_get_int(value);
-	else
-		return 0;
-}
-
-/**
  * Adds Telepathy protocol parameters to a plugin as libpurple options.
  *
  * @param plugin   The plugin to add the options to.
============================================================
--- libpurple/protocols/telepathy/telepathy_utils.c	c9db188336ac3306f9d80edc43f3b2f0e3e3da74
+++ libpurple/protocols/telepathy/telepathy_utils.c	eff1cceb223469598a0aeb7cf3c119f1c92afcf2
@@ -26,6 +26,52 @@
 
 #include "debug.h"
 
+/* TODO: Handle "as" types */
+gchar *
+get_human_name(const gchar *telepathy_name,
+               const gchar *dbus_type,
+               PurplePrefType *purple_type_out)
+{
+	int i;
+
+	/* map the type */
+	if (g_strcmp0(dbus_type, "s") == 0)
+		*purple_type_out = PURPLE_PREF_STRING;
+ 	else if (g_strcmp0(dbus_type, "i") == 0 || g_strcmp0(dbus_type, "n") == 0 || g_strcmp0(dbus_type, "q") == 0)
+		*purple_type_out = PURPLE_PREF_INT;
+ 	else if (g_strcmp0(dbus_type, "b") == 0)
+		*purple_type_out = PURPLE_PREF_BOOLEAN;
+	else
+	{
+		purple_debug_warning("telepathy", "Unknown DBus signature \"%s\" for option \"%s\"\n",
+			dbus_type, telepathy_name);
+		return NULL;
+	}
+
+	/* check for a standard specification name */
+	for (i = 0; options[i].telepathy_name != NULL; ++i)
+	{
+		if (g_strcmp0(options[i].telepathy_name, telepathy_name) == 0 &&
+				g_strcmp0(options[i].dbus_type, dbus_type) == 0)
+			return g_strdup(_(options[i].human_name));
+	}
+
+	/* non-standard parameter, beatuify the name a bit */
+	return telepathy_transform_param_name(telepathy_name);
+}
+
+int
+get_int_value(const GValue *value,
+              const gchar *signature)
+{
+	if (g_strcmp0(signature, "q") == 0)
+		return g_value_get_uint(value);
+	else if (g_strcmp0(signature, "i") == 0 || g_strcmp0(signature, "n") == 0)
+		return g_value_get_int(value);
+	else
+		return 0;
+}
+
 /* TODO: Check for other types of statuses too */
 GValueArray *
 purple_status_to_telepathy_status(PurpleStatus *status)
============================================================
--- libpurple/protocols/telepathy/telepathy_utils.h	ed085d486bee3e27a16c926d8bb7db5c06a3893a
+++ libpurple/protocols/telepathy/telepathy_utils.h	052e4062ed259b3e72b0e393f6736ca6afc56dd7
@@ -79,6 +79,31 @@ static const StatusMapping statuses[] = 
 	{ 0, NULL, NULL}
 };
 
+/**
+ * Transforms a Telepathy option name to a human-readable format.
+ *
+ * @param telepathy_name  The original Telepathy name.
+ * @param dbus_type       The DBus type of the option.
+ * @param purple_type_out An output parameter containing the option type.
+ *
+ * @return The human-readable format of the option.
+ */
+/* TODO: Handle "as" types */
+gchar *
+get_human_name(const gchar *telepathy_name,
+               const gchar *dbus_type,
+               PurplePrefType *purple_type_out);
+
+/**
+ * Returns the integer value contained in a GValue.
+ *
+ * @param value     The GValue containing the integer.
+ * @param signature The DBus signature of the integer contained in value.
+ */
+int
+get_int_value(const GValue *value,
+              const gchar *signature);
+
 GValueArray *
 purple_status_to_telepathy_status(PurpleStatus *status);
 


More information about the Commits mailing list