diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/dbus/dbus-client.c | 19 | ||||
-rw-r--r-- | src/common/hexchat.c | 23 | ||||
-rw-r--r-- | src/common/hexchatc.h | 1 | ||||
-rw-r--r-- | src/fe-gtk/fe-gtk.c | 15 | ||||
-rw-r--r-- | src/fe-text/fe-text.c | 3 |
5 files changed, 53 insertions, 8 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); } diff --git a/src/common/hexchat.c b/src/common/hexchat.c index aece9ff3..17309dee 100644 --- a/src/common/hexchat.c +++ b/src/common/hexchat.c @@ -105,6 +105,7 @@ int hexchat_is_quitting = FALSE; int arg_dont_autoconnect = FALSE; int arg_skip_plugins = FALSE; char *arg_url = NULL; +char **arg_urls = NULL; char *arg_command = NULL; gint arg_existing = FALSE; @@ -400,6 +401,7 @@ irc_init (session *sess) { static int done_init = FALSE; char *buf; + int i; if (done_init) return; @@ -431,6 +433,17 @@ irc_init (session *sess) handle_command (sess, buf, FALSE); g_free (buf); } + + if (arg_urls != NULL) + { + for (i = 0; i < g_strv_length(arg_urls); i++) + { + buf = g_strdup_printf ("%s %s", i==0? "server" : "newserver", arg_urls[i]); + handle_command (sess, buf, FALSE); + g_free (buf); + } + g_strfreev (arg_urls); + } if (arg_command != NULL) { @@ -924,17 +937,17 @@ xchat_init (void) servlist_init (); /* load server list */ /* if we got a URL, don't open the server list GUI */ - if (!prefs.hex_gui_slist_skip && !arg_url) + if (!prefs.hex_gui_slist_skip && !arg_url && !arg_urls) fe_serverlist_open (NULL); - /* turned OFF via -a arg */ - if (!arg_dont_autoconnect) + /* turned OFF via -a arg or by passing urls */ + if (!arg_dont_autoconnect && !arg_urls) { /* do any auto connects */ if (!servlist_have_auto ()) /* if no new windows open .. */ { /* and no serverlist gui ... */ - if (prefs.hex_gui_slist_skip || arg_url) + if (prefs.hex_gui_slist_skip || arg_url || arg_urls) /* we'll have to open one. */ new_ircwindow (NULL, NULL, SESS_SERVER, 0); } else @@ -943,7 +956,7 @@ xchat_init (void) } } else { - if (prefs.hex_gui_slist_skip || arg_url) + if (prefs.hex_gui_slist_skip || arg_url || arg_urls) new_ircwindow (NULL, NULL, SESS_SERVER, 0); } } diff --git a/src/common/hexchatc.h b/src/common/hexchatc.h index 774f4dd9..a999dcf2 100644 --- a/src/common/hexchatc.h +++ b/src/common/hexchatc.h @@ -26,6 +26,7 @@ extern int hexchat_is_quitting; extern gint arg_skip_plugins; /* command-line args */ extern gint arg_dont_autoconnect; extern char *arg_url; +extern char **arg_urls; extern char *arg_command; extern gint arg_existing; diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 6890286f..9793d917 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -124,13 +124,14 @@ static const GOptionEntry gopt_entries[] = {"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL}, {"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL}, {"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL}, - {"url", 0, 0, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel?key URL"), "URL"}, + {"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel?key URL"), "URL"}, #ifndef WIN32 /* uses DBUS */ {"command", 'c', 0, G_OPTION_ARG_STRING, &arg_command, N_("Execute command:"), "COMMAND"}, {"existing", 'e', 0, G_OPTION_ARG_NONE, &arg_existing, N_("Open URL or execute command in an existing HexChat"), NULL}, #endif {"minimize", 0, 0, G_OPTION_ARG_INT, &arg_minimize, N_("Begin minimized. Level 0=Normal 1=Iconified 2=Tray"), N_("level")}, {"version", 'v', 0, G_OPTION_ARG_NONE, &arg_show_version, N_("Show version information"), NULL}, + {G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &arg_urls, N_("Open an irc://server:port/channel?key URL"), "URL"}, {NULL} }; @@ -217,10 +218,14 @@ fe_args (int argc, char *argv[]) if (arg_show_version) { +#ifdef WIN32 buffer = g_strdup_printf (DISPLAY_NAME " " PACKAGE_VERSION "\n"); gtk_init (&argc, &argv); create_msg_dialog ("Version Information", buffer); g_free (buffer); +#else + printf (PACKAGE_NAME" "PACKAGE_VERSION"\n"); +#endif return 0; } @@ -228,8 +233,12 @@ fe_args (int argc, char *argv[]) if (arg_show_autoload) { buffer = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "addons\n", get_xdir ()); +#ifdef WIN32 gtk_init (&argc, &argv); create_msg_dialog ("Plugin/Script Auto-load Directory", buffer); +#else + printf (buffer); +#endif g_free (buffer); return 0; @@ -238,8 +247,12 @@ fe_args (int argc, char *argv[]) if (arg_show_config) { buffer = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "\n", get_xdir ()); +#ifdef WIN32 gtk_init (&argc, &argv); create_msg_dialog ("User Config Directory", buffer); +#else + printf (buffer); +#endif g_free (buffer); return 0; diff --git a/src/fe-text/fe-text.c b/src/fe-text/fe-text.c index 91aa1f0c..f5454dd2 100644 --- a/src/fe-text/fe-text.c +++ b/src/fe-text/fe-text.c @@ -465,8 +465,9 @@ static const GOptionEntry gopt_entries[] = {"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL}, {"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL}, {"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL}, - {"url", 0, 0, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel URL"), "URL"}, + {"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel URL"), "URL"}, {"version", 'v', 0, G_OPTION_ARG_NONE, &arg_show_version, N_("Show version information"), NULL}, + {G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &arg_urls, N_("Open an irc://server:port/channel?key URL"), "URL"}, {NULL} }; |