Implement tracker item #1031606(relating to wildcards in /list).
[ircu2.10.12-pk.git] / ircd / hash.c
index aaf017bba75e9cbe4e2c12cc6cdb91fa6322d839..2b6c3a5c09d68653df26a37059c113664c0a2e6b 100644 (file)
@@ -26,6 +26,7 @@
 #include "channel.h"
 #include "ircd_alloc.h"
 #include "ircd_chattr.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "ircd.h"
@@ -36,7 +37,7 @@
 #include "struct.h"
 #include "sys.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
@@ -107,7 +108,7 @@ static HASHREGS strhash(const char *n)
  * I avoided introducing new variables to do the work myself and I did let
  * the optimizer play with more free registers, actual tests proved this
  * solution to be faster than doing things like tmp2=tmp->hnext... and then
- * use tmp2 myself wich would have given less freedom to the optimizer.
+ * use tmp2 myself which would have given less freedom to the optimizer.
  */
 
 /** Prepend a client to the appropriate hash bucket.
@@ -407,6 +408,20 @@ void clearNickJupes(void)
     jupeTable[i][0] = '\000';
 }
 
+/** Report all nick jupes to a user.
+ * @param[in] to Client requesting statistics.
+ * @param[in] sd Stats descriptor for request (ignored).
+ * @param[in] param Extra parameter from user (ignored).
+ */
+void
+stats_nickjupes(struct Client* to, const struct StatDesc* sd, char* param)
+{
+  int i;
+  for (i = 0; i < JUPEHASHSIZE; i++)
+    if (jupeTable[i][0])
+      send_reply(to, RPL_STATSJLINE, jupeTable[i]);
+}
+
 /** Send more channels to a client in mid-LIST.
  * @param[in] cptr Client to send the list to.
  */
@@ -425,6 +440,10 @@ void list_next_channels(struct Client *cptr)
           && chptr->users < args->max_users
           && chptr->creationtime > args->min_time
           && chptr->creationtime < args->max_time
+          && (!args->wildcard[0] || (args->flags & LISTARG_NEGATEWILDCARD) ||
+              (!match(args->wildcard, chptr->chname)))
+          && (!(args->flags & LISTARG_NEGATEWILDCARD) ||
+              match(args->wildcard, chptr->chname))
           && (!(args->flags & LISTARG_TOPICLIMITS)
               || (chptr->topic[0]
                   && chptr->topic_time > args->min_topic_time