Add /query

master
C. McEnroe 2020-02-08 01:34:55 -05:00
parent f5783d15c6
commit 5c10fe0d41
2 changed files with 11 additions and 0 deletions

View File

@ -136,6 +136,8 @@ Change nicknames.
Send a notice. Send a notice.
.It Ic /part Op Ar message .It Ic /part Op Ar message
Leave the channel. Leave the channel.
.It Ic /query Ar nick
Start a private conversation.
.It Ic /quit Op Ar message .It Ic /quit Op Ar message
Quit IRC. Quit IRC.
.It Ic /quote Ar command .It Ic /quote Ar command

View File

@ -83,6 +83,13 @@ static void commandNick(size_t id, char *params) {
ircFormat("NICK :%s\r\n", params); ircFormat("NICK :%s\r\n", params);
} }
static void commandQuery(size_t id, char *params) {
if (!params) return;
size_t query = idFor(params);
idColors[query] = completeColor(id, params);
uiShowID(query);
}
static void commandWindow(size_t id, char *params) { static void commandWindow(size_t id, char *params) {
if (!params) return; if (!params) return;
if (isdigit(params[0])) { if (isdigit(params[0])) {
@ -102,6 +109,7 @@ static const struct Handler {
{ "/nick", commandNick }, { "/nick", commandNick },
{ "/notice", commandNotice }, { "/notice", commandNotice },
{ "/part", commandPart }, { "/part", commandPart },
{ "/query", commandQuery },
{ "/quit", commandQuit }, { "/quit", commandQuit },
{ "/quote", commandQuote }, { "/quote", commandQuote },
{ "/window", commandWindow }, { "/window", commandWindow },
@ -151,6 +159,7 @@ void command(size_t id, char *input) {
cmd, Commands, ARRAY_LEN(Commands), sizeof(*handler), compar cmd, Commands, ARRAY_LEN(Commands), sizeof(*handler), compar
); );
if (handler) { if (handler) {
if (input && !input[0]) input = NULL;
handler->fn(id, input); handler->fn(id, input);
} else { } else {
uiFormat(id, Hot, NULL, "No such command %s", cmd); uiFormat(id, Hot, NULL, "No such command %s", cmd);