ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/contrib/spy_trace_notice.c
Revision: 76
Committed: Tue Oct 4 19:38:49 2005 UTC (20 years, 10 months ago) by adx
Content type: text/x-csrc
File size: 4099 byte(s)
Log Message:
- fixed contrib #includes

File Contents

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

Properties

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