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

Comparing ircd-hybrid/trunk/modules/m_set.c (file contents):
Revision 1632 by michael, Sun Nov 4 15:37:10 2012 UTC vs.
Revision 1997 by michael, Sat May 11 17:35:07 2013 UTC

# Line 42 | Line 42
42   #include "s_misc.h"
43  
44  
45 – /* Structure used for the SET table itself */
46 – struct SetStruct
47 – {
48 –  const char *name;
49 –  void (*handler)();
50 –  const int wants_char; /* 1 if it expects (char *, [int]) */
51 –  const int wants_int;  /* 1 if it expects ([char *], int) */
52 –  /* eg:  0, 1 == only an int arg
53 –   * eg:  1, 1 == char and int args */
54 – };
55 –
56 – static void quote_autoconn(struct Client *, const char *, int);
57 – static void quote_autoconnall(struct Client *, int);
58 – static void quote_floodcount(struct Client *, int);
59 – static void quote_identtimeout(struct Client *, int);
60 – static void quote_max(struct Client *, int);
61 – static void quote_msglocale(struct Client *, char *);
62 – static void quote_spamnum(struct Client *, int);
63 – static void quote_spamtime(struct Client *, int);
64 – static void quote_splitmode(struct Client *, char *);
65 – static void quote_splitnum(struct Client *, int);
66 – static void quote_splitusers(struct Client *, int);
67 – static void list_quote_commands(struct Client *);
68 – static void quote_jfloodtime(struct Client *, int);
69 – static void quote_jfloodcount(struct Client *, int);
70 –
71 – /*
72 – * If this ever needs to be expanded to more than one arg of each
73 – * type, want_char/want_int could be the count of the arguments,
74 – * instead of just a boolean flag...
75 – *
76 – * -davidt
77 – */
78 –
79 – static const struct SetStruct set_cmd_table[] =
80 – {
81 –  /* name               function        string arg  int arg */
82 –  /* -------------------------------------------------------- */
83 –  { "AUTOCONN",         quote_autoconn,         1,      1 },
84 –  { "AUTOCONNALL",      quote_autoconnall,      0,      1 },
85 –  { "FLOODCOUNT",       quote_floodcount,       0,      1 },
86 –  { "IDENTTIMEOUT",     quote_identtimeout,     0,      1 },
87 –  { "MAX",              quote_max,              0,      1 },
88 –  { "MSGLOCALE",        quote_msglocale,        1,      0 },
89 –  { "SPAMNUM",          quote_spamnum,          0,      1 },
90 –  { "SPAMTIME",         quote_spamtime,         0,      1 },
91 –  { "SPLITMODE",        quote_splitmode,        1,      0 },
92 –  { "SPLITNUM",         quote_splitnum,         0,      1 },
93 –  { "SPLITUSERS",       quote_splitusers,       0,      1 },
94 –  { "JFLOODTIME",       quote_jfloodtime,       0,      1 },
95 –  { "JFLOODCOUNT",      quote_jfloodcount,      0,      1 },
96 –  /* -------------------------------------------------------- */
97 –  { NULL,               NULL,                   0,      0 }
98 – };
99 –
100 – /*
101 – * list_quote_commands() sends the client all the available commands.
102 – * Four to a line for now.
103 – */
104 – static void
105 – list_quote_commands(struct Client *source_p)
106 – {
107 –  int j = 0;
108 –  const struct SetStruct *tab = set_cmd_table;
109 –  const char *names[4] = { "", "", "", "" };
110 –
111 –  sendto_one(source_p, ":%s NOTICE %s :Available QUOTE SET commands:",
112 –             me.name, source_p->name);
113 –
114 –  for (; tab->handler; ++tab)
115 –  {
116 –    names[j++] = tab->name;
117 –
118 –    if (j > 3)
119 –    {
120 –      sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s",
121 –                 me.name, source_p->name,
122 –                 names[0], names[1],
123 –                 names[2], names[3]);
124 –      j = 0;
125 –      names[0] = names[1] = names[2] = names[3] = "";
126 –    }
127 –
128 –  }
129 –
130 –  if (j)
131 –    sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s",
132 –               me.name, source_p->name,
133 –               names[0], names[1],
134 –               names[2], names[3]);
135 – }
136 –
45   /* SET AUTOCONN */
46   static void
47   quote_autoconn(struct Client *source_p, const char *arg, int newval)
# Line 231 | Line 139 | quote_max(struct Client *source_p, int n
139   {
140    if (newval > 0)
141    {
234 –    recalc_fdlimit(NULL);
235 –
142      if (newval > MAXCLIENTS_MAX)
143      {
144        sendto_one(source_p,
# Line 260 | Line 166 | quote_max(struct Client *source_p, int n
166                 me.name, source_p->name, ServerInfo.max_clients, Count.local);
167   }
168  
263 – /* SET MSGLOCALE */
264 – static void
265 – quote_msglocale(struct Client *source_p, char *locale)
266 – {
267 –  if (locale != NULL)
268 –  {
269 –    set_locale(locale);
270 –    rebuild_isupport_message_line();
271 –    sendto_one(source_p, ":%s NOTICE %s :Set MSGLOCALE to '%s'",
272 –               me.name, source_p->name, get_locale());
273 –  }
274 –  else
275 –    sendto_one(source_p, ":%s NOTICE %s :MSGLOCALE is currently '%s'",
276 –               me.name, source_p->name, get_locale());
277 – }
278 –
169   /* SET SPAMNUM */
170   static void
171   quote_spamnum(struct Client *source_p, int newval)
# Line 463 | Line 353 | quote_jfloodcount(struct Client *source_
353                 me.name, source_p->name, GlobalSetOptions.joinfloodcount);
354   }
355  
356 + /* Structure used for the SET table itself */
357 + struct SetStruct
358 + {
359 +  const char *name;
360 +  void (*handler)();
361 +  const int wants_char; /* 1 if it expects (char *, [int]) */
362 +  const int wants_int;  /* 1 if it expects ([char *], int) */
363 +  /* eg:  0, 1 == only an int arg
364 +   * eg:  1, 1 == char and int args */
365 + };
366 +
367 + /*
368 + * If this ever needs to be expanded to more than one arg of each
369 + * type, want_char/want_int could be the count of the arguments,
370 + * instead of just a boolean flag...
371 + *
372 + * -davidt
373 + */
374 + static const struct SetStruct set_cmd_table[] =
375 + {
376 +  /* name               function        string arg  int arg */
377 +  /* -------------------------------------------------------- */
378 +  { "AUTOCONN",         quote_autoconn,         1,      1 },
379 +  { "AUTOCONNALL",      quote_autoconnall,      0,      1 },
380 +  { "FLOODCOUNT",       quote_floodcount,       0,      1 },
381 +  { "IDENTTIMEOUT",     quote_identtimeout,     0,      1 },
382 +  { "MAX",              quote_max,              0,      1 },
383 +  { "SPAMNUM",          quote_spamnum,          0,      1 },
384 +  { "SPAMTIME",         quote_spamtime,         0,      1 },
385 +  { "SPLITMODE",        quote_splitmode,        1,      0 },
386 +  { "SPLITNUM",         quote_splitnum,         0,      1 },
387 +  { "SPLITUSERS",       quote_splitusers,       0,      1 },
388 +  { "JFLOODTIME",       quote_jfloodtime,       0,      1 },
389 +  { "JFLOODCOUNT",      quote_jfloodcount,      0,      1 },
390 +  /* -------------------------------------------------------- */
391 +  { NULL,               NULL,                   0,      0 }
392 + };
393 +
394 + /*
395 + * list_quote_commands() sends the client all the available commands.
396 + * Four to a line for now.
397 + */
398 + static void
399 + list_quote_commands(struct Client *source_p)
400 + {
401 +  int j = 0;
402 +  const struct SetStruct *tab = set_cmd_table;
403 +  const char *names[4] = { "", "", "", "" };
404 +
405 +  sendto_one(source_p, ":%s NOTICE %s :Available QUOTE SET commands:",
406 +             me.name, source_p->name);
407 +
408 +  for (; tab->handler; ++tab)
409 +  {
410 +    names[j++] = tab->name;
411 +
412 +    if (j > 3)
413 +    {
414 +      sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s",
415 +                 me.name, source_p->name,
416 +                 names[0], names[1],
417 +                 names[2], names[3]);
418 +      j = 0;
419 +      names[0] = names[1] = names[2] = names[3] = "";
420 +    }
421 +
422 +  }
423 +
424 +  if (j)
425 +    sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s",
426 +               me.name, source_p->name,
427 +               names[0], names[1],
428 +               names[2], names[3]);
429 + }
430 +
431   /*
432   * mo_set - SET command handler
433   * set options while running

Diff Legend

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