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-8/modules/m_info.c (file contents), Revision 1230 by michael, Thu Sep 22 19:41:19 2011 UTC vs.
ircd-hybrid/trunk/modules/m_info.c (file contents), Revision 1832 by michael, Fri Apr 19 19:16:09 2013 UTC

# Line 24 | Line 24
24  
25   #include "stdinc.h"
26   #include "list.h"
27 #include "m_info.h"
27   #include "channel.h"
28   #include "client.h"
30 #include "common.h"
29   #include "irc_string.h"
30   #include "ircd.h"
33 #include "hook.h"
31   #include "numeric.h"
35 #include "s_log.h"
32   #include "s_serv.h"
33   #include "s_user.h"
34   #include "send.h"
35 < #include "s_conf.h"
40 < #include "handlers.h"
41 < #include "msg.h"
35 > #include "conf.h"
36   #include "parse.h"
37   #include "modules.h"
38  
39  
46 static void send_conf_options(struct Client *);
47 static void send_birthdate_online_time(struct Client *);
48 static void send_info_text(struct Client *);
49
40   /*
41   * jdc -- Structure for our configuration value table
42   */
# Line 59 | Line 49 | struct InfoStruct
49   };
50  
51   /* Types for output_type in InfoStruct */
52 < #define OUTPUT_STRING     0x0001 /* Output option as %s w/ dereference  */
53 < #define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */
54 < #define OUTPUT_DECIMAL    0x0004 /* Output option as decimal (%d)       */
55 < #define OUTPUT_BOOLEAN    0x0008 /* Output option as "ON" or "OFF"      */
56 < #define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO"      */
57 < #define OUTPUT_BOOLEAN2   0x0020 /* Output option as "YES/NO/MASKED"    */
52 > #define OUTPUT_STRING     0x0001  /* Output option as %s w/ dereference  */
53 > #define OUTPUT_STRING_PTR 0x0002  /* Output option as %s w/out deference */
54 > #define OUTPUT_DECIMAL    0x0004  /* Output option as decimal (%d)       */
55 > #define OUTPUT_BOOLEAN    0x0008  /* Output option as "ON" or "OFF"      */
56 > #define OUTPUT_BOOLEAN_YN 0x0010  /* Output option as "YES" or "NO"      */
57 > #define OUTPUT_BOOLEAN2   0x0020  /* Output option as "YES/NO/MASKED"    */
58  
59   static const struct InfoStruct info_table[] =
60   {
61    /* --[  START OF TABLE  ]-------------------------------------------- */
62 +
63 +  {
64 +    "CPATH",
65 +    OUTPUT_STRING,
66 +    &ConfigFileEntry.configfile,
67 +    "Path to main configuration file"
68 +  },
69 +  {
70 +    "DPATH",
71 +    OUTPUT_STRING,
72 +    &ConfigFileEntry.dpath,
73 +    "Directory containing configuration files"
74 +  },
75 +  {
76 +    "DLPATH",
77 +    OUTPUT_STRING,
78 +    &ConfigFileEntry.dlinefile,
79 +    "Path to D-line database file"
80 +  },
81 +  {
82 +    "KPATH",
83 +    OUTPUT_STRING,
84 +    &ConfigFileEntry.klinefile,
85 +    "Path to K-line database file"
86 +  },
87 +  {
88 +    "GPATH",
89 +    OUTPUT_STRING,
90 +    &ConfigFileEntry.glinefile,
91 +    "Path to G-line database file"
92 +  },
93 +  {
94 +    "XPATH",
95 +    OUTPUT_STRING,
96 +    &ConfigFileEntry.xlinefile,
97 +    "Path to X-line database file"
98 +  },
99 +  {
100 +    "RESVPATH",
101 +    OUTPUT_STRING,
102 +    &ConfigFileEntry.xlinefile,
103 +    "Path to resv database file"
104 +  },
105    {
106      "network_name",
107      OUTPUT_STRING,
# Line 88 | Line 121 | static const struct InfoStruct info_tabl
121      "Server is a hub"
122    },
123    {
124 <    "use_logging",
125 <    OUTPUT_BOOLEAN_YN,
126 <    &ConfigLoggingEntry.use_logging,
127 <    "Enable logging"
95 <  },
96 <  {
97 <    "fuserlog",
98 <    OUTPUT_STRING_PTR,
99 <    &ConfigLoggingEntry.userlog,
100 <    "User log file"
124 >    "max_clients",
125 >    OUTPUT_DECIMAL,
126 >    &ServerInfo.max_clients,
127 >    "Maximum number of clients permitted simultaneously on this server"
128    },
129    {
130 <    "foperlog",
131 <    OUTPUT_STRING_PTR,
132 <    &ConfigLoggingEntry.operlog,
133 <    "Operator log file"
130 >    "max_nick_length",
131 >    OUTPUT_DECIMAL,
132 >    &ServerInfo.max_nick_length,
133 >    "Maximum nickname length"
134    },
135    {
136 <    "fkilllog",
137 <    OUTPUT_STRING_PTR,
138 <    &ConfigLoggingEntry.killlog,
139 <    "Kill log file"
136 >    "max_topic_length",
137 >    OUTPUT_DECIMAL,
138 >    &ServerInfo.max_topic_length,
139 >    "Maximum topic length"
140    },
141    {
142 <    "fklinelog",
143 <    OUTPUT_STRING_PTR,
144 <    &ConfigLoggingEntry.klinelog,
145 <    "K-Line log file"
142 >    "use_logging",
143 >    OUTPUT_BOOLEAN_YN,
144 >    &ConfigLoggingEntry.use_logging,
145 >    "Enable logging"
146    },
147    {
148 <    "fglinelog",
149 <    OUTPUT_STRING_PTR,
150 <    &ConfigLoggingEntry.glinelog,
151 <    "G-Line log file"
148 >    "disable_fake_channels",
149 >    OUTPUT_BOOLEAN_YN,
150 >    &ConfigChannel.disable_fake_channels,
151 >    "Forbids channels with special ASCII characters in their name"
152    },
153    {
154      "restrict_channels",
# Line 130 | Line 157 | static const struct InfoStruct info_tabl
157      "Only reserved channels are allowed"
158    },
159    {
133    "disable_local_channels",
134    OUTPUT_BOOLEAN_YN,
135    &ConfigChannel.disable_local_channels,
136    "Prevent users from joining &channels"
137  },
138 {
139    "use_invex",
140    OUTPUT_BOOLEAN_YN,
141    &ConfigChannel.use_invex,
142    "Enable chanmode +I (invite exceptions)"
143  },
144  {
145    "use_except",
146    OUTPUT_BOOLEAN_YN,
147    &ConfigChannel.use_except,
148    "Enable chanmode +e (ban exceptions)"
149  },
150  {
151    "use_knock",
152    OUTPUT_BOOLEAN_YN,
153    &ConfigChannel.use_knock,
154    "Enable /KNOCK"
155  },
156  {
160      "knock_delay",
161      OUTPUT_DECIMAL,
162      &ConfigChannel.knock_delay,
# Line 172 | Line 175 | static const struct InfoStruct info_tabl
175      "Maximum number of channels a user can join"
176    },
177    {
178 +    "max_chans_per_oper",
179 +    OUTPUT_DECIMAL,
180 +    &ConfigChannel.max_chans_per_oper,
181 +    "Maximum number of channels an oper can join"
182 +  },
183 +  {
184      "quiet_on_ban",
185      OUTPUT_BOOLEAN_YN,
186      &ConfigChannel.quiet_on_ban,
# Line 208 | Line 217 | static const struct InfoStruct info_tabl
217      "Disallow joining channels when split"
218    },
219    {
211    "burst_topicwho",
212    OUTPUT_BOOLEAN_YN,
213    &ConfigChannel.burst_topicwho,
214    "Enable sending of who set topic on topicburst"
215  },
216  {
220      "flatten_links",
221      OUTPUT_BOOLEAN_YN,
222      &ConfigServerHide.flatten_links,
# Line 232 | Line 235 | static const struct InfoStruct info_tabl
235      "Hide this server from a flattened /links on remote servers"
236    },
237    {
235    "disable_hidden",
236    OUTPUT_BOOLEAN_YN,
237    &ConfigServerHide.disable_hidden,
238    "Prevent servers from hiding themselves from a flattened /links"
239  },
240  {
238      "hide_servers",
239      OUTPUT_BOOLEAN_YN,
240      &ConfigServerHide.hide_servers,
# Line 274 | Line 271 | static const struct InfoStruct info_tabl
271      "Automatically set mode +i on connecting users"
272    },
273    {
277    "burst_away",
278    OUTPUT_BOOLEAN_YN,
279    &ConfigFileEntry.burst_away,
280    "Send /away string that users have set on the server burst"
281  },
282  {
283    "use_whois_actually",
284    OUTPUT_BOOLEAN_YN,
285    &ConfigFileEntry.use_whois_actually,
286    "Show IP address on /WHOIS when possible"
287  },
288  {
274      "kill_chase_time_limit",
275      OUTPUT_DECIMAL,
276      &ConfigFileEntry.kill_chase_time_limit,
# Line 331 | Line 316 | static const struct InfoStruct info_tabl
316      "failed_oper_notice",
317      OUTPUT_BOOLEAN,
318      &ConfigFileEntry.failed_oper_notice,
319 <    "Inform opers if someone /oper's with the wrong password"
319 >    "Inform opers if someone tries to /oper with the wrong password"
320    },
321    {
322      "dots_in_ident",
# Line 394 | Line 379 | static const struct InfoStruct info_tabl
379      "Maximum permitted TS delta from another server"
380    },
381    {
397    "kline_with_reason",
398    OUTPUT_BOOLEAN_YN,
399    &ConfigFileEntry.kline_with_reason,
400    "Display K-line reason to client on disconnect"
401  },
402  {
403    "kline_reason",
404    OUTPUT_STRING,
405    &ConfigFileEntry.kline_reason,
406    "Reason given to K-lined clients on sign off"
407  },
408  {
382      "warn_no_nline",
383      OUTPUT_BOOLEAN,
384      &ConfigFileEntry.warn_no_nline,
385      "Display warning if connecting server lacks N-line"
386    },
387    {
388 +    "stats_e_disabled",
389 +    OUTPUT_BOOLEAN_YN,
390 +    &ConfigFileEntry.stats_e_disabled,
391 +    "Whether or not STATS e is disabled"
392 +  },
393 +  {
394      "stats_o_oper_only",
395      OUTPUT_BOOLEAN_YN,
396      &ConfigFileEntry.stats_o_oper_only,
# Line 496 | Line 475 | static const struct InfoStruct info_tabl
475      "The maximum number of PRIVMSG/NOTICE targets"
476    },
477    {
499    "client_flood",
500    OUTPUT_DECIMAL,
501    &ConfigFileEntry.client_flood,
502    "Maximum amount of data in a client's queue before they are disconnected"
503  },
504  {
478      "throttle_time",
479      OUTPUT_DECIMAL,
480      &ConfigFileEntry.throttle_time,
# Line 514 | Line 487 | static const struct InfoStruct info_tabl
487      "G-line (network-wide K-line) support"
488    },
489    {
490 <    "duration",
490 >    "gline_duration",
491      OUTPUT_DECIMAL,
492      &ConfigFileEntry.gline_time,
493      "Expiry time for G-lines"
494    },
495 +  {
496 +    "gline_request_duration",
497 +    OUTPUT_DECIMAL,
498 +    &ConfigFileEntry.gline_request_time,
499 +    "Expiry time for pending G-lines"
500 +  },
501 +
502    /* --[  END OF TABLE  ]---------------------------------------------- */
503    {
504      NULL,
# Line 528 | Line 508 | static const struct InfoStruct info_tabl
508    }
509   };
510  
531 /*
532 ** m_info()
533 **  parv[0] = sender prefix
534 **  parv[1] = servername
535 */
536 static void
537 m_info(struct Client *client_p, struct Client *source_p,
538       int parc, char *parv[])
539 {
540  static time_t last_used = 0;
541
542  if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
543  {
544    /* safe enough to give this on a local connect only */
545    sendto_one(source_p, form_str(RPL_LOAD2HI),
546               me.name, source_p->name);
547    return;
548  }
549
550  last_used = CurrentTime;
551
552  if (!ConfigFileEntry.disable_remote)
553    if (hunt_server(client_p,source_p, ":%s INFO :%s", 1,
554                    parc, parv) != HUNTED_ISME)
555      return;
556
557  send_info_text(source_p);
558 }
559
560 /*
561 ** mo_info()
562 **  parv[0] = sender prefix
563 **  parv[1] = servername
564 */
565 static void
566 mo_info(struct Client *client_p, struct Client *source_p,
567        int parc, char *parv[])
568 {
569  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
570                  parc, parv) != HUNTED_ISME)
571    return;
572
573  send_info_text(source_p);
574 }
575
576 /*
577 ** ms_info()
578 **  parv[0] = sender prefix
579 **  parv[1] = servername
580 */
581 static void
582 ms_info(struct Client *client_p, struct Client *source_p,
583        int parc, char *parv[])
584 {
585  if (!IsClient(source_p))
586      return;
587
588  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
589                  parc, parv) != HUNTED_ISME)
590    return;
591
592  send_info_text(source_p);
593 }
594
595 /* send_info_text()
596 *
597 * inputs       - client pointer to send info text to
598 * output       - NONE
599 * side effects - info text is sent to client
600 */
601 static void
602 send_info_text(struct Client *source_p)
603 {
604  const char **text = infotext;
605  char *source, *target;
606
607  sendto_realops_flags(UMODE_SPY, L_ALL,
608                       "INFO requested by %s (%s@%s) [%s]",
609                       source_p->name, source_p->username,
610                       source_p->host, source_p->servptr->name);
611
612  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) &&
613      HasID(source_p))
614    source = me.id, target = source_p->id;
615  else
616    source = me.name, target = source_p->name;
617
618  while (*text)
619  {
620    const char *line = *text++;
621
622    if (*line == '\0')
623      line = " ";
624
625    sendto_one(source_p, form_str(RPL_INFO),
626               source, target, line);
627  }
628
629  if (HasUMode(source_p, UMODE_OPER))
630    send_conf_options(source_p);
631
632  send_birthdate_online_time(source_p);
633
634  sendto_one(source_p, form_str(RPL_ENDOFINFO),
635             me.name, source_p->name);
636 }
637
511   /* send_birthdate_online_time()
512   *
513   * inputs       - client pointer to send to
# Line 645 | Line 518 | static void
518   send_birthdate_online_time(struct Client *source_p)
519   {
520    if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
648  {
521      sendto_one(source_p, ":%s %d %s :On-line since %s",
522                 me.id, RPL_INFO, source_p->id,
523 <               myctime(me.firsttime));
652 <  }
523 >               myctime(me.localClient->firsttime));
524    else
654  {
525      sendto_one(source_p, ":%s %d %s :On-line since %s",
526                 me.name, RPL_INFO, source_p->name,
527 <               myctime(me.firsttime));
658 <  }
527 >               myctime(me.localClient->firsttime));
528   }
529  
530   /* send_conf_options()
# Line 667 | Line 536 | send_birthdate_online_time(struct Client
536   static void
537   send_conf_options(struct Client *source_p)
538   {
670  Info *infoptr;
539    const char *from, *to;
540    const struct InfoStruct *iptr = NULL;
541  
# Line 685 | Line 553 | send_conf_options(struct Client *source_
553      to = source_p->name;
554    }
555  
688  for (infoptr = MyInformation; infoptr->name; infoptr++)
689  {
690    if (infoptr->intvalue)
691    {
692      sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
693                 from, RPL_INFO, to, infoptr->name,
694                 infoptr->intvalue, infoptr->desc);
695    }
696    else
697    {
698      sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
699                 from, RPL_INFO, to, infoptr->name,
700                 infoptr->strvalue, infoptr->desc);
701    }
702  }
703
556    /*
557     * Parse the info_table[] and do the magic.
558     */
# Line 759 | Line 611 | send_conf_options(struct Client *source_
611        /* Output info_table[i].option as "YES" or "NO" */
612        case OUTPUT_BOOLEAN_YN:
613        {
614 <        int option = *((int *)iptr->option);
614 >        const int option = *((int *)iptr->option);
615  
616          sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
617                     from, RPL_INFO, to,
# Line 770 | Line 622 | send_conf_options(struct Client *source_
622  
623        case OUTPUT_BOOLEAN2:
624        {
625 <        int option = *((int *)iptr->option);
625 >        const int option = *((int *)iptr->option);
626  
627          sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
628                     from, RPL_INFO, to,
# Line 781 | Line 633 | send_conf_options(struct Client *source_
633      }
634    }
635  
636 <  /* Don't send oper_only_umodes...it's a bit mask, we will have to decode it
785 <   * in order for it to show up properly to opers who issue INFO
786 <   */
787 < #ifndef EFNET
788 <  /* jdc -- Only send compile information to admins. */
789 <  if (HasUMode(source_p, UMODE_ADMIN))
790 <    sendto_one(source_p, ":%s %d %s :Running on [%s]",
791 <               from, RPL_INFO, to, ircd_platform);
792 < #endif
793 <  sendto_one(source_p, form_str(RPL_INFO),
636 >  sendto_one(source_p, RPL_INFO,
637               from, to, "");
638   }
639  
640 + /* send_info_text()
641 + *
642 + * inputs       - client pointer to send info text to
643 + * output       - NONE
644 + * side effects - info text is sent to client
645 + */
646 + static void
647 + send_info_text(struct Client *source_p)
648 + {
649 +  const char **text = infotext;
650 +  char *source, *target;
651 +
652 +  sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
653 +                       "INFO requested by %s (%s@%s) [%s]",
654 +                       source_p->name, source_p->username,
655 +                       source_p->host, source_p->servptr->name);
656 +
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 +
663 +  while (*text)
664 +  {
665 +    const char *line = *text++;
666 +
667 +    if (*line == '\0')
668 +      line = " ";
669 +
670 +    sendto_one(source_p, RPL_INFO,
671 +               source, target, line);
672 +  }
673 +
674 +  if (HasUMode(source_p, UMODE_OPER))
675 +    send_conf_options(source_p);
676 +
677 +  send_birthdate_online_time(source_p);
678 +
679 +  sendto_one(source_p, RPL_ENDOFINFO,
680 +             me.name, source_p->name);
681 + }
682 +
683 + /*
684 + ** m_info()
685 + **  parv[0] = sender prefix
686 + **  parv[1] = servername
687 + */
688 + static void
689 + m_info(struct Client *client_p, struct Client *source_p,
690 +       int parc, char *parv[])
691 + {
692 +  static time_t last_used = 0;
693 +
694 +  if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
695 +  {
696 +    /* safe enough to give this on a local connect only */
697 +    sendto_one(source_p, RPL_LOAD2HI,
698 +               me.name, source_p->name);
699 +    return;
700 +  }
701 +
702 +  last_used = CurrentTime;
703 +
704 +  if (!ConfigFileEntry.disable_remote)
705 +    if (hunt_server(client_p,source_p, ":%s INFO :%s", 1,
706 +                    parc, parv) != HUNTED_ISME)
707 +      return;
708 +
709 +  send_info_text(source_p);
710 + }
711 +
712 + /*
713 + ** ms_info()
714 + **  parv[0] = sender prefix
715 + **  parv[1] = servername
716 + */
717 + static void
718 + ms_info(struct Client *client_p, struct Client *source_p,
719 +        int parc, char *parv[])
720 + {
721 +  if (!IsClient(source_p))
722 +      return;
723 +
724 +  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
725 +                  parc, parv) != HUNTED_ISME)
726 +    return;
727 +
728 +  send_info_text(source_p);
729 + }
730 +
731   static struct Message info_msgtab = {
732    "INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
733 <  { m_unregistered, m_info, ms_info, m_ignore, mo_info, m_ignore }
733 >  { m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore }
734   };
735  
736   static void

Diff Legend

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