From bfc0ad977d89e31d0c08ea033ec055d21b84380f Mon Sep 17 00:00:00 2001 From: Tomatix Date: Fri, 29 Dec 2023 16:57:28 +0100 Subject: [PATCH] #2 Changed usage of /CTCP to the new parameter order --- Essentials.iis | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/Essentials.iis b/Essentials.iis index edd6749..d88d809 100644 --- a/Essentials.iis +++ b/Essentials.iis @@ -49,7 +49,7 @@ hook ctcprequest(sender, target, command, message) if (command == "TIME" && response_CTCP_TIME) { t = now("yyyy/MM/dd hh:mm:ss t"); - /ctcpreply %sender TIME %t + /ctcpreply TIME %sender %t } } @@ -88,15 +88,21 @@ menu private { "Whois" => /whois %nickname divide "CTCP" { - "Ping" => /ctcp %nickname PING - "Version" => /ctcp %nickname VERSION - "Time" => /ctcp %nickname TIME + "Ping" => /ctcp PING %nickname + "Version" => /ctcp VERSION %nickname + "Time" => /ctcp TIME %nickname divide "Custom..." => { msg = input("Custom CTCP message", "Message:"); if (msg == void) return; if (msg == "") return; - /ctcp %nickname %msg + sidx = strfind(msg, " "); + if (sidx < 0) /ctcp %msg %nickname + else { + command = strmid(msg, 0, sidx); + message = strmid(msg, sidx + 1, strlen(msg) - strlen(command) - 1); + /ctcp %command %nickname %message + } } } } @@ -235,7 +241,7 @@ menu memberlist { i = 0; while (selected[i] != void) { nick = selected[i]; - /ctcp %nick PING + /ctcp PING %nick i = i + 1; } } @@ -251,7 +257,7 @@ menu memberlist { i = 0; while (selected[i] != void) { nick = selected[i]; - /ctcp %nick VERSION + /ctcp VERSION %nick i = i + 1; } } @@ -267,7 +273,7 @@ menu memberlist { i = 0; while (selected[i] != void) { nick = selected[i]; - /ctcp %nick TIME + /ctcp TIME %nick i = i + 1; } } @@ -284,10 +290,22 @@ menu memberlist { } msg = input("Custom CTCP message", "Message:"); if (msg == void || msg == "") return; + + command = ""; + message = ""; + sidx = strfind(msg, " "); + if (sidx < 0) { + command = msg; + } + else { + command = strmid(msg, 0, sidx); + message = strmid(msg, sidx + 1, strlen(msg) - strlen(command) - 1); + } + i = 0; while (selected[i] != void) { nick = selected[i]; - /ctcp %nick %msg + /ctcp %command %nick %message i = i + 1; } }