# arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
#
+2006-07-18 02:48:32 GMT Michael Poole <mdpoole@troilus.org> 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 <mdpoole@troilus.org> patch-18
Summary:
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;
" 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.",
"$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.",