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