about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-08-13 23:53:41 +0100
committerJames Booth <boothj5@gmail.com>2016-08-13 23:53:41 +0100
commit9c4e02db77fd3333c038c46ffa7a40ed9e33b949 (patch)
tree296037e2a089694b76e9899475c65e06266486fc
parente776ef9b6864f5cb4aeec518d9336d6a46298ff9 (diff)
downloadprofani-tty-9c4e02db77fd3333c038c46ffa7a40ed9e33b949.tar.gz
Move caps static functions
-rw-r--r--src/xmpp/capabilities.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index 4cf97336..d64c79a0 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -201,65 +201,6 @@ caps_cache_contains(const char *const ver)
     return (g_key_file_has_group(cache, ver));
 }
 
-static EntityCapabilities*
-_caps_by_ver(const char *const ver)
-{
-    if (g_key_file_has_group(cache, ver)) {
-        EntityCapabilities *new_caps = malloc(sizeof(struct entity_capabilities_t));
-
-        char *category = g_key_file_get_string(cache, ver, "category", NULL);
-        char *type = g_key_file_get_string(cache, ver, "type", NULL);
-        char *name = g_key_file_get_string(cache, ver, "name", NULL);
-        if (category || type || name) {
-            DiscoIdentity *identity = malloc(sizeof(struct disco_identity_t));
-            identity->category = category;
-            identity->type = type;
-            identity->name = name;
-            new_caps->identity = identity;
-        } else {
-            new_caps->identity = NULL;
-        }
-
-        char *software = g_key_file_get_string(cache, ver, "software", NULL);
-        char *software_version = g_key_file_get_string(cache, ver, "software_version", NULL);
-        char *os = g_key_file_get_string(cache, ver, "os", NULL);
-        char *os_version = g_key_file_get_string(cache, ver, "os_version", NULL);
-        if (software || software_version || os || os_version) {
-            SoftwareVersion *software_versionp = malloc(sizeof(struct software_version_t));
-            software_versionp->software = software;
-            software_versionp->software_version = software_version;
-            software_versionp->os = os;
-            software_versionp->os_version = os_version;
-            new_caps->software_version = software_versionp;
-        } else {
-            new_caps->software_version = NULL;
-        }
-
-        gsize features_len = 0;
-        gchar **features = g_key_file_get_string_list(cache, ver, "features", &features_len, NULL);
-        if (features && features_len > 0) {
-            GSList *features_list = NULL;
-            int i;
-            for (i = 0; i < features_len; i++) {
-                features_list = g_slist_append(features_list, strdup(features[i]));
-            }
-            new_caps->features = features_list;
-            g_strfreev(features);
-        } else {
-            new_caps->features = NULL;
-        }
-        return new_caps;
-    } else {
-        return NULL;
-    }
-}
-
-static EntityCapabilities*
-_caps_by_jid(const char *const jid)
-{
-    return g_hash_table_lookup(jid_to_caps, jid);
-}
-
 EntityCapabilities*
 caps_lookup(const char *const jid)
 {
@@ -591,6 +532,65 @@ caps_close(void)
     prof_features = NULL;
 }
 
+static EntityCapabilities*
+_caps_by_ver(const char *const ver)
+{
+    if (!g_key_file_has_group(cache, ver)) {
+        return NULL;
+    }
+
+    EntityCapabilities *new_caps = malloc(sizeof(struct entity_capabilities_t));
+
+    char *category = g_key_file_get_string(cache, ver, "category", NULL);
+    char *type = g_key_file_get_string(cache, ver, "type", NULL);
+    char *name = g_key_file_get_string(cache, ver, "name", NULL);
+    if (category || type || name) {
+        DiscoIdentity *identity = malloc(sizeof(struct disco_identity_t));
+        identity->category = category;
+        identity->type = type;
+        identity->name = name;
+        new_caps->identity = identity;
+    } else {
+        new_caps->identity = NULL;
+    }
+
+    char *software = g_key_file_get_string(cache, ver, "software", NULL);
+    char *software_version = g_key_file_get_string(cache, ver, "software_version", NULL);
+    char *os = g_key_file_get_string(cache, ver, "os", NULL);
+    char *os_version = g_key_file_get_string(cache, ver, "os_version", NULL);
+    if (software || software_version || os || os_version) {
+        SoftwareVersion *software_versionp = malloc(sizeof(struct software_version_t));
+        software_versionp->software = software;
+        software_versionp->software_version = software_version;
+        software_versionp->os = os;
+        software_versionp->os_version = os_version;
+        new_caps->software_version = software_versionp;
+    } else {
+        new_caps->software_version = NULL;
+    }
+
+    gsize features_len = 0;
+    gchar **features = g_key_file_get_string_list(cache, ver, "features", &features_len, NULL);
+    if (features && features_len > 0) {
+        GSList *features_list = NULL;
+        int i;
+        for (i = 0; i < features_len; i++) {
+            features_list = g_slist_append(features_list, strdup(features[i]));
+        }
+        new_caps->features = features_list;
+        g_strfreev(features);
+    } else {
+        new_caps->features = NULL;
+    }
+    return new_caps;
+}
+
+static EntityCapabilities*
+_caps_by_jid(const char *const jid)
+{
+    return g_hash_table_lookup(jid_to_caps, jid);
+}
+
 static void
 _disco_identity_destroy(DiscoIdentity *disco_identity)
 {