ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/src/m_error.c
Revision: 34
Committed: Sun Oct 2 21:05:51 2005 UTC (18 years, 5 months ago) by lusky
Content type: text/x-csrc
File size: 3065 byte(s)
Log Message:
create 7.2 branch, we can move/rename it as needed.


File Contents

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

Properties

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