+
+authname *getauthbyname(const char *name) {
+ authname *a = findauthnamebyname(name);
+ if(!a || !a->nicks)
+ return NULL;
+
+ return a;
+}
+
+static char *genstats(authname **hashtable, authname *(nextfn)(authname *)) {
+ int i,curchain,maxchain=0,total=0,buckets=0;
+ authname *ap;
+ static char buf[100];
+
+ for (i=0;i<AUTHNAMEHASHSIZE;i++) {
+ if (hashtable[i]!=NULL) {
+ buckets++;
+ curchain=0;
+ for (ap=hashtable[i];ap;ap=nextfn(ap)) {
+ total++;
+ curchain++;
+ }
+ if (curchain>maxchain) {
+ maxchain=curchain;
+ }
+ }
+ }
+
+ snprintf(buf, sizeof(buf), "%6d authexts (HASH: %6d/%6d, chain %3d)",total,buckets,AUTHNAMEHASHSIZE,maxchain);
+ return buf;
+}
+
+static authname *nextbynext(authname *in) {
+ return in->next;
+}
+
+static authname *nextbyname(authname *in) {
+ return in->nextbyname;
+}
+
+static void authextstats(int hooknum, void *arg) {
+ long level=(long)arg;
+ char buf[100];
+
+ if (level>5) {
+ /* Full stats */
+ snprintf(buf,sizeof(buf),"Authext : by id: %s", genstats(authnametable, nextbynext));
+ triggerhook(HOOK_CORE_STATSREPLY,buf);
+
+ snprintf(buf,sizeof(buf),"Authext : by name: %s", genstats(authnametablebyname, nextbyname));
+ triggerhook(HOOK_CORE_STATSREPLY,buf);
+ }
+}
+