fixed propagation of user mode changes (user should ALWAYS be notified)
[ircu2.10.12-pk.git] / include / client.h
index 20db7430013e16c1c68ee120e8902f79a8135d79..36060fe0da83c88fdc4c34c802cba6726dcc71c8 100644 (file)
@@ -138,6 +138,7 @@ enum Priv
     PRIV_UNLIMITED_TARGET, /**< unlimited target changes */
     PRIV_UMODE_OVERRIDECC, /**< can set umode +c (override cmodes +cC) */
     PRIV_NOAMSG_OVERRIDE, /**< can override the +M channelmode */
+    PRIV_SET_KEEPCONN, /**< can set KeepConn time by its own */
     PRIV_LAST_PRIV /**< number of privileges */
   };
 
@@ -179,6 +180,7 @@ enum Flag
     FLAG_DEBUG,                     /**< send global debug/anti-hack info */
     FLAG_ACCOUNT,                   /**< account name has been set */
     FLAG_HIDDENHOST,                /**< user's host is hidden */
+    FLAG_NOTCONN,                   /**< nobody is connected to this client */
     FLAG_FAKEHOST,                  /**< user has a fakehost */
     FLAG_FAKEIDENT,                  /**< user has a fakeident */
     FLAG_NOCHAN,                    /**< hide user's channels for non-opers */
@@ -191,6 +193,7 @@ enum Flag
     FLAG_WEBIRC,                    /**< Is a WebIRC client with spoofed host/ip */
     FLAG_SEE_IDLETIME,              /**< Can see idletime of +I users. */
        FLAG_SECURITY_SERV,             /**< Securityflag, that can only be set by IAuth */
+    FLAG_KEEPCONN_ENABLED,          /**< special KeepConn time is set */
     FLAG_LAST_FLAG,                 /**< number of flags */
     FLAG_LOCAL_UMODES = FLAG_LOCOP, /**< First local mode flag */
     FLAG_GLOBAL_UMODES = FLAG_OPER  /**< First global mode flag */
@@ -276,7 +279,8 @@ struct Client {
   char cli_webirc[NICKLEN + 1];   /**< Contains the name of the WebIRC block */
   char           cli_yxx[4];      /**< Numeric Nick: YY if this is a
                                      server, XXX if this is a user */
-  unsigned int maxchans;
+  unsigned int maxchans : 8;
+  unsigned int keepconn : 24;
   char cli_connclass[NICKLEN + 1];
   time_t         cli_firsttime;   /**< time client was created */
   time_t         cli_lastnick;    /**< TimeStamp on nick */
@@ -601,7 +605,7 @@ struct Client {
 /** Return non-zero if the client caused a net.burst. */
 #define IsJunction(x)           HasFlag(x, FLAG_JUNCTION)
 /** Return non-zero if the client has set mode +O (local operator) locally. */
-#define IsLocOp(x)              (MyUser(x) && HasFlag(x, FLAG_LOCOP))
+#define IsLocOp(x)              (MyConnect(x) && HasFlag(x, FLAG_LOCOP))
 /** Return non-zero if the client has set mode +o (global operator). */
 #define IsOper(x)               HasFlag(x, FLAG_OPER)
 /** Return non-zero if the client has an active UDP ping request. */
@@ -626,6 +630,8 @@ struct Client {
 #define IsAccount(x)            HasFlag(x, FLAG_ACCOUNT)
 /** Return non-zero if the client has set mode +x (hidden host). */
 #define IsHiddenHost(x)         HasFlag(x, FLAG_HIDDENHOST)
+/** Return non-zero if nobody is connected to this client structure */
+#define IsNotConn(x)            HasFlag(x, FLAG_NOTCONN)
 /** Return non-zero if the client has an active PING request. */
 #define IsPingSent(x)           HasFlag(x, FLAG_PINGSENT)
 /** Return non-zero if the client's channels are hidden. */
@@ -646,10 +652,12 @@ struct Client {
 #define IsWebIRC(x)             HasFlag(x, FLAG_WEBIRC)
 /** Return non-zero if the client can see idletime of +I users. */
 #define IsSeeIdletime(x)        HasFlag(x, FLAG_SEE_IDLETIME)
-#define IsSecurityServ(x)        HasFlag(x, FLAG_SECURITY_SERV)
+#define IsSecurityServ(x)       HasFlag(x, FLAG_SECURITY_SERV)
+/** Return non-zero if the client has a special KeepConn Time set. */
+#define IsKeepConnEnabled(x)    HasFlag(x, FLAG_KEEPCONN_ENABLED)
 /** Return non-zero if the client has a fakehost. */
 #define IsFakeHost(x)           HasFlag(x, FLAG_FAKEHOST)
-#define IsFakeIdent(x)           HasFlag(x, FLAG_FAKEIDENT)
+#define IsFakeIdent(x)          HasFlag(x, FLAG_FAKEIDENT)
 
 /** Return non-zero if the client has operator or server privileges. */
 #define IsPrivileged(x)         (IsAnOper(x) || IsServer(x))
@@ -696,6 +704,8 @@ struct Client {
 #define SetAccount(x)           SetFlag(x, FLAG_ACCOUNT)
 /** Mark a client as having mode +x (hidden host). */
 #define SetHiddenHost(x)        SetFlag(x, FLAG_HIDDENHOST)
+/** Mark a client as not having anyone connected to it */
+#define SetNotConn(x)           SetFlag(x, FLAG_NOTCONN)
 /** Mark a client as having a fakehost. */
 #define SetFakeHost(x)          SetFlag(x, FLAG_FAKEHOST)
 #define SetFakeIdent(x)          SetFlag(x, FLAG_FAKEIDENT)
@@ -720,6 +730,8 @@ struct Client {
 /** Mark a client as being able to see idletime of +I users. */
 #define SetSeeIdletime(x)       SetFlag(x, FLAG_SEE_IDLETIME)
 #define SetSecurityServ(x)      SetFlag(x, FLAG_SECURITY_SERV)
+/** Mark a client as having a special KeepConn Time set. */
+#define SetKeepConnEnabled(x)   SetFlag(x, FLAG_KEEPCONN_ENABLED)
 
 /** Return non-zero if \a sptr sees \a acptr as an operator. */
 #define SeeOper(sptr,acptr) ((IsAnOper(acptr) && \
@@ -752,6 +764,8 @@ struct Client {
 #define ClearServNotice(x)      ClrFlag(x, FLAG_SERVNOTICE)
 /** Remove mode +x (hidden host) from the client. */
 #define ClearHiddenHost(x)      ClrFlag(x, FLAG_HIDDENHOST)
+/** Mark client as having someone connected to it */
+#define ClearNotConn(x)         ClrFlag(x, FLAG_NOTCONN)
 /** Remove fakehost flag from the flient. */
 #define ClearFakeHost(x)        ClrFlag(x, FLAG_FAKEHOST)
 #define ClearFakeIdent(x)        ClrFlag(x, FLAG_FAKEIDENT)
@@ -778,6 +792,8 @@ struct Client {
 /** Make client no longer being able to see idletime of +I users. */
 #define ClearSeeIdletime(x)     ClrFlag(x, FLAG_SEE_IDLETIME)
 #define ClearSecurityServ(x)    ClrFlag(x, FLAG_SECURITY_SERV)
+/** Remove the client's mark of having a special KeepConn Time set. */
+#define ClearKeepConnEnabled(x) ClrFlag(x, FLAG_KEEPCONN_ENABLED)
 
 /* free flags */
 #define FREEFLAG_SOCKET        0x0001  /**< socket needs to be freed */