Add "dnrsearch count" action.
authorMichael Poole <mdpoole@troilus.org>
Sat, 31 Mar 2007 17:24:56 +0000 (13:24 -0400)
committerMichael Poole <mdpoole@troilus.org>
Sat, 31 Mar 2007 17:24:56 +0000 (13:24 -0400)
src/chanserv.c (dnr_count_func): New function.
  (cmd_dnrsearch): Recognize it.
  (init_chanserv): Register it.

src/chanserv.help (DNRSEARCH ACTION): Document it.

src/chanserv.c
src/chanserv.help

index f80e81cd1273fecd8cc8d2c7aa7e3710081eb0e7..d9cfea21e92d79900ee38f7c9fb4cde86fb65945 100644 (file)
@@ -1918,6 +1918,12 @@ dnr_remove_func(struct do_not_register *match, void *extra)
     return 0;
 }
 
+static int
+dnr_count_func(struct do_not_register *match, void *extra)
+{
+    return 0; (void)match; (void)extra;
+}
+
 static MODCMD_FUNC(cmd_dnrsearch)
 {
     struct dnr_search *discrim;
@@ -1939,6 +1945,8 @@ static MODCMD_FUNC(cmd_dnrsearch)
         action = dnr_print_func;
     else if(!irccasecmp(argv[1], "remove"))
         action = dnr_remove_func;
+    else if(!irccasecmp(argv[1], "count"))
+        action = dnr_count_func;
     else
     {
         reply("CSMSG_DNR_BAD_ACTION", argv[1]);
@@ -7669,6 +7677,7 @@ init_chanserv(const char *nick)
     DEFINE_COMMAND(dnrsearch, 3, 0, "template", "noregister", NULL);
     modcmd_register(chanserv_module, "dnrsearch print", NULL, 0, 0, NULL);
     modcmd_register(chanserv_module, "dnrsearch remove", NULL, 0, 0, NULL);
+    modcmd_register(chanserv_module, "dnrsearch count", NULL, 0, 0, NULL);
     DEFINE_COMMAND(move, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "template", "register", NULL);
     DEFINE_COMMAND(csuspend, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "flags", "+helping", NULL);
     DEFINE_COMMAND(cunsuspend, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "flags", "+helping", NULL);
index 6d4191f0fa5383688e2ada289c5e4de25b626ea6..44e2d260e20f2239f0f54bb1aa51af6464f00ea8 100644 (file)
        "Options for the action in $bdnrsearch$b are:",
         "$bPRINT: $b      Display the do-not-register entry.",
         "$bREMOVE:$b      Remove the do-not-register entry.",
+        "$bCOUNT: $b      Count the number of matching do-not-register entries.",
         "$uSee Also:$u dnrsearch, dnrsearch criteria");
 "DNRSEARCH CRITERIA" ("$bDNRSEARCH CRITERIA$b",
         "Options for the criteria in $bdnrsearch$b are:",