]> jfr.im git - solanum.git/blobdiff - src/whowas.c
Revert "remove MONITOR for now pending a complete rewrite"
[solanum.git] / src / whowas.c
index 880826fc9011511d425218bb6f547958c5d82910..716bdccd48a4cd94f57c9a51244fe0468afa4ca5 100644 (file)
@@ -30,7 +30,7 @@
 #include "client.h"
 #include "common.h"
 #include "hash.h"
-#include "irc_string.h"
+#include "match.h"
 #include "ircd.h"
 #include "ircd_defs.h"
 #include "numeric.h"
@@ -38,8 +38,8 @@
 #include "s_user.h"
 #include "send.h"
 #include "s_conf.h"
-#include "memory.h"
 #include "scache.h"
+#include "s_assert.h"
 
 /* internally defined function */
 static void add_whowas_to_clist(struct Whowas **, struct Whowas *);
@@ -73,19 +73,19 @@ void add_history(struct Client *client_p, int online)
                del_whowas_from_list(&WHOWASHASH[who->hashv], who);
        }
        who->hashv = hash_whowas_name(client_p->name);
-       who->logoff = CurrentTime;
+       who->logoff = rb_current_time();
        /*
         * NOTE: strcpy ok here, the sizes in the client struct MUST
         * match the sizes in the whowas struct
         */
-       strlcpy(who->name, client_p->name, sizeof(who->name));
+       rb_strlcpy(who->name, client_p->name, sizeof(who->name));
        strcpy(who->username, client_p->username);
        strcpy(who->hostname, client_p->host);
        strcpy(who->realname, client_p->info);
-       if (!EmptyString(client_p->sockhost) && strcmp(client_p->sockhost, "0") && show_ip(NULL, client_p))
-               strcpy(who->sockhost, client_p->sockhost);
-       else
-               who->sockhost[0] = '\0';
+       strcpy(who->suser, client_p->user->suser);
+       strcpy(who->sockhost, client_p->sockhost);
+       who->flags = (IsIPSpoof(client_p) ? WHOWAS_IP_SPOOFING : 0) |
+               (IsDynSpoof(client_p) ? WHOWAS_DYNSPOOF : 0);
 
        who->servername = scache_get_name(client_p->servptr->serv->nameinfo);
 
@@ -119,7 +119,7 @@ struct Client *get_history(const char *nick, time_t timelimit)
        struct Whowas *temp;
        int blah;
 
-       timelimit = CurrentTime - timelimit;
+       timelimit = rb_current_time() - timelimit;
        blah = hash_whowas_name(nick);
        temp = WHOWASHASH[blah];
        for (; temp; temp = temp->next)
@@ -135,23 +135,8 @@ struct Client *get_history(const char *nick, time_t timelimit)
 
 void count_whowas_memory(size_t * wwu, size_t * wwum)
 {
-       struct Whowas *tmp;
-       int i;
-       size_t u = 0;
-       size_t um = 0;
-
-       /* count the number of used whowas structs in 'u' */
-       /* count up the memory used of whowas structs in um */
-
-       for (i = 0, tmp = &WHOWAS[0]; i < NICKNAMEHISTORYLENGTH; i++, tmp++)
-               if(tmp->hashv != -1)
-               {
-                       u++;
-                       um += sizeof(struct Whowas);
-               }
-       *wwu = u;
-       *wwum = um;
-       return;
+       *wwu = NICKNAMEHISTORYLENGTH;
+       *wwum = NICKNAMEHISTORYLENGTH * sizeof(struct Whowas);
 }
 
 void