/[svn]/ircd-hybrid/modules/m_rehash.c
ViewVC logotype

Contents of /ircd-hybrid/modules/m_rehash.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 470 - (show annotations)
Fri Feb 17 05:07:43 2006 UTC (16 years, 6 months ago) by db
File MIME type: text/x-chdr
File size: 4026 byte(s)
- fix compile errors with moved modules.h
- fix a few missing includes, msg.h and parse.h


1 /*
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 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "handlers.h"
27 #include "client.h"
28 #include "common.h"
29 #include "ircd.h"
30 #include "numeric.h"
31 #include "s_conf.h"
32 #include "send.h"
33 #include "msg.h"
34 #include "parse.h"
35 #include "conf/modules.h"
36
37 static void mo_rehash(struct Client *, struct Client *, int, char **);
38
39 struct Message rehash_msgtab = {
40 "REHASH", 0, 0, 0, 0, MFLG_SLOW, 0,
41 {m_unregistered, m_not_oper, m_ignore, m_ignore, mo_rehash, m_ignore}
42 };
43
44 INIT_MODULE(m_rehash, "$Revision$")
45 {
46 mod_add_cmd(&rehash_msgtab);
47 }
48
49 CLEANUP_MODULE
50 {
51 mod_del_cmd(&rehash_msgtab);
52 }
53
54 /*
55 * mo_rehash - REHASH message handler
56 *
57 */
58 static void
59 mo_rehash(struct Client *client_p, struct Client *source_p,
60 int parc, char *parv[])
61 {
62 int found = 0;
63
64 if (!IsOperRehash(source_p))
65 {
66 sendto_one(source_p, form_str(ERR_NOPRIVS),
67 me.name, source_p->name, "rehash");
68 return;
69 }
70
71 if (parc > 1)
72 {
73 #ifndef _WIN32
74 if (irccmp(parv[1], "DNS") == 0)
75 {
76 sendto_one(source_p, form_str(RPL_REHASHING), me.name, parv[0], "DNS");
77 sendto_realops_flags(UMODE_ALL, L_ALL, "%s is rehashing DNS",
78 get_oper_name(source_p));
79 restart_resolver(); /* re-read /etc/resolv.conf AGAIN?
80 and close/re-open res socket */
81 found = 1;
82 }
83 else if (irccmp(parv[1], "FDLIMIT") == 0)
84 {
85 sendto_one(source_p, form_str(RPL_REHASHING), me.name,
86 parv[0], "FDLIMIT");
87 sendto_realops_flags(UMODE_ALL, L_ALL, "%s is updating FDLIMIT",
88 get_oper_name(source_p));
89 recalc_fdlimit(NULL);
90 found = 1;
91 }
92 else
93 #endif
94 if (irccmp(parv[1], "MOTD") == 0)
95 {
96 sendto_realops_flags(UMODE_ALL, L_ALL,
97 "%s is forcing re-reading of MOTD file",
98 get_oper_name(source_p));
99 read_message_file(&ConfigFileEntry.motd);
100 found = 1;
101 }
102 else if (irccmp(parv[1], "OMOTD") == 0)
103 {
104 sendto_realops_flags(UMODE_ALL, L_ALL,
105 "%s is forcing re-reading of OPER MOTD file",
106 get_oper_name(source_p));
107 read_message_file(&ConfigFileEntry.opermotd);
108 found = 1;
109 }
110
111 if (found)
112 {
113 ilog(L_NOTICE, "REHASH %s From %s",
114 parv[1], get_client_name(source_p, HIDE_IP));
115 return;
116 }
117 else
118 {
119 #ifdef _WIN32
120 sendto_one(source_p, ":%s NOTICE %s :rehash one of :MOTD OMOTD",
121 me.name, source_p->name);
122 #else
123 sendto_one(source_p, ":%s NOTICE %s :rehash one of :DNS FDLIMIT "
124 "MOTD OMOTD", me.name, source_p->name);
125 #endif
126 return;
127 }
128 }
129 else
130 {
131 sendto_one(source_p, form_str(RPL_REHASHING),
132 me.name, source_p->name, ConfigFileEntry.configfile);
133 sendto_realops_flags(UMODE_ALL, L_ALL,
134 "%s is rehashing server config file",
135 get_oper_name(source_p));
136 ilog(L_NOTICE, "REHASH From %s[%s]",
137 get_oper_name(source_p), source_p->sockhost);
138 rehash(0);
139 }
140 }
141

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28