/[svn]/ircd-hybrid-8/modules/m_services.c
ViewVC logotype

Contents of /ircd-hybrid-8/modules/m_services.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1502 - (show annotations)
Tue Aug 14 08:55:15 2012 UTC (7 years, 11 months ago) by michael
File MIME type: text/x-chdr
File size: 9335 byte(s)
- m_services.c: removed "IDENTIFY". Use "CS/NS IDENTIFY" instead

1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 *
4 * Copyright (C) 1999 by the Bahamut Development Team.
5 * Copyright (C) 2011 by the Hybrid Development Team.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 */
22
23 /*! \file m_services.c
24 * \brief Provides service aliases
25 * \version $Id$
26 */
27
28 #include "stdinc.h"
29 #include "client.h"
30 #include "ircd.h"
31 #include "channel_mode.h"
32 #include "numeric.h"
33 #include "conf.h"
34 #include "s_serv.h"
35 #include "send.h"
36 #include "parse.h"
37 #include "modules.h"
38 #include "irc_string.h"
39 #include "s_user.h"
40 #include "hash.h"
41
42
43 /*
44 * XXX: Each services alias handler is currently ugly copy&paste.
45 * Configureable aliases will get implemented.
46 */
47
48 static void
49 m_nickserv(struct Client *client_p, struct Client *source_p,
50 int parc, char *parv[])
51 {
52 struct Client *target_p = NULL;
53
54 assert(client_p && source_p);
55 assert(client_p == source_p);
56
57 if (EmptyString(parv[1]))
58 {
59 sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
60 me.name, source_p->name);
61 return;
62 }
63
64 if ((target_p = hash_find_server(ConfigFileEntry.service_name)))
65 {
66 sendto_one(target_p, ":%s PRIVMSG NickServ@%s :%s",
67 source_p->name, ConfigFileEntry.service_name, parv[1]);
68 return;
69 }
70
71 sendto_one(source_p, form_str(ERR_SERVICESDOWN),
72 me.name, source_p->name, "NickServ");
73 }
74
75 static void
76 m_chanserv(struct Client *client_p, struct Client *source_p,
77 int parc, char *parv[])
78 {
79 struct Client *target_p = NULL;
80
81 assert(client_p && source_p);
82 assert(client_p == source_p);
83
84 if (EmptyString(parv[1]))
85 {
86 sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
87 me.name, source_p->name);
88 return;
89 }
90
91 if ((target_p = hash_find_server(ConfigFileEntry.service_name)))
92 {
93 sendto_one(target_p, ":%s PRIVMSG ChanServ@%s :%s",
94 source_p->name, ConfigFileEntry.service_name, parv[1]);
95 return;
96 }
97
98 sendto_one(source_p, form_str(ERR_SERVICESDOWN),
99 me.name, source_p->name, "ChanServ");
100 }
101
102 static void
103 m_memoserv(struct Client *client_p, struct Client *source_p,
104 int parc, char *parv[])
105 {
106 struct Client *target_p = NULL;
107
108 assert(client_p && source_p);
109 assert(client_p == source_p);
110
111 if (EmptyString(parv[1]))
112 {
113 sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
114 me.name, source_p->name);
115 return;
116 }
117
118 if ((target_p = hash_find_server(ConfigFileEntry.service_name)))
119 {
120 sendto_one(target_p, ":%s PRIVMSG MemoServ@%s :%s",
121 source_p->name, ConfigFileEntry.service_name, parv[1]);
122 return;
123 }
124
125 sendto_one(source_p, form_str(ERR_SERVICESDOWN),
126 me.name, source_p->name, "MemoServ");
127 }
128
129 static void
130 m_operserv(struct Client *client_p, struct Client *source_p,
131 int parc, char *parv[])
132 {
133 struct Client *target_p = NULL;
134
135 assert(client_p && source_p);
136 assert(client_p == source_p);
137
138 if (EmptyString(parv[1]))
139 {
140 sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
141 me.name, source_p->name);
142 return;
143 }
144
145 if ((target_p = hash_find_server(ConfigFileEntry.service_name)))
146 {
147 sendto_one(target_p, ":%s PRIVMSG OperServ@%s :%s",
148 source_p->name, ConfigFileEntry.service_name, parv[1]);
149 return;
150 }
151
152 sendto_one(source_p, form_str(ERR_SERVICESDOWN),
153 me.name, source_p->name, "OperServ");
154 }
155
156 static void
157 m_statserv(struct Client *client_p, struct Client *source_p,
158 int parc, char *parv[])
159 {
160 struct Client *target_p = NULL;
161
162 assert(client_p && source_p);
163 assert(client_p == source_p);
164
165 if (EmptyString(parv[1]))
166 {
167 sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
168 me.name, source_p->name);
169 return;
170 }
171
172 if ((target_p = hash_find_server(ConfigFileEntry.service_name)))
173 {
174 sendto_one(target_p, ":%s PRIVMSG StatServ@%s :%s",
175 source_p->name, ConfigFileEntry.service_name, parv[1]);
176 return;
177 }
178
179 sendto_one(source_p, form_str(ERR_SERVICESDOWN),
180 me.name, source_p->name, "StatServ");
181 }
182
183 static void
184 m_helpserv(struct Client *client_p, struct Client *source_p,
185 int parc, char *parv[])
186 {
187 struct Client *target_p = NULL;
188
189 assert(client_p && source_p);
190 assert(client_p == source_p);
191
192 if (EmptyString(parv[1]))
193 {
194 sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
195 me.name, source_p->name);
196 return;
197 }
198
199 if ((target_p = hash_find_server(ConfigFileEntry.service_name)))
200 {
201 sendto_one(target_p, ":%s PRIVMSG HelpServ@%s :%s",
202 source_p->name, ConfigFileEntry.service_name, parv[1]);
203 return;
204 }
205
206 sendto_one(source_p, form_str(ERR_SERVICESDOWN),
207 me.name, source_p->name, "HelpServ");
208 }
209
210 static void
211 m_botserv(struct Client *client_p, struct Client *source_p,
212 int parc, char *parv[])
213 {
214 struct Client *target_p = NULL;
215
216 assert(client_p && source_p);
217 assert(client_p == source_p);
218
219 if (EmptyString(parv[1]))
220 {
221 sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
222 me.name, source_p->name);
223 return;
224 }
225
226 if ((target_p = hash_find_server(ConfigFileEntry.service_name)))
227 {
228 sendto_one(target_p, ":%s PRIVMSG BotServ@%s :%s",
229 source_p->name, ConfigFileEntry.service_name, parv[1]);
230 return;
231 }
232
233 sendto_one(source_p, form_str(ERR_SERVICESDOWN),
234 me.name, source_p->name, "BotServ");
235 }
236
237
238 static struct Message ms_msgtab = {
239 "MS", 0, 0, 0, 1, MFLG_SLOW, 0,
240 {m_unregistered, m_memoserv, m_ignore, m_ignore, m_memoserv, m_ignore}
241 };
242
243 static struct Message ns_msgtab = {
244 "NS", 0, 0, 0, 1, MFLG_SLOW, 0,
245 {m_unregistered, m_nickserv, m_ignore, m_ignore, m_nickserv, m_ignore}
246 };
247
248 static struct Message os_msgtab = {
249 "OS", 0, 0, 0, 1, MFLG_SLOW, 0,
250 {m_unregistered, m_operserv, m_ignore, m_ignore, m_operserv, m_ignore}
251 };
252
253 static struct Message bs_msgtab = {
254 "BS", 0, 0, 0, 1, MFLG_SLOW, 0,
255 {m_unregistered, m_botserv, m_ignore, m_ignore, m_botserv, m_ignore}
256 };
257
258 static struct Message cs_msgtab = {
259 "CS", 0, 0, 0, 1, MFLG_SLOW, 0,
260 {m_unregistered, m_chanserv, m_ignore, m_ignore, m_chanserv, m_ignore}
261 };
262
263 static struct Message ss_msgtab = {
264 "SS", 0, 0, 0, 1, MFLG_SLOW, 0,
265 {m_unregistered, m_statserv, m_ignore, m_ignore, m_statserv, m_ignore}
266 };
267
268 static struct Message hs_msgtab = {
269 "HS", 0, 0, 0, 1, MFLG_SLOW, 0,
270 {m_unregistered, m_helpserv, m_ignore, m_ignore, m_helpserv, m_ignore}
271 };
272
273 static struct Message botserv_msgtab = {
274 "BOTSERV", 0, 0, 0, 1, MFLG_SLOW, 0,
275 {m_unregistered, m_botserv, m_ignore, m_ignore, m_botserv, m_ignore}
276 };
277
278 static struct Message chanserv_msgtab = {
279 "CHANSERV", 0, 0, 0, 1, MFLG_SLOW, 0,
280 {m_unregistered, m_chanserv, m_ignore, m_ignore, m_chanserv, m_ignore}
281 };
282
283 static struct Message memoserv_msgtab = {
284 "MEMOSERV", 0, 0, 0, 1, MFLG_SLOW, 0,
285 {m_unregistered, m_memoserv, m_ignore, m_ignore, m_memoserv, m_ignore}
286 };
287
288 static struct Message nickserv_msgtab = {
289 "NICKSERV", 0, 0, 0, 1, MFLG_SLOW, 0,
290 {m_unregistered, m_nickserv, m_ignore, m_ignore, m_nickserv, m_ignore}
291 };
292
293 static struct Message operserv_msgtab = {
294 "OPERSERV", 0, 0, 0, 1, MFLG_SLOW, 0,
295 {m_unregistered, m_operserv, m_ignore, m_ignore, m_operserv, m_ignore}
296 };
297
298 static struct Message statserv_msgtab = {
299 "STATSERV", 0, 0, 0, 1, MFLG_SLOW, 0,
300 {m_unregistered, m_statserv, m_ignore, m_ignore, m_statserv, m_ignore}
301 };
302
303 static struct Message helpserv_msgtab = {
304 "HELPSERV", 0, 0, 0, 1, MFLG_SLOW, 0,
305 {m_unregistered, m_helpserv, m_ignore, m_ignore, m_helpserv, m_ignore}
306 };
307
308
309 static void
310 module_init(void)
311 {
312 mod_add_cmd(&botserv_msgtab);
313 mod_add_cmd(&chanserv_msgtab);
314 mod_add_cmd(&memoserv_msgtab);
315 mod_add_cmd(&nickserv_msgtab);
316 mod_add_cmd(&operserv_msgtab);
317 mod_add_cmd(&statserv_msgtab);
318 mod_add_cmd(&helpserv_msgtab);
319 mod_add_cmd(&bs_msgtab);
320 mod_add_cmd(&ns_msgtab);
321 mod_add_cmd(&cs_msgtab);
322 mod_add_cmd(&ms_msgtab);
323 mod_add_cmd(&os_msgtab);
324 mod_add_cmd(&ss_msgtab);
325 mod_add_cmd(&hs_msgtab);
326 }
327
328 static void
329 module_exit(void)
330 {
331 mod_del_cmd(&botserv_msgtab);
332 mod_del_cmd(&chanserv_msgtab);
333 mod_del_cmd(&memoserv_msgtab);
334 mod_del_cmd(&nickserv_msgtab);
335 mod_del_cmd(&operserv_msgtab);
336 mod_del_cmd(&statserv_msgtab);
337 mod_del_cmd(&helpserv_msgtab);
338 mod_del_cmd(&bs_msgtab);
339 mod_del_cmd(&ns_msgtab);
340 mod_del_cmd(&cs_msgtab);
341 mod_del_cmd(&ms_msgtab);
342 mod_del_cmd(&os_msgtab);
343 mod_del_cmd(&ss_msgtab);
344 mod_del_cmd(&hs_msgtab);
345 }
346
347 struct module module_entry = {
348 .node = { NULL, NULL, NULL },
349 .name = NULL,
350 .version = "$Revision$",
351 .handle = NULL,
352 .modinit = module_init,
353 .modexit = module_exit,
354 .flags = 0
355 };

Properties

Name Value
svn:keywords Id Revision

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28