Fix urls with --existing

This commit is contained in:
TingPing 2013-07-01 14:53:47 -04:00
parent 22064278df
commit 82277a80ea
1 changed files with 18 additions and 1 deletions

View File

@ -53,6 +53,7 @@ hexchat_remote (void)
gboolean hexchat_running; gboolean hexchat_running;
GError *error = NULL; GError *error = NULL;
char *command = NULL; char *command = NULL;
int i;
/* GnomeVFS >=2.15 uses D-Bus and threads, so threads should be /* GnomeVFS >=2.15 uses D-Bus and threads, so threads should be
* initialised before opening for the first time a D-Bus connection */ * initialised before opening for the first time a D-Bus connection */
@ -62,7 +63,7 @@ hexchat_remote (void)
dbus_g_thread_init (); dbus_g_thread_init ();
/* if there is nothing to do, return now. */ /* 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; return;
} }
@ -115,5 +116,21 @@ hexchat_remote (void)
g_free (command); 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); exit (0);
} }