]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - checkmscheck.patch
Remove topic_reveal.patch. This has been fixed in IRCU and ircu patch is correct...
[irc/quakenet/snircd-patchqueue.git] / checkmscheck.patch
1 split m_check into mo_check (oper) and ms_check (server) message functions
2
3 diff -r 26edd3f62b02 include/handlers.h
4 --- a/include/handlers.h Fri Jul 26 20:21:47 2013 +0100
5 +++ b/include/handlers.h Fri Jul 26 20:34:34 2013 +0100
6 @@ -88,19 +88,6 @@
7
8 extern int m_admin(struct Client*, struct Client*, int, char*[]);
9 extern int m_away(struct Client*, struct Client*, int, char*[]);
10 -
11 -/*
12 - * - ASUKA ---------------------------------------------------------------------
13 - * Add the command for CHECK.
14 - * This was adapted from Lain for use in Asuka.
15 - * Original code by Durzel (durzel@quakenet.org).
16 - *
17 - * qoreQ (qoreQ@quakenet.org) - 08/30/2002
18 - * -----------------------------------------------------------------------------
19 - */
20 -
21 -extern int m_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]);
22 -
23 extern int m_cap(struct Client*, struct Client*, int, char*[]);
24 extern int m_cnotice(struct Client*, struct Client*, int, char*[]);
25 extern int m_cprivmsg(struct Client*, struct Client*, int, char*[]);
26 @@ -157,6 +144,7 @@
27 extern int m_whowas(struct Client*, struct Client*, int, char*[]);
28 extern int mo_admin(struct Client*, struct Client*, int, char*[]);
29 extern int mo_asll(struct Client*, struct Client*, int, char*[]);
30 +extern int mo_check(struct Client*, struct Client*, int, char*[]);
31 extern int mo_clearmode(struct Client*, struct Client*, int, char*[]);
32 extern int mo_close(struct Client*, struct Client*, int, char*[]);
33 extern int mo_connect(struct Client*, struct Client*, int, char*[]);
34 @@ -195,6 +183,7 @@
35 extern int ms_asll(struct Client*, struct Client*, int, char*[]);
36 extern int ms_away(struct Client*, struct Client*, int, char*[]);
37 extern int ms_burst(struct Client*, struct Client*, int, char*[]);
38 +extern int ms_check(struct Client*, struct Client*, int, char*[]);
39 extern int ms_clearmode(struct Client*, struct Client*, int, char*[]);
40 extern int ms_connect(struct Client*, struct Client*, int, char*[]);
41 extern int ms_create(struct Client*, struct Client*, int, char*[]);
42 diff -r 26edd3f62b02 ircd/m_check.c
43 --- a/ircd/m_check.c Fri Jul 26 20:21:47 2013 +0100
44 +++ b/ircd/m_check.c Fri Jul 26 20:34:34 2013 +0100
45 @@ -31,6 +31,7 @@
46 #include "ircd_alloc.h"
47 #include "ircd_defs.h"
48 #include "ircd_features.h"
49 +#include "ircd_log.h"
50 #include "ircd_reply.h"
51 #include "ircd_string.h"
52 #include "ircd_snprintf.h"
53 @@ -87,33 +88,105 @@
54 * <hostmask> can be of the form host, user@host, nick!user@host,
55 * with host being host.domain.cc, 127.0.0.1 or 127.0.0.0/24.
56 * Wildcards are supported.
57 + *
58 + *
59 */
60
61 -int m_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) {
62 +/*
63 + * mo_check - oper message handler
64 + *
65 + * parv[0] = Send prefix
66 + * parv[1] = mask
67 + * parv[2] = -flags
68 + *
69 + * or for remote query
70 + *
71 + * parv[0] = Send prefix
72 + * parv[1] = remote server
73 + * parv[2] = mask
74 + * parv[3] = -flags
75 + *
76 + */
77 +int mo_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) {
78 + char *mask;
79 + char *doflags = NULL;
80 +
81 + assert(0 != IsAnOper(sptr));
82 +
83 + /* check privs */
84 + if (!HasPriv(sptr, PRIV_CHECK))
85 + return send_reply(sptr, ERR_NOPRIVILEGES);
86 +
87 + /* check params */
88 + if (parc < 2)
89 + return send_reply(sptr, ERR_NEEDMOREPARAMS, "CHECK");
90 +
91 + mask = parv[1];
92 + if (parc > 2)
93 + doflags = parv[2];
94 +
95 + /* remote query? */
96 + if ( parc > 3 || (parc == 3 && parv[2][0] != '-')) {
97 + if (hunt_server_cmd(sptr, CMD_CHECK, cptr, 0, parc > 3 ? "%C %s %s" : "%C %s", 1, parc, parv) != HUNTED_ISME)
98 + return 0;
99 + mask = parv[2];
100 + if (parc > 3)
101 + doflags = parv[3];
102 + }
103 +
104 + return do_check(sptr, mask, doflags);
105 +}
106 +
107 +
108 +
109 +/*
110 + * ms_check - server message handler
111 + *
112 + * parv[0] = Send prefix
113 + * parv[1] = target server
114 + * parv[2] = mask
115 + * parv[3] = -flags
116 + *
117 + */
118 +int ms_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) {
119 + char *mask;
120 + char *doflags = NULL;
121 +
122 + assert(0 != IsServer(cptr));
123 +
124 + /* check params */
125 + if (parc < 3) {
126 + protocol_violation(sptr, "Too few parameters for CHECK (got %d - need 3)", parc);
127 + return send_reply(sptr, ERR_NEEDMOREPARAMS, "CHECK");
128 + }
129 +
130 + /* remote query for me? */
131 + if (hunt_server_cmd(sptr, CMD_CHECK, cptr, 0, parc > 3 ? "%C %s %s" : "%C %s", 1, parc, parv) != HUNTED_ISME)
132 + return 0;
133 +
134 + mask = parv[2];
135 + if (parc > 3)
136 + doflags = parv[3];
137 +
138 + return do_check(sptr, mask, doflags);
139 +}
140 +
141 +
142 +
143 +/*
144 + * do_check
145 + *
146 + */
147 +int do_check(struct Client *sptr, char *mask, char *doflags) {
148 struct Channel *chptr;
149 struct Client *acptr;
150 int flags = CHECK_SHOWUSERS, i;
151
152 - if (!HasPriv(sptr, PRIV_CHECK))
153 - return send_reply(sptr, ERR_NOPRIVILEGES);
154 -
155 - if (parc < 2) {
156 - send_reply(sptr, ERR_NEEDMOREPARAMS, "CHECK");
157 - return 0;
158 - }
159 -
160 - if ( parc>=4 ||
161 - (parc==3 && parv[2][0] != '-')) {
162 - /* remote query */
163 - if (hunt_server_cmd(sptr, CMD_CHECK, cptr, 0, parc==4 ? "%C %s %s" : "%C %s", 1, parc, parv) != HUNTED_ISME)
164 - return 0;
165 - parv++; parc--;
166 - }
167
168 /* This checks to see if any flags have been supplied */
169 - if ((parc >= 3) && (parv[2][0] == '-')) {
170 - for (i = 0; parv[2][i]; i++) {
171 - switch (parv[2][i]) {
172 + if (doflags && doflags[0] == '-') {
173 + for (i = 0; doflags[i]; i++) {
174 + switch (doflags[i]) {
175 case 'c':
176 flags |= CHECK_CHECKCHAN;
177 break;
178 @@ -149,24 +222,24 @@
179 }
180 }
181
182 - if (IsChannelName(parv[1])) { /* channel */
183 - if ((chptr = FindChannel(parv[1]))) {
184 + if (IsChannelName(mask)) { /* channel */
185 + if ((chptr = FindChannel(mask))) {
186 checkChannel(sptr, chptr);
187 checkUsers(sptr, chptr, flags);
188 }
189 else
190 - send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", parv[1]);
191 + send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", mask);
192 }
193 - else if ((acptr = FindUser(parv[1]))) {
194 + else if ((acptr = FindUser(mask))) {
195 checkClient(sptr, acptr);
196 }
197 - else if ((acptr = FindServer(parv[1]))) { /* server */
198 + else if ((acptr = FindServer(mask))) { /* server */
199 checkServer(sptr, acptr);
200 }
201 - else if (checkHostmask(sptr, parv[1], flags) > 0) /* hostmask */
202 + else if (checkHostmask(sptr, mask, flags) > 0) /* hostmask */
203 return 1;
204 else /* no match */
205 - send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", parv[1]);
206 + send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", mask);
207
208 return 1;
209 }
210 diff -r 26edd3f62b02 ircd/parse.c
211 --- a/ircd/parse.c Fri Jul 26 20:21:47 2013 +0100
212 +++ b/ircd/parse.c Fri Jul 26 20:34:34 2013 +0100
213 @@ -668,21 +668,12 @@
214 { m_cap, m_cap, m_ignore, m_cap, m_ignore }
215 },
216 #endif
217 -
218 - /*
219 - * - ASUKA ---------------------------------------------------------------------
220 - * Add the command for CHECK.
221 - * This was adapted from Lain for use in Asuka.
222 - * Original code by Durzel (durzel@quakenet.org).
223 - *
224 - * qoreQ (qoreQ@quakenet.org) - 08/14/2002
225 - * -----------------------------------------------------------------------------
226 - */
227 {
228 MSG_CHECK,
229 TOK_CHECK,
230 0, MAXPARA, MFLG_SLOW, 0, NULL,
231 - { m_unregistered, m_not_oper, m_check, m_check, m_ignore }
232 + /* UNREG, CLIENT, SERVER, OPER, SERVICE */
233 + { m_unregistered, m_not_oper, ms_check, mo_check, m_ignore }
234 },
235
236 /* This command is an alias for QUIT during the unregistered part of