2 * ircd-ratbox: A slightly useful ircd.
3 * m_error.c: Handles error messages from the other end.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * $Id: m_error.c 21510 2005-12-19 18:57:37Z leeh $
29 #include "common.h" /* FALSE */
39 static int m_error(struct Client
*, struct Client
*, int, const char **);
40 static int ms_error(struct Client
*, struct Client
*, int, const char **);
42 struct Message error_msgtab
= {
43 "ERROR", 0, 0, 0, MFLG_SLOW
| MFLG_UNREG
,
44 {{m_error
, 0}, mg_ignore
, mg_ignore
, {ms_error
, 0}, mg_ignore
, mg_ignore
}
47 mapi_clist_av1 error_clist
[] = {
51 DECLARE_MODULE_AV1(error
, NULL
, NULL
, error_clist
, NULL
, NULL
, "$Revision: 21510 $");
55 * Note: At least at protocol level ERROR has only one parameter,
56 * although this is called internally from other functions
59 * parv[0] = sender prefix
60 * parv[*] = parameters
63 m_error(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
67 para
= (parc
> 1 && *parv
[1] != '\0') ? parv
[1] : "<>";
69 ilog(L_SERVER
, "Received ERROR message from %s: %s",
70 source_p
->sockhost
, para
);
72 if(IsAnyServer(client_p
) && ConfigFileEntry
.hide_error_messages
< 2)
74 sendto_realops_flags(UMODE_ALL
, L_ADMIN
,
75 "ERROR :from %s[@255.255.255.255] -- %s",
76 EmptyString(client_p
->name
) ? "" : client_p
->name
, para
);
78 if(!ConfigFileEntry
.hide_error_messages
)
79 sendto_realops_flags(UMODE_ALL
, L_OPER
,
80 "ERROR :from %s[@255.255.255.255] -- %s",
81 EmptyString(client_p
->name
) ? "" : client_p
->name
, para
);
84 exit_client(client_p
, source_p
, source_p
, "ERROR");
90 ms_error(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
94 para
= (parc
> 1 && *parv
[1] != '\0') ? parv
[1] : "<>";
96 ilog(L_SERVER
, "Received ERROR message from %s: %s",
97 log_client_name(source_p
, SHOW_IP
), para
);
99 if(ConfigFileEntry
.hide_error_messages
== 2)
102 if(client_p
== source_p
)
104 sendto_realops_flags(UMODE_ALL
, L_ADMIN
, "ERROR :from %s -- %s",
105 client_p
->name
, para
);
107 if(!ConfigFileEntry
.hide_error_messages
)
108 sendto_realops_flags(UMODE_ALL
, L_OPER
,
109 "ERROR :from %s -- %s",
110 client_p
->name
, para
);
114 sendto_realops_flags(UMODE_ALL
, L_ADMIN
, "ERROR :from %s via %s -- %s",
115 source_p
->name
, client_p
->name
, para
);
117 if(!ConfigFileEntry
.hide_error_messages
)
118 sendto_realops_flags(UMODE_ALL
, L_OPER
,
119 "ERROR :from %s via %s -- %s",
120 source_p
->name
, client_p
->name
, para
);