From 735096d76d218776dde024c7aa4c48c0eef90d5c Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 22 May 2021 19:38:20 +0200 Subject: degesch: add a /squery command for IRCnet --- NEWS | 5 +++++ degesch.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/NEWS b/NEWS index 34dbe8d..4b79444 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +1.2.0 (202?-??-??) "There Are Other Countries As Well" + + * degesch: added a /squery command for IRCnet + + 1.1.0 (2020-10-31) "What Do You Mean By 'This Isn't Germany'?" * degesch: made fancy-prompt.lua work with libedit diff --git a/degesch.c b/degesch.c index 09ea823..cbc13da 100644 --- a/degesch.c +++ b/degesch.c @@ -11249,6 +11249,20 @@ handle_command_notice (struct handler_args *a) return true; } +static bool +handle_command_squery (struct handler_args *a) +{ + if (!*a->arguments) + return false; + + char *target = cut_word (&a->arguments); + if (!*a->arguments) + log_server_error (a->s, a->s->buffer, "No text to send"); + else + irc_send (a->s, "SQUERY %s :%s", target, a->arguments); + return true; +} + static bool handle_command_ctcp (struct handler_args *a) { @@ -11864,6 +11878,9 @@ g_command_handlers[] = { "notice", "Send notice to a nick or channel", " ", handle_command_notice, HANDLER_SERVER | HANDLER_NEEDS_REG }, + { "squery", "Send a message to a service", + " ", + handle_command_squery, HANDLER_SERVER | HANDLER_NEEDS_REG }, { "ctcp", "Send a CTCP query", " ", handle_command_ctcp, HANDLER_SERVER | HANDLER_NEEDS_REG }, -- cgit v1.2.3-70-g09d2