ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_rehash.c
Revision: 5864
Committed: Tue Apr 28 12:23:30 2015 UTC (10 years, 4 months ago) by michael
Content type: text/x-csrc
File size: 3645 byte(s)
Log Message:
- Removed useless zero initializers from the module_entry as suggested by Adam

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 5347 * Copyright (c) 1997-2015 ircd-hybrid development team
5 adx 30 *
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
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
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 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2820 /*! \file m_rehash.c
23     * \brief Includes required functions for processing the REHASH command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28     #include "client.h"
29     #include "irc_string.h"
30     #include "ircd.h"
31     #include "list.h"
32     #include "numeric.h"
33 michael 3322 #include "res.h"
34 michael 1309 #include "conf.h"
35     #include "log.h"
36 adx 30 #include "send.h"
37     #include "parse.h"
38     #include "modules.h"
39 michael 2150 #include "motd.h"
40 adx 30
41    
42 michael 3300 /*! \brief REHASH command handler
43 adx 30 *
44 michael 3300 * \param source_p Pointer to allocated Client struct from which the message
45     * originally comes from. This can be a local or remote client.
46     * \param parc Integer holding the number of supplied arguments.
47     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
48     * pointers.
49     * \note Valid arguments for this command are:
50     * - parv[0] = command
51     * - parv[1] = additional option
52 adx 30 */
53 michael 2820 static int
54 michael 3156 mo_rehash(struct Client *source_p, int parc, char *parv[])
55 adx 30 {
56     int found = 0;
57 michael 4842 const char *const option = parv[1];
58 adx 30
59 michael 1219 if (!HasOFlag(source_p, OPER_FLAG_REHASH))
60 adx 30 {
61 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "rehash");
62 michael 2820 return 0;
63 adx 30 }
64    
65 michael 4842 if (!EmptyString(option))
66 adx 30 {
67 michael 4842 if (!irccmp(option, "DNS"))
68 adx 30 {
69 michael 3109 sendto_one_numeric(source_p, &me, RPL_REHASHING, "DNS");
70 michael 1618 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
71     "%s is rehashing DNS",
72 adx 30 get_oper_name(source_p));
73 michael 3745 restart_resolver();
74 adx 30 found = 1;
75     }
76 michael 4842 else if (!irccmp(option, "MOTD"))
77 adx 30 {
78 michael 1618 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
79 michael 2150 "%s is forcing re-reading of MOTD files",
80 adx 30 get_oper_name(source_p));
81 michael 2150 motd_recache();
82 adx 30 found = 1;
83     }
84    
85     if (found)
86 michael 1247 ilog(LOG_TYPE_IRCD, "REHASH %s From %s",
87 michael 4842 option, get_oper_name(source_p));
88 adx 30 else
89 michael 3110 sendto_one_notice(source_p, &me, ":%s is not a valid option. "
90 michael 4842 "Choose from DNS, MOTD", option);
91 adx 30 }
92     else
93     {
94 michael 4340 sendto_one_numeric(source_p, &me, RPL_REHASHING, ConfigGeneral.configfile);
95 michael 1618 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
96 michael 2830 "%s is rehashing configuration file(s)",
97 adx 30 get_oper_name(source_p));
98 michael 2340 ilog(LOG_TYPE_IRCD, "REHASH From %s",
99     get_oper_name(source_p));
100 michael 4982 conf_rehash(0);
101 adx 30 }
102 michael 2820
103     return 0;
104 adx 30 }
105 michael 1230
106 michael 2820 static struct Message rehash_msgtab =
107     {
108 michael 4545 "REHASH", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
109 michael 2820 { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_rehash, m_ignore }
110 michael 1230 };
111    
112     static void
113     module_init(void)
114     {
115     mod_add_cmd(&rehash_msgtab);
116     }
117    
118     static void
119     module_exit(void)
120     {
121     mod_del_cmd(&rehash_msgtab);
122     }
123    
124 michael 2820 struct module module_entry =
125     {
126 michael 1230 .version = "$Revision$",
127     .modinit = module_init,
128     .modexit = module_exit,
129     };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision