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

Comparing ircd-hybrid/trunk/modules/m_info.c (file contents):
Revision 1858 by michael, Thu Apr 25 15:00:52 2013 UTC vs.
Revision 3237 by michael, Sun Mar 30 13:43:22 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  m_info.c: Sends information about the server.
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-2014 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 18 | Line 17
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   *  USA
20 < *
21 < *  $Id$
20 > */
21 >
22 > /*! \file m_info.c
23 > * \brief Includes required functions for processing the INFO command.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
28   #include "list.h"
27 #include "channel.h"
29   #include "client.h"
29 #include "irc_string.h"
30   #include "ircd.h"
31   #include "numeric.h"
32 + #include "s_misc.h"
33   #include "s_serv.h"
33 #include "s_user.h"
34   #include "send.h"
35   #include "conf.h"
36   #include "parse.h"
# Line 61 | Line 61 | static const struct InfoStruct info_tabl
61    /* --[  START OF TABLE  ]-------------------------------------------- */
62  
63    {
64    "CPATH",
65    OUTPUT_STRING,
66    &ConfigFileEntry.configfile,
67    "Path to main configuration file"
68  },
69  {
64      "DPATH",
65      OUTPUT_STRING,
66      &ConfigFileEntry.dpath,
67      "Root directory of installation"
68    },
69    {
70 +    "CPATH",
71 +    OUTPUT_STRING,
72 +    &ConfigFileEntry.configfile,
73 +    "Path to main configuration file"
74 +  },
75 +  {
76      "DLPATH",
77      OUTPUT_STRING,
78      &ConfigFileEntry.dlinefile,
# Line 175 | Line 175 | static const struct InfoStruct info_tabl
175      "Maximum number of channels an oper can join"
176    },
177    {
178    "quiet_on_ban",
179    OUTPUT_BOOLEAN_YN,
180    &ConfigChannel.quiet_on_ban,
181    "Banned users may not send text to a channel"
182  },
183  {
178      "max_bans",
179      OUTPUT_DECIMAL,
180      &ConfigChannel.max_bans,
# Line 250 | Line 244 | static const struct InfoStruct info_tabl
244      "hide_server_ips",
245      OUTPUT_BOOLEAN_YN,
246      &ConfigServerHide.hide_server_ips,
247 <    "Prevent people from seeing server IPs"
247 >    "Prevent people from seeing server IP addresses"
248    },
249    {
250      "gline_min_cidr",
# Line 280 | Line 274 | static const struct InfoStruct info_tabl
274      "hide_spoof_ips",
275      OUTPUT_BOOLEAN_YN,
276      &ConfigFileEntry.hide_spoof_ips,
277 <    "Hide spoofed IP's"
277 >    "Hide spoofed IP addresses"
278    },
279    {
280      "ignore_bogus_ts",
# Line 289 | Line 283 | static const struct InfoStruct info_tabl
283      "Ignore bogus timestamps from other servers"
284    },
285    {
286 +    "cycle_on_host_change",
287 +    OUTPUT_BOOLEAN_YN,
288 +    &ConfigFileEntry.cycle_on_host_change,
289 +    "Send a fake QUIT/JOIN combination on host change"
290 +  },
291 +  {
292      "disable_auth",
293      OUTPUT_BOOLEAN_YN,
294      &ConfigFileEntry.disable_auth,
# Line 297 | Line 297 | static const struct InfoStruct info_tabl
297    {
298      "disable_remote_commands",
299      OUTPUT_BOOLEAN_YN,
300 <    &ConfigFileEntry.disable_remote,
300 >    &ConfigServerHide.disable_remote_commands,
301      "Prevent users issuing commands on remote servers"
302    },
303    {
# Line 403 | Line 403 | static const struct InfoStruct info_tabl
403      "STATS P is only shown to operators"
404    },
405    {
406 +    "stats_u_oper_only",
407 +    OUTPUT_BOOLEAN_YN,
408 +    &ConfigFileEntry.stats_u_oper_only,
409 +    "STATS u is only shown to operators"
410 +  },
411 +  {
412      "stats_i_oper_only",
413      OUTPUT_BOOLEAN2,
414      &ConfigFileEntry.stats_i_oper_only,
# Line 517 | Line 523 | static const struct InfoStruct info_tabl
523   static void
524   send_birthdate_online_time(struct Client *source_p)
525   {
526 <  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
527 <    sendto_one(source_p, ":%s %d %s :On-line since %s",
528 <               me.id, RPL_INFO, source_p->id,
529 <               myctime(me.localClient->firsttime));
524 <  else
525 <    sendto_one(source_p, ":%s %d %s :On-line since %s",
526 <               me.name, RPL_INFO, source_p->name,
527 <               myctime(me.localClient->firsttime));
526 >  sendto_one(source_p, ":%s %d %s :On-line since %s",
527 >             ID_or_name(&me, source_p), RPL_INFO,
528 >             ID_or_name(source_p, source_p),
529 >             myctime(me.localClient->firsttime));
530   }
531  
532   /* send_conf_options()
# Line 536 | Line 538 | send_birthdate_online_time(struct Client
538   static void
539   send_conf_options(struct Client *source_p)
540   {
539  const char *from, *to;
541    const struct InfoStruct *iptr = NULL;
542  
542  /* Now send them a list of all our configuration options
543   * (mostly from defaults.h and config.h)
544   */
545  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
546  {
547    from = me.id;
548    to = source_p->id;
549  }
550  else
551  {
552    from = me.name;
553    to = source_p->name;
554  }
555
543    /*
544     * Parse the info_table[] and do the magic.
545     */
# Line 566 | Line 553 | send_conf_options(struct Client *source_
553          const char *option = *((char **)iptr->option);
554  
555          sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
556 <                   from, RPL_INFO, to,
556 >                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
557                     iptr->name, option ? option : "NONE",
558                     iptr->desc ? iptr->desc : "<none>");
559          break;
# Line 578 | Line 565 | send_conf_options(struct Client *source_
565          const char *option = iptr->option;
566  
567          sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
568 <                   from, RPL_INFO, to,
568 >                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
569                     iptr->name, option ? option : "NONE",
570                     iptr->desc ? iptr->desc : "<none>");
571          break;
# Line 590 | Line 577 | send_conf_options(struct Client *source_
577          const int option = *((int *)iptr->option);
578  
579          sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
580 <                   from, RPL_INFO, to, iptr->name,
581 <                   option, iptr->desc ? iptr->desc : "<none>");
580 >                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
581 >                   iptr->name, option, iptr->desc ? iptr->desc : "<none>");
582          break;
583        }
584  
# Line 601 | Line 588 | send_conf_options(struct Client *source_
588          const int option = *((int *)iptr->option);
589  
590          sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
591 <                   from, RPL_INFO, to,
591 >                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
592                     iptr->name, option ? "ON" : "OFF",
593                     iptr->desc ? iptr->desc : "<none>");
594  
# Line 614 | Line 601 | send_conf_options(struct Client *source_
601          const int option = *((int *)iptr->option);
602  
603          sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
604 <                   from, RPL_INFO, to,
604 >                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
605                     iptr->name, option ? "YES" : "NO",
606                     iptr->desc ? iptr->desc : "<none>");
607          break;
# Line 625 | Line 612 | send_conf_options(struct Client *source_
612          const int option = *((int *)iptr->option);
613  
614          sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
615 <                   from, RPL_INFO, to,
615 >                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
616                     iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
617                     iptr->desc ? iptr->desc : "<none>");
618          break;
# Line 633 | Line 620 | send_conf_options(struct Client *source_
620      }
621    }
622  
623 <  sendto_one(source_p, form_str(RPL_INFO),
637 <             from, to, "");
623 >  sendto_one_numeric(source_p, &me, RPL_INFO, "");
624   }
625  
626   /* send_info_text()
# Line 647 | Line 633 | static void
633   send_info_text(struct Client *source_p)
634   {
635    const char **text = infotext;
650  char *source, *target;
636  
637    sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
638                         "INFO requested by %s (%s@%s) [%s]",
639                         source_p->name, source_p->username,
640                         source_p->host, source_p->servptr->name);
641  
657  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) &&
658      HasID(source_p))
659    source = me.id, target = source_p->id;
660  else
661    source = me.name, target = source_p->name;
662
642    while (*text)
643    {
644      const char *line = *text++;
# Line 667 | Line 646 | send_info_text(struct Client *source_p)
646      if (*line == '\0')
647        line = " ";
648  
649 <    sendto_one(source_p, form_str(RPL_INFO),
671 <               source, target, line);
649 >    sendto_one_numeric(source_p, &me, RPL_INFO, line);
650    }
651  
652    if (HasUMode(source_p, UMODE_OPER))
# Line 676 | Line 654 | send_info_text(struct Client *source_p)
654  
655    send_birthdate_online_time(source_p);
656  
657 <  sendto_one(source_p, form_str(RPL_ENDOFINFO),
680 <             me.name, source_p->name);
657 >  sendto_one_numeric(source_p, &me, RPL_ENDOFINFO);
658   }
659  
660   /*
661   ** m_info()
662 < **  parv[0] = sender prefix
662 > **  parv[0] = command
663   **  parv[1] = servername
664   */
665 < static void
666 < m_info(struct Client *client_p, struct Client *source_p,
690 <       int parc, char *parv[])
665 > static int
666 > m_info(struct Client *source_p, int parc, char *parv[])
667   {
668    static time_t last_used = 0;
669  
670    if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
671    {
672      /* safe enough to give this on a local connect only */
673 <    sendto_one(source_p, form_str(RPL_LOAD2HI),
674 <               me.name, source_p->name);
699 <    return;
673 >    sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
674 >    return 0;
675    }
676  
677    last_used = CurrentTime;
678  
679 <  if (!ConfigFileEntry.disable_remote)
680 <    if (hunt_server(client_p,source_p, ":%s INFO :%s", 1,
679 >  if (!ConfigServerHide.disable_remote_commands)
680 >    if (hunt_server(source_p, ":%s INFO :%s", 1,
681                      parc, parv) != HUNTED_ISME)
682 <      return;
682 >      return 0;
683  
684    send_info_text(source_p);
685 +  return 0;
686   }
687  
688   /*
689   ** ms_info()
690 < **  parv[0] = sender prefix
690 > **  parv[0] = command
691   **  parv[1] = servername
692   */
693 < static void
694 < ms_info(struct Client *client_p, struct Client *source_p,
719 <        int parc, char *parv[])
693 > static int
694 > ms_info(struct Client *source_p, int parc, char *parv[])
695   {
696 <  if (!IsClient(source_p))
722 <      return;
723 <
724 <  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
696 >  if (hunt_server(source_p, ":%s INFO :%s", 1,
697                    parc, parv) != HUNTED_ISME)
698 <    return;
698 >    return 0;
699  
700    send_info_text(source_p);
701 +  return 0;
702   }
703  
704 < static struct Message info_msgtab = {
704 > static struct Message info_msgtab =
705 > {
706    "INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
707    { m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore }
708   };
# Line 745 | Line 719 | module_exit(void)
719    mod_del_cmd(&info_msgtab);
720   }
721  
722 < struct module module_entry = {
722 > struct module module_entry =
723 > {
724    .node    = { NULL, NULL, NULL },
725    .name    = NULL,
726    .version = "$Revision$",

Diff Legend

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