Add "dummy client" support.
[srvx.git] / src / hash.h
index 6ab5a869d79d2f9c0b69d9d579ff1808ea1681cf..99b411413724911363bd1b7fad60dec898b8c871 100644 (file)
@@ -1,5 +1,5 @@
 /* hash.h - IRC network state database
- * Copyright 2000-2004 srvx Development Team
+ * Copyright 2000-2006 srvx Development Team
  *
  * This file is part of srvx.
  *
 #define MODE_NOCOLORS           0x2000 /* +c */
 #define MODE_NOCTCPS            0x4000 /* +C */
 #define MODE_REGISTERED         0x8000 /* Bahamut +r */
+#define MODE_APASS             0x10000 /* +A adminpass */
+#define MODE_UPASS             0x20000 /* +U userpass */
 #define MODE_REMOVE             0x80000000
 
 #define FLAGS_OPER             0x0001 /* Operator +O */
-#define FLAGS_LOCOP            0x0002 /* Local operator +o */
 #define FLAGS_INVISIBLE                0x0004 /* invisible +i */
 #define FLAGS_WALLOP           0x0008 /* receives wallops +w */
-#define FLAGS_SERVNOTICE       0x0010 /* receives server notices +s */
 #define FLAGS_DEAF             0x0020 /* deaf +d */
 #define FLAGS_SERVICE          0x0040 /* cannot be kicked, killed or deoped +k */
 #define FLAGS_GLOBAL           0x0080 /* receives global messages +g */
-#define FLAGS_HELPER           0x0100 /* (network?) helper +h */
 #define FLAGS_PERSISTENT       0x0200 /* for reserved nicks, this isn't just one-shot */
 #define FLAGS_GAGGED           0x0400 /* for gagged users */
 #define FLAGS_AWAY             0x0800 /* for away users */
 #define FLAGS_STAMPED           0x1000 /* for users who have been stamped */
 #define FLAGS_HIDDEN_HOST       0x2000 /* user's host is masked by their account */
 #define FLAGS_REGNICK           0x4000 /* user owns their current nick */
+#define FLAGS_REGISTERING       0x8000 /* user has issued account register command, is waiting for email cookie */
+#define FLAGS_DUMMY             0x10000 /* user is not announced to other servers */
 
 #define IsOper(x)               ((x)->modes & FLAGS_OPER)
 #define IsService(x)            ((x)->modes & FLAGS_SERVICE)
 #define IsInvisible(x)          ((x)->modes & FLAGS_INVISIBLE)
 #define IsGlobal(x)             ((x)->modes & FLAGS_GLOBAL)
 #define IsWallOp(x)             ((x)->modes & FLAGS_WALLOP)
-#define IsServNotice(x)         ((x)->modes & FLAGS_SERVNOTICE)
-#define IsHelperIrcu(x)         ((x)->modes & FLAGS_HELPER)
 #define IsGagged(x)             ((x)->modes & FLAGS_GAGGED)
 #define IsPersistent(x)         ((x)->modes & FLAGS_PERSISTENT) 
 #define IsAway(x)               ((x)->modes & FLAGS_AWAY)
 #define IsStamped(x)            ((x)->modes & FLAGS_STAMPED)
 #define IsHiddenHost(x)         ((x)->modes & FLAGS_HIDDEN_HOST)
 #define IsReggedNick(x)         ((x)->modes & FLAGS_REGNICK)
+#define IsRegistering(x)       ((x)->modes & FLAGS_REGISTERING)
+#define IsDummy(x)              ((x)->modes & FLAGS_DUMMY)
+#define IsFakeHost(x)           ((x)->fakehost[0] != '\0')
 #define IsLocal(x)              ((x)->uplink == self)
 
 #define NICKLEN         30
@@ -81,6 +83,7 @@
 #define REALLEN         50
 #define TOPICLEN        250
 #define CHANNELLEN      200
+#define MAXOPLEVEL      999
 
 #define MAXMODEPARAMS  6
 #define MAXBANS                45
@@ -99,12 +102,13 @@ struct userNode {
     char ident[USERLEN + 1];      /* Per-host identification for user */
     char info[REALLEN + 1];       /* Free form additional client information */
     char hostname[HOSTLEN + 1];   /* DNS name or IP address */
+    char fakehost[HOSTLEN + 1];   /* Assigned fake host */
 #ifdef WITH_PROTOCOL_P10
     char numeric[COMBO_NUMERIC_LEN+1];
     unsigned int num_local : 18;
 #endif
     unsigned int dead : 1;        /* Is user waiting to be recycled? */
-    struct in_addr ip;            /* User's IP address */
+    irc_in_addr_t ip;             /* User's IP address */
     long modes;                   /* user flags +isw etc... */
 
     time_t timestamp;             /* Time of last nick change */
@@ -121,8 +125,10 @@ struct chanNode {
     chan_mode_t modes;
     unsigned int limit, locks;
     char key[KEYLEN + 1];
+    char upass[KEYLEN + 1];
+    char apass[KEYLEN + 1];
     time_t timestamp; /* creation time */
-  
+
     char topic[TOPICLEN + 1];
     char topic_nick[NICKLEN + 1];
     time_t topic_time;
@@ -147,7 +153,8 @@ struct banNode {
 struct modeNode {
     struct chanNode *channel;
     struct userNode *user;
-    long modes;
+    unsigned short modes;
+    short oplevel;
     time_t idle_since;
 };
 
@@ -204,6 +211,7 @@ typedef void (*account_func_t) (struct userNode *user, const char *stamp);
 void reg_account_func(account_func_t handler);
 void call_account_func(struct userNode *user, const char *stamp);
 void StampUser(struct userNode *user, const char *stamp);
+void assign_fakehost(struct userNode *user, const char *host, int announce);
 
 typedef void (*new_channel_func_t) (struct chanNode *chan);
 void reg_new_channel_func(new_channel_func_t handler);