| 19 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 20 |
|
* USA |
| 21 |
|
* |
| 22 |
< |
* $Id: m_whois.c,v 1.145 2005/09/27 12:43:33 adx Exp $ |
| 22 |
> |
* $Id$ |
| 23 |
|
*/ |
| 24 |
|
|
| 25 |
|
#include "stdinc.h" |
| 26 |
< |
#include "fdlist.h" |
| 27 |
< |
#include "tools.h" |
| 26 |
> |
#include "list.h" |
| 27 |
|
#include "common.h" |
| 28 |
|
#include "handlers.h" |
| 29 |
|
#include "client.h" |
| 36 |
|
#include "s_misc.h" |
| 37 |
|
#include "s_serv.h" |
| 38 |
|
#include "send.h" |
| 40 |
– |
#include "list.h" |
| 39 |
|
#include "irc_string.h" |
| 40 |
|
#include "sprintf_irc.h" |
| 41 |
|
#include "msg.h" |
| 57 |
|
}; |
| 58 |
|
|
| 59 |
|
#ifndef STATIC_MODULES |
| 60 |
< |
const char *_version = "$Revision: 1.145 $"; |
| 60 |
> |
const char *_version = "$Revision$"; |
| 61 |
|
static struct Callback *whois_cb; |
| 62 |
|
|
| 63 |
|
static void * |
| 104 |
|
return; |
| 105 |
|
} |
| 106 |
|
|
| 107 |
< |
if (parc > 2) |
| 107 |
> |
if (parc > 2 && !EmptyString(parv[2])) |
| 108 |
|
{ |
| 109 |
|
/* seeing as this is going across servers, we should limit it */ |
| 110 |
|
if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime) |
| 153 |
|
return; |
| 154 |
|
} |
| 155 |
|
|
| 156 |
< |
if (parc > 2) |
| 156 |
> |
if (parc > 2 && !EmptyString(parv[2])) |
| 157 |
|
{ |
| 158 |
|
if (hunt_server(client_p, source_p, ":%s WHOIS %s :%s", 1, |
| 159 |
|
parc, parv) != HUNTED_ISME) |
| 180 |
|
static void |
| 181 |
|
do_whois(struct Client *source_p, int parc, char **parv) |
| 182 |
|
{ |
| 183 |
+ |
static time_t last_used = 0; |
| 184 |
|
struct Client *target_p; |
| 185 |
|
char *nick; |
| 186 |
|
char *p = NULL; |
| 201 |
|
{ |
| 202 |
|
if ((target_p = find_client(nick)) != NULL) |
| 203 |
|
{ |
| 205 |
– |
if (IsServer(source_p->from)) |
| 206 |
– |
client_burst_if_needed(source_p->from, target_p); |
| 207 |
– |
|
| 204 |
|
if (IsClient(target_p)) |
| 205 |
|
{ |
| 206 |
< |
whois_person(source_p, target_p); |
| 207 |
< |
found = 1; |
| 206 |
> |
whois_person(source_p, target_p); |
| 207 |
> |
found = 1; |
| 208 |
|
} |
| 209 |
|
} |
| 214 |
– |
else if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL)) |
| 215 |
– |
{ |
| 216 |
– |
if (parc > 2) |
| 217 |
– |
sendto_one(uplink,":%s WHOIS %s :%s", |
| 218 |
– |
source_p->name, nick, nick); |
| 219 |
– |
else |
| 220 |
– |
sendto_one(uplink,":%s WHOIS %s", |
| 221 |
– |
source_p->name, nick); |
| 222 |
– |
return; |
| 223 |
– |
} |
| 210 |
|
} |
| 211 |
|
else /* wilds is true */ |
| 212 |
|
{ |
| 213 |
< |
/* disallow wild card whois on lazylink leafs for now */ |
| 214 |
< |
if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL)) |
| 215 |
< |
return; |
| 213 |
> |
if (!IsOper(source_p)) |
| 214 |
> |
{ |
| 215 |
> |
if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime) |
| 216 |
> |
{ |
| 217 |
> |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
| 218 |
> |
me.name, source_p->name); |
| 219 |
> |
return; |
| 220 |
> |
} |
| 221 |
> |
else |
| 222 |
> |
last_used = CurrentTime; |
| 223 |
> |
} |
| 224 |
|
|
| 225 |
|
/* Oh-oh wilds is true so have to do it the hard expensive way */ |
| 226 |
|
if (MyClient(source_p)) |
| 280 |
|
found |= single_whois(source_p, target_p); |
| 281 |
|
} |
| 282 |
|
|
| 283 |
< |
return (found); |
| 283 |
> |
return found; |
| 284 |
|
} |
| 285 |
|
|
| 286 |
|
/* single_whois() |
| 396 |
|
me.name, source_p->name, target_p->name, |
| 397 |
|
target_p->away); |
| 398 |
|
|
| 399 |
+ |
if (IsSetCallerId(target_p) && !IsSoftCallerId(target_p)) |
| 400 |
+ |
sendto_one(source_p, form_str(RPL_TARGUMODEG), |
| 401 |
+ |
me.name, source_p->name, target_p->name); |
| 402 |
+ |
|
| 403 |
|
if (IsOper(target_p)) |
| 404 |
|
sendto_one(source_p, form_str((IsAdmin(target_p) && |
| 405 |
|
!IsOperHiddenAdmin(target_p)) ? RPL_WHOISADMIN : |
| 409 |
|
sendto_one(source_p, form_str(RPL_ISCAPTURED), |
| 410 |
|
me.name, source_p->name, target_p->name); |
| 411 |
|
|
| 412 |
< |
if (ConfigFileEntry.use_whois_actually && (target_p->sockhost[0] != '\0') && |
| 415 |
< |
!(ConfigFileEntry.hide_spoof_ips && IsIPSpoof(target_p)) && |
| 416 |
< |
!(target_p->sockhost[0] == '0' && target_p->sockhost[1] == '\0')) |
| 412 |
> |
if (ConfigFileEntry.use_whois_actually) |
| 413 |
|
{ |
| 414 |
< |
if (IsAdmin(source_p) || source_p == target_p) |
| 415 |
< |
sendto_one(source_p, form_str(RPL_WHOISACTUALLY), |
| 416 |
< |
me.name, source_p->name, target_p->name, target_p->sockhost); |
| 417 |
< |
else |
| 414 |
> |
int show_ip = 0; |
| 415 |
> |
|
| 416 |
> |
if ((target_p->sockhost[0] != '\0') && irccmp(target_p->sockhost, "0")) |
| 417 |
> |
{ |
| 418 |
> |
if ((IsAdmin(source_p) || source_p == target_p)) |
| 419 |
> |
show_ip = 1; |
| 420 |
> |
else if (IsIPSpoof(target_p)) |
| 421 |
> |
show_ip = (IsOper(source_p) && !ConfigFileEntry.hide_spoof_ips); |
| 422 |
> |
else |
| 423 |
> |
show_ip = 1; |
| 424 |
> |
|
| 425 |
|
sendto_one(source_p, form_str(RPL_WHOISACTUALLY), |
| 426 |
|
me.name, source_p->name, target_p->name, |
| 427 |
< |
IsIPSpoof(target_p) || IsOper(target_p) ? |
| 428 |
< |
"255.255.255.255" : target_p->sockhost); |
| 427 |
> |
show_ip ? target_p->sockhost : "255.255.255.255"); |
| 428 |
> |
} |
| 429 |
|
} |
| 430 |
|
|
| 431 |
|
if (MyConnect(target_p)) /* Can't do any of this if not local! db */ |