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/trunk/modules/m_whois.c (file contents), Revision 8719 by michael, Mon Dec 10 18:59:47 2018 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  m_whois.c: Shows who a user is.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2005 by the past and present ircd coders, and others.
4 > *  Copyright (c) 1997-2018 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 16 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20 < *
21 < *  $Id$
20 > */
21 >
22 > /*! \file m_whois.c
23 > * \brief Includes required functions for processing the WHOIS command.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
28 < #include "fdlist.h"
27 < #include "tools.h"
28 < #include "common.h"  
29 < #include "handlers.h"
28 > #include "list.h"
29   #include "client.h"
30 + #include "client_svstag.h"
31   #include "hash.h"
32   #include "channel.h"
33   #include "channel_mode.h"
34   #include "ircd.h"
35   #include "numeric.h"
36 < #include "s_conf.h"
37 < #include "s_misc.h"
38 < #include "s_serv.h"
36 > #include "conf.h"
37 > #include "misc.h"
38 > #include "server.h"
39 > #include "user.h"
40   #include "send.h"
40 #include "list.h"
41   #include "irc_string.h"
42 #include "sprintf_irc.h"
43 #include "msg.h"
42   #include "parse.h"
43   #include "modules.h"
46 #include "hook.h"
44  
48 static void do_whois(struct Client *, int, char **);
49 static int single_whois(struct Client *, struct Client *);
50 static void whois_person(struct Client *, struct Client *);
51 static int global_whois(struct Client *, const char *);
52
53 static void m_whois(struct Client *, struct Client *, int, char *[]);
54 static void mo_whois(struct Client *, struct Client *, int, char *[]);
55
56 struct Message whois_msgtab = {
57  "WHOIS", 0, 0, 0, 0, MFLG_SLOW, 0,
58  { m_unregistered, m_whois, mo_whois, m_ignore, mo_whois, m_ignore }
59 };
45  
46 < #ifndef STATIC_MODULES
47 < const char *_version = "$Revision$";
48 < static struct Callback *whois_cb;
49 <
65 < static void *
66 < va_whois(va_list args)
46 > static int
47 > whois_can_see_channels(struct Channel *chptr,
48 >                       struct Client *source_p,
49 >                       struct Client *target_p)
50   {
51 <  struct Client *source_p = va_arg(args, struct Client *);
52 <  int parc = va_arg(args, int);
70 <  char **parv = va_arg(args, char **);
71 <
72 <  do_whois(source_p, parc, parv);
73 <  return NULL;
74 < }
51 >  if (PubChannel(chptr) && !HasUMode(target_p, UMODE_HIDECHANS))
52 >    return 1;
53  
54 < void
55 < _modinit(void)
78 < {
79 <  whois_cb = register_callback("doing_whois", va_whois);
80 <  mod_add_cmd(&whois_msgtab);
81 < }
54 >  if (source_p == target_p || IsMember(source_p, chptr))
55 >    return 1;
56  
57 < void
58 < _moddeinit(void)
59 < {
86 <  mod_del_cmd(&whois_msgtab);
87 <  uninstall_hook(whois_cb, va_whois);
57 >  if (HasUMode(source_p, UMODE_OPER))
58 >    return 2;
59 >  return 0;
60   }
89 #endif
61  
62 < /*
63 < ** m_whois
64 < **      parv[0] = sender prefix
65 < **      parv[1] = nickname masklist
66 < */
62 > /* whois_person()
63 > *
64 > * inputs       - source_p client to report to
65 > *              - target_p client to report on
66 > * output       - NONE
67 > * side effects -
68 > */
69   static void
70 < m_whois(struct Client *client_p, struct Client *source_p,
98 <        int parc, char *parv[])
70 > whois_person(struct Client *source_p, struct Client *target_p)
71   {
72 <  static time_t last_used = 0;
72 >  char buf[IRCD_BUFSIZE] = "";
73 >  dlink_node *node;
74 >  const struct ServicesTag *svstag = NULL;
75 >  char *t = NULL;
76 >  int cur_len = 0;
77 >  int mlen = 0;
78 >  int tlen = 0;
79 >  int reply_to_send = 0;
80 >
81 >  sendto_one_numeric(source_p, &me, RPL_WHOISUSER, target_p->name,
82 >                     target_p->username, target_p->host,
83 >                     target_p->info);
84  
85 <  if (parc < 2 || EmptyString(parv[1]))
86 <  {
87 <    sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
105 <               me.name, source_p->name);
106 <    return;
107 <  }
85 >  cur_len = mlen = snprintf(buf, sizeof(buf), numeric_form(RPL_WHOISCHANNELS),
86 >                            me.name, source_p->name, target_p->name, "");
87 >  t = buf + mlen;
88  
89 <  if (parc > 2)
89 >  DLINK_FOREACH(node, target_p->channel.head)
90    {
91 <    /* seeing as this is going across servers, we should limit it */
92 <    if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
113 <    {
114 <      sendto_one(source_p, form_str(RPL_LOAD2HI),
115 <                 me.name, source_p->name);
116 <      return;
117 <    }
118 <    else
119 <      last_used = CurrentTime;
91 >    const struct Membership *member = node->data;
92 >    int show = whois_can_see_channels(member->chptr, source_p, target_p);
93  
94 <    /* if we have serverhide enabled, they can either ask the clients
95 <     * server, or our server.. I dont see why they would need to ask
96 <     * anything else for info about the client.. --fl_
97 <     */
98 <    if (ConfigFileEntry.disable_remote)
99 <      parv[1] = parv[2];
100 <
101 <    if (hunt_server(client_p, source_p, ":%s WHOIS %s :%s", 1,
102 <                    parc, parv) != HUNTED_ISME)
130 <      return;
94 >    if (show)
95 >    {
96 >      if ((cur_len + 4 + member->chptr->name_len + 1) > (IRCD_BUFSIZE - 2))
97 >      {
98 >        *(t - 1) = '\0';
99 >        sendto_one(source_p, "%s", buf);
100 >        cur_len = mlen;
101 >        t = buf + mlen;
102 >      }
103  
104 <    parv[1] = parv[2];
104 >      tlen = sprintf(t, "%s%s%s ", show == 2 ? "~" : "", get_member_status(member, true),
105 >                     member->chptr->name);
106 >      t += tlen;
107 >      cur_len += tlen;
108 >      reply_to_send = 1;
109 >    }
110    }
111  
112 < #ifdef STATIC_MODULES
136 <  do_whois(source_p, parc, parv);
137 < #else
138 <  execute_callback(whois_cb, source_p, parc, parv);
139 < #endif
140 < }
141 <
142 < /*
143 < ** mo_whois
144 < **      parv[0] = sender prefix
145 < **      parv[1] = nickname masklist
146 < */
147 < static void
148 < mo_whois(struct Client *client_p, struct Client *source_p,
149 <         int parc, char *parv[])
150 < {
151 <  if (parc < 2 || EmptyString(parv[1]))
112 >  if (reply_to_send)
113    {
114 <    sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
115 <               me.name, source_p->name);
155 <    return;
114 >    *(t - 1) = '\0';
115 >    sendto_one(source_p, "%s", buf);
116    }
117  
118 <  if (parc > 2)
119 <  {
120 <    if (hunt_server(client_p, source_p, ":%s WHOIS %s :%s", 1,
121 <                    parc, parv) != HUNTED_ISME)
122 <      return;
118 >  if ((ConfigServerHide.hide_servers || IsHidden(target_p->servptr)) &&
119 >      !(HasUMode(source_p, UMODE_OPER) || source_p == target_p))
120 >    sendto_one_numeric(source_p, &me, RPL_WHOISSERVER, target_p->name,
121 >                       ConfigServerHide.hidden_name,
122 >                       ConfigServerInfo.network_desc);
123 >  else
124 >    sendto_one_numeric(source_p, &me, RPL_WHOISSERVER, target_p->name,
125 >                       target_p->servptr->name, target_p->servptr->info);
126  
127 <    parv[1] = parv[2];
128 <  }
127 >  if (HasUMode(target_p, UMODE_REGISTERED))
128 >    sendto_one_numeric(source_p, &me, RPL_WHOISREGNICK, target_p->name);
129  
130 < #ifdef STATIC_MODULES
131 <  do_whois(source_p, parc, parv);
132 < #else
170 <  execute_callback(whois_cb, source_p, parc, parv);
171 < #endif
172 < }
130 >  if (strcmp(target_p->account, "*"))
131 >    sendto_one_numeric(source_p, &me, RPL_WHOISACCOUNT, target_p->name,
132 >                       target_p->account, "is");
133  
134 < /* do_whois()
135 < *
136 < * inputs       - pointer to /whois source
177 < *              - number of parameters
178 < *              - pointer to parameters array
179 < * output       - pointer to void
180 < * side effects - Does whois
181 < */
182 < static void
183 < do_whois(struct Client *source_p, int parc, char **parv)
184 < {
185 <  struct Client *target_p;
186 <  char *nick;
187 <  char *p = NULL;
188 <  int found = 0;
189 <
190 <  nick = parv[1];
191 <  while (*nick == ',')
192 <    nick++;
193 <  if ((p = strchr(nick,',')) != NULL)
194 <    *p = '\0';
134 >  if (target_p->away[0])
135 >    sendto_one_numeric(source_p, &me, RPL_AWAY, target_p->name,
136 >                       target_p->away);
137  
138 <  if (*nick == '\0')
139 <    return;
138 >  if (HasUMode(target_p, UMODE_CALLERID | UMODE_SOFTCALLERID))
139 >  {
140 >    bool callerid = HasUMode(target_p, UMODE_CALLERID) != 0;
141  
142 <  collapse(nick);
142 >    sendto_one_numeric(source_p, &me, RPL_TARGUMODEG, target_p->name,
143 >                       callerid ? "+g" : "+G",
144 >                       callerid ? "server side ignore" :
145 >                                  "server side ignore with the exception of common channels");
146 >  }
147  
148 <  if (strpbrk(nick, "?#*") == NULL)
148 >  if (HasUMode(target_p, UMODE_OPER) || HasFlag(target_p, FLAGS_SERVICE))
149    {
150 <    if ((target_p = find_client(nick)) != NULL)
150 >    if (!HasUMode(target_p, UMODE_HIDDEN) || HasUMode(source_p, UMODE_OPER))
151      {
152 <      if (IsServer(source_p->from))
153 <        client_burst_if_needed(source_p->from, target_p);
152 >      if (target_p->svstags.head)
153 >        svstag = target_p->svstags.head->data;
154  
155 <      if (IsClient(target_p))
155 >      if (svstag == NULL || svstag->numeric != RPL_WHOISOPERATOR)
156        {
157 <        whois_person(source_p, target_p);
158 <        found = 1;
157 >        const char *text;
158 >        if (HasFlag(target_p, FLAGS_SERVICE))
159 >          text = "is a Network Service";
160 >        else if (HasUMode(target_p, UMODE_ADMIN))
161 >          text = "is a Server Administrator";
162 >        else  /* HasUMode(target_p, UMODE_OPER) == true */
163 >          text = "is an IRC Operator";
164 >        sendto_one_numeric(source_p, &me, RPL_WHOISOPERATOR, target_p->name, text);
165        }
166      }
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    }
167    }
168 <  else /* wilds is true */
168 >
169 >  DLINK_FOREACH(node, target_p->svstags.head)
170    {
171 <    /* disallow wild card whois on lazylink leafs for now */
172 <    if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL))
173 <      return;
174 <
175 <    /* Oh-oh wilds is true so have to do it the hard expensive way */
176 <    if (MyClient(source_p))
177 <      found = global_whois(source_p, nick);
171 >    svstag = node->data;
172 >
173 >    if (svstag->numeric == RPL_WHOISOPERATOR)
174 >      if (HasUMode(target_p, UMODE_HIDDEN) && !HasUMode(source_p, UMODE_OPER))
175 >        continue;
176 >
177 >    if (svstag->umodes == 0 || HasUMode(source_p, svstag->umodes))
178 >      sendto_one_numeric(source_p, &me, svstag->numeric | SND_EXPLICIT, "%s :%s",
179 >                         target_p->name, svstag->tag);
180    }
181  
182 <  if (!found)
182 >  if (HasUMode(target_p, UMODE_WEBIRC))
183 >    sendto_one_numeric(source_p, &me, RPL_WHOISTEXT, target_p->name,
184 >                       "User connected using a webirc gateway");
185 >
186 >  if (HasUMode(source_p, UMODE_OPER) || source_p == target_p)
187    {
188 <    if (!IsDigit(*nick))
189 <      sendto_one(source_p, form_str(ERR_NOSUCHNICK),
190 <                 me.name, source_p->name, nick);
188 >    char *m = buf;
189 >    *m++ = '+';
190 >
191 >    for (const struct user_modes *tab = umode_tab; tab->c; ++tab)
192 >      if (HasUMode(target_p, tab->flag))
193 >        *m++ = tab->c;
194 >    *m = '\0';
195 >
196 >    sendto_one_numeric(source_p, &me, RPL_WHOISMODES, target_p->name, buf);
197    }
198  
199 <  sendto_one(source_p, form_str(RPL_ENDOFWHOIS),
200 <             me.name, source_p->name, parv[1]);
199 >  if (HasUMode(source_p, UMODE_OPER) || source_p == target_p)
200 >    sendto_one_numeric(source_p, &me, RPL_WHOISACTUALLY, target_p->name,
201 >                       target_p->username, target_p->realhost,
202 >                       target_p->sockhost);
203 >
204 >  if (HasUMode(target_p, UMODE_SSL))
205 >    sendto_one_numeric(source_p, &me, RPL_WHOISSECURE, target_p->name);
206 >
207 >  if (!EmptyString(target_p->certfp))
208 >    if (HasUMode(source_p, UMODE_OPER) || source_p == target_p)
209 >      sendto_one_numeric(source_p, &me, RPL_WHOISCERTFP, target_p->name, target_p->certfp);
210 >
211 >  if (MyConnect(target_p))
212 >    if (!HasUMode(target_p, UMODE_HIDEIDLE) || HasUMode(source_p, UMODE_OPER) ||
213 >        source_p == target_p)
214 >      sendto_one_numeric(source_p, &me, RPL_WHOISIDLE, target_p->name,
215 >                         client_get_idle_time(source_p, target_p),
216 >                         target_p->connection->firsttime);
217 >
218 >  if (HasUMode(target_p, UMODE_SPY) && source_p != target_p)
219 >    sendto_one_notice(target_p, &me, ":*** Notice -- %s (%s@%s) [%s] is doing a /whois on you",
220 >                      source_p->name, source_p->username, source_p->host, source_p->servptr->name);
221   }
222  
223 < /* global_whois()
223 > /* do_whois()
224   *
225 < * Inputs       - source_p client to report to
226 < *              - target_p client to report on
227 < * Output       - if found return 1
228 < * Side Effects - do a single whois on given client
229 < *                writing results to source_p
225 > * inputs       - pointer to /whois source
226 > *              - number of parameters
227 > *              - pointer to parameters array
228 > * output       - pointer to void
229 > * side effects - Does whois
230   */
231 < static int
232 < global_whois(struct Client *source_p, const char *nick)
231 > static void
232 > do_whois(struct Client *source_p, const char *name)
233   {
258  dlink_node *ptr;
234    struct Client *target_p;
260  int found = 0;
261
262  DLINK_FOREACH(ptr, global_client_list.head)
263  {
264    target_p = ptr->data;
235  
236 <    if (!IsClient(target_p))
237 <      continue;
238 <
239 <    if (!match(nick, target_p->name))
270 <      continue;
271 <
272 <    assert(target_p->servptr != NULL);
273 <
274 <    /* 'Rules' established for sending a WHOIS reply:
275 <     *
276 <     *
277 <     * - if wildcards are being used dont send a reply if
278 <     *   the querier isnt any common channels and the
279 <     *   client in question is invisible and wildcards are
280 <     *   in use (allow exact matches only);
281 <     *
282 <     * - only send replies about common or public channels
283 <     *   the target user(s) are on;
284 <     */
285 <
286 <    found |= single_whois(source_p, target_p);
287 <  }
236 >  if ((target_p = hash_find_client(name)) && IsClient(target_p))
237 >    whois_person(source_p, target_p);
238 >  else
239 >    sendto_one_numeric(source_p, &me, ERR_NOSUCHNICK, name);
240  
241 <  return (found);
241 >  sendto_one_numeric(source_p, &me, RPL_ENDOFWHOIS, name);
242   }
243  
244 < /* single_whois()
244 > /*! \brief WHOIS command handler
245   *
246 < * Inputs       - source_p client to report to
247 < *              - target_p client to report on
248 < * Output       - if found return 1
249 < * Side Effects - do a single whois on given client
250 < *                writing results to source_p
246 > * \param source_p Pointer to allocated Client struct from which the message
247 > *                 originally comes from.  This can be a local or remote client.
248 > * \param parc     Integer holding the number of supplied arguments.
249 > * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
250 > *                 pointers.
251 > * \note Valid arguments for this command are:
252 > *      - parv[0] = command
253 > *      - parv[1] = nickname/servername
254 > *      - parv[2] = nickname
255   */
256   static int
257 < single_whois(struct Client *source_p, struct Client *target_p)
257 > m_whois(struct Client *source_p, int parc, char *parv[])
258   {
259 <  dlink_node *ptr;
304 <  struct Channel *chptr;
259 >  static uintmax_t last_used = 0;
260  
261 <  if (!IsInvisible(target_p) || target_p == source_p)
261 >  if (parc < 2 || EmptyString(parv[1]))
262    {
263 <    /* always show user if they are visible (no +i) */
264 <    whois_person(source_p, target_p);
310 <    return 1;
263 >    sendto_one_numeric(source_p, &me, ERR_NONICKNAMEGIVEN);
264 >    return 0;
265    }
266  
267 <  /* target_p is +i. Check if it is on any common channels with source_p */
314 <  DLINK_FOREACH(ptr, target_p->channel.head)
267 >  if (parc > 2 && !EmptyString(parv[2]))
268    {
269 <    chptr = ((struct Membership *) ptr->data)->chptr;
270 <    if (IsMember(source_p, chptr))
269 >    /* seeing as this is going across servers, we should limit it */
270 >    if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
271      {
272 <      whois_person(source_p, target_p);
273 <      return 1;
272 >      sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "WHOIS");
273 >      return 0;
274      }
275 +
276 +    last_used = CurrentTime;
277 +
278 +    /*
279 +     * if we have serverhide enabled, they can either ask the clients
280 +     * server, or our server.. I don't see why they would need to ask
281 +     * anything else for info about the client.. --fl_
282 +     */
283 +    if (ConfigServerHide.disable_remote_commands)
284 +      parv[1] = parv[2];
285 +
286 +    if (server_hunt(source_p, ":%s WHOIS %s :%s", 1, parc, parv)->ret != HUNTED_ISME)
287 +      return 0;
288 +
289 +    parv[1] = parv[2];
290    }
291  
292 +  do_whois(source_p, parv[1]);
293    return 0;
294   }
295  
296 < /* whois_person()
296 > /*! \brief WHOIS command handler
297   *
298 < * inputs       - source_p client to report to
299 < *              - target_p client to report on
300 < * output       - NONE
301 < * side effects -
298 > * \param source_p Pointer to allocated Client struct from which the message
299 > *                 originally comes from.  This can be a local or remote client.
300 > * \param parc     Integer holding the number of supplied arguments.
301 > * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
302 > *                 pointers.
303 > * \note Valid arguments for this command are:
304 > *      - parv[0] = command
305 > *      - parv[1] = nickname/servername
306 > *      - parv[2] = nickname
307   */
308 < static void
309 < whois_person(struct Client *source_p, struct Client *target_p)
308 > static int
309 > mo_whois(struct Client *source_p, int parc, char *parv[])
310   {
311 <  char buf[IRCD_BUFSIZE];
338 <  dlink_node *lp;
339 <  struct Client *server_p;
340 <  struct Channel *chptr;
341 <  struct Membership *ms;
342 <  int cur_len = 0;
343 <  int mlen;
344 <  char *t = NULL;
345 <  int tlen;
346 <  int reply_to_send = NO;
347 <
348 <  server_p = target_p->servptr;
349 <
350 <  sendto_one(source_p, form_str(RPL_WHOISUSER),
351 <             me.name, source_p->name, target_p->name,
352 <             target_p->username, target_p->host, target_p->info);
353 <
354 <  cur_len = mlen = ircsprintf(buf, form_str(RPL_WHOISCHANNELS),
355 <             me.name, source_p->name, target_p->name, "");
356 <  t = buf + mlen;
357 <
358 <  DLINK_FOREACH(lp, target_p->channel.head)
311 >  if (parc < 2 || EmptyString(parv[1]))
312    {
313 <    ms = lp->data;
314 <    chptr = ms->chptr;
362 <
363 <    if (ShowChannel(source_p, chptr))
364 <    {
365 <      /* Don't show local channels if user is doing a remote whois */
366 <      if (!MyConnect(source_p) && (chptr->chname[0] == '&'))
367 <        continue;
368 <
369 <      if ((cur_len + 3 + strlen(chptr->chname) + 1) > (IRCD_BUFSIZE - 2))
370 <      {
371 <        *(t - 1) = '\0';
372 <        sendto_one(source_p, "%s", buf);
373 <        cur_len = mlen;
374 <        t = buf + mlen;
375 <      }
376 <
377 <      tlen = ircsprintf(t, "%s%s ", get_member_status(ms, YES), chptr->chname);
378 <      t += tlen;
379 <      cur_len += tlen;
380 <      reply_to_send = YES;
381 <    }
313 >    sendto_one_numeric(source_p, &me, ERR_NONICKNAMEGIVEN);
314 >    return 0;
315    }
316  
317 <  if (reply_to_send)
317 >  if (parc > 2 && !EmptyString(parv[2]))
318    {
319 <    *(t - 1) = '\0';
320 <    sendto_one(source_p, "%s", buf);
388 <  }
319 >    if (server_hunt(source_p, ":%s WHOIS %s :%s", 1, parc, parv)->ret != HUNTED_ISME)
320 >      return 0;
321  
322 <  if (IsOper(source_p) || !ConfigServerHide.hide_servers || target_p == source_p)
391 <    sendto_one(source_p, form_str(RPL_WHOISSERVER),
392 <               me.name, source_p->name, target_p->name,
393 <               server_p->name, server_p->info);
394 <  else
395 <    sendto_one(source_p, form_str(RPL_WHOISSERVER),
396 <               me.name, source_p->name, target_p->name,
397 <               ConfigServerHide.hidden_name,
398 <               ServerInfo.network_desc);
399 <
400 <  if (target_p->away != NULL)
401 <    sendto_one(source_p, form_str(RPL_AWAY),
402 <               me.name, source_p->name, target_p->name,
403 <               target_p->away);
404 <
405 <  if (IsOper(target_p))
406 <    sendto_one(source_p, form_str((IsAdmin(target_p) &&
407 <               !IsOperHiddenAdmin(target_p)) ? RPL_WHOISADMIN :
408 <               RPL_WHOISOPERATOR), me.name, source_p->name, target_p->name);
409 <
410 <  if (IsOper(source_p) && IsCaptured(target_p))
411 <    sendto_one(source_p, form_str(RPL_ISCAPTURED),
412 <               me.name, source_p->name, target_p->name);
413 <
414 <  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'))
417 <  {
418 <    if (IsAdmin(source_p) || source_p == target_p)
419 <      sendto_one(source_p, form_str(RPL_WHOISACTUALLY),
420 <                 me.name, source_p->name, target_p->name, target_p->sockhost);
421 <    else
422 <      sendto_one(source_p, form_str(RPL_WHOISACTUALLY),
423 <                 me.name, source_p->name, target_p->name,
424 <                 IsIPSpoof(target_p) || IsOper(target_p) ?
425 <                 "255.255.255.255" : target_p->sockhost);
322 >    parv[1] = parv[2];
323    }
324  
325 <  if (MyConnect(target_p)) /* Can't do any of this if not local! db */
326 <  {
327 < #ifdef HAVE_LIBCRYPTO
328 <    if (target_p->localClient->fd.ssl)
329 <      sendto_one(source_p, form_str(RPL_WHOISSSL),
330 <                 me.name, source_p->name, target_p->name);
331 < #endif
332 <    sendto_one(source_p, form_str(RPL_WHOISIDLE),
333 <               me.name, source_p->name, target_p->name,
334 <               CurrentTime - target_p->localClient->last,
335 <               target_p->firsttime);
336 <  }
325 >  do_whois(source_p, parv[1]);
326 >  return 0;
327 > }
328 >
329 > static struct Message whois_msgtab =
330 > {
331 >  .cmd = "WHOIS",
332 >  .args_max = MAXPARA,
333 >  .handlers[UNREGISTERED_HANDLER] = m_unregistered,
334 >  .handlers[CLIENT_HANDLER] = m_whois,
335 >  .handlers[SERVER_HANDLER] = mo_whois,
336 >  .handlers[ENCAP_HANDLER] = m_ignore,
337 >  .handlers[OPER_HANDLER] = mo_whois
338 > };
339 >
340 > static void
341 > module_init(void)
342 > {
343 >  mod_add_cmd(&whois_msgtab);
344 > }
345 >
346 > static void
347 > module_exit(void)
348 > {
349 >  mod_del_cmd(&whois_msgtab);
350   }
351 +
352 + struct module module_entry =
353 + {
354 +  .version = "$Revision$",
355 +  .modinit = module_init,
356 +  .modexit = module_exit,
357 + };

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/trunk/modules/m_whois.c (property svn:keywords), Revision 8719 by michael, Mon Dec 10 18:59:47 2018 UTC

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

Diff Legend

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