]> jfr.im git - irc/quakenet/newserv.git/blobdiff - whowas/whowas.h
GLINES: fix null pointer deref in trustgline / trustungline
[irc/quakenet/newserv.git] / whowas / whowas.h
index 9b679ab0be4bf1c5d5c6ad37a2239653d77e58ba..5c02bde0e27ed1ec8f815cc582039590b84ecc90 100644 (file)
@@ -1,16 +1,16 @@
-#define WW_MAXAGE 3600
-#define WW_MAXENTRIES 100000
+#ifndef __WHOWAS_H
+#define __WHOWAS_H
+
+#define WW_MAXCHANNELS 20
+#define WW_DEFAULT_MAXENTRIES 1000
 #define WW_MASKLEN (HOSTLEN + USERLEN + NICKLEN)
 #define WW_REASONLEN 512
 
 typedef struct whowas {
-  time_t seen;
-  char nick[NICKLEN + 1];
-  char ident[USERLEN + 1];
-  char host[HOSTLEN + 1];
-  char realname[REALLEN + 1];
-
   int type;
+  time_t timestamp;
+  nick nick; /* unlinked nick */
+  chanindex *channels[WW_MAXCHANNELS];
 
   /* WHOWAS_QUIT or WHOWAS_KILL */
   sstring *reason;
@@ -18,15 +18,31 @@ typedef struct whowas {
   /* WHOWAS_RENAME */
   sstring *newnick;
 
+  unsigned int marker;
+
   struct whowas *next;
   struct whowas *prev;
 } whowas;
 
-extern whowas *whowas_head, *whowas_tail;
-extern int whowas_count;
+extern whowas *whowasrecs;
+extern int whowasmax;
+extern int whowasoffset; /* points to oldest record */
+
+#define WHOWAS_UNUSED 0
+#define WHOWAS_USED 1
+#define WHOWAS_QUIT 2
+#define WHOWAS_KILL 3
+#define WHOWAS_RENAME 4
+
+whowas *whowas_fromnick(nick *np, int standalone);
+nick *whowas_tonick(whowas *ww);
+void whowas_freenick(nick *np);
+whowas *whowas_chase(const char *target, int maxage);
+const char *whowas_format(whowas *ww);
+const char *whowas_formatchannels(whowas *ww);
+void whowas_clean(whowas *ww);
+void whowas_free(whowas *ww);
 
-#define WHOWAS_QUIT 0
-#define WHOWAS_KILL 1
-#define WHOWAS_RENAME 2
+unsigned int nextwhowasmarker(void);
 
-whowas *whowas_chase(const char *nick, int maxage);
+#endif /* __WHOWAS_H */