summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-07-01 14:53:47 -0400
committerTingPing <tngpng@gmail.com>2013-07-01 14:53:47 -0400
commit82277a80eae4e300935a6e90f053a5b22fac5850 (patch)
tree4a45f3082c9c81787f6f0506960675b4f533f7c7 /src/common
parent22064278df9adc4368ebef876fbfae805b158b35 (diff)
Fix urls with --existing
Diffstat (limited to 'src/common')
-rw-r--r--src/common/dbus/dbus-client.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/common/dbus/dbus-client.c b/src/common/dbus/dbus-client.c
index a30a75bd..6678a167 100644
--- a/src/common/dbus/dbus-client.c
+++ b/src/common/dbus/dbus-client.c
@@ -53,6 +53,7 @@ hexchat_remote (void)
 	gboolean hexchat_running;
 	GError *error = NULL;
 	char *command = NULL;
+	int i;
 
 	/* GnomeVFS >=2.15 uses D-Bus and threads, so threads should be
 	 * initialised before opening for the first time a D-Bus connection */
@@ -62,7 +63,7 @@ hexchat_remote (void)
 	dbus_g_thread_init ();
 
 	/* if there is nothing to do, return now. */
-	if (!arg_existing || !(arg_url || arg_command)) {
+	if (!arg_existing || !(arg_url || arg_urls || arg_command)) {
 		return;
 	}
 
@@ -114,6 +115,22 @@ hexchat_remote (void)
 		}
 		g_free (command);
 	}
+	
+	if (arg_urls)
+	{
+		for (i = 0; i < g_strv_length(arg_urls); i++)
+		{
+			command = g_strdup_printf ("newserver %s", arg_urls[i]);
+			if (!dbus_g_proxy_call (remote_object, "Command",
+					&error,
+					G_TYPE_STRING, command,
+					G_TYPE_INVALID, G_TYPE_INVALID)) {
+				write_error (_("Failed to complete Command"), &error);
+			}
+			g_free (command);
+		}
+		g_strfreev (arg_urls);
+	} 	
 
 	exit (0);
 }