From d0c680d67eaf658c4d06c1049d1634848b102af6 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Tue, 18 Jul 2006 02:48:32 +0000 Subject: [PATCH] Make !bans searching more flexible src/chanserv.c (cmd_bans): Allow specifying a complete hostmask or a nickname when searching bans. src/chanserv.help (BANS): Document the searching functions. git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-19 --- ChangeLog | 16 ++++++++++++++++ src/chanserv.c | 26 ++++++++++++++++++++------ src/chanserv.help | 7 +++++-- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfeb905..922686c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,22 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3 # +2006-07-18 02:48:32 GMT Michael Poole patch-19 + + Summary: + Make !bans searching more flexible + Revision: + srvx--devo--1.3--patch-19 + + src/chanserv.c (cmd_bans): Allow specifying a complete hostmask or a + nickname when searching bans. + + src/chanserv.help (BANS): Document the searching functions. + + modified files: + ChangeLog src/chanserv.c src/chanserv.help + + 2006-07-18 01:49:56 GMT Michael Poole patch-18 Summary: diff --git a/src/chanserv.c b/src/chanserv.c index bf6e378..0857d92 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -3592,23 +3592,37 @@ static CHANSERV_FUNC(cmd_plist) static CHANSERV_FUNC(cmd_bans) { + struct userNode *search_u = NULL; struct helpfile_table tbl; - unsigned int matches = 0, timed = 0, ii; + unsigned int matches = 0, timed = 0, search_wilds = 0, ii; char t_buffer[INTERVALLEN], e_buffer[INTERVALLEN], *search; const char *msg_never, *triggered, *expires; struct banData *ban, **bans; - if(argc > 1) - search = argv[1]; - else + if(argc < 2) search = NULL; + else if(strchr(search = argv[1], '!')) + { + search = argv[1]; + search_wilds = search[strcspn(search, "?*")]; + } + else if(!(search_u = GetUserH(search))) + reply("MSG_NICK_UNKNOWN", search); bans = alloca(channel->channel_info->banCount * sizeof(struct banData *)); for(ban = channel->channel_info->bans; ban; ban = ban->next) { - if(search && !match_ircglobs(search, ban->mask)) - continue; + if(search_u) + { + if(!user_matches_glob(search_u, ban->mask, MATCH_USENICK | MATCH_VISIBLE)) + continue; + } + else if(search) + { + if(search_wilds ? !match_ircglobs(search, ban->mask) : !match_ircglob(search, ban->mask)) + continue; + } bans[matches++] = ban; if(ban->expires) timed = 1; diff --git a/src/chanserv.help b/src/chanserv.help index 44a7937..1ace0a9 100644 --- a/src/chanserv.help +++ b/src/chanserv.help @@ -56,7 +56,7 @@ " CLIST coowners of a channel.", " MLIST masters of a channel.", " OLIST ops of a channel.", - " PLIST peons of a channel.", + " PLIST peons of a channel.", " BANS List all the bans for a channel.", " TOPIC Set the current topic, or reset it to the default topic.", " MODE Change a channel mode.", @@ -130,8 +130,11 @@ "$uFor assistance, please join to #support$u", "Example: *!*serv@*.gamesurge.net would ban anyone with ident 'serv' and a gamesurge.net hostname from joining the channel.", "$uSee Also:$u unban, unbanall, unbanme"); -"BANS" ("/msg $C BANS <#channel>", +"BANS" ("/msg $C BANS <#channel> [mask|nick]", "This command lists all permanent and timed bans in the channel.", + "If a nickname is specified, lists any bans that visibly match that user.", + "If a hostmask with no wildcards is specified, lists any bans that match that hostmask.", + "If a hostmask with wildcards is specified, lists any bans included in that mask.", "$uSee Also:$u addban, delban, mdelban"); "CLIST" ("/msg $C CLIST <#channel> [mask]", "This command lists all users of level $bCoowner$b on a channel's userlist. If a mask is supplied, only coowners matching the mask will be shown.", -- 2.20.1