/[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 953 - (show annotations)
Sun Jul 26 21:22:42 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: 3195 byte(s)
- propset keywords

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 "common.h" /* FALSE */
29 #include "ircd.h"
30 #include "send.h"
31 #include "msg.h"
32 #include "memory.h"
33 #include "modules.h"
34 #include "s_log.h"
35
36
37 static void m_error(struct Client *, struct Client *, int, char *[]);
38 static void ms_error(struct Client *, struct Client *, int, char *[]);
39
40 struct Message error_msgtab = {
41 "ERROR", 0, 0, 1, 0, MFLG_SLOW | MFLG_UNREG, 0,
42 { m_error, m_ignore, ms_error, m_ignore, m_ignore, m_ignore }
43 };
44
45 /*
46 * Note: At least at protocol level ERROR has only one parameter.
47 * --msa
48 *
49 * parv[0] = sender prefix
50 * parv[*] = parameters
51 */
52 void
53 m_error(struct Client *client_p, struct Client *source_p,
54 int parc, char *parv[])
55 {
56 const char *para;
57
58 para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";
59
60 ilog(L_ERROR, "Received ERROR message from %s: %s",
61 source_p->name, para);
62
63 if (client_p == source_p)
64 {
65 sendto_realops_flags(UMODE_ALL, L_ADMIN, "ERROR :from %s -- %s",
66 get_client_name(client_p, HIDE_IP), para);
67 sendto_realops_flags(UMODE_ALL, L_OPER, "ERROR :from %s -- %s",
68 get_client_name(client_p, MASK_IP), para);
69 }
70 else
71 {
72 sendto_realops_flags(UMODE_ALL, L_OPER, "ERROR :from %s via %s -- %s",
73 source_p->name, get_client_name(client_p, MASK_IP), para);
74 sendto_realops_flags(UMODE_ALL, L_ADMIN, "ERROR :from %s via %s -- %s",
75 source_p->name, get_client_name(client_p, HIDE_IP), para);
76 }
77
78 if (MyClient(source_p))
79 exit_client(source_p, source_p, "ERROR");
80 }
81
82 void
83 ms_error(struct Client *client_p, struct Client *source_p,
84 int parc, char *parv[])
85 {
86 const char *para;
87
88 para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";
89
90 ilog(L_ERROR, "Received ERROR message from %s: %s",
91 source_p->name, para);
92
93 if (client_p == source_p)
94 sendto_realops_flags(UMODE_ALL, L_ALL, "ERROR :from %s -- %s",
95 get_client_name(client_p, MASK_IP), para);
96 else
97 sendto_realops_flags(UMODE_ALL, L_ALL, "ERROR :from %s via %s -- %s",
98 source_p->name,
99 get_client_name(client_p, MASK_IP), para);
100 }

Properties

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

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