ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/ircd-hybrid-newconf/src/conf/serverhide.c
Revision: 1027
Committed: Sun Nov 8 13:01:13 2009 UTC (16 years, 9 months ago) by michael
Content type: text/x-csrc
File size: 3027 byte(s)
Log Message:
- Move old 7.3 sources to branches/ircd-hybrid-newconf

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * serverhide.c: Defines the serverhide{} block of ircd.conf.
4 *
5 * Copyright (C) 2005 by the Hybrid Development Team.
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 "conf/conf.h"
27 #include "server.h"
28
29 struct ServerHideConf ServerHide;
30
31 static dlink_node *hreset, *hverify;
32 static int old_links_delay;
33
34 /*
35 * reset_serverhide()
36 *
37 * Sets up default values before a rehash.
38 *
39 * inputs: none
40 * output: none
41 */
42 static void *
43 reset_serverhide(va_list args)
44 {
45 old_links_delay = conf_cold ? 0 : LINKS_DELAY;
46
47 ServerHide.flatten_links = NO;
48 ServerHide.links_delay = 5*60;
49 ServerHide.hidden = ServerHide.disable_hidden = ServerHide.hide_servers = NO;
50 if (!conf_cold)
51 MyFree(ServerHide.hidden_name);
52 DupString(ServerHide.hidden_name, "*.hidden.com");
53 ServerHide.hide_server_ips = NO;
54
55 return pass_callback(hreset);
56 }
57
58 /*
59 * verify_serverhide()
60 *
61 * Sets up the delayed links timer if necessary. (After a rehash)
62 *
63 * inputs: none
64 * output: none
65 */
66 static void *
67 verify_serverhide(va_list args)
68 {
69 int new_links_delay = LINKS_DELAY;
70
71 if (new_links_delay != old_links_delay)
72 {
73 if (old_links_delay != 0)
74 eventDelete(write_links_file, NULL);
75
76 if (new_links_delay != 0)
77 {
78 eventAdd("write_links_file", write_links_file, NULL, new_links_delay);
79 write_links_file(NULL);
80 }
81 }
82
83 return pass_callback(hverify);
84 }
85
86 /*
87 * init_serverhide()
88 *
89 * Defines the serverhide{} conf section.
90 *
91 * inputs: none
92 * output: none
93 */
94 void
95 init_serverhide(void)
96 {
97 struct ConfSection *s = add_conf_section("serverhide", 2);
98
99 hreset = install_hook(reset_conf, reset_serverhide);
100 hverify = install_hook(verify_conf, verify_serverhide);
101
102 add_conf_field(s, "flatten_links", CT_BOOL, NULL, &ServerHide.flatten_links);
103 add_conf_field(s, "links_delay", CT_TIME, NULL, &ServerHide.links_delay);
104 add_conf_field(s, "hidden", CT_BOOL, NULL, &ServerHide.hidden);
105 add_conf_field(s, "disable_hidden", CT_BOOL, NULL,
106 &ServerHide.disable_hidden);
107 add_conf_field(s, "hide_servers", CT_BOOL, NULL, &ServerHide.hide_servers);
108 add_conf_field(s, "hidden_name", CT_STRING, NULL, &ServerHide.hidden_name);
109 add_conf_field(s, "hide_server_ips", CT_BOOL, NULL,
110 &ServerHide.hide_server_ips);
111 }

Properties

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