ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/modules/m_rehash.c
Revision: 1001
Committed: Sat Aug 29 22:44:44 2009 UTC (16 years, 10 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-7.2/modules/m_rehash.c
File size: 3994 byte(s)
Log Message:
- remove half done and broken win32 support

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3     * m_rehash.c: Re-reads the configuration file.
4     *
5     * Copyright (C) 2002 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22 knight 31 * $Id$
23 adx 30 */
24    
25     #include "stdinc.h"
26     #include "handlers.h"
27     #include "client.h"
28     #include "common.h"
29     #include "irc_string.h"
30     #include "ircd.h"
31     #include "list.h"
32     #include "numeric.h"
33     #include "irc_res.h"
34     #include "s_conf.h"
35     #include "s_log.h"
36     #include "send.h"
37     #include "msg.h"
38     #include "parse.h"
39     #include "modules.h"
40    
41     static void mo_rehash(struct Client *, struct Client *, int, char **);
42    
43     struct Message rehash_msgtab = {
44     "REHASH", 0, 0, 0, 0, MFLG_SLOW, 0,
45     {m_unregistered, m_not_oper, m_ignore, m_ignore, mo_rehash, m_ignore}
46     };
47    
48     #ifndef STATIC_MODULES
49     void
50     _modinit(void)
51     {
52     mod_add_cmd(&rehash_msgtab);
53     }
54    
55     void
56     _moddeinit(void)
57     {
58     mod_del_cmd(&rehash_msgtab);
59     }
60    
61 knight 31 const char *_version = "$Revision$";
62 adx 30 #endif
63    
64     /*
65     * mo_rehash - REHASH message handler
66     *
67     */
68     static void
69     mo_rehash(struct Client *client_p, struct Client *source_p,
70     int parc, char *parv[])
71     {
72     int found = 0;
73    
74     if (!IsOperRehash(source_p))
75     {
76     sendto_one(source_p, form_str(ERR_NOPRIVS),
77     me.name, source_p->name, "rehash");
78     return;
79     }
80    
81     if (parc > 1)
82     {
83     if (irccmp(parv[1], "DNS") == 0)
84     {
85     sendto_one(source_p, form_str(RPL_REHASHING), me.name, parv[0], "DNS");
86     sendto_realops_flags(UMODE_ALL, L_ALL, "%s is rehashing DNS",
87     get_oper_name(source_p));
88     restart_resolver(); /* re-read /etc/resolv.conf AGAIN?
89     and close/re-open res socket */
90     found = 1;
91     }
92     else if (irccmp(parv[1], "FDLIMIT") == 0)
93     {
94     sendto_one(source_p, form_str(RPL_REHASHING), me.name,
95     parv[0], "FDLIMIT");
96     sendto_realops_flags(UMODE_ALL, L_ALL, "%s is updating FDLIMIT",
97     get_oper_name(source_p));
98     recalc_fdlimit(NULL);
99     found = 1;
100     }
101 michael 1001 else if (irccmp(parv[1], "MOTD") == 0)
102 adx 30 {
103     sendto_realops_flags(UMODE_ALL, L_ALL,
104     "%s is forcing re-reading of MOTD file",
105     get_oper_name(source_p));
106     read_message_file(&ConfigFileEntry.motd);
107     found = 1;
108     }
109     else if (irccmp(parv[1], "OMOTD") == 0)
110     {
111     sendto_realops_flags(UMODE_ALL, L_ALL,
112     "%s is forcing re-reading of OPER MOTD file",
113     get_oper_name(source_p));
114     read_message_file(&ConfigFileEntry.opermotd);
115     found = 1;
116     }
117    
118     if (found)
119     {
120     ilog(L_NOTICE, "REHASH %s From %s",
121     parv[1], get_client_name(source_p, HIDE_IP));
122     return;
123     }
124     else
125     {
126     sendto_one(source_p, ":%s NOTICE %s :rehash one of :DNS FDLIMIT "
127     "MOTD OMOTD", me.name, source_p->name);
128     return;
129     }
130     }
131     else
132     {
133     sendto_one(source_p, form_str(RPL_REHASHING),
134     me.name, source_p->name, ConfigFileEntry.configfile);
135     sendto_realops_flags(UMODE_ALL, L_ALL,
136     "%s is rehashing server config file",
137     get_oper_name(source_p));
138     ilog(L_NOTICE, "REHASH From %s[%s]",
139     get_oper_name(source_p), source_p->sockhost);
140     rehash(0);
141     }
142     }

Properties

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