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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (hide annotations)
Sun Oct 2 20:41:23 2005 UTC (14 years, 3 months ago) by knight
Original Path: ircd-hybrid/contrib/spy_trace_notice.c
File MIME type: text/x-chdr
File size: 4136 byte(s)
- svn:keywords

1 adx 30 /*
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 knight 31 * $Id$
23 adx 30 */
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    
73 knight 31 const char *_version = "$Revision$";
74 adx 30
75     static void *
76     show_trace(va_list args)
77     {
78     struct Client *source_p = va_arg(args, struct Client *);
79     int parc = va_arg(args, int);
80     char **parv = va_arg(args, char **);
81    
82     if (IsClient(source_p))
83     sendto_realops_flags(UMODE_SPY, L_ALL,
84     "trace requested by %s (%s@%s) [%s]",
85     source_p->name, source_p->username,
86     source_p->host, source_p->servptr->name);
87    
88     return pass_callback(prev_trace, source_p, parc, parv);
89     }
90    
91     static void *
92     show_ltrace(va_list args)
93     {
94     struct Client *source_p = va_arg(args, struct Client *);
95     int parc = va_arg(args, int);
96     char **parv = va_arg(args, char **);
97    
98     if (IsClient(source_p))
99     sendto_realops_flags(UMODE_SPY, L_ALL,
100     "ltrace requested by %s (%s@%s) [%s]",
101     source_p->name, source_p->username,
102     source_p->host, source_p->servptr->name);
103    
104     return pass_callback(prev_ltrace, source_p, parc, parv);
105     }
106    
107     static void *
108     show_ctrace(va_list args)
109     {
110     struct Client *source_p = va_arg(args, struct Client *);
111     int parc = va_arg(args, int);
112     char **parv = va_arg(args, char **);
113    
114     if (IsClient(source_p))
115     sendto_realops_flags(UMODE_SPY, L_ALL,
116     "ctrace requested by %s (%s@%s) [%s]",
117     source_p->name, source_p->username,
118     source_p->host, source_p->servptr->name);
119    
120     return pass_callback(prev_ctrace, source_p, parc, parv);
121     }
122    
123     static void *
124     show_etrace(va_list args)
125     {
126     struct Client *source_p = va_arg(args, struct Client *);
127     int parc = va_arg(args, int);
128     char **parv = va_arg(args, char **);
129    
130     if (IsClient(source_p))
131     sendto_realops_flags(UMODE_SPY, L_ALL,
132     "etrace requested by %s (%s@%s) [%s]",
133     source_p->name, source_p->username,
134     source_p->host, source_p->servptr->name);
135    
136     return pass_callback(prev_etrace, source_p, parc, parv);
137     }
138     #endif

Properties

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

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