From a08b3ec5924c946308ac086cd3ee7d701610d3be Mon Sep 17 00:00:00 2001 From: Adam- Date: Sat, 28 Nov 2009 23:02:07 +0000 Subject: Massive move of all of the Config variables out of global scope to the Config class git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2674 5417fbe8-f217-4b02-8779-1006273d7864 --- include/configreader.h | 382 ++++++++++++++++++++++ include/extern.h | 205 +----------- include/services.h | 10 - src/actions.c | 14 +- src/bots.cpp | 34 +- src/botserv.c | 98 +++--- src/channels.c | 36 +- src/chanserv.c | 78 ++--- src/commands.c | 2 +- src/config.c | 762 ++++++++++++++++--------------------------- src/configreader.cpp | 16 +- src/core/bs_act.c | 18 +- src/core/bs_assign.c | 18 +- src/core/bs_badwords.c | 44 +-- src/core/bs_bot.c | 82 ++--- src/core/bs_botlist.c | 18 +- src/core/bs_help.c | 6 +- src/core/bs_info.c | 82 ++--- src/core/bs_kick.c | 100 +++--- src/core/bs_say.c | 18 +- src/core/bs_set.c | 74 ++--- src/core/bs_unassign.c | 16 +- src/core/cs_access.c | 138 ++++---- src/core/cs_akick.c | 82 +++-- src/core/cs_ban.c | 34 +- src/core/cs_clear.c | 42 +-- src/core/cs_drop.c | 24 +- src/core/cs_forbid.c | 30 +- src/core/cs_getkey.c | 12 +- src/core/cs_help.c | 14 +- src/core/cs_info.c | 50 +-- src/core/cs_invite.c | 16 +- src/core/cs_kick.c | 20 +- src/core/cs_list.c | 36 +- src/core/cs_modes.c | 74 ++--- src/core/cs_register.c | 40 +-- src/core/cs_set.c | 190 +++++------ src/core/cs_status.c | 12 +- src/core/cs_suspend.c | 54 +-- src/core/cs_topic.c | 22 +- src/core/cs_xop.c | 94 +++--- src/core/enc_md5.c | 2 +- src/core/enc_none.c | 2 +- src/core/enc_old.c | 2 +- src/core/enc_sha1.c | 2 +- src/core/hs_del.c | 12 +- src/core/hs_delall.c | 12 +- src/core/hs_group.c | 10 +- src/core/hs_help.c | 4 +- src/core/hs_list.c | 32 +- src/core/hs_off.c | 8 +- src/core/hs_on.c | 10 +- src/core/hs_set.c | 26 +- src/core/hs_setall.c | 26 +- src/core/ms_cancel.c | 16 +- src/core/ms_check.c | 18 +- src/core/ms_del.c | 30 +- src/core/ms_help.c | 6 +- src/core/ms_info.c | 80 ++--- src/core/ms_list.c | 26 +- src/core/ms_read.c | 28 +- src/core/ms_rsend.c | 22 +- src/core/ms_send.c | 6 +- src/core/ms_sendall.c | 10 +- src/core/ms_set.c | 72 ++-- src/core/ms_staff.c | 8 +- src/core/ns_access.c | 42 +-- src/core/ns_alist.c | 20 +- src/core/ns_drop.c | 40 +-- src/core/ns_forbid.c | 30 +- src/core/ns_getemail.c | 12 +- src/core/ns_getpass.c | 32 +- src/core/ns_ghost.c | 30 +- src/core/ns_group.c | 82 ++--- src/core/ns_help.c | 16 +- src/core/ns_identify.c | 36 +- src/core/ns_info.c | 66 ++-- src/core/ns_list.c | 34 +- src/core/ns_logout.c | 18 +- src/core/ns_recover.c | 44 +-- src/core/ns_register.c | 126 +++---- src/core/ns_release.c | 30 +- src/core/ns_saset.c | 168 +++++----- src/core/ns_sendpass.c | 26 +- src/core/ns_set.c | 142 ++++---- src/core/ns_status.c | 14 +- src/core/ns_suspend.c | 56 ++-- src/core/ns_update.c | 6 +- src/core/os_akill.c | 68 ++-- src/core/os_chankill.c | 20 +- src/core/os_chanlist.c | 14 +- src/core/os_clearmodes.c | 46 +-- src/core/os_defcon.c | 146 ++++----- src/core/os_global.c | 10 +- src/core/os_help.c | 6 +- src/core/os_ignore.c | 24 +- src/core/os_jupe.c | 14 +- src/core/os_kick.c | 18 +- src/core/os_mode.c | 18 +- src/core/os_modinfo.c | 12 +- src/core/os_modlist.c | 22 +- src/core/os_modload.c | 10 +- src/core/os_modunload.c | 10 +- src/core/os_news.c | 60 ++-- src/core/os_noop.c | 16 +- src/core/os_oline.c | 22 +- src/core/os_quit.c | 8 +- src/core/os_reload.c | 6 +- src/core/os_restart.c | 8 +- src/core/os_session.c | 80 ++--- src/core/os_set.c | 96 +++--- src/core/os_sgline.c | 60 ++-- src/core/os_shutdown.c | 8 +- src/core/os_sqline.c | 62 ++-- src/core/os_staff.c | 16 +- src/core/os_stats.c | 144 ++++---- src/core/os_svsnick.c | 22 +- src/core/os_szline.c | 60 ++-- src/core/os_umode.c | 18 +- src/core/os_update.c | 6 +- src/core/os_userlist.c | 14 +- src/core/ss_main.c | 2 +- src/datafiles.c | 60 ++-- src/hostserv.c | 42 +-- src/init.c | 106 +++--- src/language.c | 14 +- src/log.c | 8 +- src/mail.c | 34 +- src/main.c | 20 +- src/memoserv.c | 64 ++-- src/messages.c | 132 ++++---- src/misc.c | 24 +- src/modes.cpp | 4 +- src/modulemanager.cpp | 12 +- src/modules.c | 36 +- src/modules/cs_appendtopic.c | 26 +- src/modules/cs_enforce.c | 38 +-- src/modules/cs_tban.c | 24 +- src/modules/hs_request.c | 88 ++--- src/modules/ns_maxemail.c | 6 +- src/modules/os_ignore_db.c | 4 +- src/modules/os_info.c | 34 +- src/nickcore.cpp | 4 +- src/nickserv.c | 76 ++--- src/operserv.c | 92 +++--- src/protocol.cpp | 8 +- src/protocol/bahamut.c | 30 +- src/protocol/inspircd11.c | 54 +-- src/protocol/inspircd12.cpp | 38 +-- src/protocol/ratbox.c | 26 +- src/protocol/unreal32.c | 44 +-- src/regchannel.cpp | 10 +- src/send.c | 2 +- src/servers.c | 14 +- src/sessions.c | 46 +-- src/sockutil.c | 6 +- src/users.c | 20 +- 157 files changed, 3492 insertions(+), 3537 deletions(-) diff --git a/include/configreader.h b/include/configreader.h index 017e254da..b5b124777 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -374,6 +374,388 @@ class ServerConfig void ValidateHostname(const char *, const std::string &, const std::string &); void ValidateIP(const char *p, const std::string &, const std::string &, bool); void ValidateNoSpaces(const char *, const std::string &, const std::string &); + + + + /** Below here is a list of variables which contain the config files values + */ + /* IRCd module in use */ + char *IRCDModule; + + /* Host to connect to **/ + char *LocalHost; + /* Port */ + unsigned LocalPort; + /* List of uplink servers to try and connect to */ + std::list Uplinks; + + /* Our server name */ + char *ServerName; + /* Our servers description */ + char *ServerDesc; + /* The username/ident of services clients */ + char *ServiceUser; + /* The hostname if services clients */ + char *ServiceHost; + + /* Help channel, ops here get usermode +h **/ + char *HelpChannel; + /* Log channel */ + char *LogChannel; + /* Name of the network were on */ + char *NetworkName; + /* The max legnth of nicks */ + unsigned NickLen; + + /* NickServ Name */ + char *s_NickServ; + /* ChanServ Name */ + char *s_ChanServ; + /* MemoServ Name */ + char *s_MemoServ; + /* BotServ Name */ + char *s_BotServ; + /* OperServ name */ + char *s_OperServ; + /* Global name */ + char *s_GlobalNoticer; + /* NickServs realname */ + char *desc_NickServ; + /* ChanServ realname */ + char *desc_ChanServ; + /* MemoServ relname */ + char *desc_MemoServ; + /* BotServ realname */ + char *desc_BotServ; + /* OperServ realname */ + char *desc_OperServ; + /* Global realname */ + char *desc_GlobalNoticer; + + /* Name of the hostserv database */ + char *HostDBName; + /* HostServ Name */ + char *s_HostServ; + /* HostServ realname */ + char *desc_HostServ; + + /* Filename for the PID file */ + char *PIDFilename; + /* MOTD filename */ + char *MOTDFilename; + /* NickServ DB name */ + char *NickDBName; + /* DB name for nicks being registered */ + char *PreNickDBName; + /* Channel DB name */ + char *ChanDBName; + /* Botserv DB name */ + char *BotDBName; + /* OperServ db name */ + char *OperDBName; + /* News DB name */ + char *NewsDBName; + + /* True if its ok to not be able to save backs */ + bool NoBackupOkay; + /* Do password checking when new people register */ + bool StrictPasswords; + /* How many times you're allowed to give a bad password before being killed */ + unsigned BadPassLimit; + /* How long before bad passwords are forgotten */ + time_t BadPassTimeout; + /* Delay between automatic database updates */ + time_t UpdateTimeout; + /* Delay between checks for expired nicks and channels */ + time_t ExpireTimeout; + /* How long to wait for something from the uplink, this is passed to select() */ + time_t ReadTimeout; + /* How often to send program errors */ + time_t WarningTimeout; + /* How long to process things such as timers to see if there is anything to calll */ + time_t TimeoutCheck; + /* Num of days logfiles are kept */ + int KeepLogs; + /* Number of days backups are kept */ + int KeepBackups; + /* Forbidding requires a reason */ + bool ForceForbidReason; + /* Services should use privmsgs instead of notices */ + bool UsePrivmsg; + /* Services only respond to full PRIVMSG client@services.server.name messaegs */ + bool UseStrictPrivMsg; + /* Dump a core file if we crash */ + bool DumpCore; + /* Log users connecting/existing/changing nicks */ + bool LogUsers; + /* Number of seconds between consecutive uses of the REGISTER command + * Not to be confused with NSRegDelay */ + unsigned NickRegDelay; + /* Max number if news items allowed in the list */ + unsigned NewsCount; + + /* Services can use email */ + bool UseMail; + /* Path to the sendmail executable */ + char *SendMailPath; + /* Address to send from */ + char *SendFrom; + /* Only opers can have services send mail */ + bool RestrictMail; + /* Delay between sending mail */ + time_t MailDelay; + /* Don't quote the To: address */ + bool DontQuoteAddresses; + + /* Prefix of guest nicks when a user gets forced off of a nick */ + char *NSGuestNickPrefix; + /* Allow users to set kill immed on */ + bool NSAllowKillImmed; + /* Don't allow nicks to use /ns group to regroup nicks */ + bool NSNoGroupChange; + /* Default flags for newly registered nicks */ + Flags NSDefFlags; + /* Default language used by services */ + unsigned NSDefLanguage; + /* Users must be connected this long before they can register + * Not to be confused with NickRegDelay */ + time_t NSRegDelay; + /* Time before the registering mail will be resent */ + time_t NSResendDelay; + /* How long before nicks expir */ + time_t NSExpire; + /* Time before NickRequests expire */ + time_t NSRExpire; + /* Force email when registering */ + bool NSForceEmail; + /* Max number of nicks in a group */ + int NSMaxAliases; + /* Max number of allowed strings on the access list */ + unsigned NSAccessMax; + /* Enforcer client user name */ + char *NSEnforcerUser; + /* Enforcer client hostname */ + char *NSEnforcerHost; + /* How long before recovered nicks are released */ + time_t NSReleaseTimeout; + /* /nickserv list is oper only */ + bool NSListOpersOnly; + /* Max number of entries that can be returned from the list command */ + unsigned NSListMax; + /* Only allow usermode +a etc on real services admins */ + bool NSSecureAdmins; + /* Services opers must be /operd on the ircd aswell */ + bool NSStrictPrivileges; + /* Use email to verify new users registering */ + bool NSEmailReg; + /* Set the proper channel modes on users when they identify */ + bool NSModeOnID; + /* Add the users hostnask their access list when they register */ + bool NSAddAccessOnReg; + + /* Default flags for newly registered channels */ + Flags CSDefFlags; + /* Max number of channels a user can own */ + unsigned CSMaxReg; + /* Time before a channel expires */ + time_t CSExpire; + /* Default ban type to use for channels */ + int CSDefBantype; + /* Max number of entries allowed on channel access lists */ + unsigned CSAccessMax; + /* Max number of entries allowed on autokick lists */ + unsigned CSAutokickMax; + /* Default autokick reason */ + char *CSAutokickReason; + /* Time ChanServ should stay in the channel to hold it to keep users from getting in */ + time_t CSInhabit; + /* ChanServ's LIST command is oper only */ + bool CSListOpersOnly; + /* Max number of entries allowed to be returned from the LIST command */ + unsigned CSListMax; + /* true to make ChanServ oper only */ + bool CSOpersOnly; + + /* Max number of memos allowed */ + unsigned MSMaxMemos; + /* Time you must wait between sending memos */ + time_t MSSendDelay; + /* Notify all of the aliases of the core the memo was sent to */ + bool MSNotifyAll; + /* Who can use memos reciepts */ + unsigned MSMemoReceipt; + + /* Defai;t BotServ flags */ + Flags BSDefFlags; + /* How long before botserv forgets a user. This is used for flood kickers etc */ + time_t BSKeepData; + /* Min number of users to have in the channel before the service bot joins */ + unsigned BSMinUsers; + /* Max number of words allowed on the badwordslist */ + unsigned BSBadWordsMax; + /* BotServ bot only joins if it would normally allowed to, abides by bans etc */ + bool BSSmartJoin; + /* Dont tell users what badword they used */ + bool BSGentleBWReason; + /* Case sensitive badwords matching */ + bool BSCaseSensitive; + /* Char to use for the fantasy char, eg ! */ + char *BSFantasyCharacter; + + /* Only show /stats o to opers */ + bool HideStatsO; + /* Send out a global when services shut down or restart */ + bool GlobalOnCycle; + /* Don't include the opers name in globals */ + bool AnonymousGlobal; + /* Dont allow users to register nicks with oper names in them */ + bool RestrictOperNicks; + /* Message to send when shutting down */ + char *GlobalOnCycleMessage; + /* Message to send when starting up */ + char *GlobalOnCycleUP; + /* Super admin is allowed */ + bool SuperAdmin; + /* Log things said through ACT/SAY */ + bool LogBot; + /* Log when new user max is reached */ + bool LogMaxUsers; + /* Default expiry time for akills */ + time_t AutokillExpiry; + /* Default expiry time for chan kills */ + time_t ChankillExpiry; + /* Default expiry time for SGLine Expire */ + time_t SGLineExpiry; + /* Default expiry time for SQLines */ + time_t SQLineExpiry; + /* Default expiry time for SZLine */ + time_t SZLineExpiry; + /* Actually akill the user when the akill is added */ + bool AkillOnAdd; + /* Kill users on SGline */ + bool KillonSGline; + /* Kill users on SQline */ + bool KillonSQline; + /* Send a WALLOPS/GLOBOPS when a user opers */ + bool WallOper; + /* Send a WALLOPS/GLOBOPS when a nonoper tries to use OperServ */ + bool WallBadOS; + /* Send a WALLOPS/GLOBOPS when someone uses the GLOBAL command */ + bool WallOSGlobal; + /* Send a WALLOPS/GLOBOPS when someone uses the MODE command */ + bool WallOSMode; + /* Send a WALLOPS/GLOBOPS when someone uses the CLEARMODES command */ + bool WallOSClearmodes; + /* Send a WALLOPS/GLOBOPS when someone uses the KICK command */ + bool WallOSKick; + /* Send a WALLOPS/GLOBOPS when someone uses the AKILL command */ + bool WallOSAkill; + /* Send a WALLOPS/GLOBOPS when someone uses the SGLINE command */ + bool WallOSSGLine; + /* Send a WALLOPS/GLOBOPS when someone uses the SQLINE command */ + bool WallOSSQLine; + /* Send a WALLOPS/GLOBOPS when someone uses the SZLINE command */ + bool WallOSSZLine; + /* Send a WALLOPS/GLOBOPS when someone uses the NOOP command */ + bool WallOSNoOp; + /* Send a WALLOPS/GLOBOPS when when someone uses the JUPE command */ + bool WallOSJupe; + /* Send a WALLOPS/GLOBOPS when an akill expires */ + bool WallAkillExpire; + /* Send a WALLOPS/GLOBOPS when SGLines expire */ + bool WallSGLineExpire; + /* Send a WALLOPS/GLOBOPS when SQLines expire */ + bool WallSQLineExpire; + /* Send a WALLOPS/GLOBOPS when SZLines expire */ + bool WallSZLineExpire; + /* Send a WALLOPS/GLOBOPS when exceptions expire */ + bool WallExceptionExpire; + /* Send a WALLOPS/GLOBOPS when DROP is used */ + bool WallDrop; + /* Send a WALLOPS/GLOBOPS when FORBID is used */ + bool WallForbid; + /* Send a WALLOPS/GLOBOPS when GETPASS is used */ + bool WallGetpass; + /* Send a WALLOPS/GLOBOPS when SETPASS is used */ + bool WallSetpass; + /* Add the akillers nick to the akill reason */ + bool AddAkiller; + + /* Limit sessions */ + bool LimitSessions; + /* The default session limit */ + unsigned DefSessionLimit; + /* How long before exceptions expire */ + time_t ExceptionExpiry; + /* How many times to kill before adding an KILL */ + int MaxSessionKill; + /* Max limit that can be used for exceptions */ + unsigned MaxSessionLimit; + /* How long session akills should last */ + time_t SessionAutoKillExpiry; + /* DB name for exceptions */ + char *ExceptionDBName; + /* Reason to use for session kills */ + char *SessionLimitExceeded; + /* Optional second reason */ + char *SessionLimitDetailsLoc; + /* OperServ requires you to be an operator */ + bool OSOpersOnly; + + /* List of modules to autoload */ + std::list ModulesAutoLoad; + /* Encryption modules */ + std::list EncModuleList; + /* HostServ Core Modules */ + std::list HostServCoreModules; + /* MemoServ Core Modules */ + std::list MemoServCoreModules; + /* BotServ Core Modules */ + std::list BotServCoreModules; + /* OperServ Core Modules */ + std::list OperServCoreModules; + /* NickServ Core Modules */ + std::list NickServCoreModules; + /* ChanServ Core Modules */ + std::list ChanServCoreModules; + + /* Default defcon level */ + int DefConLevel; + /* Timeout before defcon is reset */ + time_t DefConTimeOut; + /* Session limiit to use when using defcon */ + int DefConSessionLimit; + /* How long to add akills for defcon */ + time_t DefConAKILL; + /* Chan modes for defcon */ + char *DefConChanModes; + /* Should we global on defcon */ + bool GlobalOnDefcon; + /* Should we send DefconMessage aswell? */ + bool GlobalOnDefconMore; + /* Message to send when defcon is off */ + char *DefConOffMessage; + /* Message to send when defcon is on*/ + char *DefconMessage; + /* Reason to akill clients for defcon */ + char *DefConAkillReason; + + /* User keys to use for generating random hashes for pass codes etc */ + long unsigned int UserKey1; + long unsigned int UserKey2; + long unsigned int UserKey3; + + /* Numeric */ + char *Numeric; + /* Array of ulined servers */ + char **Ulines; + /* Number of ulines */ + int NumUlines; + + /* List of available opertypes */ + std::list MyOperTypes; + /* List of pairs of opers and their opertype from the config */ + std::list > Opers; }; /** This class can be used on its own to represent an exception, or derived to represent a module-specific exception. diff --git a/include/extern.h b/include/extern.h index e6005b4e8..348489a40 100644 --- a/include/extern.h +++ b/include/extern.h @@ -31,7 +31,6 @@ E char *uplink; E IRCDVar *ircd; E IRCDCAPAB *ircdcap; E int UseTSMODE; /* hack to get around bahamut clones that don't send TSMODE */ -E char *IRCDModule; E IRCDProto *ircdproto; /**** actions.c ****/ @@ -121,7 +120,7 @@ E Entry *elist_find_mask(EList *list, const char *mask); E long get_memuse(EList *list); -#define whosends(ci) ((!(ci) || !((ci)->botflags.HasFlag(BS_SYMBIOSIS)) || !(ci)->bi || !(ci)->c || (ci)->c->usercount < BSMinUsers) ? findbot(s_ChanServ) : (ci)->bi) +#define whosends(ci) ((!(ci) || !((ci)->botflags.HasFlag(BS_SYMBIOSIS)) || !(ci)->bi || !(ci)->c || (ci)->c->usercount < Config.BSMinUsers) ? findbot(Config.s_ChanServ) : (ci)->bi) /**** chanserv.c ****/ @@ -178,212 +177,16 @@ char *sockstrerror(int error); /**** config.c ****/ -E ServerConfig serverConfig; - -E std::list Uplinks; -E char *LocalHost; -E unsigned LocalPort; - -E char *ServerName; -E char *ServerDesc; -E char *ServiceUser; -E char *ServiceHost; - -E char *HelpChannel; -E char *LogChannel; -E char *NetworkName; -E unsigned NickLen; - -E char *s_NickServ; -E char *s_ChanServ; -E char *s_MemoServ; -E char *s_BotServ; -E char *s_OperServ; -E char *s_GlobalNoticer; -E char *desc_NickServ; -E char *desc_ChanServ; -E char *desc_MemoServ; -E char *desc_BotServ; -E char *desc_OperServ; -E char *desc_GlobalNoticer; - -E char *HostDBName; -E char *desc_HostServ; -E char *s_HostServ; +E ServerConfig Config; + E void load_hs_dbase(); E void save_hs_dbase(); E int do_on_id(User * u); E void delHostCore(const char *nick); E void hostserv(User * u, char *buf); -E char *PIDFilename; -E char *MOTDFilename; -E char *NickDBName; -E char *PreNickDBName; -E char *ChanDBName; -E char *BotDBName; -E char *OperDBName; -E char *NewsDBName; - -E bool NoBackupOkay; -E bool StrictPasswords; -E unsigned BadPassLimit; -E time_t BadPassTimeout; -E time_t UpdateTimeout; -E time_t ExpireTimeout; -E time_t ReadTimeout; -E time_t WarningTimeout; -E time_t TimeoutCheck; -E int KeepLogs; -E int KeepBackups; -E bool ForceForbidReason; -E bool UsePrivmsg; -E bool UseStrictPrivMsg; -E bool DumpCore; -E bool LogUsers; -E unsigned NickRegDelay; -E bool RestrictOperNicks; -E unsigned NewsCount; -E char *Numeric; - -E bool UseMail; -E char *SendMailPath; -E char *SendFrom; -E bool RestrictMail; -E time_t MailDelay; -E bool DontQuoteAddresses; - -E Flags NSDefFlags; -E unsigned NSDefLanguage; -E time_t NSRegDelay; -E time_t NSResendDelay; -E time_t NSExpire; -E time_t NSRExpire; -E bool NSForceEmail; -E int NSMaxAliases; -E unsigned NSAccessMax; -E char *NSEnforcerUser; -E char *NSEnforcerHost; -E time_t NSReleaseTimeout; -E bool NSAllowKillImmed; -E bool NSNoGroupChange; -E bool NSListOpersOnly; -E unsigned NSListMax; -E char *NSGuestNickPrefix; -E bool NSSecureAdmins; -E bool NSStrictPrivileges; -E bool NSEmailReg; -E bool NSModeOnID; -E bool NSAddAccessOnReg; - -E Flags CSDefFlags; -E unsigned CSMaxReg; -E time_t CSExpire; -E int CSDefBantype; -E unsigned CSAccessMax; -E unsigned CSAutokickMax; -E char *CSAutokickReason; -E time_t CSInhabit; -E bool CSListOpersOnly; -E unsigned CSListMax; -E bool CSRestrictGetPass; -E bool CSOpersOnly; - -E unsigned MSMaxMemos; -E time_t MSSendDelay; -E bool MSNotifyAll; -E unsigned MSMemoReceipt; - -E Flags BSDefFlags; -E time_t BSKeepData; -E unsigned BSMinUsers; -E unsigned BSBadWordsMax; -E bool BSSmartJoin; -E bool BSGentleBWReason; -E bool BSCaseSensitive; -E char *BSFantasyCharacter; - -E bool HideStatsO; -E bool GlobalOnCycle; -E bool AnonymousGlobal; -E char *GlobalOnCycleMessage; -E char *GlobalOnCycleUP; -E bool LogMaxUsers; -E bool SuperAdmin; -E bool LogBot; -E time_t AutokillExpiry; -E time_t ChankillExpiry; -E time_t SGLineExpiry; -E time_t SQLineExpiry; -E time_t SZLineExpiry; -E bool AkillOnAdd; -E bool KillonSGline; -E bool KillonSQline; -E bool WallOper; -E bool WallBadOS; -E bool WallOSGlobal; -E bool WallOSMode; -E bool WallOSClearmodes; -E bool WallOSKick; -E bool WallOSAkill; -E bool WallOSSGLine; -E bool WallOSSQLine; -E bool WallOSSZLine; -E bool WallOSNoOp; -E bool WallOSJupe; -E bool WallAkillExpire; -E bool WallSGLineExpire; -E bool WallSQLineExpire; -E bool WallSZLineExpire; -E bool WallExceptionExpire; -E bool WallDrop; -E bool WallForbid; -E bool WallGetpass; -E bool WallSetpass; -E bool AddAkiller; - -/** - * Modules Stuff - **/ -E std::list ModulesAutoLoad; - -E std::list EncModuleList; -E std::list HostServCoreModules; -E std::list MemoServCoreModules; -E std::list BotServCoreModules; -E std::list OperServCoreModules; -E std::list NickServCoreModules; -E std::list ChanServCoreModules; - -E bool LimitSessions; -E unsigned DefSessionLimit; -E time_t ExceptionExpiry; -E int MaxSessionKill; -E unsigned MaxSessionLimit; -E time_t SessionAutoKillExpiry; -E char *ExceptionDBName; -E char *SessionLimitDetailsLoc; -E char *SessionLimitExceeded; - -E char **Ulines; -E int NumUlines; - E int read_config(int reload); -E int DefConLevel; -E int DefConSessionLimit; -E time_t DefConTimeOut; -E time_t DefConAKILL; -E char *DefConChanModes; -E bool GlobalOnDefcon; -E bool GlobalOnDefconMore; -E char *DefconMessage; -E char *DefConAkillReason; -E char *DefConOffMessage; - -E long unsigned int UserKey1; -E long unsigned int UserKey2; -E long unsigned int UserKey3; /**** converter.c ****/ E int convert_ircservices_44(); @@ -683,8 +486,6 @@ E void AddDefCon(int level, DefconLevel Level); E void DelDefCon(int level, DefconLevel Level); E std::vector > DefCon; -E bool OSOpersOnly; - /**** process.c ****/ E int allow_ignore; diff --git a/include/services.h b/include/services.h index f8e48aa8a..6901c61b0 100644 --- a/include/services.h +++ b/include/services.h @@ -1767,16 +1767,6 @@ class CoreExport Anope /*************************************************************************/ -/** Pair of nick/opertype lookup. It's stored like this currently, because config is parsed before db load. - * XXX: It would be nice to not need this. UGH. - */ -E std::list > svsopers_in_config; -/** List of available opertypes. - */ -E std::list MyOperTypes; - -/*************************************************************************/ - #include "timers.h" /** Timer for colliding nicks to force people off of nicknames diff --git a/src/actions.c b/src/actions.c index f6b8c7675..9ed6b3b72 100644 --- a/src/actions.c +++ b/src/actions.c @@ -26,16 +26,16 @@ void bad_password(User * u) { time_t now = time(NULL); - if (!u || !BadPassLimit) { + if (!u || !Config.BadPassLimit) { return; } - if (BadPassTimeout > 0 && u->invalid_pw_time > 0 - && u->invalid_pw_time < now - BadPassTimeout) + if (Config.BadPassTimeout > 0 && u->invalid_pw_time > 0 + && u->invalid_pw_time < now - Config.BadPassTimeout) u->invalid_pw_count = 0; u->invalid_pw_count++; u->invalid_pw_time = now; - if (u->invalid_pw_count >= BadPassLimit) { + if (u->invalid_pw_count >= Config.BadPassLimit) { kill_user(NULL, u->nick, "Too many invalid passwords"); } } @@ -57,7 +57,7 @@ void kill_user(const char *source, const char *user, const char *reason) return; } if (!source || !*source) { - source = ServerName; + source = Config.ServerName; } if (!reason) { reason = ""; @@ -106,9 +106,9 @@ void sqline(char *mask, char *reason) av[0] = c->name; av[1] = cu->user->nick; av[2] = reason; - ircdproto->SendKick(findbot(s_OperServ), av[0], av[1], + ircdproto->SendKick(findbot(Config.s_OperServ), av[0], av[1], "Q-Lined: %s", av[2]); - do_kick(s_ChanServ, 3, av); + do_kick(Config.s_ChanServ, 3, av); } } } diff --git a/src/bots.cpp b/src/bots.cpp index 6d7728a93..db236c175 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -21,19 +21,19 @@ BotInfo::BotInfo(const char *nnick) this->cmdTable = NULL; this->chancount = 0; - if (s_ChanServ && !stricmp(s_ChanServ, nnick)) + if (Config.s_ChanServ && !stricmp(Config.s_ChanServ, nnick)) this->SetFlag(BI_CHANSERV); - else if (s_BotServ && !stricmp(s_BotServ, nnick)) + else if (Config.s_BotServ && !stricmp(Config.s_BotServ, nnick)) this->SetFlag(BI_BOTSERV); - else if (s_HostServ && !stricmp(s_HostServ, nnick)) + else if (Config.s_HostServ && !stricmp(Config.s_HostServ, nnick)) this->SetFlag(BI_HOSTSERV); - else if (s_OperServ && !stricmp(s_OperServ, nnick)) + else if (Config.s_OperServ && !stricmp(Config.s_OperServ, nnick)) this->SetFlag(BI_OPERSERV); - else if (s_MemoServ && !stricmp(s_MemoServ, nnick)) + else if (Config.s_MemoServ && !stricmp(Config.s_MemoServ, nnick)) this->SetFlag(BI_MEMOSERV); - else if (s_NickServ && !stricmp(s_NickServ, nnick)) + else if (Config.s_NickServ && !stricmp(Config.s_NickServ, nnick)) this->SetFlag(BI_NICKSERV); - else if (s_GlobalNoticer && !stricmp(s_GlobalNoticer, nnick)) + else if (Config.s_GlobalNoticer && !stricmp(Config.s_GlobalNoticer, nnick)) this->SetFlag(BI_GLOBAL); FOREACH_MOD(I_OnBotPreLoad, OnBotPreLoad(this)); @@ -58,19 +58,19 @@ BotInfo::BotInfo(const char *nnick, const char *nuser, const char *nhost, const this->cmdTable = NULL; this->chancount = 0; - if (s_ChanServ && !stricmp(s_ChanServ, nnick)) + if (Config.s_ChanServ && !stricmp(Config.s_ChanServ, nnick)) this->SetFlag(BI_CHANSERV); - else if (s_BotServ && !stricmp(s_BotServ, nnick)) + else if (Config.s_BotServ && !stricmp(Config.s_BotServ, nnick)) this->SetFlag(BI_BOTSERV); - else if (s_HostServ && !stricmp(s_HostServ, nnick)) + else if (Config.s_HostServ && !stricmp(Config.s_HostServ, nnick)) this->SetFlag(BI_HOSTSERV); - else if (s_OperServ && !stricmp(s_OperServ, nnick)) + else if (Config.s_OperServ && !stricmp(Config.s_OperServ, nnick)) this->SetFlag(BI_OPERSERV); - else if (s_MemoServ && !stricmp(s_MemoServ, nnick)) + else if (Config.s_MemoServ && !stricmp(Config.s_MemoServ, nnick)) this->SetFlag(BI_MEMOSERV); - else if (s_NickServ && !stricmp(s_NickServ, nnick)) + else if (Config.s_NickServ && !stricmp(Config.s_NickServ, nnick)) this->SetFlag(BI_NICKSERV); - else if (s_GlobalNoticer && !stricmp(s_GlobalNoticer, nnick)) + else if (Config.s_GlobalNoticer && !stricmp(Config.s_GlobalNoticer, nnick)) this->SetFlag(BI_GLOBAL); FOREACH_MOD(I_OnBotPreLoad, OnBotPreLoad(this)); @@ -132,7 +132,7 @@ void BotInfo::RejoinAll() for (i = 0; i < 256; i++) for (ci = chanlists[i]; ci; ci = ci->next) - if (ci->bi == this && ci->c && (ci->c->usercount >= BSMinUsers)) + if (ci->bi == this && ci->c && (ci->c->usercount >= Config.BSMinUsers)) bot_join(ci); } @@ -153,7 +153,7 @@ void BotInfo::Assign(User *u, ChannelInfo *ci) ci->bi = this; this->chancount++; - if (ci->c && ci->c->usercount >= BSMinUsers) + if (ci->c && ci->c->usercount >= Config.BSMinUsers) bot_join(ci); } @@ -164,7 +164,7 @@ void BotInfo::UnAssign(User *u, ChannelInfo *ci) if (MOD_RESULT == EVENT_STOP) return; - if (ci->c && ci->c->usercount >= BSMinUsers) + if (ci->c && ci->c->usercount >= Config.BSMinUsers) { if (u) ircdproto->SendPart(ci->bi, ci->name, "UNASSIGN from %s", u->nick); diff --git a/src/botserv.c b/src/botserv.c index 7c1657187..0919df3aa 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -34,7 +34,7 @@ E void moduleAddBotServCmds(); /*************************************************************************/ /* *INDENT-OFF* */ void moduleAddBotServCmds() { - ModuleManager::LoadModuleList(BotServCoreModules); + ModuleManager::LoadModuleList(Config.BotServCoreModules); } /* *INDENT-ON* */ /*************************************************************************/ @@ -70,7 +70,7 @@ void get_botserv_stats(long *nrec, long *memuse) void bs_init() { - if (s_BotServ) { + if (Config.s_BotServ) { moduleAddBotServCmds(); } } @@ -91,9 +91,9 @@ void botserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { *s = 0; } - ircdproto->SendCTCP(findbot(s_BotServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_BotServ), u->nick, "PING %s", s); } else { - mod_run_cmd(s_BotServ, u, BOTSERV, cmd); + mod_run_cmd(Config.s_BotServ, u, BOTSERV, cmd); } } @@ -244,21 +244,21 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) bw = ci->GetBadWord(i); if (bw->type == BW_ANY - && ((BSCaseSensitive && strstr(nbuf, bw->word.c_str())) - || (!BSCaseSensitive && stristr(nbuf, bw->word.c_str())))) { + && ((Config.BSCaseSensitive && strstr(nbuf, bw->word.c_str())) + || (!Config.BSCaseSensitive && stristr(nbuf, bw->word.c_str())))) { mustkick = 1; } else if (bw->type == BW_SINGLE) { int len = bw->word.length(); - if ((BSCaseSensitive && nbuf == bw->word) - || (!BSCaseSensitive + if ((Config.BSCaseSensitive && nbuf == bw->word) + || (!Config.BSCaseSensitive && (!stricmp(nbuf, bw->word.c_str())))) { mustkick = 1; /* two next if are quite odd isn't it? =) */ } else if ((strchr(nbuf, ' ') == nbuf + len) && - ((BSCaseSensitive && nbuf == bw->word) - || (!BSCaseSensitive + ((Config.BSCaseSensitive && nbuf == bw->word) + || (!Config.BSCaseSensitive && (stristr(nbuf, bw->word.c_str()) == nbuf)))) { mustkick = 1; @@ -266,10 +266,10 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) if ((strrchr(nbuf, ' ') == nbuf + strlen(nbuf) - len - 1) && - ((BSCaseSensitive + ((Config.BSCaseSensitive && (strstr(nbuf, bw->word.c_str()) == nbuf + strlen(nbuf) - len)) - || (!BSCaseSensitive + || (!Config.BSCaseSensitive && (stristr(nbuf, bw->word.c_str()) == nbuf + strlen(nbuf) - len)))) { mustkick = 1; @@ -281,9 +281,9 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) wordbuf[len + 2] = '\0'; memcpy(wordbuf + 1, bw->word.c_str(), len); - if ((BSCaseSensitive + if ((Config.BSCaseSensitive && (strstr(nbuf, wordbuf))) - || (!BSCaseSensitive + || (!Config.BSCaseSensitive && (stristr(nbuf, wordbuf)))) { mustkick = 1; } @@ -295,9 +295,9 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) } else if (bw->type == BW_START) { int len = bw->word.length(); - if ((BSCaseSensitive + if ((Config.BSCaseSensitive && (!strncmp(nbuf, bw->word.c_str(), len))) - || (!BSCaseSensitive + || (!Config.BSCaseSensitive && (!strnicmp(nbuf, bw->word.c_str(), len)))) { mustkick = 1; } else { @@ -307,8 +307,8 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) wordbuf[0] = ' '; wordbuf[len + 1] = '\0'; - if ((BSCaseSensitive && (strstr(nbuf, wordbuf))) - || (!BSCaseSensitive + if ((Config.BSCaseSensitive && (strstr(nbuf, wordbuf))) + || (!Config.BSCaseSensitive && (stristr(nbuf, wordbuf)))) mustkick = 1; @@ -317,11 +317,11 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) } else if (bw->type == BW_END) { int len = bw->word.length(); - if ((BSCaseSensitive + if ((Config.BSCaseSensitive && (!strncmp (nbuf + strlen(nbuf) - len, bw->word.c_str(), len))) - || (!BSCaseSensitive + || (!Config.BSCaseSensitive && (!strnicmp (nbuf + strlen(nbuf) - len, bw->word.c_str(), @@ -334,8 +334,8 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) wordbuf[len] = ' '; wordbuf[len + 1] = '\0'; - if ((BSCaseSensitive && (strstr(nbuf, wordbuf))) - || (!BSCaseSensitive + if ((Config.BSCaseSensitive && (strstr(nbuf, wordbuf))) + || (!Config.BSCaseSensitive && (stristr(nbuf, wordbuf)))) mustkick = 1; @@ -345,7 +345,7 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) if (mustkick) { check_ban(ci, u, TTB_BADWORDS); - if (BSGentleBWReason) + if (Config.BSGentleBWReason) bot_kick(ci, u, BOT_REASON_BADWORD_GENTLE); else bot_kick(ci, u, BOT_REASON_BADWORD, bw->word.c_str()); @@ -415,10 +415,10 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) /* Fantaisist commands */ - if (buf && ci->botflags.HasFlag(BS_FANTASY) && *buf == *BSFantasyCharacter && !was_action) { + if (buf && ci->botflags.HasFlag(BS_FANTASY) && *buf == *Config.BSFantasyCharacter && !was_action) { cmd = strtok(buf, " "); - if (cmd && (cmd[0] == *BSFantasyCharacter)) { + if (cmd && (cmd[0] == *Config.BSFantasyCharacter)) { char *params = strtok(NULL, ""); /* Strip off the fantasy character */ @@ -467,7 +467,7 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) #define SAFE(x) do { \ if ((x) < 0) { \ if (!forceload) \ - fatal("Read error on %s", BotDBName); \ + fatal("Read error on %s", Config.BotDBName); \ failed = 1; \ break; \ } \ @@ -482,7 +482,7 @@ void load_bs_dbase() BotInfo *bi; int failed = 0; - if (!(f = open_db(s_BotServ, BotDBName, "r", BOT_VERSION))) + if (!(f = open_db(Config.s_BotServ, Config.BotDBName, "r", BOT_VERSION))) return; ver = get_file_version(f); @@ -491,7 +491,7 @@ void load_bs_dbase() char *s; if (c != 1) - fatal("Invalid format in %s %d", BotDBName, c); + fatal("Invalid format in %s %d", Config.BotDBName, c); SAFE(read_string(&s, f)); bi = new BotInfo(s); @@ -512,20 +512,20 @@ void load_bs_dbase() * changed in the config and different from database * names */ - if (s_ChanServ && bi->HasFlag(BI_CHANSERV) && strcmp(bi->nick, s_ChanServ)) - bi->ChangeNick(s_ChanServ); - else if (s_BotServ && bi->HasFlag(BI_BOTSERV) && strcmp(bi->nick, s_BotServ)) - bi->ChangeNick(s_BotServ); - else if (s_HostServ && bi->HasFlag(BI_HOSTSERV) && strcmp(bi->nick, s_HostServ)) - bi->ChangeNick(s_HostServ); - else if (s_OperServ && bi->HasFlag(BI_OPERSERV) && strcmp(bi->nick, s_OperServ)) - bi->ChangeNick(s_OperServ); - else if (s_MemoServ && bi->HasFlag(BI_MEMOSERV) && strcmp(bi->nick, s_MemoServ)) - bi->ChangeNick(s_MemoServ); - else if (s_NickServ && bi->HasFlag(BI_NICKSERV) && strcmp(bi->nick, s_NickServ)) - bi->ChangeNick(s_NickServ); - else if (s_GlobalNoticer && bi->HasFlag(BI_GLOBAL) && strcmp(bi->nick, s_GlobalNoticer)) - bi->ChangeNick(s_GlobalNoticer); + if (Config.s_ChanServ && bi->HasFlag(BI_CHANSERV) && strcmp(bi->nick, Config.s_ChanServ)) + bi->ChangeNick(Config.s_ChanServ); + else if (Config.s_BotServ && bi->HasFlag(BI_BOTSERV) && strcmp(bi->nick, Config.s_BotServ)) + bi->ChangeNick(Config.s_BotServ); + else if (Config.s_HostServ && bi->HasFlag(BI_HOSTSERV) && strcmp(bi->nick, Config.s_HostServ)) + bi->ChangeNick(Config.s_HostServ); + else if (Config.s_OperServ && bi->HasFlag(BI_OPERSERV) && strcmp(bi->nick, Config.s_OperServ)) + bi->ChangeNick(Config.s_OperServ); + else if (Config.s_MemoServ && bi->HasFlag(BI_MEMOSERV) && strcmp(bi->nick, Config.s_MemoServ)) + bi->ChangeNick(Config.s_MemoServ); + else if (Config.s_NickServ && bi->HasFlag(BI_NICKSERV) && strcmp(bi->nick, Config.s_NickServ)) + bi->ChangeNick(Config.s_NickServ); + else if (Config.s_GlobalNoticer && bi->HasFlag(BI_GLOBAL) && strcmp(bi->nick, Config.s_GlobalNoticer)) + bi->ChangeNick(Config.s_GlobalNoticer); } close_db(f); @@ -538,9 +538,9 @@ void load_bs_dbase() #define SAFE(x) do { \ if ((x) < 0) { \ restore_db(f); \ - log_perror("Write error on %s", BotDBName); \ - if (time(NULL) - lastwarn > WarningTimeout) { \ - ircdproto->SendGlobops(NULL, "Write error on %s: %s", BotDBName, \ + log_perror("Write error on %s", Config.BotDBName); \ + if (time(NULL) - lastwarn > Config.WarningTimeout) { \ + ircdproto->SendGlobops(NULL, "Write error on %s: %s", Config.BotDBName, \ strerror(errno)); \ lastwarn = time(NULL); \ } \ @@ -555,7 +555,7 @@ void save_bs_dbase() static time_t lastwarn = 0; int i; - if (!(f = open_db(s_BotServ, BotDBName, "w", BOT_VERSION))) + if (!(f = open_db(Config.s_BotServ, Config.BotDBName, "w", BOT_VERSION))) return; for (i = 0; i < 256; i++) { @@ -647,7 +647,7 @@ static BanData *get_ban_data(Channel * c, User * u) u->GetDisplayedHost().c_str()); for (bd = c->bd; bd; bd = next) { - if (now - bd->last_use > BSKeepData) { + if (now - bd->last_use > Config.BSKeepData) { if (bd->next) bd->next->prev = bd->prev; if (bd->prev) @@ -702,7 +702,7 @@ static UserData *get_user_data(Channel * c, User * u) time_t now = time(NULL); /* Checks whether data is obsolete */ - if (now - user->ud->last_use > BSKeepData) { + if (now - user->ud->last_use > Config.BSKeepData) { if (user->ud->lastline) delete [] user->ud->lastline; /* We should not free and realloc, but reset to 0 @@ -736,7 +736,7 @@ void bot_join(ChannelInfo * ci) if (!ci || !ci->c || !ci->bi) return; - if (BSSmartJoin) { + if (Config.BSSmartJoin) { /* We check for bans */ if (ci->c->bans && ci->c->bans->count) { char buf[BUFSIZE]; diff --git a/src/channels.c b/src/channels.c index e6ee45430..b9d276a49 100644 --- a/src/channels.c +++ b/src/channels.c @@ -187,7 +187,7 @@ void Channel::RemoveMode(ChannelModeName Name) if (Name == CMODE_PERM && ci) { ci->UnsetFlag(CI_PERSIST); - if (s_BotServ && ci->bi && usercount == BSMinUsers - 1) + if (Config.s_BotServ && ci->bi && usercount == Config.BSMinUsers - 1) ircdproto->SendPart(ci->bi, name, NULL); if (!users) delete this; @@ -440,7 +440,7 @@ void chan_deluser(User * user, Channel * c) if (c->ci && c->ci->HasFlag(CI_PERSIST)) return; - if (s_BotServ && c->ci && c->ci->bi && c->usercount == BSMinUsers - 1) + if (Config.s_BotServ && c->ci && c->ci->bi && c->usercount == Config.BSMinUsers - 1) ircdproto->SendPart(c->ci->bi, c->name, NULL); if (!c->users) @@ -766,8 +766,8 @@ void chan_set_user_status(Channel * chan, User * user, int16 status) alog("debug: setting user status (%d) on %s for %s", status, user->nick, chan->name); - if (HelpChannel && ((um = ModeManager::FindUserModeByName(UMODE_HELPOP))) && (status & CUS_OP) - && (stricmp(chan->name, HelpChannel) == 0) + if (Config.HelpChannel && ((um = ModeManager::FindUserModeByName(UMODE_HELPOP))) && (status & CUS_OP) + && (stricmp(chan->name, Config.HelpChannel) == 0) && (!chan->ci || check_access(user, chan->ci, CA_AUTOOP))) { if (debug) { alog("debug: %s being given helpop for having %d status in %s", @@ -1044,7 +1044,7 @@ void do_kick(const char *source, int ac, const char **av) * channel and stop immediately. * --lara */ - if (s_BotServ && (bi = findbot(s)) && (ci = cs_findchan(av[0]))) { + if (Config.s_BotServ && (bi = findbot(s)) && (ci = cs_findchan(av[0]))) { bot_join(ci); continue; } @@ -1329,7 +1329,7 @@ void do_sjoin(const char *source, int ac, const char **av) } if (is_sqlined && !is_oper(user)) { - ircdproto->SendKick(findbot(s_OperServ), av[1], s, "Q-Lined"); + ircdproto->SendKick(findbot(Config.s_OperServ), av[1], s, "Q-Lined"); } else { if (!check_kick(user, av[1], ts)) { FOREACH_MOD(I_OnPreJoinChannel, OnPreJoinChannel(user, av[1])); @@ -1415,7 +1415,7 @@ void do_sjoin(const char *source, int ac, const char **av) } if (is_sqlined && !is_oper(user)) { - ircdproto->SendKick(findbot(s_OperServ), av[1], s, "Q-Lined"); + ircdproto->SendKick(findbot(Config.s_OperServ), av[1], s, "Q-Lined"); } else { if (!check_kick(user, av[1], ts)) { FOREACH_MOD(I_OnPreJoinChannel, OnPreJoinChannel(user, av[1])); @@ -1491,7 +1491,7 @@ void do_sjoin(const char *source, int ac, const char **av) } if (is_sqlined && !is_oper(user)) { - ircdproto->SendKick(findbot(s_OperServ), av[1], s, "Q-Lined"); + ircdproto->SendKick(findbot(Config.s_OperServ), av[1], s, "Q-Lined"); } else { if (!check_kick(user, av[1], ts)) { FOREACH_MOD(I_OnPreJoinChannel, OnPreJoinChannel(user, av[1])); @@ -1550,7 +1550,7 @@ void do_sjoin(const char *source, int ac, const char **av) } if (is_sqlined && !is_oper(user)) { - ircdproto->SendKick(findbot(s_OperServ), av[1], user->nick, "Q-Lined"); + ircdproto->SendKick(findbot(Config.s_OperServ), av[1], user->nick, "Q-Lined"); } else { FOREACH_MOD(I_OnPreJoinChannel, OnPreJoinChannel(user, av[1])); @@ -1910,10 +1910,10 @@ void chan_adduser2(User * user, Channel * c) if (c->ci && (check_access(user, c->ci, CA_MEMO)) && (c->ci->memos.memos.size() > 0)) { if (c->ci->memos.memos.size() == 1) { - notice_lang(s_MemoServ, user, MEMO_X_ONE_NOTICE, + notice_lang(Config.s_MemoServ, user, MEMO_X_ONE_NOTICE, c->ci->memos.memos.size(), c->ci->name); } else { - notice_lang(s_MemoServ, user, MEMO_X_MANY_NOTICE, + notice_lang(Config.s_MemoServ, user, MEMO_X_MANY_NOTICE, c->ci->memos.memos.size(), c->ci->name); } } @@ -1930,14 +1930,14 @@ void chan_adduser2(User * user, Channel * c) * legit users - Rob * But don't join the bot if the channel is persistant - Adam **/ - if (s_BotServ && c->ci && c->ci->bi && !c->ci->HasFlag(CI_PERSIST)) + if (Config.s_BotServ && c->ci && c->ci->bi && !c->ci->HasFlag(CI_PERSIST)) { - if (c->usercount == BSMinUsers) + if (c->usercount == Config.BSMinUsers) bot_join(c->ci); } - if (s_BotServ && c->ci && c->ci->bi) + if (Config.s_BotServ && c->ci && c->ci->bi) { - if (c->usercount >= BSMinUsers && (c->ci->botflags.HasFlag(BS_GREET)) + if (c->usercount >= Config.BSMinUsers && (c->ci->botflags.HasFlag(BS_GREET)) && user->nc && user->nc->greet && check_access(user, c->ci, CA_GREET)) { /* Only display the greet if the main uplink we're connected @@ -1978,7 +1978,7 @@ Channel *join_user_update(User * user, Channel * chan, const char *name, modes[0] = "-ov"; modes[1] = cu->user->nick; modes[2] = cu->user->nick; - chan_set_modes(s_OperServ, chan, 3, modes, 2); + chan_set_modes(Config.s_OperServ, chan, 3, modes, 2); } if (chan->ci) { @@ -2040,8 +2040,8 @@ void do_mass_mode(char *modes) delete [] myModes; return; } else { - ircdproto->SendMode(findbot(s_OperServ), c->name, "%s", modes); - chan_set_modes(s_OperServ, c, ac, av, 1); + ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "%s", modes); + chan_set_modes(Config.s_OperServ, c, ac, av, 1); } } free(av); diff --git a/src/chanserv.c b/src/chanserv.c index 19ab774f1..e54ce75fd 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -113,7 +113,7 @@ int levelinfo_maxwidth = 0; /*************************************************************************/ void moduleAddChanServCmds() { - ModuleManager::LoadModuleList(ChanServCoreModules); + ModuleManager::LoadModuleList(Config.ChanServCoreModules); } /* *INDENT-ON* */ @@ -136,7 +136,7 @@ class ChanServTimer : public Timer if (ci) ci->UnsetFlag(CI_INHABIT); - ircdproto->SendPart(findbot(s_ChanServ), channel.c_str(), NULL); + ircdproto->SendPart(findbot(Config.s_ChanServ), channel.c_str(), NULL); } }; @@ -295,9 +295,9 @@ void chanserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { *s = 0; } - ircdproto->SendCTCP(findbot(s_ChanServ), u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(Config.s_ChanServ), u->nick, "PING %s", s); } else { - mod_run_cmd(s_ChanServ, u, CHANSERV, cmd); + mod_run_cmd(Config.s_ChanServ, u, CHANSERV, cmd); } } @@ -309,7 +309,7 @@ void chanserv(User * u, char *buf) #define SAFE(x) do { \ if ((x) < 0) { \ if (!forceload) \ - fatal("Read error on %s", ChanDBName); \ + fatal("Read error on %s", Config.ChanDBName); \ failed = 1; \ break; \ } \ @@ -323,7 +323,7 @@ void load_cs_dbase() ChannelInfo *ci, **last, *prev; int failed = 0; - if (!(f = open_db(s_ChanServ, ChanDBName, "r", CHAN_VERSION))) + if (!(f = open_db(Config.s_ChanServ, Config.ChanDBName, "r", CHAN_VERSION))) return; ver = get_file_version(f); @@ -343,7 +343,7 @@ void load_cs_dbase() prev = NULL; while ((c = getc_db(f)) != 0) { if (c != 1) - fatal("Invalid format in %s", ChanDBName); + fatal("Invalid format in %s", Config.ChanDBName); char channame[CHANMAX]; SAFE(read = read_buffer(channame, f)); ci = new ChannelInfo(channame); @@ -594,7 +594,7 @@ void load_cs_dbase() next = ci->next; if (!(ci->HasFlag(CI_FORBIDDEN)) && !ci->founder) { alog("%s: database load: Deleting founderless channel %s", - s_ChanServ, ci->name); + Config.s_ChanServ, ci->name); delete ci; continue; } @@ -609,9 +609,9 @@ void load_cs_dbase() #define SAFE(x) do { \ if ((x) < 0) { \ restore_db(f); \ - log_perror("Write error on %s", ChanDBName); \ - if (time(NULL) - lastwarn > WarningTimeout) { \ - ircdproto->SendGlobops(NULL, "Write error on %s: %s", ChanDBName, \ + log_perror("Write error on %s", Config.ChanDBName); \ + if (time(NULL) - lastwarn > Config.WarningTimeout) { \ + ircdproto->SendGlobops(NULL, "Write error on %s: %s", Config.ChanDBName, \ strerror(errno)); \ lastwarn = time(NULL); \ } \ @@ -627,7 +627,7 @@ void save_cs_dbase() static time_t lastwarn = 0; std::string param; - if (!(f = open_db(s_ChanServ, ChanDBName, "w", CHAN_VERSION))) + if (!(f = open_db(Config.s_ChanServ, Config.ChanDBName, "w", CHAN_VERSION))) return; for (i = 0; i < 256; i++) { @@ -806,7 +806,7 @@ void check_modes(Channel * c) if (c->server_modecount >= 3 && c->chanserv_modecount >= 3) { ircdproto->SendGlobops(NULL, "Warning: unable to set modes on channel %s. Are your servers' U:lines configured correctly?", c->name); - alog("%s: Bouncy modes on channel %s", s_ChanServ, c->name); + alog("%s: Bouncy modes on channel %s", Config.s_ChanServ, c->name); c->bouncy_modes = 1; return; } @@ -911,7 +911,7 @@ void check_modes(Channel * c) if (modebuf.empty()) return; - ircdproto->SendMode((ci ? whosends(ci) : findbot(s_OperServ)), c->name, "%s%s", modebuf.c_str(), argbuf.empty() ? "" : argbuf.c_str()); + ircdproto->SendMode((ci ? whosends(ci) : findbot(Config.s_OperServ)), c->name, "%s%s", modebuf.c_str(), argbuf.empty() ? "" : argbuf.c_str()); } /*************************************************************************/ @@ -931,7 +931,7 @@ int check_valid_admin(User * user, Channel * chan, int servermode) return 0; if (servermode && !check_access(user, chan->ci, CA_AUTOPROTECT)) { - notice_lang(s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ); + notice_lang(Config.s_ChanServ, user, CHAN_IS_REGISTERED, Config.s_ChanServ); ircdproto->SendMode(whosends(chan->ci), chan->name, "-%s %s", cm->ModeChar, user->nick); return 0; @@ -967,7 +967,7 @@ int check_valid_op(User * user, Channel * chan, int servermode) halfop = ModeManager::FindChannelModeByName(CMODE_HALFOP); if (servermode && !check_access(user, chan->ci, CA_AUTOOP)) { - notice_lang(s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ); + notice_lang(Config.s_ChanServ, user, CHAN_IS_REGISTERED, Config.s_ChanServ); if (halfop) { if (owner && protect) @@ -1214,7 +1214,7 @@ int check_kick(User * user, const char *chan, time_t chants) get_idealban(ci, user, mask, sizeof(mask)); else strlcpy(mask, akick->mask.c_str(), sizeof(mask)); - reason = !akick->reason.empty() ? akick->reason.c_str() : CSAutokickReason; + reason = !akick->reason.empty() ? akick->reason.c_str() : Config.CSAutokickReason; goto kick; } } @@ -1241,16 +1241,16 @@ int check_kick(User * user, const char *chan, time_t chants) * c may be NULL even if it exists */ if ((!(c = findchan(chan)) || c->usercount == 0) && !ci->HasFlag(CI_INHABIT)) { - ircdproto->SendJoin(findbot(s_ChanServ), chan, (c ? c->creation_time : chants)); + ircdproto->SendJoin(findbot(Config.s_ChanServ), chan, (c ? c->creation_time : chants)); /* * If channel was forbidden, etc, set it +si to prevent rejoin */ if (set_modes) { - ircdproto->SendMode(findbot(s_ChanServ), chan, "+ntsi"); + ircdproto->SendMode(findbot(Config.s_ChanServ), chan, "+ntsi"); } - t = new ChanServTimer(CSInhabit, chan); + t = new ChanServTimer(Config.CSInhabit, chan); ci->SetFlag(CI_INHABIT); } @@ -1339,16 +1339,16 @@ void restore_topic(const char *chan) strscpy(c->topic_setter, whosends(ci)->nick, NICKMAX); } if (ircd->join2set) { - if (whosends(ci) == findbot(s_ChanServ)) { - ircdproto->SendJoin(findbot(s_ChanServ), chan, c->creation_time); - ircdproto->SendMode(NULL, chan, "+o %s", s_ChanServ); + if (whosends(ci) == findbot(Config.s_ChanServ)) { + ircdproto->SendJoin(findbot(Config.s_ChanServ), chan, c->creation_time); + ircdproto->SendMode(NULL, chan, "+o %s", Config.s_ChanServ); } } ircdproto->SendTopic(whosends(ci), c->name, c->topic_setter, c->topic ? c->topic : "", c->topic_time); if (ircd->join2set) { - if (whosends(ci) == findbot(s_ChanServ)) { - ircdproto->SendPart(findbot(s_ChanServ), c->name, NULL); + if (whosends(ci) == findbot(Config.s_ChanServ)) { + ircdproto->SendPart(findbot(Config.s_ChanServ), c->name, NULL); } } } @@ -1380,7 +1380,7 @@ int check_topiclock(Channel * c, time_t topic_time) } else { c->topic = NULL; /* Bot assigned & Symbiosis ON?, the bot will set the topic - doc */ - /* Altough whosends() also checks for BSMinUsers -GD */ + /* Altough whosends() also checks for Config.BSMinUsers -GD */ strscpy(c->topic_setter, whosends(ci)->nick, NICKMAX); } @@ -1401,9 +1401,9 @@ int check_topiclock(Channel * c, time_t topic_time) } if (ircd->join2set) { - if (whosends(ci) == findbot(s_ChanServ)) { - ircdproto->SendJoin(findbot(s_ChanServ), c->name, c->creation_time); - ircdproto->SendMode(NULL, c->name, "+o %s", s_ChanServ); + if (whosends(ci) == findbot(Config.s_ChanServ)) { + ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name, c->creation_time); + ircdproto->SendMode(NULL, c->name, "+o %s", Config.s_ChanServ); } } @@ -1411,8 +1411,8 @@ int check_topiclock(Channel * c, time_t topic_time) c->topic ? c->topic : "", c->topic_time); if (ircd->join2set) { - if (whosends(ci) == findbot(s_ChanServ)) { - ircdproto->SendPart(findbot(s_ChanServ), c->ci->name, NULL); + if (whosends(ci) == findbot(Config.s_ChanServ)) { + ircdproto->SendPart(findbot(Config.s_ChanServ), c->ci->name, NULL); } } return 1; @@ -1428,13 +1428,13 @@ void expire_chans() int i; time_t now = time(NULL); - if (!CSExpire) + if (!Config.CSExpire) return; for (i = 0; i < 256; i++) { for (ci = chanlists[i]; ci; ci = next) { next = ci->next; - if (!ci->c && now - ci->last_used >= CSExpire && !ci->HasFlag(CI_FORBIDDEN) && !ci->HasFlag(CI_NO_EXPIRE) && !ci->HasFlag(CI_SUSPENDED)) + if (!ci->c && now - ci->last_used >= Config.CSExpire && !ci->HasFlag(CI_FORBIDDEN) && !ci->HasFlag(CI_NO_EXPIRE) && !ci->HasFlag(CI_SUSPENDED)) { EventReturn MOD_RESULT; FOREACH_RESULT(I_OnPreChanExpire, OnPreChanExpire(ci)); @@ -1469,18 +1469,18 @@ void cs_remove_nick(const NickCore * nc) if (ci->founder == nc) { if (ci->successor) { NickCore *nc2 = ci->successor; - if (!nc2->IsServicesOper() && CSMaxReg && nc2->channelcount >= CSMaxReg) { - alog("%s: Successor (%s) of %s owns too many channels, " "deleting channel", s_ChanServ, nc2->display, ci->name); + if (!nc2->IsServicesOper() && Config.CSMaxReg && nc2->channelcount >= Config.CSMaxReg) { + alog("%s: Successor (%s) of %s owns too many channels, " "deleting channel", Config.s_ChanServ, nc2->display, ci->name); delete ci; continue; } else { - alog("%s: Transferring foundership of %s from deleted " "nick %s to successor %s", s_ChanServ, ci->name, nc->display, nc2->display); + alog("%s: Transferring foundership of %s from deleted " "nick %s to successor %s", Config.s_ChanServ, ci->name, nc->display, nc2->display); ci->founder = nc2; ci->successor = NULL; nc2->channelcount++; } } else { - alog("%s: Deleting channel %s owned by deleted nick %s", s_ChanServ, ci->name, nc->display); + alog("%s: Deleting channel %s owned by deleted nick %s", Config.s_ChanServ, ci->name, nc->display); if ((ModeManager::FindChannelModeByName(CMODE_REGISTERED))) { @@ -1898,7 +1898,7 @@ void stick_mask(ChannelInfo * ci, AutoKick * akick) av[0] = "+b"; av[1] = akick->mask.c_str(); ircdproto->SendMode(whosends(ci), ci->c->name, "+b %s", akick->mask.c_str()); - chan_set_modes(s_ChanServ, ci->c, 2, av, 1); + chan_set_modes(Config.s_ChanServ, ci->c, 2, av, 1); } /* Ban the stuck mask in a safe manner. */ @@ -1920,6 +1920,6 @@ void stick_all(ChannelInfo * ci) av[0] = "+b"; av[1] = akick->mask.c_str(); ircdproto->SendMode(whosends(ci), ci->c->name, "+b %s", akick->mask.c_str()); - chan_set_modes(s_ChanServ, ci->c, 2, av, 1); + chan_set_modes(Config.s_ChanServ, ci->c, 2, av, 1); } } diff --git a/src/commands.c b/src/commands.c index 22e9fb8de..ad6a154d6 100644 --- a/src/commands.c +++ b/src/commands.c @@ -70,7 +70,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * // Command requires registered users only if (!nick_identified(u)) { - notice_lang(service, u, NICK_IDENTIFY_REQUIRED, s_NickServ); + notice_lang(service, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ); alog("Access denied for unregistered user %s with service %s and command %s", u->nick, service, cmd); return; } diff --git a/src/config.c b/src/config.c index e531dafa1..e7e821f0a 100644 --- a/src/config.c +++ b/src/config.c @@ -18,242 +18,26 @@ /*************************************************************************/ -ServerConfig serverConfig; - -/* Configurable variables: */ - -char *IRCDModule; - -std::list Uplinks; - -char *LocalHost; -unsigned LocalPort; - -char *ServerName; -char *ServerDesc; -char *ServiceUser; -char *ServiceHost; - -char *HelpChannel; -char *LogChannel; -char *NetworkName; -unsigned NickLen; - -char *s_NickServ; -char *s_ChanServ; -char *s_MemoServ; -char *s_BotServ; -char *s_OperServ; -char *s_GlobalNoticer; -char *desc_NickServ; -char *desc_ChanServ; -char *desc_MemoServ; -char *desc_BotServ; -char *desc_OperServ; -char *desc_GlobalNoticer; - -char *HostDBName; /* Name of HostServ DB File */ -char *s_HostServ; /* HostServ Name */ -char *desc_HostServ; /* HostServ Description */ - -char *PIDFilename; -char *MOTDFilename; -char *NickDBName; -char *PreNickDBName; -char *ChanDBName; -char *BotDBName; -char *OperDBName; -char *NewsDBName; - -bool NoBackupOkay; -bool StrictPasswords; -unsigned BadPassLimit; -time_t BadPassTimeout; -time_t UpdateTimeout; -time_t ExpireTimeout; -time_t ReadTimeout; -time_t WarningTimeout; -time_t TimeoutCheck; -int KeepLogs; -int KeepBackups; -bool ForceForbidReason; -bool UsePrivmsg; -bool UseStrictPrivMsg; -bool DumpCore; -bool LogUsers; -unsigned NickRegDelay; -unsigned NewsCount; - -bool UseMail; -char *SendMailPath; -char *SendFrom; -bool RestrictMail; -time_t MailDelay; -bool DontQuoteAddresses; - -static std::string NSDefaults; -char *NSGuestNickPrefix; -bool NSAllowKillImmed; -bool NSNoGroupChange; -Flags NSDefFlags; -unsigned NSDefLanguage; -time_t NSRegDelay; -time_t NSResendDelay; -time_t NSExpire; -time_t NSRExpire; -bool NSForceEmail; -int NSMaxAliases; -unsigned NSAccessMax; -char *NSEnforcerUser; -char *NSEnforcerHost; -static char *temp_nsuserhost; -time_t NSReleaseTimeout; -bool NSListOpersOnly; -unsigned NSListMax; -bool NSSecureAdmins; -bool NSStrictPrivileges; -bool NSEmailReg; -bool NSModeOnID; -bool NSAddAccessOnReg; - -static std::string CSDefaults; -Flags CSDefFlags; -unsigned CSMaxReg; -time_t CSExpire; -int CSDefBantype; -unsigned CSAccessMax; -unsigned CSAutokickMax; -char *CSAutokickReason; -time_t CSInhabit; -bool CSListOpersOnly; -unsigned CSListMax; -bool CSOpersOnly; - -unsigned MSMaxMemos; -time_t MSSendDelay; -bool MSNotifyAll; -unsigned MSMemoReceipt; - -static std::string BSDefaults; -Flags BSDefFlags; -time_t BSKeepData; -unsigned BSMinUsers; -unsigned BSBadWordsMax; -bool BSSmartJoin; -bool BSGentleBWReason; -bool BSCaseSensitive; -char *BSFantasyCharacter; - -bool HideStatsO; -bool GlobalOnCycle; -bool AnonymousGlobal; -bool RestrictOperNicks; -char *GlobalOnCycleMessage; -char *GlobalOnCycleUP; -bool SuperAdmin; -bool LogBot; -bool LogMaxUsers; -bool DisableRaw; -time_t AutokillExpiry; -time_t ChankillExpiry; -time_t SGLineExpiry; -time_t SQLineExpiry; -time_t SZLineExpiry; -bool AkillOnAdd; -bool KillonSGline; -bool KillonSQline; -static std::string OSNotifications; -bool WallOper; -bool WallBadOS; -bool WallOSGlobal; -bool WallOSMode; -bool WallOSClearmodes; -bool WallOSKick; -bool WallOSAkill; -bool WallOSSGLine; -bool WallOSSQLine; -bool WallOSSZLine; -bool WallOSNoOp; -bool WallOSJupe; -bool WallAkillExpire; -bool WallSGLineExpire; -bool WallSQLineExpire; -bool WallSZLineExpire; -bool WallExceptionExpire; -bool WallDrop; -bool WallForbid; -bool WallGetpass; -bool WallSetpass; -bool AddAkiller; - -bool LimitSessions; -unsigned DefSessionLimit; -time_t ExceptionExpiry; -int MaxSessionKill; -unsigned MaxSessionLimit; -time_t SessionAutoKillExpiry; -char *ExceptionDBName; -char *SessionLimitExceeded; -char *SessionLimitDetailsLoc; - -bool OSOpersOnly; +ServerConfig Config; static std::string Modules; -std::list ModulesAutoLoad; - -/** - * Core Module Stuff - **/ static std::string EncModules; -std::list EncModuleList; - static std::string HostCoreModules; -std::list HostServCoreModules; - static std::string MemoCoreModules; -std::list MemoServCoreModules; - static std::string BotCoreModules; -std::list BotServCoreModules; - static std::string OperCoreModules; -std::list OperServCoreModules; - static std::string NickCoreModules; -std::list NickServCoreModules; - static std::string ChanCoreModules; -std::list ChanServCoreModules; - -int DefConLevel; static std::string DefCon1; static std::string DefCon2; static std::string DefCon3; static std::string DefCon4; -time_t DefConTimeOut; -int DefConSessionLimit; -time_t DefConAKILL; -char *DefConChanModes; -bool GlobalOnDefcon; -bool GlobalOnDefconMore; -char *DefConOffMessage; -char *DefconMessage; -char *DefConAkillReason; - -long unsigned int UserKey1; -long unsigned int UserKey2; -long unsigned int UserKey3; - -char *Numeric; static char *UlineServers; -char **Ulines; -int NumUlines; - -std::list MyOperTypes; -/* Pair of nick/opertype lookup. It's stored like this currently, because config is parsed before db load. - * XXX: It would be nice to not need this. - */ -std::list > svsopers_in_config; +static std::string OSNotifications; +static std::string BSDefaults; +static std::string CSDefaults; +static char *temp_nsuserhost; +static std::string NSDefaults; /*************************************************************************/ @@ -394,7 +178,7 @@ bool ValidateNotZero(ServerConfig *, const char *tag, const char *value, ValueIt bool ValidateEmailReg(ServerConfig *, const char *tag, const char *value, ValueItem &data) { - if (NSEmailReg) + if (Config.NSEmailReg) { if (std::string(value) == "prenickdatabase") { @@ -454,7 +238,7 @@ bool ValidateBantype(ServerConfig *, const char *, const char *, ValueItem &data bool ValidateBotServ(ServerConfig *, const char *tag, const char *value, ValueItem &data) { - if (s_BotServ) + if (Config.s_BotServ) { if (std::string(value) == "description" || std::string(value) == "database") { @@ -472,7 +256,7 @@ bool ValidateBotServ(ServerConfig *, const char *tag, const char *value, ValueIt bool ValidateHostServ(ServerConfig *, const char *tag, const char *value, ValueItem &data) { - if (s_HostServ) + if (Config.s_HostServ) { if (std::string(value) == "description" || std::string(value) == "database") { @@ -485,7 +269,7 @@ bool ValidateHostServ(ServerConfig *, const char *tag, const char *value, ValueI bool ValidateLimitSessions(ServerConfig *, const char *tag, const char *value, ValueItem &data) { - if (LimitSessions) + if (Config.LimitSessions) { if (std::string(value) == "maxsessionlimit" || std::string(value) == "exceptionexpiry") { @@ -506,14 +290,14 @@ bool ValidateDefCon(ServerConfig *, const char *tag, const char *value, ValueIte if (level > 5) throw ConfigException("The value for