]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - cCNmode
nickgline: include nick! bit in gline loggin
[irc/quakenet/snircd-patchqueue.git] / cCNmode
1 # HG changeset patch
2 # Parent 450ce608fb5cb90722bed3601ea5d424664796c6
3
4 diff -r 450ce608fb5c include/channel.h
5 --- a/include/channel.h Sat Jul 20 14:47:02 2013 +0100
6 +++ b/include/channel.h Sat Jul 20 14:47:57 2013 +0100
7 @@ -101,8 +101,12 @@
8 #define MODE_LIMIT 0x0400 /**< +l Limit */
9 #define MODE_REGONLY 0x0800 /**< Only +r users may join */
10 #define MODE_DELJOINS 0x1000 /**< New join messages are delayed */
11 -#define MODE_REGISTERED 0x2000 /**< Channel marked as registered
12 - * (for future semantic expansion) */
13 +#define MODE_REGISTERED 0x2000 /**< Channel marked as registered
14 + * (for future semantic expansion) */
15 +#define MODE_NOCOLOUR 0x4000 /**< No mIRC/ANSI colors/bold */
16 +#define MODE_NOCTCP 0x8000 /**< No channel CTCPs */
17 +#define MODE_NONOTICE 0x10000 /**< No channel notices */
18 +
19 #define MODE_SAVE 0x20000 /**< save this mode-with-arg 'til
20 * later */
21 #define MODE_FREE 0x40000 /**< string needs to be passed to
22 @@ -119,7 +123,7 @@
23 #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS)
24
25 /** Available Channel modes */
26 -#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDdR" : "biklmnopstvrDdR"
27 +#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDdRcCNu" : "biklmnopstvrDdRcCNu"
28 /** Available Channel modes that take parameters */
29 #define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "AbkloUv" : "bklov"
30
31 diff -r 450ce608fb5c include/supported.h
32 --- a/include/supported.h Sat Jul 20 14:47:02 2013 +0100
33 +++ b/include/supported.h Sat Jul 20 14:47:57 2013 +0100
34 @@ -65,7 +65,7 @@
35 #define FEATURESVALUES2 NICKLEN, TOPICLEN, AWAYLEN, TOPICLEN, \
36 feature_int(FEAT_CHANNELLEN), CHANNELLEN, \
37 (feature_bool(FEAT_LOCAL_CHANNELS) ? "#&" : "#"), "(ov)@+", "@+", \
38 - (feature_bool(FEAT_OPLEVELS) ? "b,AkU,l,imnpstrDdRu" : "b,k,l,imnpstrDdRu"), \
39 + (feature_bool(FEAT_OPLEVELS) ? "b,AkU,l,imnpstrDdRucCN" : "b,k,l,imnpstrDdRucCN"), \
40 "rfc1459", feature_str(FEAT_NETWORK)
41
42 #endif /* INCLUDED_supported_h */
43 diff -r 450ce608fb5c ircd/channel.c
44 --- a/ircd/channel.c Sat Jul 20 14:47:02 2013 +0100
45 +++ b/ircd/channel.c Sat Jul 20 14:47:57 2013 +0100
46 @@ -835,6 +835,12 @@
47 *mbuf++ = 'n';
48 if (chptr->mode.mode & MODE_REGONLY)
49 *mbuf++ = 'r';
50 + if (chptr->mode.mode & MODE_NOCOLOUR)
51 + *mbuf++ = 'c';
52 + if (chptr->mode.mode & MODE_NOCTCP)
53 + *mbuf++ = 'C';
54 + if (chptr->mode.mode & MODE_NONOTICE)
55 + *mbuf++ = 'N';
56 if (chptr->mode.mode & MODE_NOQUITPARTS)
57 *mbuf++ = 'u';
58 if (chptr->mode.mode & MODE_DELJOINS)
59 @@ -1289,9 +1295,9 @@
60 MODE_INVITEONLY, 'i',
61 MODE_NOPRIVMSGS, 'n',
62 MODE_REGONLY, 'r',
63 -/* MODE_NOCOLOUR, 'c',
64 + MODE_NOCOLOUR, 'c',
65 MODE_NOCTCP, 'C',
66 - MODE_NONOTICE, 'N',*/
67 + MODE_NONOTICE, 'N',
68 MODE_DELJOINS, 'D',
69 MODE_NOQUITPARTS, 'u'
70 };
71 @@ -1591,6 +1597,9 @@
72 /* MODE_APASS, 'A', */
73 /* MODE_UPASS, 'U', */
74 MODE_NOQUITPARTS, 'u',
75 + MODE_NOCOLOUR, 'c',
76 + MODE_NOCTCP, 'C',
77 + MODE_NONOTICE, 'N',
78 0x0, 0x0
79 };
80 static int local_flags[] = {
81 @@ -2016,7 +2025,8 @@
82
83 mode &= (MODE_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET | MODE_MODERATED |
84 MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_REGONLY |
85 - MODE_DELJOINS | MODE_WASDELJOINS | MODE_REGISTERED | MODE_NOQUITPARTS);
86 + MODE_DELJOINS | MODE_WASDELJOINS | MODE_REGISTERED | MODE_NOQUITPARTS |
87 + MODE_NOCOLOUR | MODE_NOCTCP | MODE_NONOTICE);
88
89 if (!(mode & ~(MODE_ADD | MODE_DEL))) /* don't add empty modes... */
90 return;
91 @@ -2150,6 +2160,9 @@
92 MODE_REGONLY, 'r',
93 MODE_DELJOINS, 'D',
94 MODE_NOQUITPARTS, 'u',
95 + MODE_NOCOLOUR, 'c',
96 + MODE_NOCTCP, 'C',
97 + MODE_NONOTICE, 'N',
98 0x0, 0x0
99 };
100 unsigned int add;
101 @@ -3303,6 +3316,9 @@
102 MODE_REGONLY, 'r',
103 MODE_DELJOINS, 'D',
104 MODE_NOQUITPARTS, 'u',
105 + MODE_NOCOLOUR, 'c',
106 + MODE_NOCTCP, 'C',
107 + MODE_NONOTICE, 'N',
108 MODE_ADD, '+',
109 MODE_DEL, '-',
110 0x0, 0x0
111 diff -r 450ce608fb5c ircd/ircd_relay.c
112 --- a/ircd/ircd_relay.c Sat Jul 20 14:47:02 2013 +0100
113 +++ b/ircd/ircd_relay.c Sat Jul 20 14:47:57 2013 +0100
114 @@ -86,6 +86,7 @@
115 void relay_channel_message(struct Client* sptr, const char* name, const char* text)
116 {
117 struct Channel* chptr;
118 + const char *ch;
119 assert(0 != sptr);
120 assert(0 != name);
121 assert(0 != text);
122 @@ -105,6 +106,21 @@
123 check_target_limit(sptr, chptr, chptr->chname, 0))
124 return;
125
126 + /* +cC checks */
127 + if (chptr->mode.mode & MODE_NOCOLOUR)
128 + for (ch=text;*ch;ch++)
129 + if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) {
130 + send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
131 + return;
132 + }
133 +
134 + if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(text,"\001ACTION ",8))
135 + for (ch=text;*ch;)
136 + if (*ch++==1) {
137 + send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
138 + return;
139 + }
140 +
141 RevealDelayedJoinIfNeeded(sptr, chptr);
142 sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, cli_from(sptr),
143 SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
144 @@ -119,6 +135,7 @@
145 void relay_channel_notice(struct Client* sptr, const char* name, const char* text)
146 {
147 struct Channel* chptr;
148 + const char *ch;
149 assert(0 != sptr);
150 assert(0 != name);
151 assert(0 != text);
152 @@ -135,6 +152,20 @@
153 check_target_limit(sptr, chptr, chptr->chname, 0))
154 return;
155
156 + if ((chptr->mode.mode & MODE_NONOTICE))
157 + return;
158 +
159 + /* +cC checks */
160 + if (chptr->mode.mode & MODE_NOCOLOUR)
161 + for (ch=text;*ch;ch++)
162 + if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31)
163 + return;
164 +
165 + if (chptr->mode.mode & MODE_NOCTCP)
166 + for (ch=text;*ch;)
167 + if (*ch++==1)
168 + return;
169 +
170 RevealDelayedJoinIfNeeded(sptr, chptr);
171 sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr),
172 SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
173 diff -r 450ce608fb5c ircd/m_clearmode.c
174 --- a/ircd/m_clearmode.c Sat Jul 20 14:47:02 2013 +0100
175 +++ b/ircd/m_clearmode.c Sat Jul 20 14:47:57 2013 +0100
176 @@ -125,6 +125,9 @@
177 MODE_REGONLY, 'r',
178 MODE_DELJOINS, 'D',
179 MODE_NOQUITPARTS, 'u',
180 + MODE_NOCOLOUR, 'c',
181 + MODE_NOCTCP, 'C',
182 + MODE_NONOTICE, 'N',
183 0x0, 0x0
184 };
185 int *flag_p;
186 diff -r 450ce608fb5c ircd/m_wallchops.c
187 --- a/ircd/m_wallchops.c Sat Jul 20 14:47:02 2013 +0100
188 +++ b/ircd/m_wallchops.c Sat Jul 20 14:47:57 2013 +0100
189 @@ -102,6 +102,7 @@
190 int m_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
191 {
192 struct Channel *chptr;
193 + struct Membership* member;
194
195 assert(0 != cptr);
196 assert(cptr == sptr);
197 @@ -115,10 +116,24 @@
198 return send_reply(sptr, ERR_NOTEXTTOSEND);
199
200 if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
201 - if (client_can_send_to_channel(sptr, chptr, 0)) {
202 + if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
203 if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
204 check_target_limit(sptr, chptr, chptr->chname, 0))
205 return 0;
206 +
207 + /* +cC checks */
208 + if (chptr->mode.mode & MODE_NOCOLOUR)
209 + for (ch=parv[parc - 1];*ch;ch++)
210 + if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) {
211 + return 0;
212 + }
213 +
214 + if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(parv[parc - 1],"\001ACTION ",8))
215 + for (ch=parv[parc - 1];*ch;)
216 + if (*ch++==1) {
217 + return 0;
218 + }
219 +
220 RevealDelayedJoinIfNeeded(sptr, chptr);
221 sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
222 SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
223 @@ -146,7 +161,8 @@
224 return 0;
225
226 if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) {
227 - if (client_can_send_to_channel(sptr, chptr, 1)) {
228 + if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
229 + RevealDelayedJoinIfNeeded(sptr, chptr);
230 sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
231 SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
232 "%H :%s", chptr, parv[parc - 1]);
233 diff -r 450ce608fb5c ircd/m_wallvoices.c
234 --- a/ircd/m_wallvoices.c Sat Jul 20 14:47:02 2013 +0100
235 +++ b/ircd/m_wallvoices.c Sat Jul 20 14:47:57 2013 +0100
236 @@ -101,6 +101,7 @@
237 int m_wallvoices(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
238 {
239 struct Channel *chptr;
240 + struct Membership* member;
241
242 assert(0 != cptr);
243 assert(cptr == sptr);
244 @@ -114,10 +115,24 @@
245 return send_reply(sptr, ERR_NOTEXTTOSEND);
246
247 if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
248 - if (client_can_send_to_channel(sptr, chptr, 0)) {
249 + if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
250 if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
251 check_target_limit(sptr, chptr, chptr->chname, 0))
252 return 0;
253 +
254 + /* +cC checks */
255 + if (chptr->mode.mode & MODE_NOCOLOUR)
256 + for (ch=parv[parc - 1];*ch;ch++)
257 + if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) {
258 + return 0;
259 + }
260 +
261 + if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(parv[parc - 1],"\001ACTION ",8))
262 + for (ch=parv[parc - 1];*ch;)
263 + if (*ch++==1) {
264 + return 0;
265 + }
266 +
267 RevealDelayedJoinIfNeeded(sptr, chptr);
268 sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr,
269 SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES,
270 @@ -145,7 +160,8 @@
271 return 0;
272
273 if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) {
274 - if (client_can_send_to_channel(sptr, chptr, 1)) {
275 + if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
276 + RevealDelayedJoinIfNeeded(sptr, chptr);
277 sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr,
278 SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES,
279 "%H :%s", chptr, parv[parc - 1]);
280 diff -r 450ce608fb5c ircd/s_auth.c
281 --- a/ircd/s_auth.c Sat Jul 20 14:47:02 2013 +0100
282 +++ b/ircd/s_auth.c Sat Jul 20 14:47:57 2013 +0100
283 @@ -267,6 +267,9 @@
284 || ((user->username[0] == '~') && (user->username[1] == '\0')))
285 return exit_client(sptr, sptr, &me, "USER: Bogus userid.");
286
287 + /* Have to set up "realusername" before doing the gline check below */
288 + ircd_strncpy(user->realusername, user->username, USERLEN);
289 +
290 /* Check for K- or G-line. */
291 killreason = find_kill(sptr, 1);
292 if (killreason) {