diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c index 762aa034..8345d52f 100644 --- a/src/fe-common/core/fe-queries.c +++ b/src/fe-common/core/fe-queries.c @@ -194,23 +194,29 @@ static void cmd_window_server(const char *data) static void cmd_unquery(const char *data, SERVER_REC *server, WI_ITEM_REC *item) { QUERY_REC *query; + char *nick; + void *free_arg; g_return_if_fail(data != NULL); - if (*data == '\0') { + if (!cmd_get_params(data, &free_arg, 1, &nick)) + return; + + if (*nick == '\0') { /* remove current query */ query = QUERY(item); - if (query == NULL) return; } else { - query = query_find(server, data); + query = query_find(server, nick); if (query == NULL) { printformat(server, NULL, MSGLEVEL_CLIENTERROR, - TXT_NO_QUERY, data); - return; + TXT_NO_QUERY, nick); } } - query_destroy(query); + if (query != NULL) + query_destroy(query); + + cmd_params_free(free_arg); } /* SYNTAX: QUERY [-window] [-] [] */ diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index f3e56a90..a8f3bb10 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -280,6 +280,8 @@ static WINDOW_REC *window_highest_activity(WINDOW_REC *window) static void cmd_window_goto(const char *data) { WINDOW_REC *window; + char *target; + void *free_arg; g_return_if_fail(data != NULL); @@ -288,13 +290,18 @@ static void cmd_window_goto(const char *data) return; } - if (g_strcasecmp(data, "active") == 0) + if (!cmd_get_params(data, &free_arg, 1, &target)) + return; + + if (g_strcasecmp(target, "active") == 0) window = window_highest_activity(active_win); else - window = window_find_item(active_win->active_server, data); + window = window_find_item(active_win->active_server, target); if (window != NULL) window_set_active(window); + + cmd_params_free(free_arg); } /* SYNTAX: WINDOW NEXT */