/[svn]/ircd-hybrid/modules/core/m_error.c
ViewVC logotype

Contents of /ircd-hybrid/modules/core/m_error.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 965 - (show annotations)
Sat Aug 1 16:14:03 2009 UTC (11 years, 10 months ago) by michael
Original Path: ircd-hybrid-7.2/modules/core/m_error.c
File MIME type: text/x-chdr
File size: 3291 byte(s)
- add misssing _modinit/_moddeinit entry point functions to m_error.c

1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_error.c: Handles error messages from the other end.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
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 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "handlers.h"
27 #include "client.h"
28 #include "ircd.h"
29 #include "send.h"
30 #include "msg.h"
31 #include "modules.h"
32 #include "s_log.h"
33
34
35 static void m_error(struct Client *, struct Client *, int, char *[]);
36 static void ms_error(struct Client *, struct Client *, int, char *[]);
37
38 struct Message error_msgtab = {
39 "ERROR", 0, 0, 1, 0, MFLG_SLOW | MFLG_UNREG, 0,
40 { m_error, m_ignore, ms_error, m_ignore, m_ignore, m_ignore }
41 };
42
43 void
44 _modinit(void)
45 {
46 mod_add_cmd(&error_msgtab);
47 }
48
49 void
50 _moddeinit(void)
51 {
52 mod_del_cmd(&error_msgtab);
53 }
54
55 const char *_version = "$Revision$";
56
57 /*
58 * Note: At least at protocol level ERROR has only one parameter.
59 * --msa
60 *
61 * parv[0] = sender prefix
62 * parv[*] = parameters
63 */
64 void
65 m_error(struct Client *client_p, struct Client *source_p,
66 int parc, char *parv[])
67 {
68 const char *para;
69
70 para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";
71
72 ilog(L_ERROR, "Received ERROR message from %s: %s",
73 source_p->name, para);
74
75 if (client_p == source_p)
76 {
77 sendto_realops_flags(UMODE_ALL, L_ADMIN, "ERROR :from %s -- %s",
78 get_client_name(client_p, HIDE_IP), para);
79 sendto_realops_flags(UMODE_ALL, L_OPER, "ERROR :from %s -- %s",
80 get_client_name(client_p, MASK_IP), para);
81 }
82 else
83 {
84 sendto_realops_flags(UMODE_ALL, L_OPER, "ERROR :from %s via %s -- %s",
85 source_p->name, get_client_name(client_p, MASK_IP), para);
86 sendto_realops_flags(UMODE_ALL, L_ADMIN, "ERROR :from %s via %s -- %s",
87 source_p->name, get_client_name(client_p, HIDE_IP), para);
88 }
89
90 if (MyClient(source_p))
91 exit_client(source_p, source_p, "ERROR");
92 }
93
94 void
95 ms_error(struct Client *client_p, struct Client *source_p,
96 int parc, char *parv[])
97 {
98 const char *para;
99
100 para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";
101
102 ilog(L_ERROR, "Received ERROR message from %s: %s",
103 source_p->name, para);
104
105 if (client_p == source_p)
106 sendto_realops_flags(UMODE_ALL, L_ALL, "ERROR :from %s -- %s",
107 get_client_name(client_p, MASK_IP), para);
108 else
109 sendto_realops_flags(UMODE_ALL, L_ALL, "ERROR :from %s via %s -- %s",
110 source_p->name,
111 get_client_name(client_p, MASK_IP), para);
112 }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision

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