From 2ccf874d7e85c12278ee8ce24d750b0819eb2384 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 6 Mar 2007 22:53:51 +0000 Subject: Fix on-rehash reloading of the lists... and why were we tokenizing the string on every connect/operup, when we should do it once on rehash? This makes it a ton faster. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6632 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_conn_join.cpp | 20 +++++++++++--------- src/modules/m_operjoin.cpp | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index 6d5c607be..9a7fdca7a 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -23,6 +23,7 @@ class ModuleConnJoin : public Module private: std::string JoinChan; ConfigReader* conf; + std::vector Joinchans; int tokenize(const string &str, std::vector &tokens) @@ -50,6 +51,9 @@ class ModuleConnJoin : public Module { conf = new ConfigReader(ServerInstance); JoinChan = conf->ReadValue("autojoin", "channel", 0); + Joinchans.clear(); + if (!JoinChan.empty()) + tokenize(JoinChan,Joinchans); } void Implements(char* List) @@ -61,6 +65,10 @@ class ModuleConnJoin : public Module { DELETE(conf); conf = new ConfigReader(ServerInstance); + JoinChan = conf->ReadValue("autojoin", "channel", 0); + Joinchans.clear(); + if (!JoinChan.empty()) + tokenize(JoinChan,Joinchans); } virtual ~ModuleConnJoin() @@ -78,15 +86,9 @@ class ModuleConnJoin : public Module if (!IS_LOCAL(user)) return; - if (!JoinChan.empty()) - { - std::vector Joinchans; - tokenize(JoinChan,Joinchans); - for(std::vector::iterator it = Joinchans.begin(); it != Joinchans.end(); it++) - if (ServerInstance->IsChannel(it->c_str())) - chanrec::JoinUser(ServerInstance, user, it->c_str(), false); - } - + for(std::vector::iterator it = Joinchans.begin(); it != Joinchans.end(); it++) + if (ServerInstance->IsChannel(it->c_str())) + chanrec::JoinUser(ServerInstance, user, it->c_str(), false); } }; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 87e3aa380..09ddb47b9 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -22,6 +22,7 @@ class ModuleOperjoin : public Module { private: std::string operChan; + std::vector operChans; ConfigReader* conf; @@ -51,6 +52,9 @@ class ModuleOperjoin : public Module conf = new ConfigReader(ServerInstance); operChan = conf->ReadValue("operjoin", "channel", 0); + operChans.clear(); + if (!operChan.empty()) + tokenize(operChan,operChans); } void Implements(char* List) @@ -62,6 +66,10 @@ class ModuleOperjoin : public Module { DELETE(conf); conf = new ConfigReader(ServerInstance); + operChan = conf->ReadValue("operjoin", "channel", 0); + operChans.clear(); + if (!operChan.empty()) + tokenize(operChan,operChans); } virtual ~ModuleOperjoin() @@ -79,15 +87,9 @@ class ModuleOperjoin : public Module if (!IS_LOCAL(user)) return; - if (!operChan.empty()) - { - std::vector operChans; - tokenize(operChan,operChans); - for(std::vector::iterator it = operChans.begin(); it != operChans.end(); it++) - if (ServerInstance->IsChannel(it->c_str())) - chanrec::JoinUser(ServerInstance, user, it->c_str(), false); - } - + for(std::vector::iterator it = operChans.begin(); it != operChans.end(); it++) + if (ServerInstance->IsChannel(it->c_str())) + chanrec::JoinUser(ServerInstance, user, it->c_str(), false); } }; -- cgit v1.2.3