1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

/UNQUERY and /WINDOW GOTO now ignores trailing whitespace

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2942 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-10-14 11:39:36 +00:00 committed by cras
parent 7d5ee9db1f
commit 7c11b314eb
2 changed files with 21 additions and 8 deletions

View File

@ -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) static void cmd_unquery(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
{ {
QUERY_REC *query; QUERY_REC *query;
char *nick;
void *free_arg;
g_return_if_fail(data != NULL); 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 */ /* remove current query */
query = QUERY(item); query = QUERY(item);
if (query == NULL) return;
} else { } else {
query = query_find(server, data); query = query_find(server, nick);
if (query == NULL) { if (query == NULL) {
printformat(server, NULL, MSGLEVEL_CLIENTERROR, printformat(server, NULL, MSGLEVEL_CLIENTERROR,
TXT_NO_QUERY, data); TXT_NO_QUERY, nick);
return;
} }
} }
query_destroy(query); if (query != NULL)
query_destroy(query);
cmd_params_free(free_arg);
} }
/* SYNTAX: QUERY [-window] [-<server tag>] <nick> [<message>] */ /* SYNTAX: QUERY [-window] [-<server tag>] <nick> [<message>] */

View File

@ -280,6 +280,8 @@ static WINDOW_REC *window_highest_activity(WINDOW_REC *window)
static void cmd_window_goto(const char *data) static void cmd_window_goto(const char *data)
{ {
WINDOW_REC *window; WINDOW_REC *window;
char *target;
void *free_arg;
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
@ -288,13 +290,18 @@ static void cmd_window_goto(const char *data)
return; 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); window = window_highest_activity(active_win);
else else
window = window_find_item(active_win->active_server, data); window = window_find_item(active_win->active_server, target);
if (window != NULL) if (window != NULL)
window_set_active(window); window_set_active(window);
cmd_params_free(free_arg);
} }
/* SYNTAX: WINDOW NEXT */ /* SYNTAX: WINDOW NEXT */