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 */
};
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 */
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 */
#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))
/** 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) && \
/** 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 */
{ FLAG_WEBIRC, 'W' },
{ FLAG_SEE_IDLETIME,'t' },
{ FLAG_SECURITY_SERV,'D' },
+ { FLAG_KEEPCONN_ENABLED, 'K' },
{ FLAG_HIDDENHOST, 'x' },
{ FLAG_NOTCONN, 'Z' }
};
char buf[BUFSIZE];
int prop = 0;
int do_host_hiding = 0;
- char* account = NULL, *fakehost = NULL;
+ char* account = NULL, *fakehost = NULL, *keepconn = NULL;
struct Membership *chan;
what = MODE_ADD;
else
ClearWebIRC(sptr);
break;
+ case 'K':
+ if (what == MODE_ADD) {
+ if(*(p + 1) == 0)
+ break;
+ keepconn = *(++p);
+ SetKeepConnEnabled(sptr);
+ } else {
+ ClearKeepConnEnabled(sptr);
+ }
+ break;
case 'r':
if (*(p + 1) && (what == MODE_ADD)) {
account = *(++p);
ClearHiddenOper(sptr);
if (!FlagHas(&setflags, FLAG_OVERRIDECC) && IsOverrideCC(sptr) && !HasPriv(sptr, PRIV_UMODE_OVERRIDECC))
ClearOverrideCC(sptr);
+ if (!FlagHas(&setflags, FLAG_KEEPCONN_ENABLED) && IsKeepConnEnabled(sptr) && !HasPriv(sptr, PRIV_SET_KEEPCONN))
+ ClearKeepConnEnabled(sptr);
/* Opers are able to fake the webirc usermode only if FEAT_FAKE_WEBIRC is true. */
if (!FlagHas(&setflags, FLAG_WEBIRC) && IsWebIRC(sptr) && !(feature_bool(FEAT_FAKE_WEBIRC) && IsOper(sptr)))
ClearWebIRC(sptr);
if (!FlagHas(&setflags, FLAG_FAKEHOST) && IsFakeHost(sptr)) {
ircd_strncpy(cli_user(sptr)->fakehost, fakehost, HOSTLEN);
}
+ if (!FlagHas(&setflags, FLAG_KEEPCONN_ENABLED) && IsKeepConnEnabled(sptr)) {
+ sptr->keepconn = atoi(keepconn);
+ }
if (IsRegistered(sptr)) {
if(do_host_hiding)