diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/actions.cpp | 8 | ||||
| -rw-r--r-- | src/bots.cpp | 20 | ||||
| -rw-r--r-- | src/botserv.cpp | 32 | ||||
| -rw-r--r-- | src/channels.cpp | 18 | ||||
| -rw-r--r-- | src/chanserv.cpp | 28 | ||||
| -rw-r--r-- | src/commands.cpp | 4 | ||||
| -rw-r--r-- | src/config.cpp | 1183 | ||||
| -rw-r--r-- | src/configreader.cpp | 40 | ||||
| -rw-r--r-- | src/hostserv.cpp | 8 | ||||
| -rw-r--r-- | src/init.cpp | 59 | ||||
| -rw-r--r-- | src/language.cpp | 14 | ||||
| -rw-r--r-- | src/log.cpp | 8 | ||||
| -rw-r--r-- | src/mail.cpp | 16 | ||||
| -rw-r--r-- | src/main.cpp | 38 | ||||
| -rw-r--r-- | src/memoserv.cpp | 50 | ||||
| -rw-r--r-- | src/messages.cpp | 92 | ||||
| -rw-r--r-- | src/misc.cpp | 26 | ||||
| -rw-r--r-- | src/modes.cpp | 12 | ||||
| -rw-r--r-- | src/modulemanager.cpp | 8 | ||||
| -rw-r--r-- | src/modules.cpp | 12 | ||||
| -rw-r--r-- | src/nickalias.cpp | 8 | ||||
| -rw-r--r-- | src/nickcore.cpp | 4 | ||||
| -rw-r--r-- | src/nickserv.cpp | 24 | ||||
| -rw-r--r-- | src/operserv.cpp | 42 | ||||
| -rw-r--r-- | src/protocol.cpp | 12 | ||||
| -rw-r--r-- | src/regchannel.cpp | 10 | ||||
| -rw-r--r-- | src/send.cpp | 2 | ||||
| -rw-r--r-- | src/servers.cpp | 8 | ||||
| -rw-r--r-- | src/sessions.cpp | 26 | ||||
| -rw-r--r-- | src/users.cpp | 24 |
30 files changed, 873 insertions, 963 deletions
diff --git a/src/actions.cpp b/src/actions.cpp index 17c0a2898..bdc5a041d 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -23,14 +23,14 @@ bool bad_password(User *u) { time_t now = time(NULL); - if (!u || !Config.BadPassLimit) + if (!u || !Config->BadPassLimit) return false; - if (Config.BadPassTimeout > 0 && u->invalid_pw_time > 0 && u->invalid_pw_time < now - Config.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 >= Config.BadPassLimit) + if (u->invalid_pw_count >= Config->BadPassLimit) { kill_user("", u->nick, "Too many invalid passwords"); return true; @@ -53,7 +53,7 @@ void kill_user(const Anope::string &source, const Anope::string &user, const Ano if (user.empty()) return; - Anope::string real_source = source.empty() ? Config.ServerName : source; + Anope::string real_source = source.empty() ? Config->ServerName : source; Anope::string buf = real_source + " (" + reason + ")"; diff --git a/src/bots.cpp b/src/bots.cpp index c07b358da..cb7a370c1 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -30,19 +30,19 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A this->chancount = 0; this->lastmsg = this->created = time(NULL); - if (!Config.s_ChanServ.empty() && nnick.equals_ci(Config.s_ChanServ)) + if (!Config->s_ChanServ.empty() && nnick.equals_ci(Config->s_ChanServ)) ChanServ = this; - else if (!Config.s_BotServ.empty() && nnick.equals_ci(Config.s_BotServ)) + else if (!Config->s_BotServ.empty() && nnick.equals_ci(Config->s_BotServ)) BotServ = this; - else if (!Config.s_HostServ.empty() && nnick.equals_ci(Config.s_HostServ)) + else if (!Config->s_HostServ.empty() && nnick.equals_ci(Config->s_HostServ)) HostServ = this; - else if (!Config.s_OperServ.empty() && nnick.equals_ci(Config.s_OperServ)) + else if (!Config->s_OperServ.empty() && nnick.equals_ci(Config->s_OperServ)) OperServ = this; - else if (!Config.s_MemoServ.empty() && nnick.equals_ci(Config.s_MemoServ)) + else if (!Config->s_MemoServ.empty() && nnick.equals_ci(Config->s_MemoServ)) MemoServ = this; - else if (!Config.s_NickServ.empty() && nnick.equals_ci(Config.s_NickServ)) + else if (!Config->s_NickServ.empty() && nnick.equals_ci(Config->s_NickServ)) NickServ = this; - else if (!Config.s_GlobalNoticer.empty() && nnick.equals_ci(Config.s_GlobalNoticer)) + else if (!Config->s_GlobalNoticer.empty() && nnick.equals_ci(Config->s_GlobalNoticer)) Global = this; BotListByNick[this->nick] = this; @@ -94,7 +94,7 @@ void BotInfo::RejoinAll() { ChannelInfo *ci = it->second; - if (ci->bi == this && ci->c && ci->c->users.size() >= Config.BSMinUsers) + if (ci->bi == this && ci->c && ci->c->users.size() >= Config->BSMinUsers) this->Join(ci->c); } } @@ -112,7 +112,7 @@ void BotInfo::Assign(User *u, ChannelInfo *ci) ++this->chancount; ci->bi = this; - if (ci->c && ci->c->users.size() >= Config.BSMinUsers) + if (ci->c && ci->c->users.size() >= Config->BSMinUsers) this->Join(ci->c); } @@ -138,7 +138,7 @@ void BotInfo::UnAssign(User *u, ChannelInfo *ci) void BotInfo::Join(Channel *c) { - if (Config.BSSmartJoin) + if (Config->BSSmartJoin) { /* We check for bans */ if (c->bans && c->bans->count) diff --git a/src/botserv.cpp b/src/botserv.cpp index 381223681..ee6f08f29 100644 --- a/src/botserv.cpp +++ b/src/botserv.cpp @@ -26,7 +26,7 @@ E void moduleAddBotServCmds(); void moduleAddBotServCmds() { - ModuleManager::LoadModuleList(Config.BotServCoreModules); + ModuleManager::LoadModuleList(Config->BotServCoreModules); } /*************************************************************************/ @@ -61,7 +61,7 @@ void get_botserv_stats(long *nrec, long *memuse) void bs_init() { - if (!Config.s_BotServ.empty()) + if (!Config->s_BotServ.empty()) moduleAddBotServCmds(); } @@ -198,25 +198,25 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) { BadWord *bw = ci->GetBadWord(i); - if (bw->type == BW_ANY && ((Config.BSCaseSensitive && nbuf.find(bw->word) != Anope::string::npos) || (!Config.BSCaseSensitive && nbuf.find_ci(bw->word) != Anope::string::npos))) + if (bw->type == BW_ANY && ((Config->BSCaseSensitive && nbuf.find(bw->word) != Anope::string::npos) || (!Config->BSCaseSensitive && nbuf.find_ci(bw->word) != Anope::string::npos))) mustkick = true; else if (bw->type == BW_SINGLE) { size_t len = bw->word.length(); - if ((Config.BSCaseSensitive && bw->word.equals_cs(nbuf)) || (!Config.BSCaseSensitive && bw->word.equals_ci(nbuf))) + if ((Config->BSCaseSensitive && bw->word.equals_cs(nbuf)) || (!Config->BSCaseSensitive && bw->word.equals_ci(nbuf))) mustkick = true; - else if (nbuf.find(' ') == len && ((Config.BSCaseSensitive && bw->word.equals_cs(nbuf)) || (!Config.BSCaseSensitive && bw->word.equals_ci(nbuf)))) + else if (nbuf.find(' ') == len && ((Config->BSCaseSensitive && bw->word.equals_cs(nbuf)) || (!Config->BSCaseSensitive && bw->word.equals_ci(nbuf)))) mustkick = true; else { - if (nbuf.rfind(' ') == nbuf.length() - len - 1 && ((Config.BSCaseSensitive && nbuf.find(bw->word) == nbuf.length() - len) || (!Config.BSCaseSensitive && nbuf.find_ci(bw->word) == nbuf.length() - len))) + if (nbuf.rfind(' ') == nbuf.length() - len - 1 && ((Config->BSCaseSensitive && nbuf.find(bw->word) == nbuf.length() - len) || (!Config->BSCaseSensitive && nbuf.find_ci(bw->word) == nbuf.length() - len))) mustkick = true; else { Anope::string wordbuf = " " + bw->word + " "; - if ((Config.BSCaseSensitive && nbuf.find(wordbuf) != Anope::string::npos) || (!Config.BSCaseSensitive && nbuf.find_ci(wordbuf) != Anope::string::npos)) + if ((Config->BSCaseSensitive && nbuf.find(wordbuf) != Anope::string::npos) || (!Config->BSCaseSensitive && nbuf.find_ci(wordbuf) != Anope::string::npos)) mustkick = true; } } @@ -225,13 +225,13 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) { size_t len = bw->word.length(); - if ((Config.BSCaseSensitive && nbuf.substr(0, len).equals_cs(bw->word)) || (!Config.BSCaseSensitive && nbuf.substr(0, len).equals_ci(bw->word))) + if ((Config->BSCaseSensitive && nbuf.substr(0, len).equals_cs(bw->word)) || (!Config->BSCaseSensitive && nbuf.substr(0, len).equals_ci(bw->word))) mustkick = true; else { Anope::string wordbuf = " " + bw->word; - if ((Config.BSCaseSensitive && nbuf.find(wordbuf) != Anope::string::npos) || (!Config.BSCaseSensitive && nbuf.find_ci(wordbuf) != Anope::string::npos)) + if ((Config->BSCaseSensitive && nbuf.find(wordbuf) != Anope::string::npos) || (!Config->BSCaseSensitive && nbuf.find_ci(wordbuf) != Anope::string::npos)) mustkick = true; } } @@ -239,13 +239,13 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) { size_t len = bw->word.length(); - if ((Config.BSCaseSensitive && nbuf.substr(nbuf.length() - len).equals_cs(bw->word)) || (!Config.BSCaseSensitive && nbuf.substr(nbuf.length() - len).equals_ci(bw->word))) + if ((Config->BSCaseSensitive && nbuf.substr(nbuf.length() - len).equals_cs(bw->word)) || (!Config->BSCaseSensitive && nbuf.substr(nbuf.length() - len).equals_ci(bw->word))) mustkick = true; else { Anope::string wordbuf = bw->word + " "; - if ((Config.BSCaseSensitive && nbuf.find(wordbuf) != Anope::string::npos) || (!Config.BSCaseSensitive && nbuf.find_ci(wordbuf) != Anope::string::npos)) + if ((Config->BSCaseSensitive && nbuf.find(wordbuf) != Anope::string::npos) || (!Config->BSCaseSensitive && nbuf.find_ci(wordbuf) != Anope::string::npos)) mustkick = true; } } @@ -253,7 +253,7 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) if (mustkick) { check_ban(ci, u, TTB_BADWORDS); - if (Config.BSGentleBWReason) + if (Config->BSGentleBWReason) bot_kick(ci, u, BOT_REASON_BADWORD_GENTLE); else bot_kick(ci, u, BOT_REASON_BADWORD, bw->word.c_str()); @@ -320,12 +320,12 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) return; /* Fantaisist commands */ - if (ci->botflags.HasFlag(BS_FANTASY) && buf[0] == Config.BSFantasyCharacter[0] && !was_action) + if (ci->botflags.HasFlag(BS_FANTASY) && buf[0] == Config->BSFantasyCharacter[0] && !was_action) { spacesepstream sep(buf); Anope::string token; - if (sep.GetToken(token) && token[0] == Config.BSFantasyCharacter[0]) + if (sep.GetToken(token) && token[0] == Config->BSFantasyCharacter[0]) { /* Strip off the fantasy character */ token.erase(token.begin()); @@ -396,7 +396,7 @@ static BanData *get_ban_data(Channel *c, User *u) for (bd = c->bd; bd; bd = next) { - if (now - bd->last_use > Config.BSKeepData) + if (now - bd->last_use > Config->BSKeepData) { if (bd->next) bd->next->prev = bd->prev; @@ -452,7 +452,7 @@ static UserData *get_user_data(Channel *c, User *u) time_t now = time(NULL); /* Checks whether data is obsolete */ - if (now - uc->ud.last_use > Config.BSKeepData) + if (now - uc->ud.last_use > Config->BSKeepData) { /* We should not free and realloc, but reset to 0 instead. */ diff --git a/src/channels.cpp b/src/channels.cpp index 9392b70cd..a10a4e675 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -109,9 +109,9 @@ void Channel::JoinUser(User *user) if (this->ci && check_access(user, this->ci, CA_MEMO) && this->ci->memos.memos.size() > 0) { if (this->ci->memos.memos.size() == 1) - notice_lang(Config.s_MemoServ, user, MEMO_X_ONE_NOTICE, this->ci->memos.memos.size(), this->ci->name.c_str()); + notice_lang(Config->s_MemoServ, user, MEMO_X_ONE_NOTICE, this->ci->memos.memos.size(), this->ci->name.c_str()); else - notice_lang(Config.s_MemoServ, user, MEMO_X_MANY_NOTICE, this->ci->memos.memos.size(), this->ci->name.c_str()); + notice_lang(Config->s_MemoServ, user, MEMO_X_MANY_NOTICE, this->ci->memos.memos.size(), this->ci->name.c_str()); } /* Added channelname to entrymsg - 30.03.2004, Certus */ /* Also, don't send the entrymsg when bursting -GD */ @@ -119,7 +119,7 @@ void Channel::JoinUser(User *user) user->SendMessage(whosends(this->ci)->nick, "[%s] %s", this->name.c_str(), this->ci->entry_message.c_str()); } - if (!Config.s_BotServ.empty() && this->ci && this->ci->bi) + if (!Config->s_BotServ.empty() && this->ci && this->ci->bi) { /** * We let the bot join even if it was an ignored user, as if we don't, @@ -129,7 +129,7 @@ void Channel::JoinUser(User *user) * But don't join the bot if the channel is persistant - Adam * But join persistant channels when syncing with our uplink- DP **/ - if ((!Me->IsSynced() || !this->ci->HasFlag(CI_PERSIST)) && this->users.size() >= Config.BSMinUsers && !this->FindUser(this->ci->bi)) + if ((!Me->IsSynced() || !this->ci->HasFlag(CI_PERSIST)) && this->users.size() >= Config->BSMinUsers && !this->FindUser(this->ci->bi)) this->ci->bi->Join(this); /* Only display the greet if the main uplink we're connected * to has synced, or we'll get greet-floods when the net @@ -193,7 +193,7 @@ void Channel::DeleteUser(User *user) /* check for BSMinUsers and part the BotServ bot from the channel * Use <= because the bot is included in this->users.size() */ - if (!Config.s_BotServ.empty() && this->ci && this->ci->bi && this->users.size() <= Config.BSMinUsers && this->FindUser(this->ci->bi)) + if (!Config->s_BotServ.empty() && this->ci && this->ci->bi && this->users.size() <= Config->BSMinUsers && this->FindUser(this->ci->bi)) this->ci->bi->Part(this->ci->c); else if (this->users.empty()) delete this; @@ -278,7 +278,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const Anope::string ¶m, bool } BotInfo *bi = NULL; - if (!Config.s_BotServ.empty()) + if (!Config->s_BotServ.empty()) bi = findbot(param); User *u = bi ? bi : finduser(param); @@ -404,7 +404,7 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const Anope::string ¶m, bo } BotInfo *bi = NULL; - if (!Config.s_BotServ.empty()) + if (!Config->s_BotServ.empty()) bi = findbot(param); User *u = bi ? bi : finduser(param); @@ -460,7 +460,7 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const Anope::string ¶m, bo if (ci) { ci->UnsetFlag(CI_PERSIST); - if (!Config.s_BotServ.empty() && ci->bi && this->FindUser(ci->bi)) + if (!Config->s_BotServ.empty() && ci->bi && this->FindUser(ci->bi)) this->ci->bi->Part(this); } } @@ -865,7 +865,7 @@ void ChanSetInternalModes(Channel *c, int ac, const char **av) void Channel::KickInternal(const Anope::string &source, const Anope::string &nick, const Anope::string &reason) { BotInfo *bi = NULL; - if (!Config.s_BotServ.empty() && this->ci) + if (!Config->s_BotServ.empty() && this->ci) bi = findbot(nick); User *user = bi ? bi : finduser(nick); if (!user) diff --git a/src/chanserv.cpp b/src/chanserv.cpp index b0d6f4b16..03760b9b6 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -110,7 +110,7 @@ int levelinfo_maxwidth = 0; void moduleAddChanServCmds() { - ModuleManager::LoadModuleList(Config.ChanServCoreModules); + ModuleManager::LoadModuleList(Config->ChanServCoreModules); } /*************************************************************************/ @@ -263,7 +263,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.c_str()); - Alog() << Config.s_ChanServ << ": Bouncy modes on channel " << c->name; + Alog() << Config->s_ChanServ << ": Bouncy modes on channel " << c->name; c->bouncy_modes = 1; return; } @@ -355,7 +355,7 @@ int check_valid_admin(User *user, Channel *chan, int servermode) if (servermode && !check_access(user, chan->ci, CA_AUTOPROTECT)) { - notice_lang(Config.s_ChanServ, user, CHAN_IS_REGISTERED, Config.s_ChanServ.c_str()); + notice_lang(Config->s_ChanServ, user, CHAN_IS_REGISTERED, Config->s_ChanServ.c_str()); chan->RemoveMode(NULL, CMODE_PROTECT, user->nick); return 0; } @@ -391,7 +391,7 @@ int check_valid_op(User *user, Channel *chan, int servermode) if (servermode && !check_access(user, chan->ci, CA_AUTOOP)) { - notice_lang(Config.s_ChanServ, user, CHAN_IS_REGISTERED, Config.s_ChanServ.c_str()); + notice_lang(Config->s_ChanServ, user, CHAN_IS_REGISTERED, Config->s_ChanServ.c_str()); if (owner) chan->RemoveMode(NULL, CMODE_OWNER, user->nick); @@ -479,7 +479,7 @@ void restore_topic(const Anope::string &chan) if (ircd->join2set && whosends(ci) == ChanServ) { ChanServ->Join(chan); - c->SetMode(NULL, CMODE_OP, Config.s_ChanServ); + c->SetMode(NULL, CMODE_OP, Config->s_ChanServ); } ircdproto->SendTopic(whosends(ci), c, c->topic_setter, c->topic); if (ircd->join2set && whosends(ci) == ChanServ) @@ -513,7 +513,7 @@ int check_topiclock(Channel *c, time_t topic_time) { c->topic.clear(); /* Bot assigned & Symbiosis ON?, the bot will set the topic - doc */ - /* Altough whosends() also checks for Config.BSMinUsers -GD */ + /* Altough whosends() also checks for Config->BSMinUsers -GD */ c->topic_setter = whosends(ci)->nick; } @@ -538,7 +538,7 @@ int check_topiclock(Channel *c, time_t topic_time) if (ircd->join2set && whosends(ci) == ChanServ) { ChanServ->Join(c); - c->SetMode(NULL, CMODE_OP, Config.s_ChanServ); + c->SetMode(NULL, CMODE_OP, Config->s_ChanServ); } ircdproto->SendTopic(whosends(ci), c, c->topic_setter, c->topic); @@ -554,7 +554,7 @@ int check_topiclock(Channel *c, time_t topic_time) void expire_chans() { - if (!Config.CSExpire) + if (!Config->CSExpire) return; time_t now = time(NULL); @@ -564,7 +564,7 @@ void expire_chans() ChannelInfo *ci = it->second; ++it; - if (!ci->c && now - ci->last_used >= Config.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)); @@ -597,15 +597,15 @@ void cs_remove_nick(const NickCore *nc) if (ci->successor) { NickCore *nc2 = ci->successor; - if (!nc2->IsServicesOper() && Config.CSMaxReg && nc2->channelcount >= Config.CSMaxReg) + if (!nc2->IsServicesOper() && Config->CSMaxReg && nc2->channelcount >= Config->CSMaxReg) { - Alog() << Config.s_ChanServ << ": Successor (" << nc2->display << " ) of " << ci->name << " owns too many channels, deleting channel", + Alog() << Config->s_ChanServ << ": Successor (" << nc2->display << " ) of " << ci->name << " owns too many channels, deleting channel", delete ci; continue; } else { - Alog() << Config.s_ChanServ << ": Transferring foundership of " << ci->name << " from deleted nick " << nc->display << " to successor " << nc2->display; + Alog() << Config->s_ChanServ << ": Transferring foundership of " << ci->name << " from deleted nick " << nc->display << " to successor " << nc2->display; ci->founder = nc2; ci->successor = NULL; ++nc2->channelcount; @@ -613,7 +613,7 @@ void cs_remove_nick(const NickCore *nc) } else { - Alog() << Config.s_ChanServ << ": Deleting channel " << ci->name << "owned by deleted nick " << nc->display; + Alog() << Config->s_ChanServ << ": Deleting channel " << ci->name << "owned by deleted nick " << nc->display; if (ModeManager::FindChannelModeByName(CMODE_REGISTERED)) { @@ -963,7 +963,7 @@ void stick_all(ChannelInfo *ci) } } -ChanServTimer::ChanServTimer(Channel *chan) : Timer(Config.CSInhabit), c(chan) +ChanServTimer::ChanServTimer(Channel *chan) : Timer(Config->CSInhabit), c(chan) { if (c->ci) c->ci->SetFlag(CI_INHABIT); diff --git a/src/commands.cpp b/src/commands.cpp index 2647ea952..26ca76e65 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -57,7 +57,7 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, // Command requires registered users only if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->IsIdentified()) { - notice_lang(bi->nick, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ.c_str()); + notice_lang(bi->nick, u, NICK_IDENTIFY_REQUIRED, Config->s_NickServ.c_str()); Alog() << "Access denied for unregistered user " << u->nick << " with service " << bi->nick << " and command " << command; return; } @@ -164,7 +164,7 @@ void mod_help_cmd(BotInfo *bi, User *u, const Anope::string &cmd) Anope::string subcommand = tokens.StreamEnd() ? "" : tokens.GetRemaining(); - if (!c || (Config.HidePrivilegedCommands && !c->permission.empty() && (!u->Account() || !u->Account()->HasCommand(c->permission))) || !c->OnHelp(u, subcommand)) + if (!c || (Config->HidePrivilegedCommands && !c->permission.empty() && (!u->Account() || !u->Account()->HasCommand(c->permission))) || !c->OnHelp(u, subcommand)) notice_lang(bi->nick, u, NO_HELP_AVAILABLE, cmd.c_str()); else { diff --git a/src/config.cpp b/src/config.cpp index 7853196ad..0dfc9702e 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -16,7 +16,7 @@ /*************************************************************************/ Anope::string services_conf = "services.conf"; // Services configuration file name -ServerConfig Config; +ServerConfig *Config = NULL; static Anope::string Modules; static Anope::string EncModules; @@ -40,14 +40,319 @@ static Anope::string NSDefaults; /*************************************************************************/ -ServerConfig::ServerConfig() : include_stack(), errstr(""), newconfig(), config_data() +ServerConfig::ServerConfig() : errstr(""), config_data() { - this->ClearStack(); -} + this->Read(); -void ServerConfig::ClearStack() -{ - include_stack.clear(); + if (!temp_nsuserhost.empty()) + { + size_t at = temp_nsuserhost.find('@'); + if (at == Anope::string::npos) + { + this->NSEnforcerUser = temp_nsuserhost; + this->NSEnforcerHost = this->ServiceHost; + } + else + { + this->NSEnforcerUser = temp_nsuserhost.substr(0, at); + this->NSEnforcerHost = temp_nsuserhost.substr(at + 1); + } + } + + if (NSDefaults.empty()) + { + this->NSDefFlags.SetFlag(NI_SECURE); + this->NSDefFlags.SetFlag(NI_MEMO_SIGNON); + this->NSDefFlags.SetFlag(NI_MEMO_RECEIVE); + } + else if (!NSDefaults.equals_ci("none")) + { + spacesepstream options(NSDefaults); + Anope::string option; + while (options.GetToken(option)) + { + if (option.equals_ci("kill")) + this->NSDefFlags.SetFlag(NI_KILLPROTECT); + else if (option.equals_ci("killquick")) + this->NSDefFlags.SetFlag(NI_KILL_QUICK); + else if (option.equals_ci("secure")) + this->NSDefFlags.SetFlag(NI_SECURE); + else if (option.equals_ci("private")) + this->NSDefFlags.SetFlag(NI_PRIVATE); + else if (option.equals_ci("msg")) + { + if (!this->UsePrivmsg) + Alog() << "msg in <nickserv:defaults> can only be used when UsePrivmsg is set"; + else + this->NSDefFlags.SetFlag(NI_MSG); + } + else if (option.equals_ci("hideemail")) + this->NSDefFlags.SetFlag(NI_HIDE_EMAIL); + else if (option.equals_ci("hideusermask")) + this->NSDefFlags.SetFlag(NI_HIDE_MASK); + else if (option.equals_ci("hidequit")) + this->NSDefFlags.SetFlag(NI_HIDE_QUIT); + else if (option.equals_ci("memosignon")) + this->NSDefFlags.SetFlag(NI_MEMO_SIGNON); + else if (option.equals_ci("memoreceive")) + this->NSDefFlags.SetFlag(NI_MEMO_RECEIVE); + else if (option.equals_ci("autoop")) + this->NSDefFlags.SetFlag(NI_AUTOOP); + } + } + + if ((this->NSDefLanguage = langlist[this->NSDefLanguage]) < 0) + this->NSDefLanguage = DEF_LANGUAGE; + + if (this->CSDefBantype < 0 || this->CSDefBantype > 3) + { + throw ConfigException("Value of CSDefBantype must be between 0 and 3 included"); + } + + if (CSDefaults.empty()) + { + this->CSDefFlags.SetFlag(CI_KEEPTOPIC); + this->CSDefFlags.SetFlag(CI_SECURE); + this->CSDefFlags.SetFlag(CI_SECUREFOUNDER); + this->CSDefFlags.SetFlag(CI_SIGNKICK); + } + else if (!CSDefaults.equals_ci("none")) + { + spacesepstream options(CSDefaults); + Anope::string option; + while (options.GetToken(option)) + { + if (option.equals_ci("keeptopic")) + this->CSDefFlags.SetFlag(CI_KEEPTOPIC); + else if (option.equals_ci("topiclock")) + this->CSDefFlags.SetFlag(CI_TOPICLOCK); + else if (option.equals_ci("private")) + this->CSDefFlags.SetFlag(CI_PRIVATE); + else if (option.equals_ci("restricted")) + this->CSDefFlags.SetFlag(CI_RESTRICTED); + else if (option.equals_ci("secure")) + this->CSDefFlags.SetFlag(CI_SECURE); + else if (option.equals_ci("secureops")) + this->CSDefFlags.SetFlag(CI_SECUREOPS); + else if (option.equals_ci("securefounder")) + this->CSDefFlags.SetFlag(CI_SECUREFOUNDER); + else if (option.equals_ci("signkick")) + this->CSDefFlags.SetFlag(CI_SIGNKICK); + else if (option.equals_ci("signkicklevel")) + this->CSDefFlags.SetFlag(CI_SIGNKICK_LEVEL); + else if (option.equals_ci("opnotice")) + this->CSDefFlags.SetFlag(CI_OPNOTICE); + else if (option.equals_ci("xop")) + this->CSDefFlags.SetFlag(CI_XOP); + else if (option.equals_ci("peace")) + this->CSDefFlags.SetFlag(CI_PEACE); + else if (option.equals_ci("persist")) + this->CSDefFlags.SetFlag(CI_PERSIST); + } + } + + if (!BSDefaults.empty()) + { + spacesepstream options(BSDefaults); + Anope::string option; + while (options.GetToken(option)) + { + if (option.equals_ci("dontkickops")) + this->BSDefFlags.SetFlag(BS_DONTKICKOPS); + else if (option.equals_ci("dontkickvoices")) + this->BSDefFlags.SetFlag(BS_DONTKICKVOICES); + else if (option.equals_ci("greet")) + this->BSDefFlags.SetFlag(BS_GREET); + else if (option.equals_ci("fantasy")) + this->BSDefFlags.SetFlag(BS_FANTASY); + else if (option.equals_ci("symbiosis")) + this->BSDefFlags.SetFlag(BS_SYMBIOSIS); + } + } + + this->WallOper = this->WallBadOS = this->WallOSGlobal = this->WallOSMode = this->WallOSClearmodes = this->WallOSKick = this->WallOSAkill = this->WallOSSNLine = this->WallOSSQLine = + this->WallOSSZLine = this->WallOSNoOp = this->WallOSJupe = this->WallAkillExpire = this->WallSNLineExpire = this->WallSQLineExpire = this->WallSZLineExpire = this->WallExceptionExpire = + this->WallGetpass = this->WallSetpass = this->WallForbid = this->WallDrop = false; + if (!OSNotifications.empty()) + { + spacesepstream notifications(OSNotifications); + Anope::string notice; + while (notifications.GetToken(notice)) + { + if (notice.equals_ci("oper")) + this->WallOper = true; + else if (notice.equals_ci("bados")) + this->WallBadOS = true; + else if (notice.equals_ci("osglobal")) + this->WallOSGlobal = true; + else if (notice.equals_ci("osmode")) + this->WallOSMode = true; + else if (notice.equals_ci("osclearmodes")) + this->WallOSClearmodes = true; + else if (notice.equals_ci("oskick")) + this->WallOSKick = true; + else if (notice.equals_ci("osakill")) + this->WallOSAkill = true; + else if (notice.equals_ci("ossnline")) + this->WallOSSNLine = true; + else if (notice.equals_ci("ossqline")) + this->WallOSSQLine = true; + else if (notice.equals_ci("osszline")) + this->WallOSSZLine = true; + else if (notice.equals_ci("osnoop")) + this->WallOSNoOp = true; + else if (notice.equals_ci("osjupe")) + this->WallOSJupe = true; + else if (notice.equals_ci("akillexpire")) + this->WallAkillExpire = true; + else if (notice.equals_ci("snlineexpire")) + this->WallSNLineExpire = true; + else if (notice.equals_ci("sqlineexpire")) + this->WallSQLineExpire = true; + else if (notice.equals_ci("szlineexpire")) + this->WallSZLineExpire = true; + else if (notice.equals_ci("exceptionexpire")) + this->WallExceptionExpire = true; + else if (notice.equals_ci("getpass")) + this->WallGetpass = true; + else if (notice.equals_ci("setpass")) + this->WallSetpass = true; + else if (notice.equals_ci("forbid")) + this->WallForbid = true; + else if (notice.equals_ci("drop")) + this->WallDrop = true; + } + } + + /* Ulines */ + if (!UlineServers.empty()) + { + this->Ulines.clear(); + + spacesepstream ulines(UlineServers); + Anope::string uline; + while (ulines.GetToken(uline)) + this->Ulines.push_back(uline); + } + + /* Modules Autoload building... :P */ + this->ModulesAutoLoad = BuildStringList(Modules); + this->EncModuleList = BuildStringList(EncModules); + this->DBModuleList = BuildStringList(DBModules); + this->HostServCoreModules = BuildStringList(HostCoreModules); + this->MemoServCoreModules = BuildStringList(MemoCoreModules); + this->BotServCoreModules = BuildStringList(BotCoreModules); + this->OperServCoreModules = BuildStringList(OperCoreModules); + this->ChanServCoreModules = BuildStringList(ChanCoreModules); + this->NickServCoreModules = BuildStringList(NickCoreModules); + + if (this->LimitSessions) + { + if (this->MaxSessionKill && !this->SessionAutoKillExpiry) + this->SessionAutoKillExpiry = 1800; /* 30 minutes */ + } + + if (!this->s_BotServ.empty()) + { + if (this->BSFantasyCharacter.empty()) + this->BSFantasyCharacter = "!"; + if (this->BSFantasyCharacter.length() > 1) + printf("*** this->BSFantasyCharacter is more than 1 character long. Only the first\n*** character ('%c') will be used. The others will be ignored.\n", this->BSFantasyCharacter[0]); + } + + /* Check the user keys */ + if (this->UserKey1 == this->UserKey2 || this->UserKey1 == this->UserKey3 || this->UserKey3 == this->UserKey2) + Alog() << "Every UserKey must be different. It's for YOUR safety! Remember that!"; + + /** + * Check all DEFCON dependiencies... + **/ + if (this->DefConLevel) + { + /* Build DefCon's */ + DefCon.resize(6); + DefCon[5].reset(); + for (unsigned int level = 1; level < 5; ++level) + { + DefCon[level] = 0; + Anope::string *levelDefinition = NULL; + switch (level) + { + case 1: + levelDefinition = &DefCon1; + break; + case 2: + levelDefinition = &DefCon2; + break; + case 3: + levelDefinition = &DefCon3; + break; + case 4: + levelDefinition = &DefCon4; + } + spacesepstream operations(*levelDefinition); + Anope::string operation; + while (operations.GetToken(operation)) + { + if (operation.equals_ci("nonewchannels")) + AddDefCon(level, DEFCON_NO_NEW_CHANNELS); + else if (operation.equals_ci("nonewnicks")) + AddDefCon(level, DEFCON_NO_NEW_NICKS); + else if (operation.equals_ci("nomlockchanges")) + AddDefCon(level, DEFCON_NO_MLOCK_CHANGE); + else if ( |
