]>
Commit | Line | Data |
---|---|---|
9591050c | 1 | allow usermodes +n and usermode +I to be auto set from the class block |
2 | ||
3 | diff -r 64e4811dd29a include/s_user.h | |
4 | --- a/include/s_user.h | |
5 | +++ b/include/s_user.h | |
6 | @@ -53,6 +53,7 @@ | |
7 | /* used for parsing user modes */ | |
8 | #define ALLOWMODES_ANY 0 /**< Allow any user mode */ | |
9 | #define ALLOWMODES_DEFAULT 1 /**< Only allow the subset of modes that are legit defaults */ | |
10 | +#define ALLOWMODES_AUTO 2 /**< Only allow auto modes */ | |
11 | ||
12 | /* return sets for umode_str() */ | |
13 | #define UMODE_ALL_PARAMS 0 /**< return the user modes and all parameters */ | |
14 | diff -r 64e4811dd29a ircd/s_user.c | |
15 | --- a/ircd/s_user.c | |
16 | +++ b/ircd/s_user.c | |
17 | @@ -365,7 +365,7 @@ | |
18 | if (tmpstr) { | |
19 | char *umodev[] = { NULL, NULL, NULL, NULL }; | |
20 | umodev[2] = tmpstr; | |
21 | - set_user_mode(cptr, sptr, 3, umodev, ALLOWMODES_ANY); | |
22 | + set_user_mode(cptr, sptr, 3, umodev, ALLOWMODES_AUTO); | |
23 | } | |
24 | ||
25 | if (feature_bool(FEAT_AUTOINVISIBLE)) | |
26 | @@ -1355,9 +1355,11 @@ | |
27 | ClearChannelService(sptr); | |
28 | if (!FlagHas(&setflags, FLAG_XTRAOP) && !(IsAnOper(sptr) && HasPriv(sptr, PRIV_XTRA_OPER))) | |
29 | ClearXtraOp(sptr); | |
30 | - if (!FlagHas(&setflags, FLAG_NOCHAN) && !(IsAnOper(sptr) || feature_bool(FEAT_USER_HIDECHANS))) | |
31 | + /* user is an oper, or feature USER_HIDECHANS is TRUE, or the mode is auto set from the class block, else clear mode +n */ | |
32 | + if (!FlagHas(&setflags, FLAG_NOCHAN) && !(IsAnOper(sptr) || feature_bool(FEAT_USER_HIDECHANS) || allow_modes == ALLOWMODES_AUTO)) | |
33 | ClearNoChan(sptr); | |
34 | - if (!FlagHas(&setflags, FLAG_NOIDLE) && !((IsAnOper(sptr) && HasPriv(sptr, PRIV_NOIDLE)) || feature_bool(FEAT_USER_HIDEIDLETIME))) | |
35 | + /* user is an oper with priv NOIDLE, or feature USER_HIDEIDLETIME is TRUE, or the mode is auto set from the class block, else clear mode +I */ | |
36 | + if (!FlagHas(&setflags, FLAG_NOIDLE) && !((IsAnOper(sptr) && HasPriv(sptr, PRIV_NOIDLE)) || feature_bool(FEAT_USER_HIDEIDLETIME) || allow_modes == ALLOWMODES_AUTO)) | |
37 | ClearNoIdle(sptr); | |
38 | if (!FlagHas(&setflags, FLAG_PARANOID) && !(IsAnOper(sptr) && HasPriv(sptr, PRIV_PARANOID))) | |
39 | ClearParanoid(sptr); |