ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_whois.c
(Generate patch)

Comparing:
ircd-hybrid/modules/m_whois.c (file contents), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid-8/modules/m_whois.c (file contents), Revision 1169 by michael, Fri Aug 12 18:45:03 2011 UTC

# Line 23 | Line 23
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"
# Line 37 | Line 36
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"
# Line 58 | Line 56 | struct Message whois_msgtab = {
56    { m_unregistered, m_whois, mo_whois, m_ignore, mo_whois, m_ignore }
57   };
58  
61 #ifndef STATIC_MODULES
59   const char *_version = "$Revision$";
60   static struct Callback *whois_cb;
61  
# Line 86 | Line 83 | _moddeinit(void)
83    mod_del_cmd(&whois_msgtab);
84    uninstall_hook(whois_cb, va_whois);
85   }
89 #endif
86  
87   /*
88   ** m_whois
# Line 106 | Line 102 | m_whois(struct Client *client_p, struct
102      return;
103    }
104  
105 <  if (parc > 2)
105 >  if (parc > 2 && !EmptyString(parv[2]))
106    {
107      /* seeing as this is going across servers, we should limit it */
108      if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
# Line 115 | Line 111 | m_whois(struct Client *client_p, struct
111                   me.name, source_p->name);
112        return;
113      }
114 <    else
115 <      last_used = CurrentTime;
114 >
115 >    last_used = CurrentTime;
116  
117      /* if we have serverhide enabled, they can either ask the clients
118       * server, or our server.. I dont see why they would need to ask
# Line 132 | Line 128 | m_whois(struct Client *client_p, struct
128      parv[1] = parv[2];
129    }
130  
135 #ifdef STATIC_MODULES
136  do_whois(source_p, parc, parv);
137 #else
131    execute_callback(whois_cb, source_p, parc, parv);
139 #endif
132   }
133  
134   /*
# Line 155 | Line 147 | mo_whois(struct Client *client_p, struct
147      return;
148    }
149  
150 <  if (parc > 2)
150 >  if (parc > 2 && !EmptyString(parv[2]))
151    {
152      if (hunt_server(client_p, source_p, ":%s WHOIS %s :%s", 1,
153                      parc, parv) != HUNTED_ISME)
# Line 164 | Line 156 | mo_whois(struct Client *client_p, struct
156      parv[1] = parv[2];
157    }
158  
167 #ifdef STATIC_MODULES
168  do_whois(source_p, parc, parv);
169 #else
159    execute_callback(whois_cb, source_p, parc, parv);
171 #endif
160   }
161  
162   /* do_whois()
# Line 182 | Line 170 | mo_whois(struct Client *client_p, struct
170   static void
171   do_whois(struct Client *source_p, int parc, char **parv)
172   {
173 +  static time_t last_used = 0;
174    struct Client *target_p;
175    char *nick;
176    char *p = NULL;
# Line 200 | Line 189 | do_whois(struct Client *source_p, int pa
189  
190    if (strpbrk(nick, "?#*") == NULL)
191    {
192 <    if ((target_p = find_client(nick)) != NULL)
192 >    if ((target_p = hash_find_client(nick)) != NULL)
193      {
205      if (IsServer(source_p->from))
206        client_burst_if_needed(source_p->from, target_p);
207
194        if (IsClient(target_p))
195        {
196 <        whois_person(source_p, target_p);
197 <        found = 1;
196 >        whois_person(source_p, target_p);
197 >        found = 1;
198        }
199      }
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    }
200    }
201    else /* wilds is true */
202    {
203 <    /* disallow wild card whois on lazylink leafs for now */
204 <    if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL))
205 <      return;
203 >    if (!IsOper(source_p))
204 >    {
205 >      if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
206 >      {
207 >        sendto_one(source_p, form_str(RPL_LOAD2HI),
208 >                   me.name, source_p->name);
209 >        return;
210 >      }
211 >      else
212 >        last_used = CurrentTime;
213 >  }
214  
215      /* Oh-oh wilds is true so have to do it the hard expensive way */
216      if (MyClient(source_p))
# Line 286 | Line 270 | global_whois(struct Client *source_p, co
270      found |= single_whois(source_p, target_p);
271    }
272  
273 <  return (found);
273 >  return found;
274   }
275  
276   /* single_whois()
# Line 300 | Line 284 | global_whois(struct Client *source_p, co
284   static int
285   single_whois(struct Client *source_p, struct Client *target_p)
286   {
287 <  dlink_node *ptr;
304 <  struct Channel *chptr;
287 >  dlink_node *ptr = NULL;
288  
289    if (!IsInvisible(target_p) || target_p == source_p)
290    {
# Line 313 | Line 296 | single_whois(struct Client *source_p, st
296    /* target_p is +i. Check if it is on any common channels with source_p */
297    DLINK_FOREACH(ptr, target_p->channel.head)
298    {
299 <    chptr = ((struct Membership *) ptr->data)->chptr;
299 >    struct Channel *chptr = ((struct Membership *) ptr->data)->chptr;
300 >
301      if (IsMember(source_p, chptr))
302      {
303        whois_person(source_p, target_p);
# Line 397 | Line 381 | whois_person(struct Client *source_p, st
381                 ConfigServerHide.hidden_name,
382                 ServerInfo.network_desc);
383  
384 +  if (HasUMode(target_p, UMODE_REGISTERED))
385 +    sendto_one(source_p, form_str(RPL_WHOISREGNICK),
386 +               me.name, source_p->name, target_p->name);
387 +
388    if (target_p->away != NULL)
389      sendto_one(source_p, form_str(RPL_AWAY),
390                 me.name, source_p->name, target_p->name,
391                 target_p->away);
392  
393 +  if (IsSetCallerId(target_p) && !IsSoftCallerId(target_p))
394 +    sendto_one(source_p, form_str(RPL_TARGUMODEG),
395 +               me.name, source_p->name, target_p->name);
396 +
397    if (IsOper(target_p))
398      sendto_one(source_p, form_str((IsAdmin(target_p) &&
399                 !IsOperHiddenAdmin(target_p)) ? RPL_WHOISADMIN :
# Line 411 | Line 403 | whois_person(struct Client *source_p, st
403      sendto_one(source_p, form_str(RPL_ISCAPTURED),
404                 me.name, source_p->name, target_p->name);
405  
406 <  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'))
406 >  if (ConfigFileEntry.use_whois_actually)
407    {
408 <    if (IsAdmin(source_p) || source_p == target_p)
409 <      sendto_one(source_p, form_str(RPL_WHOISACTUALLY),
410 <                 me.name, source_p->name, target_p->name, target_p->sockhost);
411 <    else
408 >    int show_ip = 0;
409 >
410 >    if ((target_p->sockhost[0] != '\0') && irccmp(target_p->sockhost, "0"))
411 >    {
412 >      if ((IsAdmin(source_p) || source_p == target_p))
413 >        show_ip = 1;
414 >      else if (IsIPSpoof(target_p))
415 >        show_ip = (IsOper(source_p) && !ConfigFileEntry.hide_spoof_ips);
416 >      else
417 >        show_ip = 1;
418 >
419        sendto_one(source_p, form_str(RPL_WHOISACTUALLY),
420                   me.name, source_p->name, target_p->name,
421 <                 IsIPSpoof(target_p) || IsOper(target_p) ?
422 <                 "255.255.255.255" : target_p->sockhost);
421 >                 show_ip ? target_p->sockhost : "255.255.255.255");
422 >    }
423    }
424  
425    if (MyConnect(target_p)) /* Can't do any of this if not local! db */
426    {
427   #ifdef HAVE_LIBCRYPTO
428      if (target_p->localClient->fd.ssl)
429 <      sendto_one(source_p, form_str(RPL_WHOISSSL),
429 >      sendto_one(source_p, form_str(RPL_WHOISSECURE),
430                   me.name, source_p->name, target_p->name);
431   #endif
432      sendto_one(source_p, form_str(RPL_WHOISIDLE),
433                 me.name, source_p->name, target_p->name,
434                 CurrentTime - target_p->localClient->last,
435                 target_p->firsttime);
436 +
437 +    if (IsOper(target_p) && target_p != source_p)
438 +      if ((target_p->umodes & UMODE_SPY))
439 +        sendto_one(target_p, ":%s NOTICE %s :*** Notice -- %s (%s@%s) [%s] is doing "
440 +                   "a whois on you", me.name, target_p->name, source_p->name,
441 +                   source_p->username, source_p->host, source_p->servptr->name);
442    }
443   }

Comparing:
ircd-hybrid/modules/m_whois.c (property svn:keywords), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid-8/modules/m_whois.c (property svn:keywords), Revision 1169 by michael, Fri Aug 12 18:45:03 2011 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)