From 5a91e0b1d89a47d9d6200861d5191c40e254fd37 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 25 May 2016 23:41:34 +1000 Subject: [PATCH] Add /SCANB command to scan for users on the userlist with the BOT flag This is analagous to the /SCANF command that scans for friends etc. --- Changelog | 2 ++ source/commands.c | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 07a0a21..d844374 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2.2] +* Add /SCANB command to scan for users on the userlist with the BOT flag. (caf) + * Wire up /FSET WHOIS_BOT for users on the userlist with the BOT flag. (caf) * Use /FSET RELSN to format /RELSN relayed messages instead of diff --git a/source/commands.c b/source/commands.c index 0011e1b..0790a79 100644 --- a/source/commands.c +++ b/source/commands.c @@ -590,6 +590,7 @@ IrcCommand irc_command[] = { "SAY", empty_string, do_send_text, 0, "-%Y<%ntype%Y>%n Says whatever you write" }, { "SC", "NAMES", do_mynames, 0, NULL }, { "SCAN", "scan", do_scan, 0, "%R[%Bchannel%R]%n\n- Scans %R[%Bchannel%R]%n or current channel for all nicks" }, + { "SCANB", "ScanB", do_scan, 0, "%R[%Bchannel%R]%n\n- Scans %R[%Bchannel%R]%n or current channel for bots" }, { "SCANF", "ScanF", do_scan, 0, "%R[%Bchannel%R]%n\n- Scans %R[%Bchannel%R]%n or current channel for friends" }, { "SCANI", "ScanI", do_scan, 0, "%R[%Bchannel%R]%n\n- Scans %R[%Bchannel%R]%n or current channel for ircops" }, { "SCANN", "ScanN", do_scan, 0, "%R[%Bchannel%R]%n\n- Scans %R[%Bchannel%R]%n or current channel for non-ops" }, @@ -1321,7 +1322,7 @@ int server = from_server; enum SCAN_TYPE { SCAN_ALL, SCAN_VOICES, SCAN_CHANOPS, SCAN_NONOPS, SCAN_IRCOPS, - SCAN_FRIENDS, SCAN_SHITLISTED + SCAN_FRIENDS, SCAN_SHITLISTED, SCAN_BOTS }; /* nick_in_scan @@ -1357,6 +1358,10 @@ int nick_in_scan(NickList *nick, enum SCAN_TYPE scan_type, char *mask) if (!nick->shitlist) return 0; break; + case SCAN_BOTS: + if (!nick->userlist || !(nick->userlist->flags & ADD_BOT)) return 0; + break; + case SCAN_ALL: default: break; @@ -1401,6 +1406,8 @@ BUILT_IN_COMMAND(do_scan) scan_type = SCAN_SHITLISTED; else if (!my_stricmp(command, "scani")) scan_type = SCAN_IRCOPS; + else if (!my_stricmp(command, "scanb")) + scan_type = SCAN_BOTS; } while ((s = next_arg(args, &args))) @@ -1461,6 +1468,11 @@ BUILT_IN_COMMAND(do_scan) case 'I': scan_type = SCAN_IRCOPS; break; + + case 'b': + case 'B': + scan_type = SCAN_BOTS; + break; } continue; @@ -1515,6 +1527,10 @@ BUILT_IN_COMMAND(do_scan) s = fget_string_var(FORMAT_NAMES_SHIT_FSET); break; + case SCAN_BOTS: + s = fget_string_var(FORMAT_NAMES_BOT_FSET); + break; + case SCAN_ALL: default: s = fget_string_var(FORMAT_NAMES_FSET);