| 24 |
|
|
| 25 |
|
#include "stdinc.h" |
| 26 |
|
#include "list.h" |
| 27 |
– |
#include "handlers.h" |
| 28 |
– |
#include "hook.h" |
| 27 |
|
#include "client.h" |
| 28 |
|
#include "hash.h" |
| 31 |
– |
#include "common.h" |
| 29 |
|
#include "irc_string.h" |
| 30 |
|
#include "ircd.h" |
| 31 |
|
#include "numeric.h" |
| 33 |
|
#include "s_bsd.h" |
| 34 |
|
#include "s_serv.h" |
| 35 |
|
#include "send.h" |
| 39 |
– |
#include "msg.h" |
| 36 |
|
#include "parse.h" |
| 37 |
|
#include "modules.h" |
| 38 |
< |
#include "s_conf.h" |
| 38 |
> |
#include "conf.h" |
| 39 |
> |
#include "conf_class.h" |
| 40 |
|
|
| 41 |
|
|
| 45 |
– |
static void do_etrace(struct Client *, int, char *[]); |
| 46 |
– |
static void mo_etrace(struct Client *, struct Client *, int, char *[]); |
| 47 |
– |
|
| 48 |
– |
struct Message etrace_msgtab = { |
| 49 |
– |
"ETRACE", 0, 0, 0, 0, MFLG_SLOW, 0, |
| 50 |
– |
{m_unregistered, m_not_oper, m_ignore, m_ignore, mo_etrace, m_ignore} |
| 51 |
– |
}; |
| 52 |
– |
|
| 53 |
– |
const char *_version = "$Revision$"; |
| 54 |
– |
|
| 55 |
– |
void |
| 56 |
– |
_modinit(void) |
| 57 |
– |
{ |
| 58 |
– |
mod_add_cmd(&etrace_msgtab); |
| 59 |
– |
} |
| 60 |
– |
|
| 61 |
– |
void |
| 62 |
– |
_moddeinit(void) |
| 63 |
– |
{ |
| 64 |
– |
mod_del_cmd(&etrace_msgtab); |
| 65 |
– |
} |
| 66 |
– |
|
| 42 |
|
static void report_this_status(struct Client *, struct Client *, int); |
| 43 |
|
|
| 44 |
|
/* |
| 54 |
|
int full_etrace = 0; |
| 55 |
|
dlink_node *ptr; |
| 56 |
|
|
| 57 |
< |
sendto_realops_flags(UMODE_SPY, L_ALL, |
| 57 |
> |
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
| 58 |
|
"ETRACE requested by %s (%s@%s) [%s]", |
| 59 |
|
source_p->name, source_p->username, |
| 60 |
|
source_p->host, source_p->servptr->name); |
| 63 |
|
{ |
| 64 |
|
if (irccmp(parv[1], "-full") == 0) |
| 65 |
|
{ |
| 66 |
< |
parv++; |
| 67 |
< |
parc--; |
| 66 |
> |
++parv; |
| 67 |
> |
--parc; |
| 68 |
|
full_etrace = 1; |
| 69 |
|
} |
| 70 |
|
} |
| 74 |
|
tname = parv[1]; |
| 75 |
|
|
| 76 |
|
if (tname != NULL) |
| 77 |
< |
wilds = strchr(tname, '*') || strchr(tname, '?'); |
| 77 |
> |
wilds = has_wildcards(tname); |
| 78 |
|
else |
| 79 |
|
tname = "*"; |
| 80 |
|
} |
| 84 |
|
tname = "*"; |
| 85 |
|
} |
| 86 |
|
|
| 87 |
< |
if (IsFull(source_p)) |
| 87 |
> |
if (HasUMode(source_p, UMODE_CCONN_FULL)) |
| 88 |
|
full_etrace = 1; |
| 89 |
|
|
| 90 |
|
if (!wilds && !do_all) |
| 91 |
|
{ |
| 92 |
< |
target_p = find_client(tname); |
| 92 |
> |
target_p = hash_find_client(tname); |
| 93 |
|
|
| 94 |
|
if (target_p && MyClient(target_p)) |
| 95 |
|
report_this_status(source_p, target_p, full_etrace); |
| 105 |
|
|
| 106 |
|
if (wilds) |
| 107 |
|
{ |
| 108 |
< |
if (match(tname, target_p->name)) |
| 108 |
> |
if (!match(tname, target_p->name)) |
| 109 |
|
report_this_status(source_p, target_p, full_etrace); |
| 110 |
|
} |
| 111 |
|
else |
| 139 |
|
report_this_status(struct Client *source_p, struct Client *target_p, |
| 140 |
|
int full_etrace) |
| 141 |
|
{ |
| 167 |
– |
const char *name; |
| 168 |
– |
const char *class_name; |
| 169 |
– |
|
| 170 |
– |
name = get_client_name(target_p, HIDE_IP); |
| 171 |
– |
class_name = get_client_class(target_p); |
| 172 |
– |
|
| 173 |
– |
set_time(); |
| 174 |
– |
|
| 142 |
|
if (target_p->status == STAT_CLIENT) |
| 143 |
|
{ |
| 144 |
|
if (full_etrace) |
| 147 |
|
sendto_one(source_p, form_str(RPL_ETRACE_FULL), |
| 148 |
|
me.name, |
| 149 |
|
source_p->name, |
| 150 |
< |
IsOper(target_p) ? "Oper" : "User", |
| 151 |
< |
class_name, |
| 150 |
> |
HasUMode(target_p, UMODE_OPER) ? "Oper" : "User", |
| 151 |
> |
get_client_class(&target_p->localClient->confs), |
| 152 |
|
target_p->name, |
| 153 |
|
target_p->username, |
| 154 |
|
target_p->host, |
| 160 |
|
sendto_one(source_p, form_str(RPL_ETRACE_FULL), |
| 161 |
|
me.name, |
| 162 |
|
source_p->name, |
| 163 |
< |
IsOper(target_p) ? "Oper" : "User", |
| 164 |
< |
class_name, |
| 163 |
> |
HasUMode(target_p, UMODE_OPER) ? "Oper" : "User", |
| 164 |
> |
get_client_class(&target_p->localClient->confs), |
| 165 |
|
target_p->name, |
| 166 |
|
target_p->username, |
| 167 |
|
target_p->host, |
| 176 |
|
sendto_one(source_p, form_str(RPL_ETRACE), |
| 177 |
|
me.name, |
| 178 |
|
source_p->name, |
| 179 |
< |
IsOper(target_p) ? "Oper" : "User", |
| 180 |
< |
class_name, |
| 179 |
> |
HasUMode(target_p, UMODE_OPER) ? "Oper" : "User", |
| 180 |
> |
get_client_class(&target_p->localClient->confs), |
| 181 |
|
target_p->name, |
| 182 |
|
target_p->username, |
| 183 |
|
target_p->host, |
| 187 |
|
sendto_one(source_p, form_str(RPL_ETRACE), |
| 188 |
|
me.name, |
| 189 |
|
source_p->name, |
| 190 |
< |
IsOper(target_p) ? "Oper" : "User", |
| 191 |
< |
class_name, |
| 190 |
> |
HasUMode(target_p, UMODE_OPER) ? "Oper" : "User", |
| 191 |
> |
get_client_class(&target_p->localClient->confs), |
| 192 |
|
target_p->name, |
| 193 |
|
target_p->username, |
| 194 |
|
target_p->host, |
| 197 |
|
} |
| 198 |
|
} |
| 199 |
|
} |
| 200 |
+ |
|
| 201 |
+ |
static struct Message etrace_msgtab = { |
| 202 |
+ |
"ETRACE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
| 203 |
+ |
{m_unregistered, m_not_oper, m_ignore, m_ignore, mo_etrace, m_ignore} |
| 204 |
+ |
}; |
| 205 |
+ |
|
| 206 |
+ |
static void |
| 207 |
+ |
module_init(void) |
| 208 |
+ |
{ |
| 209 |
+ |
mod_add_cmd(&etrace_msgtab); |
| 210 |
+ |
} |
| 211 |
+ |
|
| 212 |
+ |
static void |
| 213 |
+ |
module_exit(void) |
| 214 |
+ |
{ |
| 215 |
+ |
mod_del_cmd(&etrace_msgtab); |
| 216 |
+ |
} |
| 217 |
+ |
|
| 218 |
+ |
struct module module_entry = { |
| 219 |
+ |
.node = { NULL, NULL, NULL }, |
| 220 |
+ |
.name = NULL, |
| 221 |
+ |
.version = "$Revision$", |
| 222 |
+ |
.handle = NULL, |
| 223 |
+ |
.modinit = module_init, |
| 224 |
+ |
.modexit = module_exit, |
| 225 |
+ |
.flags = 0 |
| 226 |
+ |
}; |