diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-03-06 22:53:51 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-03-06 22:53:51 +0000 |
commit | 2ccf874d7e85c12278ee8ce24d750b0819eb2384 (patch) | |
tree | 5d00d191fe703a8a9d912de2d33aed276e286218 /src | |
parent | 3ed3241a5c38dde202deaa73204fecbe9d12d303 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_conn_join.cpp | 20 | ||||
-rw-r--r-- | src/modules/m_operjoin.cpp | 20 |
2 files changed, 22 insertions, 18 deletions
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<std::string> Joinchans; int tokenize(const string &str, std::vector<std::string> &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<std::string> Joinchans; - tokenize(JoinChan,Joinchans); - for(std::vector<std::string>::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<std::string>::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<std::string> 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<std::string> operChans; - tokenize(operChan,operChans); - for(std::vector<std::string>::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<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++) + if (ServerInstance->IsChannel(it->c_str())) + chanrec::JoinUser(ServerInstance, user, it->c_str(), false); } }; |