]> jfr.im git - irc/quakenet/newserv.git/blobdiff - nick/nick.h
merge
[irc/quakenet/newserv.git] / nick / nick.h
index a8f9c7d6feaf3ea97b33e9cb1bbc663665c4af3e..6adfa0e4bb0d44c197c22dac424727c03054e595 100644 (file)
@@ -9,9 +9,16 @@
 #include "../lib/array.h"
 #include "../server/server.h"
 #include "../lib/base64.h"
+#include "../lib/irc_ipv6.h"
+#include "../patricia/patricia.h"
+
+#include "../authext/authext.h"
+
 #include <time.h>
 
-#define MAXNICKEXTS       5
+#ifndef MAXNICKEXTS
+#define MAXNICKEXTS       6
+#endif
 
 #define UMODE_INV       0x0001
 #define UMODE_WALLOPS   0x0002
 #define UMODE_SETHOST   0x0400
 #define UMODE_REGPRIV   0x0800
 #define UMODE_HIDEIDLE  0x1000
+#define UMODE_PARANOID  0x2000
+
+#define UMODE_ALL       0x3FFF
 
-#define UMODE_ALL       0x1FFF
+#define AFLAG_STAFF     0x0001
+#define AFLAG_DEVELOPER 0x0002
 
 #define IsInvisible(x)    ((x)->umodes & UMODE_INV)
 #define IsWallops(x)      ((x)->umodes & UMODE_WALLOPS)
@@ -42,6 +53,7 @@
 #define IsSetHost(x)      ((x)->umodes & UMODE_SETHOST)
 #define IsRegPriv(x)      ((x)->umodes & UMODE_REGPRIV)
 #define IsHideIdle(x)     ((x)->umodes & UMODE_HIDEIDLE)
+#define IsParanoid(x)     ((x)->umodes & UMODE_PARANOID)
 
 #define SetInvisible(x)    ((x)->umodes |= UMODE_INV)
 #define SetWallops(x)      ((x)->umodes |= UMODE_WALLOPS)
@@ -56,6 +68,7 @@
 #define SetSetHost(x)      ((x)->umodes |= UMODE_SETHOST)
 #define SetRegPriv(x)      ((x)->umodes |= UMODE_REGPRIV)
 #define SetHideIdle(x)     ((x)->umodes |= UMODE_HIDEIDLE)
+#define SetParanoid(x)     ((x)->umodes |= UMODE_PARANOID)
 
 #define ClearInvisible(x)    ((x)->umodes &= ~UMODE_INV)
 #define ClearWallops(x)      ((x)->umodes &= ~UMODE_WALLOPS)
 #define ClearSetHost(x)      ((x)->umodes &= ~UMODE_SETHOST)
 #define ClearRegPriv(x)      ((x)->umodes &= ~UMODE_REGPRIV)
 #define ClearHideIdle(x)     ((x)->umodes &= ~UMODE_HIDEIDLE)
+#define ClearParanoid(x)     ((x)->umodes &= ~UMODE_PARANOID)
+
+#define IsStaff(x)           ((x)->umodes & AFLAG_STAFF)
+#define IsDeveloper(x)       ((x)->umodes & AFLAG_DEVELOPER)
+
+#define SetStaff(x)          ((x)->umodes |= AFLAG_STAFF)
+#define SetDeveloper(x)      ((x)->umodes |= AFLAG_DEVELOPER)
+
+#define ClearStaff(x)        ((x)->umodes &= ~AFLAG_STAFF)
+#define ClearDeveloper(x)    ((x)->umodes &= ~AFLAG_DEVELOPER)
 
 typedef struct host {
   sstring *name;
@@ -97,18 +120,23 @@ typedef struct nick {
   sstring *sethost;
   flag_t umodes;
   char authname[ACCOUNTLEN+1];
+  authname *auth; /* This requires User ID numbers to work */
   time_t timestamp;
   time_t accountts;
-  unsigned long ipaddress;  
+  flag_t accountflags;
+  patricia_node_t *ipnode;
   unsigned int marker;
   struct nick *next;
   struct nick *nextbyhost;
   struct nick *nextbyrealname;
+  struct nick *nextbyauthname;
   /* These are extensions only used by other modules */
   array *channels;
   void *exts[MAXNICKEXTS];
 } nick;
 
+#define p_ipaddr ipnode->prefix->sin
+
 #define NICKHASHSIZE      60000
 #define HOSTHASHSIZE      40000
 #define REALNAMEHASHSIZE  40000
@@ -118,6 +146,7 @@ extern nick **servernicks[MAXSERVERS];
 extern host *hosttable[HOSTHASHSIZE];
 extern realname *realnametable[REALNAMEHASHSIZE];
 extern const flag umodeflags[];
+extern const flag accountflags[];
 
 #define MAXNUMERIC 0x3FFFFFFF
 
@@ -150,6 +179,7 @@ int registernickext(const char *name);
 int findnickext(const char *name);
 void releasenickext(int index);
 char *visiblehostmask(nick *np, char *buf);
+char *visibleuserhost(nick *np, char *buf);
 
 /* nickhandlers.c functions */
 int handlenickmsg(void *source, int cargc, char **cargv);
@@ -168,6 +198,7 @@ nick *getnickbynumericstr(char *numericstr);
                     
 /* nickhelpers.c functions */
 void initnickhelpers();
+void fininickhelpers();
 host *findhost(const char *hostname);
 host *findorcreatehost(const char *hostname);
 void releasehost(host *hp);