From 070688006ac7cea1639f38c0bb270c191f7dc38f Mon Sep 17 00:00:00 2001 From: Alan Fitton Date: Fri, 8 Apr 2011 14:24:25 +0000 Subject: a torrent add dialog based off Transmission GTK (different bencode+action implementation) which allows you to set file priorities, torrent priority, directory in advance. probably needs a little more work. --- src/util.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 6cb6e11..cd7e9f2 100644 --- a/src/util.c +++ b/src/util.c @@ -35,6 +35,24 @@ #include "util.h" #include "dispatch.h" +void add_file_id_to_array(JsonObject * args, gchar * key, gint index) +{ + JsonArray *array; + if (json_object_has_member(args, key)) { + array = json_object_get_array_member(args, key); + } else { + array = json_array_new(); + json_object_set_array_member(args, key, array); + } + json_array_add_int_element(array, index); +} + +void g_str_slist_free(GSList * list) +{ + g_slist_foreach( list, (GFunc)g_free, NULL ); + g_slist_free(list); +} + GRegex *trg_uri_host_regex_new(void) { return g_regex_new("^[^:/?#]+:?//([^/?#]*)", G_REGEX_OPTIMIZE, 0, -- cgit v1.2.3