/[svn]/ircd-hybrid-7.2/contrib/spy_trace_notice.c
ViewVC logotype

Contents of /ircd-hybrid-7.2/contrib/spy_trace_notice.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 448 - (show annotations)
Sun Feb 12 10:55:28 2006 UTC (14 years, 4 months ago) by michael
File MIME type: text/x-chdr
File size: 4198 byte(s)
- Backported spy_trace_notice module unload fix

1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * spy_trace_notice.c: Sends a notice when someone uses TRACE or LTRACE
4 *
5 * Copyright (C) 2002 Hybrid Development Team
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 #ifndef STATIC_MODULES
27 #include "tools.h"
28 #include "modules.h"
29 #include "hook.h"
30 #include "client.h"
31 #include "ircd.h"
32 #include "send.h"
33
34 static struct Callback *trace_cb = NULL, *ltrace_cb = NULL;
35 static struct Callback *ctrace_cb = NULL, *etrace_cb = NULL;
36 static dlink_node *prev_trace, *prev_ltrace;
37 static dlink_node *prev_ctrace, *prev_etrace;
38
39 static void *show_trace(va_list);
40 static void *show_ltrace(va_list);
41 static void *show_ctrace(va_list);
42 static void *show_etrace(va_list);
43
44 void
45 _modinit(void)
46 {
47 if ((trace_cb = find_callback("doing_trace")))
48 prev_trace = install_hook(trace_cb, show_trace);
49
50 if ((ltrace_cb = find_callback("doing_ltrace")))
51 prev_ltrace = install_hook(ltrace_cb, show_ltrace);
52
53 if ((ctrace_cb = find_callback("doing_ctrace")))
54 prev_ctrace = install_hook(ctrace_cb, show_ctrace);
55
56 if ((etrace_cb = find_callback("doing_etrace")))
57 prev_etrace = install_hook(etrace_cb, show_etrace);
58 }
59
60 void
61 _moddeinit(void)
62 {
63 if (trace_cb)
64 uninstall_hook(trace_cb, show_trace);
65
66 if (ltrace_cb)
67 uninstall_hook(ltrace_cb, show_ltrace);
68
69 if (ctrace_cb)
70 uninstall_hook(ctrace_cb, show_ctrace);
71
72 if (etrace_cb)
73 uninstall_hook(etrace_cb, show_etrace);
74 }
75
76 const char *_version = "$Revision$";
77
78 static void *
79 show_trace(va_list args)
80 {
81 struct Client *source_p = va_arg(args, struct Client *);
82 int parc = va_arg(args, int);
83 char **parv = va_arg(args, char **);
84
85 if (IsClient(source_p))
86 sendto_realops_flags(UMODE_SPY, L_ALL,
87 "trace requested by %s (%s@%s) [%s]",
88 source_p->name, source_p->username,
89 source_p->host, source_p->servptr->name);
90
91 return pass_callback(prev_trace, source_p, parc, parv);
92 }
93
94 static void *
95 show_ltrace(va_list args)
96 {
97 struct Client *source_p = va_arg(args, struct Client *);
98 int parc = va_arg(args, int);
99 char **parv = va_arg(args, char **);
100
101 if (IsClient(source_p))
102 sendto_realops_flags(UMODE_SPY, L_ALL,
103 "ltrace requested by %s (%s@%s) [%s]",
104 source_p->name, source_p->username,
105 source_p->host, source_p->servptr->name);
106
107 return pass_callback(prev_ltrace, source_p, parc, parv);
108 }
109
110 static void *
111 show_ctrace(va_list args)
112 {
113 struct Client *source_p = va_arg(args, struct Client *);
114 int parc = va_arg(args, int);
115 char **parv = va_arg(args, char **);
116
117 if (IsClient(source_p))
118 sendto_realops_flags(UMODE_SPY, L_ALL,
119 "ctrace requested by %s (%s@%s) [%s]",
120 source_p->name, source_p->username,
121 source_p->host, source_p->servptr->name);
122
123 return pass_callback(prev_ctrace, source_p, parc, parv);
124 }
125
126 static void *
127 show_etrace(va_list args)
128 {
129 struct Client *source_p = va_arg(args, struct Client *);
130 int parc = va_arg(args, int);
131 char **parv = va_arg(args, char **);
132
133 if (IsClient(source_p))
134 sendto_realops_flags(UMODE_SPY, L_ALL,
135 "etrace requested by %s (%s@%s) [%s]",
136 source_p->name, source_p->username,
137 source_p->host, source_p->servptr->name);
138
139 return pass_callback(prev_etrace, source_p, parc, parv);
140 }
141 #endif

Properties

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

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