summaryrefslogtreecommitdiff
path: root/src/requests.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-16 23:41:56 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-16 23:41:56 +0000
commit2743f8edc3b22deb7a5cd34760faef137fbf4fdc (patch)
tree5ab296a8f08945d24c364a9e99f3aa6299db56f7 /src/requests.c
parent2515c70aec58814f32fc7e22ab9dfa90fcd934e6 (diff)
updating a torrents file or trackers doesn't make it recently active, so these changes could get missed if doing active only updates. for these: send the torrent id as the request tag, which Transmission passes back, then we request an update just for that torrent.
Diffstat (limited to 'src/requests.c')
-rw-r--r--src/requests.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/requests.c b/src/requests.c
index a891364..ba761f9 100644
--- a/src/requests.c
+++ b/src/requests.c
@@ -110,15 +110,20 @@ JsonNode *torrent_remove(JsonArray * array, gboolean removeData)
return root;
}
-JsonNode *torrent_get(gboolean recent)
+JsonNode *torrent_get(gint64 id)
{
JsonNode *root = base_request(METHOD_TORRENT_GET);
JsonObject *args = node_get_arguments(root);
JsonArray *fields = json_array_new();
- if (recent)
+ if (id == -2) {
json_object_set_string_member(args, PARAM_IDS,
FIELD_RECENTLY_ACTIVE);
+ } else if (id >= 0) {
+ JsonArray *ids = json_array_new();
+ json_array_add_int_element(ids, id);
+ json_object_set_array_member(args, PARAM_IDS, ids);
+ }
json_array_add_string_element(fields, FIELD_ETA);
json_array_add_string_element(fields, FIELD_PEERS);
@@ -192,3 +197,8 @@ static JsonNode *base_request(gchar * method)
json_node_take_object(root, object);
return root;
}
+
+void request_set_tag(JsonNode * req, gint64 tag)
+{
+ json_object_set_int_member(json_node_get_object(req), PARAM_TAG, tag);
+}