summaryrefslogtreecommitdiff
path: root/src/remote-exec.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-10-19 17:32:46 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-10-19 17:32:46 +0000
commita04430bff79030690add518548677251816e3e71 (patch)
treecbc567bf9c2e6b44df87ab0b8f7c2889c5b5e0f3 /src/remote-exec.c
parentee516bb3b42f42a1880de7b943c0e17a97da48ae (diff)
issue 155
Diffstat (limited to 'src/remote-exec.c')
-rw-r--r--src/remote-exec.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/remote-exec.c b/src/remote-exec.c
index 75c1d10..d8041c7 100644
--- a/src/remote-exec.c
+++ b/src/remote-exec.c
@@ -22,6 +22,8 @@
#include <json-glib/json-glib.h>
#include "trg-torrent-model.h"
+#include "trg-client.h"
+#include "trg-prefs.h"
#include "protocol-constants.h"
#include "torrent.h"
@@ -81,15 +83,19 @@ static gchar *dump_json_value(JsonNode * node) {
return g_string_free(buffer, FALSE);
}
-gchar *build_remote_exec_cmd(TrgPrefs *prefs, GtkTreeModel *model, GList *selection,
+gchar *build_remote_exec_cmd(TrgClient *tc, GtkTreeModel *model, GList *selection,
const gchar * input) {
- JsonObject *profile = trg_prefs_get_profile(prefs);
- gchar *work = g_strdup(input);
+ JsonObject *profile = trg_client_get_current_profile(tc);
+ gchar *work;
GRegex *regex, *replacerx;
GMatchInfo *match_info;
gchar *whole, *wholeEscaped, *id, *tmp, *valuestr, *repeater;
JsonNode *replacement;
+ if (!profile)
+ return NULL;
+
+ work = g_strdup(input);
regex = g_regex_new("%{([A-Za-z\\-]+)}(?:\\[(.*)\\])?", 0, 0, NULL);
g_regex_match_full(regex, input, -1, 0, 0, &match_info, NULL);