Add missing header to ircd_string.h; add debug logging to test scripts.
[ircu2.10.12-pk.git] / include / client.h
index 7b97409d5fa12dd4fe7d4a0ffc519b3bf579f33a..06cdcfbab3e8ee1e28d09218677fc14f54cf97c3 100644 (file)
@@ -89,7 +89,7 @@ typedef unsigned long flagpage_t;
 /** Clear a flag in a flagset. */
 #define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag))
 
-/** String containig valid user modes, in no particular order. */
+/** String containing valid user modes, in no particular order. */
 #define infousermodes "dioswkgx"
 
 /** Operator privileges. */
@@ -125,6 +125,7 @@ enum Priv
     PRIV_LIST_CHAN, /**< oper can list secret channels */
     PRIV_FORCE_OPMODE, /**< can hack modes on quarantined channels */
     PRIV_FORCE_LOCAL_OPMODE, /**< can hack modes on quarantined local channels */
+    PRIV_APASS_OPMODE, /**< can hack modes +A/-A/+U/-U */
     PRIV_LAST_PRIV /**< number of privileges */
   };
 
@@ -212,6 +213,7 @@ struct Connection
   struct DNSReply*    con_dns_reply; /**< DNS reply received during client
                                        registration. */
   struct ListingArgs* con_listing;   /**< Current LIST status. */
+  unsigned long       con_unreg;     /**< Indicate what still needs to be done */
   unsigned int        con_max_sendq; /**< cached max send queue for client */
   unsigned int        con_ping_freq; /**< cached ping freq */
   unsigned short      con_lastsq;    /**< # 2k blocks when sendqueued
@@ -230,6 +232,9 @@ struct Connection
                                       client */
   struct Timer        con_proc;      /**< process latent messages from
                                       client */
+  struct Privs        con_privs;     /**< Oper privileges */
+  struct CapSet       con_capab;     /**< Client capabilities (from us) */
+  struct CapSet       con_active;    /**< Active capabilities (to us) */
   struct AuthRequest* con_auth;      /**< auth request for client */
   struct IAuthRequest* con_iauth;    /**< iauth request for client */
 };
@@ -256,12 +261,8 @@ struct Client {
   unsigned int   cli_hopcount;    /**< number of servers to this 0 = local */
   struct irc_in_addr cli_ip;      /**< Real IP of client */
   short          cli_status;      /**< Client type */
-  struct Privs   cli_privs;       /**< Oper privileges */
-  struct CapSet  cli_capab;       /**< Client capabilities */
-  struct CapSet  cli_active;      /**< Active client capabilities */
-  unsigned long  cli_unreg;       /**< Indicate what still needs to be done */
   char cli_name[HOSTLEN + 1];     /**< Unique name of the client, nick or host */
-  char cli_username[USERLEN + 1]; /**< username here now for auth stuff */
+  char cli_username[USERLEN + 1]; /**< Username determined by ident lookup */
   char cli_info[REALLEN + 1];     /**< Free form additional client information */
 };
 
@@ -318,13 +319,13 @@ struct Client {
 /** Return non-zero if the client is local. */
 #define cli_local(cli)          (cli_from(cli) == cli)
 /** Get oper privileges for client. */
-#define cli_privs(cli)         ((cli)->cli_privs)
+#define cli_privs(cli)         con_privs(cli_connect(cli))
 /** Get client capabilities for client */
-#define cli_capab(cli)         (&((cli)->cli_capab))
+#define cli_capab(cli)         con_capab(cli_connect(cli))
 /** Get active client capabilities for client */
-#define cli_active(cli)                (&((cli)->cli_active))
+#define cli_active(cli)                con_active(cli_connect(cli))
 /** Get flags for remaining registration tasks */
-#define cli_unreg(cli)         ((cli)->cli_unreg)
+#define cli_unreg(cli)         con_unreg(cli_connect(cli))
 /** Get client name. */
 #define cli_name(cli)          ((cli)->cli_name)
 /** Get client username (ident). */
@@ -451,6 +452,8 @@ struct Client {
 #define con_dns_reply(con)     ((con)->con_dns_reply)
 /** Get the LIST status for the connection. */
 #define con_listing(con)       ((con)->con_listing)
+/** Get remining steps before registration completes. */
+#define con_unreg(con)          ((con)->con_unreg)
 /** Get the maximum permitted SendQ size for the connection. */
 #define con_max_sendq(con)     ((con)->con_max_sendq)
 /** Get the ping frequency for the connection. */
@@ -471,6 +474,12 @@ struct Client {
 #define con_socket(con)                ((con)->con_socket)
 /** Get the Timer for processing more data from the connection. */
 #define con_proc(con)          ((con)->con_proc)
+/** Get the oper privilege set for the connection. */
+#define con_privs(con)          (&(con)->con_privs)
+/** Get the peer's capabilities for the connection. */
+#define con_capab(con)          (&(con)->con_capab)
+/** Get the active capabilities for the connection. */
+#define con_active(con)         (&(con)->con_active)
 /** Get the auth request for the connection. */
 #define con_auth(con)          ((con)->con_auth)
 /** Get the iauth request for the connection. */
@@ -734,7 +743,11 @@ struct Client {
 #define SNO_NOISY (SNO_SERVKILL|SNO_UNAUTH)
 
 /** Test whether a privilege has been granted to a client. */
-#define HasPriv(cli, priv)  FlagHas(&cli_privs(cli), priv)
+#define HasPriv(cli, priv)  FlagHas(cli_privs(cli), priv)
+/** Grant a privilege to a client. */
+#define SetPriv(cli, priv)  FlagSet(cli_privs(cli), priv)
+/** Revoke a privilege from a client. */
+#define ClrPriv(cli, priv)  FlagClr(cli_privs(cli), priv)
 
 /** Test whether a client has a capability */
 #define HasCap(cli, cap)    CapHas(cli_capab(cli), (cap))