diff options
author | Adam <Adam@anope.org> | 2013-05-05 01:55:04 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-05-05 01:55:04 -0400 |
commit | 1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b (patch) | |
tree | 4486f0784bdf050fd7eb225c0cb9df352ce1f45a /modules/protocol | |
parent | 781defb7076ddfddf723ca08cd0a518b6657b64f (diff) |
Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in.
Diffstat (limited to 'modules/protocol')
-rw-r--r-- | modules/protocol/bahamut.cpp | 6 | ||||
-rw-r--r-- | modules/protocol/charybdis.cpp | 29 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 18 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 8 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 18 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 39 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 11 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 6 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 7 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 50 |
10 files changed, 105 insertions, 87 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 458602d3b..6aa097433 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -79,9 +79,9 @@ class BahamutIRCdProto : public IRCDProto } /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick) anope_override + void SendSVSHold(const Anope::string &nick, time_t time) anope_override { - UplinkSocket::Message(Me) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << " :Being held for registered user"; + UplinkSocket::Message(Me) << "SVSHOLD " << nick << " " << time << " :Being held for registered user"; } /* SVSHOLD - release */ @@ -265,7 +265,7 @@ class BahamutIRCdProto : public IRCDProto void SendConnect() anope_override { - UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " :TS"; + UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " :TS"; UplinkSocket::Message() << "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3"; SendServer(Me); /* diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp index 374111f44..1fb017fef 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/charybdis.cpp @@ -11,6 +11,7 @@ #include "module.h" +static bool sasl = true; static Anope::string UplinkSID; static ServiceReference<IRCDProto> ratbox("IRCDProto", "ratbox"); @@ -64,7 +65,7 @@ class CharybdisProto : public IRCDProto void SendConnect() anope_override { - UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " TS 6 :" << Me->GetSID(); + UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* * Received: CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN * KNOCK MLOCK QS RSFNC SAVE SERVICES TB UNKLN @@ -128,12 +129,12 @@ class CharybdisProto : public IRCDProto << " " << newnick << " " << when << " " << u->timestamp; } - void SendSVSHold(const Anope::string &nick) + void SendSVSHold(const Anope::string &nick, time_t delay) anope_override { - UplinkSocket::Message(Me) << "ENCAP * NICKDELAY " << Config->NSReleaseTimeout << " " << nick; + UplinkSocket::Message(Me) << "ENCAP * NICKDELAY " << delay << " " << nick; } - void SendSVSHoldDel(const Anope::string &nick) + void SendSVSHoldDel(const Anope::string &nick) anope_override { UplinkSocket::Message(Me) << "ENCAP * NICKDELAY 0 " << nick; } @@ -183,7 +184,7 @@ struct IRCDMessageEncap : IRCDMessage * * Charybdis only accepts messages from SASL agents; these must have umode +S */ - if (params[1] == "SASL" && Config->NSSASL && params.size() == 6) + if (params[1] == "SASL" && sasl && params.size() == 6) { class CharybdisSASLIdentifyRequest : public IdentifyRequest { @@ -298,7 +299,7 @@ struct IRCDMessageServer : IRCDMessage if (params[1] != "1") return; new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); - IRCD->SendPing(Config->ServerName, params[0]); + IRCD->SendPing(Me->GetName(), params[0]); } }; @@ -350,6 +351,8 @@ class ProtoCharybdis : public Module IRCDMessagePass message_pass; IRCDMessageServer message_server; + bool use_server_side_mlock; + void AddModes() { /* Add user modes */ @@ -403,7 +406,7 @@ class ProtoCharybdis : public Module { - Implementation i[] = { I_OnChannelCreate, I_OnMLock, I_OnUnMLock }; + Implementation i[] = { I_OnReload, I_OnChannelCreate, I_OnMLock, I_OnUnMLock }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); if (ModuleManager::LoadModule("ratbox", User::Find(creator)) != MOD_ERR_OK) @@ -422,9 +425,15 @@ class ProtoCharybdis : public Module ModuleManager::UnloadModule(m_ratbox, NULL); } + void OnReload(Configuration::Conf *conf) anope_override + { + use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); + sasl = conf->GetModule(this)->Get<bool>("sasl"); + } + void OnChannelCreate(Channel *c) anope_override { - if (c->ci && Config->UseServerSideMLock && Servers::Capab.count("MLOCK") > 0) + if (use_server_side_mlock && c->ci && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = c->ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; @@ -434,7 +443,7 @@ class ProtoCharybdis : public Module EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0 && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; @@ -446,7 +455,7 @@ class ProtoCharybdis : public Module EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0 && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index a00158bf8..1a50b89a6 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -160,7 +160,7 @@ class HybridProto : public IRCDProto void SendConnect() anope_override { - UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " TS 6 :" << Me->GetSID(); + UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* * As of October 13, 2012, ircd-hybrid-8 does support the following capabilities @@ -249,9 +249,9 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick << " " << when; } - void SendSVSHold(const Anope::string &nick) anope_override + void SendSVSHold(const Anope::string &nick, time_t t) anope_override { - XLine x(nick, OperServ->nick, Anope::CurTime + Config->NSReleaseTimeout, "Being held for registered user"); + XLine x(nick, OperServ->nick, Anope::CurTime + t, "Being held for registered user"); this->SendSQLine(NULL, &x); } @@ -357,7 +357,7 @@ struct IRCDMessageServer : IRCDMessage new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); - IRCD->SendPing(Config->ServerName, params[0]); + IRCD->SendPing(Me->GetName(), params[0]); } }; @@ -372,7 +372,7 @@ struct IRCDMessageSID : IRCDMessage unsigned int hops = params[1].is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[3], params[2]); - IRCD->SendPing(Config->ServerName, params[0]); + IRCD->SendPing(Me->GetName(), params[0]); } }; @@ -608,12 +608,8 @@ public: ModuleManager::Attach(I_OnUserNickChange, this); - if (Config->Numeric.empty()) - { - Anope::string numeric = Servers::TS6_SID_Retrieve(); - Me->SetSID(numeric); - Config->Numeric = numeric; - } + if (Me->GetSID() == Me->GetName()) + Me->SetSID(Servers::TS6_SID_Retrieve()); for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it) it->second->GenerateUID(); diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index eeb1e17e1..12a22e724 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -239,7 +239,7 @@ class InspIRCdProto : public IRCDProto void SendConnect() anope_override { - current_pass = Config->Uplinks[Anope::CurrentUplink]->password; + current_pass = Config->Uplinks[Anope::CurrentUplink].password; SendServer(Me); UplinkSocket::Message() << "BURST"; Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); @@ -247,9 +247,9 @@ class InspIRCdProto : public IRCDProto } /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick) anope_override + void SendSVSHold(const Anope::string &nick, time_t t) anope_override { - UplinkSocket::Message(OperServ) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << "s :Being held for registered user"; + UplinkSocket::Message(OperServ) << "SVSHOLD " << nick << " " << t << "s :Being held for registered user"; } /* SVSHOLD - release */ @@ -790,7 +790,7 @@ struct IRCDMessageRSQuit : IRCDMessage Server *s; /* Horrible workaround to an insp bug (#) in how RSQUITs are sent - mark */ - if (params.size() > 1 && Config->ServerName.equals_cs(params[0])) + if (params.size() > 1 && params[0] == Me->GetName()) s = Server::Find(params[1]); else s = Server::Find(params[0]); diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 80f21c3da..c3fa04b85 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -211,7 +211,7 @@ class InspIRCd12Proto : public IRCDProto /* SERVER services-dev.chatspike.net password 0 :Description here */ void SendServer(const Server *server) anope_override { - UplinkSocket::Message() << "SERVER " << server->GetName() << " " << Config->Uplinks[Anope::CurrentUplink]->password << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); + UplinkSocket::Message() << "SERVER " << server->GetName() << " " << Config->Uplinks[Anope::CurrentUplink].password << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); } /* JOIN */ @@ -270,13 +270,13 @@ class InspIRCd12Proto : public IRCDProto SendServer(Me); UplinkSocket::Message(Me) << "BURST"; Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); - UplinkSocket::Message(Me) << "VERSION :Anope-" << Anope::Version() << " " << Config->ServerName << " :" << IRCD->GetProtocolName() << " - (" << (enc ? enc->name : "none") << ") -- " << Anope::VersionBuildString(); + UplinkSocket::Message(Me) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << IRCD->GetProtocolName() << " - (" << (enc ? enc->name : "none") << ") -- " << Anope::VersionBuildString(); } /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick) anope_override + void SendSVSHold(const Anope::string &nick, time_t t) anope_override { - UplinkSocket::Message(NickServ) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << " :Being held for registered user"; + UplinkSocket::Message(NickServ) << "SVSHOLD " << nick << " " << t << " :Being held for registered user"; } /* SVSHOLD - release */ @@ -929,7 +929,7 @@ struct IRCDMessageMetadata : IRCDMessage u->Login(nc); const NickAlias *user_na = NickAlias::Find(u->nick); - if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false) + if (!Config->GetBlock("options")->Get<bool>("nonicknameownership") && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false) u->SetMode(NickServ, "REGISTERED"); /* Sometimes a user connects, we send them the usual "this nickname is registered" mess (if @@ -1221,12 +1221,8 @@ class ProtoInspIRCd : public Module Servers::Capab.insert("NOQUIT"); - if (Config->Numeric.empty()) - { - Anope::string numeric = Servers::TS6_SID_Retrieve(); - Me->SetSID(numeric); - Config->Numeric = numeric; - } + if (Me->GetSID() == Me->GetName()) + Me->SetSID(Servers::TS6_SID_Retrieve()); for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it) it->second->GenerateUID(); diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 7b21c2b08..3884862d9 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -13,6 +13,7 @@ #include "module.h" +static bool sasl = true; static unsigned int spanningtree_proto_ver = 0; static ServiceReference<IRCDProto> insp12("IRCDProto", "inspircd12"); @@ -58,7 +59,7 @@ class InspIRCd20Proto : public IRCDProto void SendSQLineDel(const XLine *x) anope_override { insp12->SendSQLineDel(x); } void SendSQLine(User *u, const XLine *x) anope_override { insp12->SendSQLine(u, x); } void SendVhost(User *u, const Anope::string &vident, const Anope::string &vhost) anope_override { insp12->SendVhost(u, vident, vhost); } - void SendSVSHold(const Anope::string &nick) anope_override { insp12->SendSVSHold(nick); } + void SendSVSHold(const Anope::string &nick, time_t t) anope_override { insp12->SendSVSHold(nick, t); } void SendSVSHoldDel(const Anope::string &nick) anope_override { insp12->SendSVSHoldDel(nick); } void SendSZLineDel(const XLine *x) anope_override { insp12->SendSZLineDel(x); } void SendSZLine(User *u, const XLine *x) anope_override { insp12->SendSZLine(u, x); } @@ -367,8 +368,9 @@ struct IRCDMessageCapab : Message::Capab else if (module.find("m_rline.so") == 0) { Servers::Capab.insert("RLINE"); - if (!Config->RegexEngine.empty() && module.length() > 11 && Config->RegexEngine != module.substr(11)) - Log() << "Warning: InspIRCd is using regex engine " << module.substr(11) << ", but we have " << Config->RegexEngine << ". This may cause inconsistencies."; + const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string &>("regexengine"); + if (!regexengine.empty() && module.length() > 11 && regexengine != module.substr(11)) + Log() << "Warning: InspIRCd is using regex engine " << module.substr(11) << ", but we have " << regexengine << ". This may cause inconsistencies."; } else if (module.equals_cs("m_topiclock.so")) Servers::Capab.insert("TOPICLOCK"); @@ -502,8 +504,6 @@ struct IRCDMessageCapab : Message::Capab Log() << "CHGHOST missing, Usage disabled until module is loaded."; if (!Servers::Capab.count("CHGIDENT")) Log() << "CHGIDENT missing, Usage disabled until module is loaded."; - if (!Servers::Capab.count("TOPICLOCK") && Config->UseServerSideTopicLock) - Log() << "m_topiclock missing, server side topic locking disabled until module is loaded."; chmodes.clear(); umodes.clear(); @@ -549,7 +549,7 @@ struct IRCDMessageEncap : IRCDMessage u->SetRealname(params[3]); UplinkSocket::Message(u) << "FNAME " << params[3]; } - else if (Config->NSSASL && params[1] == "SASL" && params.size() == 6) + else if (sasl && params[1] == "SASL" && params.size() == 6) { class InspIRCDSASLIdentifyRequest : public IdentifyRequest { @@ -656,6 +656,8 @@ class ProtoInspIRCd : public Module IRCDMessageEncap message_encap; IRCDMessageFIdent message_fident; + bool use_server_side_topiclock, use_server_side_mlock; + void SendChannelMetadata(Channel *c, const Anope::string &metadataname, const Anope::string &value) { UplinkSocket::Message(Me) << "METADATA " << c->name << " " << metadataname << " :" << value; @@ -695,7 +697,7 @@ class ProtoInspIRCd : public Module throw ModuleException("No protocol interface for insp12"); ModuleManager::DetachAll(m_insp12); - Implementation i[] = { I_OnUserNickChange, I_OnChannelCreate, I_OnChanRegistered, I_OnDelChan, I_OnMLock, I_OnUnMLock, I_OnSetChannelOption }; + Implementation i[] = { I_OnReload, I_OnUserNickChange, I_OnChannelCreate, I_OnChanRegistered, I_OnDelChan, I_OnMLock, I_OnUnMLock, I_OnSetChannelOption }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } @@ -704,6 +706,13 @@ class ProtoInspIRCd : public Module ModuleManager::UnloadModule(m_insp12, NULL); } + void OnReload(Configuration::Conf *conf) anope_override + { + use_server_side_topiclock = conf->GetModule(this)->Get<bool>("use_server_side_topiclock"); + use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); + sasl = conf->GetModule(this)->Get<bool>("sasl"); + } + void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED")); @@ -711,19 +720,18 @@ class ProtoInspIRCd : public Module void OnChannelCreate(Channel *c) anope_override { - if (c->ci && (Config->UseServerSideMLock || Config->UseServerSideTopicLock)) - this->OnChanRegistered(c->ci); + this->OnChanRegistered(c->ci); } void OnChanRegistered(ChannelInfo *ci) anope_override { - if (Config->UseServerSideMLock && ci->c) + if (use_server_side_mlock && ci->c) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); SendChannelMetadata(ci->c, "mlock", modes); } - if (Config->UseServerSideTopicLock && Servers::Capab.count("TOPICLOCK") && ci->c) + if (use_server_side_topiclock && Servers::Capab.count("TOPICLOCK") && ci->c) { Anope::string on = ci->HasExt("TOPICLOCK") ? "1" : ""; SendChannelMetadata(ci->c, "topiclock", on); @@ -732,17 +740,17 @@ class ProtoInspIRCd : public Module void OnDelChan(ChannelInfo *ci) anope_override { - if (Config->UseServerSideMLock && ci->c) + if (use_server_side_mlock && ci->c) SendChannelMetadata(ci->c, "mlock", ""); - if (Config->UseServerSideTopicLock && Servers::Capab.count("TOPICLOCK") && ci->c) + if (use_server_side_topiclock && Servers::Capab.count("TOPICLOCK") && ci->c) SendChannelMetadata(ci->c, "topiclock", ""); } EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; SendChannelMetadata(ci->c, "mlock", modes); @@ -754,7 +762,7 @@ class ProtoInspIRCd : public Module EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); SendChannelMetadata(ci->c, "mlock", modes); @@ -767,7 +775,6 @@ class ProtoInspIRCd : public Module { if (cmd->name == "chanserv/topic" && ci->c) { - if (setting == "topiclock on") SendChannelMetadata(ci->c, "topiclock", "1"); else if (setting == "topiclock off") diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index c749a2d7d..3d1a727e7 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -53,7 +53,7 @@ class ngIRCdProto : public IRCDProto void SendConnect() anope_override { - UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " 0210-IRC+ Anope|" << Anope::VersionShort() << ":CLHMSo P"; + UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " 0210-IRC+ Anope|" << Anope::VersionShort() << ":CLHMSo P"; /* Make myself known to myself in the serverlist */ SendServer(Me); /* finish the enhanced server handshake and register the connection */ @@ -184,11 +184,10 @@ struct IRCDMessage005 : IRCDMessage } else if (parameter == "NICKLEN") { - unsigned newlen = convertTo<unsigned>(data); - if (Config->NickLen != newlen) + unsigned newlen = convertTo<unsigned>(data), len = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); + if (len != newlen) { - Log() << "NickLen changed from " << Config->NickLen << " to " << newlen; - Config->NickLen = newlen; + Log() << "Warning: NICKLEN is " << newlen << " but networkinfo:nicklen is " << len; } } } @@ -540,7 +539,7 @@ struct IRCDMessageServer : IRCDMessage * when receiving a new server and then finish sync once we * get a pong back from that server. */ - IRCD->SendPing(Config->ServerName, params[0]); + IRCD->SendPing(Me->GetName(), params[0]); } }; diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index b256afc36..484f6a4bc 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -45,7 +45,7 @@ class PlexusProto : public IRCDProto void SendAkill(User *u, XLine *x) anope_override { hybrid->SendAkill(u, x); } void SendServer(const Server *server) anope_override { hybrid->SendServer(server); } void SendChannel(Channel *c) anope_override { hybrid->SendChannel(c); } - void SendSVSHold(const Anope::string &nick) anope_override { hybrid->SendSVSHold(nick); } + void SendSVSHold(const Anope::string &nick, time_t t) anope_override { hybrid->SendSVSHold(nick, t); } void SendSVSHoldDel(const Anope::string &nick) anope_override { hybrid->SendSVSHoldDel(nick); } void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override @@ -90,7 +90,7 @@ class PlexusProto : public IRCDProto void SendConnect() anope_override { - UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " TS 6 :" << Me->GetSID(); + UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* CAPAB * QS - Can handle quit storm removal * EX - Can do channel +e exemptions @@ -186,7 +186,7 @@ struct IRCDMessageEncap : IRCDMessage if (u && nc) { u->Login(nc); - if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false) + if (!Config->GetBlock("options")->Get<bool>("nonicknameownership") && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false) u->SetMode(NickServ, "REGISTERED"); } } diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 2d01605bb..2b971b23f 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -45,7 +45,7 @@ class RatboxProto : public IRCDProto void SendConnect() anope_override { - UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink]->password << " TS 6 :" << Me->GetSID(); + UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* QS - Can handle quit storm removal EX - Can do channel +e exemptions @@ -107,7 +107,7 @@ struct IRCDMessageEncap : IRCDMessage u->Login(nc); const NickAlias *user_na = NickAlias::Find(u->nick); - if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false) + if (!Config->GetBlock("options")->Get<bool>("nonicknameownership") && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false) u->SetMode(NickServ, "REGISTERED"); } } @@ -134,7 +134,7 @@ struct IRCDMessageServer : IRCDMessage if (params[1] != "1") return; new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); - IRCD->SendPing(Config->ServerName, params[0]); + IRCD->SendPing(Me->GetName(), params[0]); } }; @@ -217,6 +217,7 @@ class ProtoRatbox : public Module /* user modes */ ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("HIDEOPER")); ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("REGPRIV")); + ModeManager::AddUserMode(new UserMode("PROTECTED", 'S')); /* v/h/o/a/q */ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("HALFOP")); diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 7a7847972..4186ee5d0 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -13,6 +13,8 @@ #include "module.h" +static bool sasl = true; + class UnrealIRCdProto : public IRCDProto { public: @@ -53,7 +55,7 @@ class UnrealIRCdProto : public IRCDProto } catch (const SocketException &) { } - UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << Config->OperServ; + UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by; } void SendTopic(BotInfo *whosets, Channel *c) anope_override @@ -143,8 +145,8 @@ class UnrealIRCdProto : public IRCDProto /* Unreal 3.2 actually sends some info about itself in the descript area */ void SendServer(const Server *server) anope_override { - if (!Config->Numeric.empty()) - UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :U0-*-" << Config->Numeric << " " << server->GetDescription(); + if (!server->GetSID().empty() && server == Me) + UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :U0-*-" << server->GetSID() << " " << server->GetDescription(); else UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); } @@ -225,24 +227,24 @@ class UnrealIRCdProto : public IRCDProto VL = Version Info NS = Config->Numeric Server */ - if (!Config->Numeric.empty()) - UplinkSocket::Message() << "PROTOCTL NICKv2 VHP UMODE2 NICKIP SJOIN SJOIN2 SJ3 NOQUIT TKLEXT ESVID MLOCK VL"; - else - UplinkSocket::Message() << "PROTOCTL NICKv2 VHP UMODE2 NICKIP SJOIN SJOIN2 SJ3 NOQUIT TKLEXT ESVID MLOCK"; - UplinkSocket::Message() << "PASS :" << Config->Uplinks[Anope::CurrentUplink]->password; + Anope::string protoctl = "NICKv2 VHP UMODE2 NICKIP SJOIN SJOIN2 SJ3 NOQUIT TKLEXT ESVID MLOCK VL"; + if (!Me->GetSID().empty()) + protoctl += " VL"; + UplinkSocket::Message() << "PROTOCTL " << protoctl; + UplinkSocket::Message() << "PASS :" << Config->Uplinks[Anope::CurrentUplink].password; SendServer(Me); } /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick) anope_override + void SendSVSHold(const Anope::string &nick, time_t t) anope_override { - UplinkSocket::Message() << "TKL + Q H " << nick << " " << Config->ServerName << " " << Anope::CurTime + Config->NSReleaseTimeout << " " << Anope::CurTime << " :Being held for registered user"; + UplinkSocket::Message() << "TKL + Q H " << nick << " " << Me->GetName() << " " << Anope::CurTime + t << " " << Anope::CurTime << " :Being held for registered user"; } /* SVSHOLD - release */ void SendSVSHoldDel(const Anope::string &nick) anope_override { - UplinkSocket::Message() << "TKL - Q * " << nick << " " << Config->ServerName; + UplinkSocket::Message() << "TKL - Q * " << nick << " " << Me->GetName(); } /* UNSGLINE */ @@ -257,7 +259,7 @@ class UnrealIRCdProto : public IRCDProto /* UNSZLINE */ void SendSZLineDel(const XLine *x) anope_override { - UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << Config->OperServ; + UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << x->by; } /* SZLINE */ @@ -892,7 +894,7 @@ struct IRCDMessageSASL : IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { size_t p = params[1].find('!'); - if (!Config->NSSASL || p == Anope::string::npos) + if (!sasl || p == Anope::string::npos) return; if (params[2] == "S") @@ -996,7 +998,7 @@ struct IRCDMessageServer : IRCDMessage else new Server(source.GetServer(), params[0], hops, params[2]); - IRCD->SendPing(Config->ServerName, params[0]); + IRCD->SendPing(Me->GetName(), params[0]); } }; @@ -1158,6 +1160,8 @@ class ProtoUnreal : public Module IRCDMessageTopic message_topic; IRCDMessageUmode2 message_umode2; + bool use_server_side_mlock; + void AddModes() { ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0)); @@ -1212,11 +1216,17 @@ class ProtoUnreal : public Module this->AddModes(); - Implementation i[] = { I_OnUserNickChange, I_OnChannelCreate, I_OnChanRegistered, I_OnDelChan, I_OnMLock, I_OnUnMLock }; + Implementation i[] = { I_OnReload, I_OnUserNickChange, I_OnChannelCreate, I_OnChanRegistered, I_OnDelChan, I_OnMLock, I_OnUnMLock }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); ModuleManager::SetPriority(this, PRIORITY_FIRST); } + void OnReload(Configuration::Conf *conf) anope_override + { + use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); + sasl = conf->GetModule(this)->Get<bool>("sasl"); + } + void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED")); @@ -1226,7 +1236,7 @@ class ProtoUnreal : public Module void OnChannelCreate(Channel *c) anope_override { - if (Config->UseServerSideMLock && Servers::Capab.count("MLOCK") > 0 && c->ci) + if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && c->ci) { Anope::string modes = c->ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; @@ -1235,7 +1245,7 @@ class ProtoUnreal : public Module void OnChanRegistered(ChannelInfo *ci) anope_override { - if (!ci->c || !Config->UseServerSideMLock) + if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK")) return; Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; @@ -1243,7 +1253,7 @@ class ProtoUnreal : public Module void OnDelChan(ChannelInfo *ci) anope_override { - if (!ci->c || !Config->UseServerSideMLock) + if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK")) return; UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " :"; } @@ -1251,7 +1261,7 @@ class ProtoUnreal : public Module EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0 && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; @@ -1263,7 +1273,7 @@ class ProtoUnreal : public Module EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0 && Config->UseServerSideMLock) + if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; |