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

Comparing:
ircd-hybrid-7.2/modules/m_who.c (file contents), Revision 313 by michael, Fri Dec 23 10:55:47 2005 UTC vs.
ircd-hybrid-7.3/modules/m_who.c (file contents), Revision 1121 by michael, Sun Jan 9 11:03:03 2011 UTC

# Line 21 | Line 21
21   *
22   *  $Id$
23   */
24 +
25   #include "stdinc.h"
26 < #include "tools.h"
26 > #include "list.h"
27   #include "common.h"  
28   #include "handlers.h"
29   #include "client.h"
# Line 33 | Line 34
34   #include "numeric.h"
35   #include "s_serv.h"
36   #include "send.h"
36 – #include "list.h"
37   #include "irc_string.h"
38   #include "sprintf_irc.h"
39   #include "s_conf.h"
# Line 43 | Line 43
43  
44   static time_t last_used = 0;
45  
46 < static void m_who(struct Client *, struct Client *, int, char **);
47 < static void ms_who(struct Client *, struct Client *, int, char **);
46 > static void m_who(struct Client *, struct Client *, int, char *[]);
47  
48   struct Message who_msgtab = {
49    "WHO", 0, 0, 2, 0, MFLG_SLOW, 0,
50 <  {m_unregistered, m_who, ms_who, m_ignore, m_who, m_ignore}
50 >  {m_unregistered, m_who, m_ignore, m_ignore, m_who, m_ignore}
51   };
52  
54 – #ifndef STATIC_MODULES
53   void
54   _modinit(void)
55   {
# Line 65 | Line 63 | _moddeinit(void)
63   }
64  
65   const char *_version = "$Revision$";
68 – #endif
66  
67 < static void who_global(struct Client *source_p, char *mask, int server_oper);
68 < static void do_who(struct Client *source_p, struct Client *target_p,
69 <                   const char *chname, const char *op_flags);
70 < static void do_who_on_channel(struct Client *source_p, struct Channel *chptr,
71 <                              const char *chname, int member, int server_oper);
67 > static void who_global(struct Client *, char *, int);
68 > static void do_who(struct Client *, struct Client *,
69 >                   const char *, const char *);
70 > static void do_who_on_channel(struct Client *, struct Channel *,
71 >                              const char *, int, int);
72  
73   /*
74   ** m_who
# Line 88 | Line 85 | m_who(struct Client *client_p, struct Cl
85    dlink_node *lp;
86    int server_oper = parc > 2 ? (*parv[2] == 'o') : 0; /* Show OPERS only */
87    struct Channel *chptr;
91 –  const char *from, *to;
92 –
93 –  if (IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
94 –  {
95 –    from = me.id;
96 –    to = source_p->id;
97 –  }
98 –  else
99 –  {
100 –    from = me.name;
101 –    to = source_p->name;
102 –  }
88  
89    /* See if mask is there, collapse it or return if not there */
90 <  if (mask == NULL || !*mask)
90 >  if (EmptyString(mask))
91    {
92      who_global(source_p, mask, server_oper);
93      sendto_one(source_p, form_str(RPL_ENDOFWHO),
94 <               from, to, "*");
94 >               me.name, source_p->name, "*");
95      return;
96    }
97  
# Line 123 | Line 108 | m_who(struct Client *client_p, struct Cl
108                          server_oper);
109      }
110  
111 <    sendto_one(source_p, form_str(RPL_ENDOFWHO), from, to, "*");
111 >    sendto_one(source_p, form_str(RPL_ENDOFWHO), me.name, source_p->name, "*");
112      return;
113    }
114  
# Line 140 | Line 125 | m_who(struct Client *client_p, struct Cl
125      }
126  
127      sendto_one(source_p, form_str(RPL_ENDOFWHO),
128 <               from, to, mask);
128 >               me.name, source_p->name, mask);
129      return;
130    }
131  
# Line 148 | Line 133 | m_who(struct Client *client_p, struct Cl
133    if (((target_p = find_client(mask)) != NULL) &&
134        IsClient(target_p) && (!server_oper || IsOper(target_p)))
135    {
151 –    if (IsServer(client_p))
152 –      client_burst_if_needed(client_p,target_p);
153 –
136      DLINK_FOREACH(lp, target_p->channel.head)
137      {
138        chptr = ((struct Membership *) lp->data)->chptr;
# Line 165 | Line 147 | m_who(struct Client *client_p, struct Cl
147        do_who(source_p, target_p, NULL, "");
148  
149      sendto_one(source_p, form_str(RPL_ENDOFWHO),
150 <               from, to, mask);
150 >               me.name, source_p->name, mask);
151      return;
152    }
153  
# Line 177 | Line 159 | m_who(struct Client *client_p, struct Cl
159  
160   /* Wasn't a nick, wasn't a channel, wasn't a '*' so ... */
161    sendto_one(source_p, form_str(RPL_ENDOFWHO),
162 <             from, to, mask);
162 >             me.name, source_p->name, mask);
163   }
164  
165   /* who_common_channel
# Line 255 | Line 237 | who_global(struct Client *source_p, char
237      if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
238      {
239        /* safe enough to give this on a local connect only */
240 <      sendto_one(source_p, form_str(RPL_LOAD2HI),
259 <        me.name, source_p->name);
240 >      sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name);
241        return;
242      }
243 <    else
244 <      last_used = CurrentTime;
243 >
244 >    last_used = CurrentTime;
245    }
246  
247    /* first, list all matching invisible clients on common channels */
# Line 352 | Line 333 | do_who(struct Client *source_p, struct C
333         const char *chname, const char *op_flags)
334   {
335    char status[6];
355 –  const char *from, *to;
356 –
357 –  if (IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
358 –  {
359 –    from = me.id;
360 –    to = source_p->id;
361 –  }
362 –  else
363 –  {
364 –    from = me.name;
365 –    to = source_p->name;
366 –  }
336  
337    if (IsOper(source_p))
338 <    ircsprintf(status, "%c%s%s%s",
370 <               target_p->away ? 'G' : 'H',
338 >    ircsprintf(status, "%c%s%s%s", target_p->away ? 'G' : 'H',
339                 IsOper(target_p) ? "*" : "", IsCaptured(target_p) ? "#" : "", op_flags);
340    else
341      ircsprintf(status, "%c%s%s", target_p->away ? 'G' : 'H',
# Line 375 | Line 343 | do_who(struct Client *source_p, struct C
343  
344    if (ConfigServerHide.hide_servers)
345    {
346 <    sendto_one(source_p, form_str(RPL_WHOREPLY), from, to,
346 >    sendto_one(source_p, form_str(RPL_WHOREPLY), me.name, source_p->name,
347                 (chname) ? (chname) : "*",
348 <               target_p->username, target_p->host,
348 >               target_p->username, target_p->host,
349                 IsOper(source_p) ? target_p->servptr->name : "*",
350                 target_p->name, status, 0, target_p->info);
351    }
352    else
353    {
354 <    sendto_one(source_p, form_str(RPL_WHOREPLY), from, to,
355 <               (chname) ? (chname) : "*",
388 <               target_p->username,
354 >    sendto_one(source_p, form_str(RPL_WHOREPLY), me.name, source_p->name,
355 >               (chname) ? (chname) : "*", target_p->username,
356                 target_p->host, target_p->servptr->name, target_p->name,
357                 status, target_p->hopcount, target_p->info);
358    }
359   }
393 –
394 – /*
395 – ** ms_who()
396 – **      parv[0] = sender prefix
397 – **      parv[1] = nickname mask list
398 – **      parv[2] = additional selection flag, only 'o' for now.
399 – */
400 – static void
401 – ms_who(struct Client *client_p, struct Client *source_p,
402 –       int parc, char *parv[])
403 – {
404 –  /* If its running as a hub, and linked with lazy links
405 –   * then allow leaf to use normal client m_who()
406 –   * other wise, ignore it.
407 –   */
408 –  if (IsClient(source_p) && ServerInfo.hub &&
409 –      IsCapable(client_p->from, CAP_LL))
410 –    m_who(client_p, source_p, parc, parv);
411 – }

Diff Legend

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