prefs.c
上传用户:tany51
上传日期:2013-06-12
资源大小:1397k
文件大小:40k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /*
  2.  * Copyright (C) 1998,1999,2000,2001  Ross Combs (rocombs@cs.nmsu.edu)
  3.  * Copyright (C) 1999  Rob Crittenden (rcrit@greyoak.com)
  4.  * Copyright (C) 1999  Mark Baysinger (mbaysing@ucsd.edu)
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU General Public License
  8.  * as published by the Free Software Foundation; either version 2
  9.  * of the License, or (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.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  */
  20. #define PREFS_INTERNAL_ACCESS
  21. #include "common/setup_before.h"
  22. #include <stdio.h>
  23. #ifdef HAVE_STDDEF_H
  24. # include <stddef.h>
  25. #else
  26. # ifndef NULL
  27. #  define NULL ((void *)0)
  28. # endif
  29. #endif
  30. #ifdef STDC_HEADERS
  31. # include <stdlib.h>
  32. #else
  33. # ifdef HAVE_MALLOC_H
  34. #  include <malloc.h>
  35. # endif
  36. #endif
  37. #ifdef HAVE_STRING_H
  38. # include <string.h>
  39. #else
  40. # ifdef HAVE_STRINGS_H
  41. #  include <strings.h>
  42. # endif
  43. #endif
  44. #include "compat/strdup.h"
  45. #include "compat/strcasecmp.h"
  46. #include <errno.h>
  47. #include "compat/strerror.h"
  48. #include <ctype.h>
  49. #include "common/util.h"
  50. #include "common/eventlog.h"
  51. #include "prefs.h"
  52. #include "common/setup_after.h"
  53. static int processDirective(char const * directive, char const * value, unsigned int curLine);
  54. #define NONE 0
  55. static struct {
  56.     /* files and paths */
  57.     char const * filedir;
  58.     char const * storage_path;
  59.     char const * logfile;
  60.     char const * loglevels;
  61.     char const * motdfile;
  62.     char const * newsfile;
  63.     char const * channelfile;
  64.     char const * pidfile;
  65.     char const * adfile;
  66.     char const * topicfile;
  67.     char const * DBlayoutfile;
  68.     unsigned int usersync;
  69.     unsigned int userflush;
  70.     unsigned int userstep;
  71.     char const * servername;
  72.     unsigned int track;
  73.     char const * location;
  74.     char const * description;
  75.     char const * url;
  76.     char const * contact_name;
  77.     char const * contact_email;
  78.     unsigned int latency;
  79.     unsigned int irc_latency;
  80.     unsigned int shutdown_delay;
  81.     unsigned int shutdown_decr;
  82.     unsigned int new_accounts;
  83.     unsigned int max_accounts;
  84.     unsigned int kick_old_login;
  85.     unsigned int ask_new_channel;
  86.     unsigned int hide_pass_games;
  87.     unsigned int hide_started_games;
  88.     unsigned int hide_temp_channels;
  89.     unsigned int hide_addr;
  90.     unsigned int enable_conn_all;
  91.     unsigned int extra_commands;
  92.     char const * reportdir;
  93.     unsigned int report_all_games;
  94.     unsigned int report_diablo_games;
  95.     char const * iconfile;
  96.     char const * war3_iconfile;
  97.     char const * star_iconfile;
  98.     char const * tosfile;
  99.     char const * mpqfile;
  100.     char const * trackaddrs;
  101.     char const * servaddrs;
  102.     char const * w3routeaddr;
  103.     char const * ircaddrs;
  104.     unsigned int use_keepalive;
  105.     unsigned int udptest_port;
  106.     char const * ipbanfile;
  107.     unsigned int disc_is_loss;
  108.     char const * helpfile;
  109.     char const * fortunecmd;
  110.     char const * transfile;
  111.     unsigned int chanlog;
  112.     char const * chanlogdir;
  113.     unsigned int quota;
  114.     unsigned int quota_lines;
  115.     unsigned int quota_time;
  116.     unsigned int quota_wrapline;
  117.     unsigned int quota_maxline;
  118.     unsigned int ladder_init_rating;
  119.     unsigned int quota_dobae;
  120.     char const * realmfile;
  121.     char const * issuefile;
  122.     char const * effective_user;
  123.     char const * effective_group;
  124.     unsigned int nullmsg;
  125.     unsigned int mail_support;
  126.     unsigned int mail_quota;
  127.     char const * maildir;
  128.     char const * log_notice;
  129.     unsigned int savebyname;
  130.     unsigned int skip_versioncheck;
  131.     unsigned int allow_bad_version;
  132.     unsigned int allow_unknown_version;
  133.     char const * versioncheck_file;
  134.     unsigned int d2cs_version;
  135.     unsigned int allow_d2cs_setname;
  136.     unsigned int hashtable_size;
  137.     char const * telnetaddrs;
  138.     unsigned int ipban_check_int;
  139.     char const * version_exeinfo_match;
  140.     unsigned int version_exeinfo_maxdiff;
  141.     unsigned int max_concurrent_logins;
  142.     unsigned int identify_timeout_secs;
  143.     char const * server_info;
  144.     char const * mapsfile;
  145.     char const * xplevelfile;
  146.     char const * xpcalcfile;
  147.     unsigned int initkill_timer;
  148.     unsigned int war3_ladder_update_secs;
  149.     unsigned int output_update_secs;
  150.     char const * ladderdir;
  151.     char const * statusdir;
  152.     unsigned int XML_output_ladder;
  153.     unsigned int XML_status_output;
  154.     char const * account_allowed_symbols;
  155.     char const * command_groups_file;
  156.     char const * tournament_file;
  157.     char const * aliasfile;
  158.     char const * anongame_infos_file;
  159.     char const * w3trans_file;
  160.     unsigned int max_conns_per_IP;
  161.     unsigned int max_friends;
  162.     unsigned int clan_newer_time;
  163.     unsigned int clan_max_members;
  164.     unsigned int clan_channel_default_private;
  165.     unsigned int passfail_count;
  166.     unsigned int passfail_bantime;
  167.     unsigned int maxusers_per_channel;
  168.     unsigned int load_new_account;
  169.     char const * supportfile;
  170. } prefs_runtime_config;
  171. /*    directive                 type               defcharval            defintval                 */
  172. static Bconf_t conf_table[] =
  173. {
  174.     { "filedir",                conf_type_char,    BNETD_FILE_DIR,       NONE                , (void *)&prefs_runtime_config.filedir},
  175.     { "storage_path",           conf_type_char,    BNETD_STORAGE_PATH,   NONE                , (void *)&prefs_runtime_config.storage_path},
  176.     { "logfile",                conf_type_char,    BNETD_LOG_FILE,       NONE                , (void *)&prefs_runtime_config.logfile},
  177.     { "loglevels",              conf_type_char,    BNETD_LOG_LEVELS,     NONE                , (void *)&prefs_runtime_config.loglevels},
  178.     { "motdfile",               conf_type_char,    BNETD_MOTD_FILE,      NONE                , (void *)&prefs_runtime_config.motdfile},
  179.     { "newsfile",               conf_type_char,    BNETD_NEWS_DIR,       NONE                , (void *)&prefs_runtime_config.newsfile},
  180.     { "channelfile",            conf_type_char,    BNETD_CHANNEL_FILE,   NONE                , (void *)&prefs_runtime_config.channelfile},
  181.     { "pidfile",                conf_type_char,    BNETD_PID_FILE,       NONE                , (void *)&prefs_runtime_config.pidfile},
  182.     { "adfile",                 conf_type_char,    BNETD_AD_FILE,        NONE                , (void *)&prefs_runtime_config.adfile},
  183.     { "topicfile", conf_type_char,    BNETD_TOPIC_FILE,  NONE      , (void *)&prefs_runtime_config.topicfile},
  184.     { "DBlayoutfile", conf_type_char,    BNETD_DBLAYOUT_FILE,  NONE      , (void *)&prefs_runtime_config.DBlayoutfile},
  185.     { "supportfile", conf_type_char,    BNETD_SUPPORT_FILE,   NONE                , (void *)&prefs_runtime_config.supportfile},
  186.     { "usersync",               conf_type_int,     NULL,                 BNETD_USERSYNC      , (void *)&prefs_runtime_config.usersync},
  187.     { "userflush",              conf_type_int,     NULL,                 BNETD_USERFLUSH     , (void *)&prefs_runtime_config.userflush},
  188.     { "userstep",               conf_type_int,     NULL,                 BNETD_USERSTEP      , (void *)&prefs_runtime_config.userstep},
  189.     { "servername",             conf_type_char,    "",                   NONE                , (void *)&prefs_runtime_config.servername},
  190.     { "track",                  conf_type_int,     NULL,                 BNETD_TRACK_TIME    , (void *)&prefs_runtime_config.track},
  191.     { "location",               conf_type_char,    "",                   NONE                , (void *)&prefs_runtime_config.location},
  192.     { "description",            conf_type_char,    "",                   NONE                , (void *)&prefs_runtime_config.description},
  193.     { "url",                    conf_type_char,    "",                   NONE                , (void *)&prefs_runtime_config.url},
  194.     { "contact_name",           conf_type_char,    "",                   NONE                , (void *)&prefs_runtime_config.contact_name},
  195.     { "contact_email",          conf_type_char,    "",                   NONE                , (void *)&prefs_runtime_config.contact_email},
  196.     { "latency",                conf_type_int,     NULL,                 BNETD_LATENCY       , (void *)&prefs_runtime_config.latency},
  197.     { "irc_latency",            conf_type_int,     NULL,                 BNETD_IRC_LATENCY   , (void *)&prefs_runtime_config.irc_latency},
  198.     { "shutdown_delay",         conf_type_int,     NULL,                 BNETD_SHUTDELAY     , (void *)&prefs_runtime_config.shutdown_delay},
  199.     { "shutdown_decr",          conf_type_int,     NULL,                 BNETD_SHUTDECR      , (void *)&prefs_runtime_config.shutdown_decr},
  200.     { "new_accounts",           conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.new_accounts},
  201.     { "max_accounts",           conf_type_int,     NULL,                 0                   , (void *)&prefs_runtime_config.max_accounts},
  202.     { "kick_old_login",         conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.kick_old_login},
  203.     { "ask_new_channel",        conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.ask_new_channel},
  204.     { "hide_pass_games",        conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.hide_pass_games},
  205.     { "hide_started_games",     conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.hide_started_games},
  206.     { "hide_temp_channels",     conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.hide_temp_channels},
  207.     { "hide_addr",              conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.hide_addr},
  208.     { "enable_conn_all",        conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.enable_conn_all},
  209.     { "extra_commands",         conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.extra_commands},
  210.     { "reportdir",              conf_type_char,    BNETD_REPORT_DIR,     NONE                , (void *)&prefs_runtime_config.reportdir},
  211.     { "report_all_games",       conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.report_all_games},
  212.     { "report_diablo_games",    conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.report_diablo_games},
  213.     { "iconfile",               conf_type_char,    BNETD_ICON_FILE,      NONE                , (void *)&prefs_runtime_config.iconfile},
  214.     { "war3_iconfile",          conf_type_char,    BNETD_WAR3_ICON_FILE, NONE                , (void *)&prefs_runtime_config.war3_iconfile},
  215.     { "star_iconfile",          conf_type_char,    BNETD_STAR_ICON_FILE, NONE                , (void *)&prefs_runtime_config.star_iconfile},
  216.     { "tosfile",                conf_type_char,    BNETD_TOS_FILE,       NONE                , (void *)&prefs_runtime_config.tosfile},
  217.     { "mpqfile",                conf_type_char,    BNETD_MPQ_FILE,       NONE                , (void *)&prefs_runtime_config.mpqfile},
  218.     { "trackaddrs",             conf_type_char,    BNETD_TRACK_ADDRS,    NONE                , (void *)&prefs_runtime_config.trackaddrs},
  219.     { "servaddrs",              conf_type_char,    BNETD_SERV_ADDRS,     NONE                , (void *)&prefs_runtime_config.servaddrs},
  220.     { "w3routeaddr",            conf_type_char,    BNETD_W3ROUTE_ADDR,   NONE                , (void *)&prefs_runtime_config.w3routeaddr},
  221.     { "ircaddrs",               conf_type_char,    BNETD_IRC_ADDRS,      NONE                , (void *)&prefs_runtime_config.ircaddrs},
  222.     { "use_keepalive",          conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.use_keepalive},
  223.     { "udptest_port",           conf_type_int,     NULL,                 BNETD_DEF_TEST_PORT , (void *)&prefs_runtime_config.udptest_port},
  224.     { "ipbanfile",              conf_type_char,    BNETD_IPBAN_FILE,     NONE                , (void *)&prefs_runtime_config.ipbanfile},
  225.     { "disc_is_loss",           conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.disc_is_loss},
  226.     { "helpfile",               conf_type_char,    BNETD_HELP_FILE,      NONE                , (void *)&prefs_runtime_config.helpfile},
  227.     { "fortunecmd",             conf_type_char,    BNETD_FORTUNECMD,     NONE                , (void *)&prefs_runtime_config.fortunecmd},
  228.     { "transfile",              conf_type_char,    BNETD_TRANS_FILE,     NONE                , (void *)&prefs_runtime_config.transfile},
  229.     { "chanlog",                conf_type_bool,    NULL         ,        BNETD_CHANLOG       , (void *)&prefs_runtime_config.chanlog},
  230.     { "chanlogdir",             conf_type_char,    BNETD_CHANLOG_DIR,    NONE                , (void *)&prefs_runtime_config.chanlogdir},
  231.     { "quota",                  conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.quota},
  232.     { "quota_lines",            conf_type_int,     NULL,                 BNETD_QUOTA_LINES   , (void *)&prefs_runtime_config.quota_lines},
  233.     { "quota_time",             conf_type_int,     NULL,                 BNETD_QUOTA_TIME    , (void *)&prefs_runtime_config.quota_time},
  234.     { "quota_wrapline",         conf_type_int,     NULL,                 BNETD_QUOTA_WLINE   , (void *)&prefs_runtime_config.quota_wrapline},
  235.     { "quota_maxline",         conf_type_int,     NULL,                 BNETD_QUOTA_MLINE   , (void *)&prefs_runtime_config.quota_maxline},
  236.     { "ladder_init_rating",     conf_type_int,     NULL,                 BNETD_LADDER_INIT_RAT , (void *)&prefs_runtime_config.ladder_init_rating},
  237.     { "quota_dobae",            conf_type_int,     NULL,                 BNETD_QUOTA_DOBAE   , (void *)&prefs_runtime_config.quota_dobae},
  238.     { "realmfile",              conf_type_char,    BNETD_REALM_FILE,     NONE                , (void *)&prefs_runtime_config.realmfile},
  239.     { "issuefile",              conf_type_char,    BNETD_ISSUE_FILE,     NONE                , (void *)&prefs_runtime_config.issuefile},
  240.     { "effective_user",         conf_type_char,    NULL,                 NONE                , (void *)&prefs_runtime_config.effective_user},
  241.     { "effective_group",        conf_type_char,    NULL,                 NONE                , (void *)&prefs_runtime_config.effective_group},
  242.     { "nullmsg",                conf_type_int,     NULL,                 BNETD_DEF_NULLMSG   , (void *)&prefs_runtime_config.nullmsg},
  243.     { "mail_support",           conf_type_bool,    NULL,                 BNETD_MAIL_SUPPORT  , (void *)&prefs_runtime_config.mail_support},
  244.     { "mail_quota",             conf_type_int,     NULL,                 BNETD_MAIL_QUOTA    , (void *)&prefs_runtime_config.mail_quota},
  245.     { "maildir",                conf_type_char,    BNETD_MAIL_DIR,       NONE                , (void *)&prefs_runtime_config.maildir},
  246.     { "log_notice",             conf_type_char,    BNETD_LOG_NOTICE,     NONE                , (void *)&prefs_runtime_config.log_notice},
  247.     { "savebyname",             conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.savebyname},
  248.     { "skip_versioncheck",      conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.skip_versioncheck},
  249.     { "allow_bad_version",      conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.allow_bad_version},
  250.     { "allow_unknown_version",  conf_type_bool,    NULL,                 0                   , (void *)&prefs_runtime_config.allow_unknown_version},
  251.     { "versioncheck_file",      conf_type_char,    PVPGN_VERSIONCHECK,   NONE                , (void *)&prefs_runtime_config.versioncheck_file},
  252.     { "d2cs_version",           conf_type_int,     NULL,                 0                   , (void *)&prefs_runtime_config.d2cs_version},
  253.     { "allow_d2cs_setname",     conf_type_bool,    NULL,                 1                   , (void *)&prefs_runtime_config.allow_d2cs_setname},
  254.     { "hashtable_size",         conf_type_int,     NULL,                 BNETD_HASHTABLE_SIZE , (void *)&prefs_runtime_config.hashtable_size},
  255.     { "telnetaddrs",            conf_type_char,    BNETD_TELNET_ADDRS,   NONE                , (void *)&prefs_runtime_config.telnetaddrs},
  256.     { "ipban_check_int", conf_type_int,    NULL,  30      , (void *)&prefs_runtime_config.ipban_check_int},
  257.     { "version_exeinfo_match",  conf_type_char,    BNETD_EXEINFO_MATCH,  NONE                , (void *)&prefs_runtime_config.version_exeinfo_match},
  258.     { "version_exeinfo_maxdiff",conf_type_int,     NULL,                 PVPGN_VERSION_TIMEDIV , (void *)&prefs_runtime_config.version_exeinfo_maxdiff},
  259.     { "max_concurrent_logins",  conf_type_int,     NULL,                 0               , (void *)&prefs_runtime_config.max_concurrent_logins},
  260.     { "identify_timeout_secs",  conf_type_int,    NULL,  W3_IDENTTIMEOUT     , (void *)&prefs_runtime_config.identify_timeout_secs},
  261.     { "server_info",  conf_type_char,    "",    NONE      , (void *)&prefs_runtime_config.server_info},
  262.     { "mapsfile", conf_type_char,    NULL,  0                , (void *)&prefs_runtime_config.mapsfile},
  263.     { "xplevelfile",     conf_type_char,    NULL,  0                , (void *)&prefs_runtime_config.xplevelfile},
  264.     { "xpcalcfile", conf_type_char,    NULL,  0                , (void *)&prefs_runtime_config.xpcalcfile},
  265.     { "initkill_timer",  conf_type_int,     NULL,         0      , (void *)&prefs_runtime_config.initkill_timer},
  266.     { "war3_ladder_update_secs",conf_type_int,     NULL,                 0                   , (void *)&prefs_runtime_config.war3_ladder_update_secs},
  267.     { "output_update_secs", conf_type_int,     NULL,                 0                   , (void *)&prefs_runtime_config.output_update_secs},
  268.     { "ladderdir",              conf_type_char,    BNETD_LADDER_DIR,     NONE                , (void *)&prefs_runtime_config.ladderdir},
  269.     { "statusdir",              conf_type_char,    BNETD_STATUS_DIR,     NONE                , (void *)&prefs_runtime_config.statusdir},
  270.     { "XML_output_ladder",      conf_type_bool,    NULL,                 0           , (void *)&prefs_runtime_config.XML_output_ladder},
  271.     { "XML_status_output",      conf_type_bool,    NULL,                 0            , (void *)&prefs_runtime_config.XML_status_output},
  272.     { "account_allowed_symbols",conf_type_char,    PVPGN_DEFAULT_SYMB,   NONE                , (void *)&prefs_runtime_config.account_allowed_symbols},
  273.     { "command_groups_file", conf_type_char,    BNETD_COMMAND_GROUPS_FILE, NONE      , (void *)&prefs_runtime_config.command_groups_file},
  274.     { "tournament_file", conf_type_char,    BNETD_TOURNAMENT_FILE,NONE      , (void *)&prefs_runtime_config.tournament_file},
  275.     { "aliasfile"          ,    conf_type_char,    BNETD_ALIASFILE   ,   NONE                , (void *)&prefs_runtime_config.aliasfile},
  276.     { "w3trans_file", conf_type_char,    BNETD_W3TRANS_FILE,  NONE      , (void *)&prefs_runtime_config.w3trans_file},
  277.     { "anongame_infos_file", conf_type_char,    PVPGN_AINFO_FILE,  NONE      , (void *)&prefs_runtime_config.anongame_infos_file},
  278.     { "max_conns_per_IP", conf_type_int,    NULL,  0      , (void *)&prefs_runtime_config.max_conns_per_IP},
  279.     { "max_friends", conf_type_int,     NULL,                 MAX_FRIENDS         , (void *)&prefs_runtime_config.max_friends},
  280.     { "clan_newer_time",        conf_type_int,     NULL,                 CLAN_NEWER_TIME     , (void *)&prefs_runtime_config.clan_newer_time},
  281.     { "clan_max_members",       conf_type_int,     NULL,                 CLAN_MAX_MEMBERS    , (void *)&prefs_runtime_config.clan_max_members},
  282.     { "clan_channel_default_private",   conf_type_bool,    NULL,         0                   , (void *)&prefs_runtime_config.clan_channel_default_private},
  283.     { "passfail_count", conf_type_int,     NULL,                 0                   , (void *)&prefs_runtime_config.passfail_count},
  284.     { "passfail_bantime", conf_type_int,     NULL,                 300                 , (void *)&prefs_runtime_config.passfail_bantime},
  285.     { "maxusers_per_channel", conf_type_int,    NULL,  0      , (void *)&prefs_runtime_config.maxusers_per_channel},
  286.     { "load_new_account", conf_type_bool,    NULL,  0      , (void *)&prefs_runtime_config.load_new_account},
  287.     { NULL,              conf_type_none,    NULL,                 NONE                , NULL},
  288. };
  289. #define PREFS_STORE_UINT(addr) (*((unsigned int *)(addr)))
  290. #define PREFS_STORE_CHAR(addr) (*((char const **)(addr)))
  291. char const * preffile=NULL;
  292. static int processDirective(char const * directive, char const * value, unsigned int curLine)
  293. {
  294.     unsigned int i;
  295.     
  296.     if (!directive)
  297.     {
  298. eventlog(eventlog_level_error,"processDirective","got NULL directive");
  299. return -1;
  300.     }
  301.     if (!value)
  302.     {
  303. eventlog(eventlog_level_error,"processDirective","got NULL value");
  304. return -1;
  305.     }
  306.     
  307.     for (i=0; conf_table[i].directive; i++)
  308.         if (strcasecmp(conf_table[i].directive,directive)==0)
  309. {
  310.             switch (conf_table[i].type)
  311.             {
  312.     case conf_type_char:
  313. {
  314.     char const * temp;
  315.     
  316.     if (!(temp = strdup(value)))
  317.     {
  318. eventlog(eventlog_level_error,"processDirective","could not allocate memory for value");
  319. return -1;
  320.     }
  321.     if (PREFS_STORE_CHAR(conf_table[i].store))
  322. free((void *)PREFS_STORE_CHAR(conf_table[i].store)); /* avoid warning */
  323.     PREFS_STORE_CHAR(conf_table[i].store) = temp;
  324. }
  325. break;
  326.     case conf_type_int:
  327. {
  328.     unsigned int temp;
  329.     
  330.     if (str_to_uint(value,&temp)<0)
  331. eventlog(eventlog_level_error,"processDirective","invalid integer value "%s" for element "%s" at line %u",value,directive,curLine);
  332.     else
  333.                  PREFS_STORE_UINT(conf_table[i].store) = temp;
  334. }
  335. break;
  336.     case conf_type_bool:
  337. switch (str_get_bool(value))
  338. {
  339. case 1:
  340.     PREFS_STORE_UINT(conf_table[i].store) = 1;
  341.     break;
  342. case 0:
  343.     PREFS_STORE_UINT(conf_table[i].store) = 0;
  344.     break;
  345. default:
  346.     eventlog(eventlog_level_error,"processDirective","invalid boolean value for element "%s" at line %u",directive,curLine);
  347. }
  348. break;
  349.     default:
  350. eventlog(eventlog_level_error,"processDirective","invalid type %d in table",(int)conf_table[i].type);
  351.     }
  352.     return 0;
  353. }
  354.     
  355.     eventlog(eventlog_level_error,"processDirective","unknown element "%s" at line %u",directive,curLine);
  356.     return -1;
  357. }
  358. extern int prefs_load(char const * filename)
  359. {
  360.     /* restore defaults */
  361.     {
  362. unsigned int i;
  363. for (i=0; conf_table[i].directive; i++)
  364.     switch (conf_table[i].type)
  365.     {
  366.     case conf_type_int:
  367.     case conf_type_bool:
  368. PREFS_STORE_UINT(conf_table[i].store) = conf_table[i].defintval;
  369. break;
  370.     case conf_type_char:
  371. if (PREFS_STORE_CHAR(conf_table[i].store))
  372.     free((void *)PREFS_STORE_CHAR(conf_table[i].store)); /* avoid warning */
  373. if (!conf_table[i].defcharval)
  374.     PREFS_STORE_CHAR(conf_table[i].store) = NULL;
  375. else
  376.     if (!(PREFS_STORE_CHAR(conf_table[i].store) = strdup(conf_table[i].defcharval)))
  377.     {
  378. eventlog(eventlog_level_error,"prefs_load","could not allocate memory for conf_table[i].charval");
  379. return -1;
  380.     }
  381. break;
  382.     default:
  383. eventlog(eventlog_level_error,"prefs_load","invalid type %d in table",(int)conf_table[i].type);
  384. return -1;
  385.     }
  386.     }
  387.     
  388.     /* load file */
  389.     if (filename)
  390.     {
  391. FILE *       fp;
  392. char *       buff;
  393. char *       cp;
  394. char *       temp;
  395. unsigned int currline;
  396. unsigned int j;
  397. char const * directive;
  398. char const * value;
  399. char *       rawvalue;
  400. unsigned     cflag;
  401.         if (!(fp = fopen(filename,"r")))
  402.         {
  403.             eventlog(eventlog_level_error,"prefs_load","could not open file "%s" for reading (fopen: %s)",filename,strerror(errno));
  404.             return -1;
  405.         }
  406. /* Read the configuration file */
  407. for (currline=1; (buff = file_get_line(fp)); currline++)
  408. {
  409.     cflag = 1;
  410.     for(cp = buff; *cp; cp++) {
  411. switch(*cp) {
  412.     case '\': 
  413. if (!*(++cp)) cflag = 0; /* end of string, exit the loop */
  414. break;
  415.     case '"':
  416. switch(cflag) {
  417.     case 1: cflag = 2; break;
  418.     case 2: cflag = 1; break;
  419. }
  420. break;
  421.     case '#':
  422. if (cflag == 1) cflag = 0; /* comment outside quotes found, exit the loop */
  423. break;
  424. }
  425. if (!cflag) break;
  426.     }
  427.     if (*cp == '#') *cp = '';
  428.     cp = buff;
  429.     
  430.             while (*cp=='t' || *cp==' ') cp++;
  431.     if (*cp=='')
  432.     {
  433. free(buff);
  434. continue;
  435.     }
  436.     temp = cp;
  437.     while (*cp!='t' && *cp!=' ' && *cp!='') cp++;
  438.     if (*cp!='')
  439.     {
  440. *cp = '';
  441. cp++;
  442.     }
  443.     if (!(directive = strdup(temp)))
  444.     {
  445. eventlog(eventlog_level_error,"prefs_load","could not allocate memory for directive");
  446. free(buff);
  447. continue;
  448.     }
  449.             while (*cp=='t' || *cp==' ') cp++;
  450.     if (*cp!='=')
  451.     {
  452. eventlog(eventlog_level_error,"prefs_load","missing = on line %u",currline);
  453. free((void *)directive); /* avoid warning */
  454. free(buff);
  455. continue;
  456.     }
  457.     cp++;
  458.     while (*cp=='t' || *cp==' ') cp++;
  459.     if (*cp=='')
  460.     {
  461. eventlog(eventlog_level_error,"prefs_load","missing value after = on line %u",currline);
  462. free((void *)directive); /* avoid warning */
  463. free(buff);
  464. continue;
  465.     }
  466.     if (!(rawvalue = strdup(cp)))
  467.     {
  468. eventlog(eventlog_level_error,"prefs_load","could not allocate memory for rawvalue");
  469. free((void *)directive); /* avoid warning */
  470. free(buff);
  471. continue;
  472.     }
  473.     
  474.     if (rawvalue[0]=='"')
  475.     {
  476. char prev;
  477. for (j=1,prev=''; rawvalue[j]!=''; j++)
  478. {
  479.     switch (rawvalue[j])
  480.     {
  481.     case '"':
  482. if (prev!='\')
  483.     break;
  484. prev = '"';
  485. continue;
  486.     case '\':
  487. if (prev=='\')
  488.     prev = '';
  489. else
  490.     prev = '\';
  491. continue;
  492.     default:
  493. prev = rawvalue[j];
  494. continue;
  495.     }
  496.     break;
  497. }
  498. if (rawvalue[j]!='"')
  499. {
  500.     eventlog(eventlog_level_error,"prefs_load","missing end quote for value of element "%s" on line %u",directive,currline);
  501.     free(rawvalue);
  502.     free((void *)directive); /* avoid warning */
  503.     free(buff);
  504.     continue;
  505. }
  506. rawvalue[j] = '';
  507. if (rawvalue[j+1]!='')
  508. {
  509.     eventlog(eventlog_level_error,"prefs_load","extra characters after the value for element "%s" on line %u",directive,currline);
  510.     free(rawvalue);
  511.     free((void *)directive); /* avoid warning */
  512.     free(buff);
  513.     continue;
  514. }
  515. value = &rawvalue[1];
  516.             }
  517.     else
  518.     {
  519. unsigned int k;
  520. for (j=0; rawvalue[j]!='' && rawvalue[j]!=' ' && rawvalue[j]!='t'; j++);
  521. k = j;
  522. while (rawvalue[k]==' ' || rawvalue[k]=='t') k++;
  523. if (rawvalue[k]!='')
  524. {
  525.     eventlog(eventlog_level_error,"prefs_load","extra characters after the value for element "%s" on line %u (%s)",directive,currline,&rawvalue[k]);
  526.     free(rawvalue);
  527.     free((void *)directive); /* avoid warning */
  528.     free(buff);
  529.     continue;
  530. }
  531. rawvalue[j] = '';
  532. value = rawvalue;
  533.     }
  534.             
  535.     processDirective(directive,value,currline);
  536.     
  537.     free(rawvalue);
  538.     free((void *)directive); /* avoid warning */
  539.     free(buff);
  540. }
  541. if (fclose(fp)<0)
  542.     eventlog(eventlog_level_error,"prefs_load","could not close prefs file "%s" after reading (fclose: %s)",filename,strerror(errno));
  543.     }
  544.     
  545.     return 0;
  546. }
  547. extern void prefs_unload(void)
  548. {
  549.     unsigned int i;
  550.     
  551.     for (i=0; conf_table[i].directive; i++)
  552. switch (conf_table[i].type)
  553. {
  554. case conf_type_int:
  555. case conf_type_bool:
  556.     break;
  557.     
  558. case conf_type_char:
  559.     if (PREFS_STORE_CHAR(conf_table[i].store))
  560.     {
  561. free((void *)PREFS_STORE_CHAR(conf_table[i].store)); /* avoid warning */
  562. PREFS_STORE_CHAR(conf_table[i].store) = NULL;
  563.     }
  564.     break;
  565.     
  566. default:
  567.     eventlog(eventlog_level_error,"prefs_unload","invalid type %d in table",(int)conf_table[i].type);
  568.     break;
  569. }
  570. }
  571. extern char const * prefs_get_storage_path(void)
  572. {
  573.     return prefs_runtime_config.storage_path;
  574. }
  575. extern char const * prefs_get_filedir(void)
  576. {
  577.     return prefs_runtime_config.filedir;
  578. }
  579. extern char const * prefs_get_logfile(void)
  580. {
  581.     return prefs_runtime_config.logfile;
  582. }
  583. extern char const * prefs_get_loglevels(void)
  584. {
  585.     return prefs_runtime_config.loglevels;
  586. }
  587. extern char const * prefs_get_motdfile(void)
  588. {
  589.     return prefs_runtime_config.motdfile;
  590. }
  591. extern char const * prefs_get_newsfile(void)
  592. {
  593.     return prefs_runtime_config.newsfile;
  594. }
  595. extern char const * prefs_get_adfile(void)
  596. {
  597.     return prefs_runtime_config.adfile;
  598. }
  599. extern char const * prefs_get_topicfile(void)
  600. {
  601.     return prefs_runtime_config.topicfile;
  602. }
  603. extern char const * prefs_get_DBlayoutfile(void)
  604. {
  605.     return prefs_runtime_config.DBlayoutfile;
  606. }
  607. extern unsigned int prefs_get_user_sync_timer(void)
  608. {
  609.     return prefs_runtime_config.usersync;
  610. }
  611. extern unsigned int prefs_get_user_flush_timer(void)
  612. {
  613.     return prefs_runtime_config.userflush;
  614. }
  615. extern unsigned int prefs_get_user_step(void)
  616. {
  617.     return prefs_runtime_config.userstep;
  618. }
  619. extern char const * prefs_get_servername(void)
  620. {
  621.     return prefs_runtime_config.servername;
  622. }
  623. extern unsigned int prefs_get_track(void)
  624. {
  625.     unsigned int rez;
  626.     
  627.     rez = prefs_runtime_config.track;
  628.     if (rez>0 && rez<60) rez = 60;
  629.     return rez;
  630. }
  631. extern char const * prefs_get_location(void)
  632. {
  633.     return prefs_runtime_config.location;
  634. }
  635. extern char const * prefs_get_description(void)
  636. {
  637.     return prefs_runtime_config.description;
  638. }
  639. extern char const * prefs_get_url(void)
  640. {
  641.     return prefs_runtime_config.url;
  642. }
  643. extern char const * prefs_get_contact_name(void)
  644. {
  645.     return prefs_runtime_config.contact_name;
  646. }
  647. extern char const * prefs_get_contact_email(void)
  648. {
  649.     return prefs_runtime_config.contact_email;
  650. }
  651. extern unsigned int prefs_get_latency(void)
  652. {
  653.     return prefs_runtime_config.latency;
  654. }
  655. extern unsigned int prefs_get_irc_latency(void)
  656. {
  657.     return prefs_runtime_config.irc_latency;
  658. }
  659. extern unsigned int prefs_get_shutdown_delay(void)
  660. {
  661.     return prefs_runtime_config.shutdown_delay;
  662. }
  663. extern unsigned int prefs_get_shutdown_decr(void)
  664. {
  665.     return prefs_runtime_config.shutdown_decr;
  666. }
  667. extern unsigned int prefs_get_allow_new_accounts(void)
  668. {
  669.     return prefs_runtime_config.new_accounts;
  670. }
  671. extern unsigned int prefs_get_max_accounts(void)
  672. {
  673.     return prefs_runtime_config.max_accounts;
  674. }
  675. extern unsigned int prefs_get_kick_old_login(void)
  676. {
  677.     return prefs_runtime_config.kick_old_login;
  678. }
  679. extern char const * prefs_get_channelfile(void)
  680. {
  681.     return prefs_runtime_config.channelfile;
  682. }
  683. extern unsigned int prefs_get_ask_new_channel(void)
  684. {
  685.     return prefs_runtime_config.ask_new_channel;
  686. }
  687. extern unsigned int prefs_get_hide_pass_games(void)
  688. {
  689.     return prefs_runtime_config.hide_pass_games;
  690. }
  691. extern unsigned int prefs_get_hide_started_games(void)
  692. {
  693.     return prefs_runtime_config.hide_started_games;
  694. }
  695. extern unsigned int prefs_get_hide_temp_channels(void)
  696. {
  697.     return prefs_runtime_config.hide_temp_channels;
  698. }
  699. extern unsigned int prefs_get_hide_addr(void)
  700. {
  701.     return prefs_runtime_config.hide_addr;
  702. }
  703. extern unsigned int prefs_get_enable_conn_all(void)
  704. {
  705.     return prefs_runtime_config.enable_conn_all;
  706. }
  707. extern unsigned int prefs_get_extra_commands(void)
  708. {
  709.     return prefs_runtime_config.extra_commands;
  710. }
  711. extern char const * prefs_get_reportdir(void)
  712. {
  713.     return prefs_runtime_config.reportdir;
  714. }
  715. extern unsigned int prefs_get_report_all_games(void)
  716. {
  717.     return prefs_runtime_config.report_all_games;
  718. }
  719. extern unsigned int prefs_get_report_diablo_games(void)
  720. {
  721.     return prefs_runtime_config.report_diablo_games;
  722. }
  723. extern char const * prefs_get_pidfile(void)
  724. {
  725.     return prefs_runtime_config.pidfile;
  726. }
  727. extern char const * prefs_get_iconfile(void)
  728. {
  729.     return prefs_runtime_config.iconfile;
  730. }
  731. extern char const * prefs_get_war3_iconfile(void)
  732. {
  733.     return prefs_runtime_config.war3_iconfile;
  734. }
  735. extern char const * prefs_get_star_iconfile(void)
  736. {
  737.     return prefs_runtime_config.star_iconfile;
  738. }
  739. extern char const * prefs_get_tosfile(void)
  740. {
  741.     return prefs_runtime_config.tosfile;
  742. }
  743. extern char const * prefs_get_mpqfile(void)
  744. {
  745.     return prefs_runtime_config.mpqfile;
  746. }
  747. extern char const * prefs_get_trackserv_addrs(void)
  748. {
  749.     return prefs_runtime_config.trackaddrs;
  750. }
  751. extern char const * prefs_get_bnetdserv_addrs(void)
  752. {
  753.     return prefs_runtime_config.servaddrs;
  754. }
  755. extern char const * prefs_get_w3route_addr(void)
  756. {
  757.     return prefs_runtime_config.w3routeaddr;
  758. }
  759. extern char const * prefs_get_irc_addrs(void)
  760. {
  761.     return prefs_runtime_config.ircaddrs;
  762. }
  763. extern unsigned int prefs_get_use_keepalive(void)
  764. {
  765.     return prefs_runtime_config.use_keepalive;
  766. }
  767. extern unsigned int prefs_get_udptest_port(void)
  768. {
  769.     return prefs_runtime_config.udptest_port;
  770. }
  771. extern char const * prefs_get_ipbanfile(void)
  772. {
  773.     return prefs_runtime_config.ipbanfile;
  774. }
  775. extern unsigned int prefs_get_discisloss(void)
  776. {
  777.     return prefs_runtime_config.disc_is_loss;
  778. }
  779. extern char const * prefs_get_helpfile(void)
  780. {
  781.     return prefs_runtime_config.helpfile;
  782. }
  783. extern char const * prefs_get_fortunecmd(void)
  784. {
  785.     return prefs_runtime_config.fortunecmd;
  786. }
  787. extern char const * prefs_get_transfile(void)
  788. {
  789.     return prefs_runtime_config.transfile;
  790. }
  791. extern unsigned int prefs_get_chanlog(void)
  792. {
  793.     return prefs_runtime_config.chanlog;
  794. }
  795. extern char const * prefs_get_chanlogdir(void)
  796. {
  797.     return prefs_runtime_config.chanlogdir;
  798. }
  799. extern unsigned int prefs_get_quota(void)
  800. {
  801.     return prefs_runtime_config.quota;
  802. }
  803. extern unsigned int prefs_get_quota_lines(void)
  804. {
  805.     unsigned int rez;
  806.     
  807.     rez=prefs_runtime_config.quota_lines;
  808.     if (rez<1) rez = 1;
  809.     if (rez>100) rez = 100;
  810.     return rez;
  811. }
  812. extern unsigned int prefs_get_quota_time(void)
  813. {
  814.     unsigned int rez;
  815.     
  816.     rez=prefs_runtime_config.quota_time;
  817.     if (rez<1) rez = 1;
  818.     if (rez>10) rez = 60;
  819.     return rez;
  820. }
  821. extern unsigned int prefs_get_quota_wrapline(void)
  822. {
  823.     unsigned int rez;
  824.     
  825.     rez=prefs_runtime_config.quota_wrapline;
  826.     if (rez<1) rez = 1;
  827.     if (rez>256) rez = 256;
  828.     return rez;
  829. }
  830. extern unsigned int prefs_get_quota_maxline(void)
  831. {
  832.     unsigned int rez;
  833.     
  834.     rez=prefs_runtime_config.quota_maxline;
  835.     if (rez<1) rez = 1;
  836.     if (rez>256) rez = 256;
  837.     return rez;
  838. }
  839. extern unsigned int prefs_get_ladder_init_rating(void)
  840. {
  841.     return prefs_runtime_config.ladder_init_rating;
  842. }
  843. extern unsigned int prefs_get_quota_dobae(void)
  844. {
  845.     unsigned int rez;
  846.     rez=prefs_runtime_config.quota_dobae;
  847.     if (rez<1) rez = 1;
  848.     if (rez>100) rez = 100;
  849.     return rez;
  850. }
  851. extern char const * prefs_get_realmfile(void)
  852. {
  853.     return prefs_runtime_config.realmfile;
  854. }
  855. extern char const * prefs_get_issuefile(void)
  856. {
  857.     return prefs_runtime_config.issuefile;
  858. }
  859. extern char const * prefs_get_effective_user(void)
  860. {
  861.     return prefs_runtime_config.effective_user;
  862. }
  863. extern char const * prefs_get_effective_group(void)
  864. {
  865.     return prefs_runtime_config.effective_group;
  866. }
  867. extern unsigned int prefs_get_nullmsg(void)
  868. {
  869.     return prefs_runtime_config.nullmsg;
  870. }
  871. extern unsigned int prefs_get_mail_support(void)
  872. {
  873.     return prefs_runtime_config.mail_support;
  874. }
  875. extern unsigned int prefs_get_mail_quota(void)
  876. {
  877.     unsigned int rez;
  878.     
  879.     rez=prefs_runtime_config.mail_quota;
  880.     if (rez<1) rez = 1;
  881.     if (rez>30) rez = 30;
  882.     return rez;
  883. }
  884. extern char const * prefs_get_maildir(void)
  885. {
  886.     return prefs_runtime_config.maildir;
  887. }
  888. extern char const * prefs_get_log_notice(void)
  889. {
  890.     return prefs_runtime_config.log_notice;
  891. }
  892. extern unsigned int prefs_get_savebyname(void)
  893. {
  894.     return prefs_runtime_config.savebyname;
  895. }
  896. extern unsigned int prefs_get_skip_versioncheck(void)
  897. {
  898.     return prefs_runtime_config.skip_versioncheck;
  899. }
  900. extern unsigned int prefs_get_allow_bad_version(void)
  901. {
  902.     return prefs_runtime_config.allow_bad_version;
  903. }
  904. extern unsigned int prefs_get_allow_unknown_version(void)
  905. {
  906.     return prefs_runtime_config.allow_unknown_version;
  907. }
  908. extern char const * prefs_get_versioncheck_file(void)
  909. {
  910.     return prefs_runtime_config.versioncheck_file;
  911. }
  912. extern unsigned int prefs_allow_d2cs_setname(void)
  913. {
  914.         return prefs_runtime_config.allow_d2cs_setname;
  915. }
  916. extern unsigned int prefs_get_d2cs_version(void)
  917. {
  918.         return prefs_runtime_config.d2cs_version;
  919. }
  920. extern unsigned int prefs_get_hashtable_size(void)
  921. {
  922.     return prefs_runtime_config.hashtable_size;
  923. }
  924. extern char const * prefs_get_telnet_addrs(void)
  925. {
  926.     return prefs_runtime_config.telnetaddrs;
  927. }
  928. extern unsigned int prefs_get_ipban_check_int(void)
  929. {
  930.     return prefs_runtime_config.ipban_check_int;
  931. }
  932. extern char const * prefs_get_version_exeinfo_match(void)
  933. {
  934.     return prefs_runtime_config.version_exeinfo_match;
  935. }
  936. extern unsigned int prefs_get_version_exeinfo_maxdiff(void)
  937. {
  938.     return prefs_runtime_config.version_exeinfo_maxdiff;
  939. }
  940. // added by NonReal
  941. extern unsigned int prefs_get_max_concurrent_logins(void)
  942. {
  943.     return prefs_runtime_config.max_concurrent_logins;
  944. }
  945. /* ADDED BY UNDYING SOULZZ 4/9/02 */
  946. extern unsigned int prefs_get_identify_timeout_secs(void)
  947. {
  948.     return prefs_runtime_config.identify_timeout_secs;
  949. }
  950. extern char const * prefs_get_server_info( void )
  951. {
  952.     return prefs_runtime_config.server_info;
  953. }
  954. extern char const * prefs_get_mapsfile(void)
  955. {
  956.     return prefs_runtime_config.mapsfile;
  957. }
  958. extern char const * prefs_get_xplevel_file(void)
  959. {
  960.     return prefs_runtime_config.xplevelfile;
  961. }
  962. extern char const * prefs_get_xpcalc_file(void)
  963. {
  964.     return prefs_runtime_config.xpcalcfile;
  965. }
  966. extern int prefs_get_initkill_timer(void)
  967. {
  968. return prefs_runtime_config.initkill_timer;
  969.  }
  970. extern int prefs_get_war3_ladder_update_secs(void)
  971. {
  972.         return prefs_runtime_config.war3_ladder_update_secs;
  973. }
  974. extern int prefs_get_output_update_secs(void)
  975. {
  976.         return prefs_runtime_config.output_update_secs;
  977. }
  978. extern char const * prefs_get_ladderdir(void)
  979. {
  980.         return prefs_runtime_config.ladderdir;
  981. }
  982. extern char const * prefs_get_outputdir(void)
  983. {
  984.         return prefs_runtime_config.statusdir;
  985. }
  986. extern int prefs_get_XML_output_ladder(void)
  987. {
  988.         return prefs_runtime_config.XML_output_ladder;
  989. }
  990. extern int prefs_get_XML_status_output(void)
  991. {
  992.         return prefs_runtime_config.XML_status_output;
  993. }
  994. extern char const * prefs_get_account_allowed_symbols(void)
  995. {
  996. return prefs_runtime_config.account_allowed_symbols;
  997. }
  998. extern char const * prefs_get_command_groups_file(void)
  999. {
  1000.     return prefs_runtime_config.command_groups_file;
  1001. }
  1002. extern char const * prefs_get_tournament_file(void)
  1003. {
  1004.     return prefs_runtime_config.tournament_file;
  1005. }
  1006. extern char const * prefs_get_aliasfile(void)
  1007. {
  1008.    return prefs_runtime_config.aliasfile;
  1009. }
  1010. extern char const * prefs_get_w3trans_file(void)
  1011. {
  1012.     return prefs_runtime_config.w3trans_file;
  1013. }
  1014. extern char const * prefs_get_anongame_infos_file(void)
  1015. {
  1016. return prefs_runtime_config.anongame_infos_file;
  1017. }
  1018. extern unsigned int prefs_get_max_conns_per_IP(void)
  1019. {
  1020. return prefs_runtime_config.max_conns_per_IP;
  1021. }
  1022. extern int prefs_get_max_friends(void)
  1023. {
  1024. return prefs_runtime_config.max_friends;
  1025. }
  1026. extern unsigned int prefs_get_clan_newer_time(void)
  1027. {
  1028.     return prefs_runtime_config.clan_newer_time;
  1029. }
  1030. extern unsigned int prefs_get_clan_max_members(void)
  1031. {
  1032.     return prefs_runtime_config.clan_max_members;
  1033. }
  1034. extern unsigned int prefs_get_clan_channel_default_private(void)
  1035. {
  1036.     return prefs_runtime_config.clan_channel_default_private;
  1037. }
  1038. extern unsigned int prefs_get_passfail_count(void)
  1039. {
  1040.     return prefs_runtime_config.passfail_count;
  1041. }
  1042. extern unsigned int prefs_get_passfail_bantime(void)
  1043. {
  1044.     return prefs_runtime_config.passfail_bantime;
  1045. }
  1046. extern unsigned int prefs_get_maxusers_per_channel(void)
  1047. {
  1048.     return prefs_runtime_config.maxusers_per_channel;
  1049. }
  1050. extern unsigned int prefs_get_load_new_account(void)
  1051. {
  1052.     return prefs_runtime_config.load_new_account;
  1053. }
  1054. extern char const * prefs_get_supportfile(void)
  1055. {
  1056.     return prefs_runtime_config.supportfile;
  1057. }