More RCS keyword removal...
[seven-1.x.git] / modules / core / m_error.c
blob60b06c723993dc1b843686e31b6a0b64c758b677
1 /* {{{ irc-seven: Cows like it.
3 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
4 * Copyright (C) 1996-2002 Hybrid Development Team
5 * Copyright (C) 2002-2005 ircd-ratbox development team
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.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to:
20 * Free Software Foundation, Inc.
21 * 51 Franklin St - Fifth Floor
22 * Boston, MA 02110-1301
23 * USA
25 * }}} */
27 /* {{{ Includes. */
28 #include "stdinc.h"
29 #include "client.h"
30 #include "common.h"
31 #include "ircd.h"
32 #include "numeric.h"
33 #include "send.h"
34 #include "msg.h"
35 #include "memory.h"
36 #include "modules.h"
37 #include "s_log.h"
38 #include "s_conf.h"
39 /* }}} */
41 static int m_error (struct Client *, struct Client *, int, const char **);
42 static int ms_error (struct Client *, struct Client *, int, const char **);
44 /* {{{ struct Message error_msgtab = { ... }
46 * This message handler table is referenced in src/module.c and used by
47 * support code for the vaious MOD* commands and therefore cannot be
48 * static.
50 struct Message error_msgtab =
52 "ERROR", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
54 {m_error, 0}, mg_ignore, mg_ignore,
55 {ms_error, 0}, mg_ignore, mg_ignore,
58 /* }}} */
60 mapi_clist_av1 error_clist[] =
62 &error_msgtab,
63 NULL,
66 /* {{{ DECLARE_MODULE_AV1(...) */
67 DECLARE_MODULE_AV1
69 error,
70 NULL,
71 NULL,
72 error_clist,
73 NULL,
74 NULL,
75 "1.1"
77 /* }}} */
79 /* {{{ m_error()
81 * Usage:
82 * ERROR [<message>]
84 * Note: At least at protocol level ERROR has only one parameter,
85 * although this is called internally from other functions
86 * --msa
88 * parv[0] - prefix
89 * parv[1] - message
91 int
92 m_error (struct Client *client_p, struct Client *source_p, int parc, const char **parv)
94 const char *para = "<>";
96 if (parc > 1 && !EmptyString(parv[1]))
97 para = parv[1];
99 ilog(L_SERVER, "Received ERROR message from %s: %s",
100 log_client_name(source_p, SHOW_IP), para);
102 if (IsAnyServer(client_p) && ConfigFileEntry.hide_error_messages < 2)
104 sendto_realops_snomask(SNO_GENERAL, L_ADMIN,
105 "ERROR :from %s -- %s",
106 get_server_name(client_p, HIDE_IP), para);
108 if (!ConfigFileEntry.hide_error_messages)
109 sendto_realops_snomask(SNO_GENERAL, L_OPER,
110 "ERROR :from %s -- %s",
111 get_server_name(client_p, HIDE_IP), para);
114 exit_client(client_p, source_p, source_p, "ERROR");
115 return 0;
117 /* }}} */
119 /* {{{ ms_error()
121 * Usage:
122 * ERROR [<message>]
124 * parv[0] - prefix
125 * parv[1] - message
127 static int
128 ms_error(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
130 const char *para = "<>";
132 if (parc > 1 && !EmptyString(parv[1]))
133 para = parv[1];
135 ilog(L_SERVER, "Received ERROR message from %s: %s",
136 log_client_name(source_p, SHOW_IP), para);
138 if(ConfigFileEntry.hide_error_messages == 2)
139 return 0;
141 if(client_p == source_p)
143 sendto_realops_snomask(SNO_GENERAL, L_ADMIN,
144 "ERROR :from %s -- %s",
145 get_server_name(client_p, HIDE_IP), para);
147 if(!ConfigFileEntry.hide_error_messages)
148 sendto_realops_snomask(SNO_GENERAL, L_OPER,
149 "ERROR :from %s -- %s",
150 get_server_name(client_p, HIDE_IP), para);
152 else
154 sendto_realops_snomask(SNO_GENERAL, L_ADMIN,
155 "ERROR :from %s via %s -- %s", source_p->name,
156 get_server_name(client_p, HIDE_IP), para);
158 if(!ConfigFileEntry.hide_error_messages)
159 sendto_realops_snomask(SNO_GENERAL, L_OPER,
160 "ERROR :from %s via %s -- %s",
161 source_p->name,
162 get_server_name(client_p, HIDE_IP), para);
165 return 0;
167 /* }}} */
170 * vim: ts=8 sw=8 noet fdm=marker tw=80