/[cvs]/eggdrop1.9/src/core_config.c
ViewVC logotype

Annotation of /eggdrop1.9/src/core_config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.16 - (hide annotations) (download) (as text)
Thu Jun 17 13:32:44 2004 UTC (14 years, 11 months ago) by wingman
Branch: MAIN
Changes since 1.15: +16 -16 lines
File MIME type: text/x-chdr
* Added new TAG: DDC for "this feature is document". After we are sure
  that all source code variables/commands/functions/ are tagged with either
  DDD or DDC we'll remove them.

* Made module Makefile.am's more centralized by moving common stuff
  to acconfig/module.mk.

* Introducted new help system. It's now on per module basis and localized.
  Default language is "en_EN" else not otherwise specified. Beside the
  %b formattings of 1.6 it has all features of the 1.6 help system.

  It's also more intelligent since help files are automaticly bound to
  module load/unload events. You don't need to manually load module help
  files any more. (Though unloading not tested yet... 8-))

* Fixed some tweaks here and there.

1 wcc 1.10 /* core_config.c: config file
2     *
3     * Copyright (C) 2003, 2004 Eggheads Development Team
4     *
5     * This program is free software; you can redistribute it and/or
6     * modify it under the terms of the GNU General Public License
7     * as published by the Free Software Foundation; either version 2
8     * of the License, or (at your option) any later version.
9     *
10     * This program is distributed in the hope that it will be useful,
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     * GNU General Public License for more details.
14     *
15     * You should have received a copy of the GNU General Public License
16     * along with this program; if not, write to the Free Software
17     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18     */
19    
20     #ifndef lint
21 wingman 1.16 static const char rcsid[] = "$Id: core_config.c,v 1.15 2004/03/01 22:58:33 stdarg Exp $";
22 wcc 1.10 #endif
23    
24 stdarg 1.1 #include <eggdrop/eggdrop.h>
25 wcc 1.11 #include <string.h>
26 stdarg 1.1 #include "core_config.h"
27    
28 stdarg 1.15 extern char *configfile;
29 stdarg 1.1 core_config_t core_config = {0};
30     void *config_root = NULL;
31    
32     static config_var_t core_config_vars[] = {
33 stdarg 1.2 /* General bot stuff. */
34 wingman 1.16 {"botname", &core_config.botname, CONFIG_STRING}, /* DDC */
35     {"userfile", &core_config.userfile, CONFIG_STRING}, /* DDC */
36 stdarg 1.1
37 stdarg 1.5 /* The owner. */
38 wingman 1.16 {"owner", &core_config.owner, CONFIG_STRING}, /* DDD */
39     {"admin", &core_config.admin, CONFIG_STRING}, /* DDD */
40 stdarg 1.5
41     /* Paths. */
42 wingman 1.16 {"help_path", &core_config.help_path, CONFIG_STRING}, /* DDD */
43     {"temp_path", &core_config.temp_path, CONFIG_STRING}, /* DDD */
44     {"text_path", &core_config.text_path, CONFIG_STRING}, /* DDD */
45     {"module_path", &core_config.module_path, CONFIG_STRING}, /* DDD */
46 stdarg 1.5
47 stdarg 1.2 /* Logfile. */
48 wingman 1.16 {"logfile_suffix", &core_config.logfile_suffix, CONFIG_STRING}, /* DDD */
49     {"max_logsize", &core_config.max_logsize, CONFIG_INT}, /* DDD */
50     {"switch_logfiles_at", &core_config.switch_logfiles_at, CONFIG_INT}, /* DDD */
51     {"keep_all_logs", &core_config.keep_all_logs, CONFIG_INT}, /* DDD */
52     {"quick_logs", &core_config.quick_logs, CONFIG_INT}, /* DDD */
53 stdarg 1.2
54 stdarg 1.13 /* Whois. */
55 wingman 1.16 {"whois_items", &core_config.whois_items, CONFIG_STRING}, /* DDD */
56 stdarg 1.13
57 wcc 1.9 /* Other. */
58 wingman 1.16 {"die_on_sigterm", &core_config.die_on_sigterm, CONFIG_INT}, /* DDD */
59 stdarg 1.1 {0}
60     };
61    
62 stdarg 1.4 void core_config_init(const char *fname)
63 stdarg 1.1 {
64     /* Set default vals. */
65 stdarg 1.5 memset(&core_config, 0, sizeof(core_config));
66 stdarg 1.6
67     /* Hook the owner variable into libeggdrop. */
68     egg_setowner(&core_config.owner);
69 stdarg 1.5
70 stdarg 1.1 core_config.botname = strdup("eggdrop");
71     core_config.userfile = strdup("users.xml");
72 wcc 1.14 core_config.help_path = strdup("help/");
73 stdarg 1.2
74     core_config.logfile_suffix = strdup(".%d%b%Y");
75 stdarg 1.1
76 stdarg 1.4 config_root = config_load(fname);
77 stdarg 1.3 config_set_root("eggdrop", config_root);
78 stdarg 1.5 config_link_table(core_config_vars, config_root, "eggdrop", 0, NULL);
79 stdarg 1.1 }
80    
81     void core_config_save()
82     {
83 stdarg 1.5 config_update_table(core_config_vars, config_root, "eggdrop", 0, NULL);
84 stdarg 1.12 config_save("eggdrop", configfile);
85 stdarg 1.1 }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23