]>
Commit | Line | Data |
---|---|---|
1 | # HG changeset patch | |
2 | # Parent 8b801a1994c3d114000b71e08c90ef233e4336a0 | |
3 | ||
4 | diff -r 8b801a1994c3 include/client.h | |
5 | --- a/include/client.h Sat Jul 20 14:21:41 2013 +0100 | |
6 | +++ b/include/client.h Sat Jul 20 14:45:22 2013 +0100 | |
7 | @@ -90,7 +90,7 @@ | |
8 | #define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag)) | |
9 | ||
10 | /** String containing valid user modes, in no particular order. */ | |
11 | -#define infousermodes "diOoswkgx" | |
12 | +#define infousermodes "diOoswkgxR" | |
13 | ||
14 | /** Operator privileges. */ | |
15 | enum Priv | |
16 | @@ -165,6 +165,8 @@ | |
17 | don't display channels in /whois */ | |
18 | FLAG_DEBUG, /**< send global debug/anti-hack info */ | |
19 | FLAG_ACCOUNT, /**< account name has been set */ | |
20 | + FLAG_ACCOUNTONLY, /**< ASUKA_R: hide privmsgs/notices if | |
21 | + user is not authed or opered */ | |
22 | FLAG_HIDDENHOST, /**< user's host is hidden */ | |
23 | FLAG_LAST_FLAG, /**< number of flags */ | |
24 | FLAG_LOCAL_UMODES = FLAG_LOCOP, /**< First local mode flag */ | |
25 | @@ -583,6 +585,9 @@ | |
26 | #define IsHiddenHost(x) HasFlag(x, FLAG_HIDDENHOST) | |
27 | /** Return non-zero if the client has an active PING request. */ | |
28 | #define IsPingSent(x) HasFlag(x, FLAG_PINGSENT) | |
29 | +/** Return non-zero if the client should not receive privmsgs/notices | |
30 | + * from unauthed users */ | |
31 | +#define IsAccountOnly(x) HasFlag(x, FLAG_ACCOUNTONLY) | |
32 | ||
33 | /** Return non-zero if the client has operator or server privileges. */ | |
34 | #define IsPrivileged(x) (IsAnOper(x) || IsServer(x)) | |
35 | @@ -629,6 +634,8 @@ | |
36 | #define SetHiddenHost(x) SetFlag(x, FLAG_HIDDENHOST) | |
37 | /** Mark a client as having a pending PING. */ | |
38 | #define SetPingSent(x) SetFlag(x, FLAG_PINGSENT) | |
39 | +/** Mark a client as having mode +R (account only). */ | |
40 | +#define SetAccountOnly(x) SetFlag(x, FLAG_ACCOUNTONLY) | |
41 | ||
42 | /** Return non-zero if \a sptr sees \a acptr as an operator. */ | |
43 | #define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \ | |
44 | @@ -664,6 +671,8 @@ | |
45 | #define ClearPingSent(x) ClrFlag(x, FLAG_PINGSENT) | |
46 | /** Clear the client's HUB flag. */ | |
47 | #define ClearHub(x) ClrFlag(x, FLAG_HUB) | |
48 | +/** Remove mode +R (account only) from a client */ | |
49 | +#define ClearAccountOnly(x) ClrFlag(x, FLAG_ACCOUNTONLY) | |
50 | ||
51 | /* free flags */ | |
52 | #define FREEFLAG_SOCKET 0x0001 /**< socket needs to be freed */ | |
53 | diff -r 8b801a1994c3 include/numeric.h | |
54 | --- a/include/numeric.h Sat Jul 20 14:21:41 2013 +0100 | |
55 | +++ b/include/numeric.h Sat Jul 20 14:45:22 2013 +0100 | |
56 | @@ -181,14 +181,14 @@ | |
57 | #define RPL_ENDOFGLIST 281 /* Undernet extension */ | |
58 | #define RPL_JUPELIST 282 /* Undernet extension - jupe -Kev */ | |
59 | #define RPL_ENDOFJUPELIST 283 /* Undernet extension - jupe -Kev */ | |
60 | -#define RPL_FEATURE 284 /* Undernet extension - features */ | |
61 | -/* RPL_CHANINFO_HANDLE 285 aircd */ | |
62 | -/* RPL_CHANINFO_USERS 286 aircd */ | |
63 | -/* RPL_CHANINFO_CHOPS 287 aircd */ | |
64 | -/* RPL_CHANINFO_VOICES 288 aircd */ | |
65 | -/* RPL_CHANINFO_AWAY 289 aircd */ | |
66 | -/* RPL_CHANINFO_OPERS 290 aircd */ | |
67 | -/* RPL_HELPHDR 290 Numeric List: Dalnet */ | |
68 | +#define RPL_FEATURE 284 /* QuakeNet - Asuka */ | |
69 | +#define RPL_NEWHOSTIS 285 /* QuakeNet - Asuka */ | |
70 | +#define RPL_CHKHEAD 286 /* QuakeNet - Asuka */ | |
71 | +#define RPL_CHANUSER 287 /* QuakeNet - Asuka */ | |
72 | +#define RPL_PATCHHEAD 288 /* QuakeNet - Asuka */ | |
73 | +#define RPL_PATCHCON 289 /* QuakeNet - Asuka */ | |
74 | +#define RPL_DATASTR 290 /* QuakeNet - Asuka */ | |
75 | +#define RPL_ENDOFCHECK 291 /* QuakeNet - Asuka */ | |
76 | /* RPL_CHANINFO_BANNED 291 aircd */ | |
77 | /* RPL_HELPOP 291 Numeric List: Dalnet */ | |
78 | /* RPL_CHANINFO_BANS 292 aircd */ | |
79 | @@ -325,6 +325,7 @@ | |
80 | #define ERR_TOOMANYCHANNELS 405 | |
81 | #define ERR_WASNOSUCHNICK 406 | |
82 | #define ERR_TOOMANYTARGETS 407 | |
83 | +#define ERR_SEARCHNOMATCH 408 /* QuakeNet - Asuka */ | |
84 | /* ERR_NOSUCHSERVICE 408 IRCnet */ | |
85 | /* ERR_NOCOLORSONCHAN 408 Dalnet */ | |
86 | #define ERR_NOORIGIN 409 | |
87 | @@ -413,6 +414,7 @@ | |
88 | /* ERR_KILLDENY 485 unreal */ | |
89 | /* ERR_CANTKICKADMIN 485 PTlink */ | |
90 | /* ERR_HTMDISABLED 486 unreal */ | |
91 | +#define ERR_ACCOUNTONLY 486 /* QuakeNet/ASUKA extension */ | |
92 | /* ERR_CHANTOORECENT 487 IRCnet extension (?) */ | |
93 | /* ERR_TSLESSCHAN 488 IRCnet extension (?) */ | |
94 | #define ERR_VOICENEEDED 489 /* Undernet extension */ | |
95 | diff -r 8b801a1994c3 ircd/ircd_relay.c | |
96 | --- a/ircd/ircd_relay.c Sat Jul 20 14:21:41 2013 +0100 | |
97 | +++ b/ircd/ircd_relay.c Sat Jul 20 14:45:22 2013 +0100 | |
98 | @@ -340,6 +340,16 @@ | |
99 | is_silenced(sptr, acptr)) | |
100 | return; | |
101 | ||
102 | + /* ASUKA -- slug | |
103 | + * +R check, if target is +R and we're not +r (or opered) then | |
104 | + * deny the message | |
105 | + */ | |
106 | + | |
107 | + if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsOper(sptr)) { | |
108 | + send_reply(sptr, ERR_ACCOUNTONLY, cli_name(acptr)); | |
109 | + return; | |
110 | + } | |
111 | + | |
112 | /* | |
113 | * send away message if user away | |
114 | */ | |
115 | @@ -375,6 +385,15 @@ | |
116 | check_target_limit(sptr, acptr, cli_name(acptr), 0)) || | |
117 | is_silenced(sptr, acptr)) | |
118 | return; | |
119 | + | |
120 | + /* ASUKA -- slug | |
121 | + * +R check, if target is +R and we're not +r (or opered) then | |
122 | + * deny the message | |
123 | + */ | |
124 | + | |
125 | + if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsOper(sptr)) | |
126 | + return; | |
127 | + | |
128 | /* | |
129 | * deliver the message | |
130 | */ | |
131 | diff -r 8b801a1994c3 ircd/m_invite.c | |
132 | --- a/ircd/m_invite.c Sat Jul 20 14:21:41 2013 +0100 | |
133 | +++ b/ircd/m_invite.c Sat Jul 20 14:45:22 2013 +0100 | |
134 | @@ -166,6 +166,11 @@ | |
135 | ||
136 | /* If we get here, it was a VALID and meaningful INVITE */ | |
137 | ||
138 | + if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsOper(sptr)) { | |
139 | + send_reply(sptr, ERR_ACCOUNTONLY, cli_name(acptr)); | |
140 | + return 0; | |
141 | + } | |
142 | + | |
143 | if (check_target_limit(sptr, acptr, cli_name(acptr), 0)) | |
144 | return 0; | |
145 | ||
146 | diff -r 8b801a1994c3 ircd/s_err.c | |
147 | --- a/ircd/s_err.c Sat Jul 20 14:21:41 2013 +0100 | |
148 | +++ b/ircd/s_err.c Sat Jul 20 14:45:22 2013 +0100 | |
149 | @@ -1004,7 +1004,7 @@ | |
150 | /* 485 */ | |
151 | { 0 }, | |
152 | /* 486 */ | |
153 | - { 0 }, | |
154 | + { ERR_ACCOUNTONLY, "%s :You must be authed in order to message this user", "486" }, | |
155 | /* 487 */ | |
156 | { 0 }, | |
157 | /* 488 */ | |
158 | diff -r 8b801a1994c3 ircd/s_user.c | |
159 | --- a/ircd/s_user.c Sat Jul 20 14:21:41 2013 +0100 | |
160 | +++ b/ircd/s_user.c Sat Jul 20 14:45:22 2013 +0100 | |
161 | @@ -502,7 +502,8 @@ | |
162 | { FLAG_CHSERV, 'k' }, | |
163 | { FLAG_DEBUG, 'g' }, | |
164 | { FLAG_ACCOUNT, 'r' }, | |
165 | - { FLAG_HIDDENHOST, 'x' } | |
166 | + { FLAG_HIDDENHOST, 'x' }, | |
167 | + { FLAG_ACCOUNTONLY, 'R' } | |
168 | }; | |
169 | ||
170 | /** Length of #userModeList. */ | |
171 | @@ -1088,6 +1089,12 @@ | |
172 | } | |
173 | /* There is no -r */ | |
174 | break; | |
175 | + case 'R': | |
176 | + if (what == MODE_ADD) | |
177 | + SetAccountOnly(sptr); | |
178 | + else | |
179 | + ClearAccountOnly(sptr); | |
180 | + break; | |
181 | default: | |
182 | send_reply(sptr, ERR_UMODEUNKNOWNFLAG, *m); | |
183 | break; |