X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_conn_join.cpp;h=b22dbdf4dc69bee8b5078b725b8b452f2a0c4592;hb=63aa8d0d42f619c52d382bde3e6ba2e5e23b12ac;hp=cbe8b0be3bea99fff1e2dd73bcb23cba904a85bd;hpb=9e1399c12824e759f605dca601621159a5be618c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index cbe8b0be3..b22dbdf4d 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -43,10 +43,10 @@ class JoinTimer : public Timer public: JoinTimer(LocalUser* u, SimpleExtItem& ex, const std::string& chans, unsigned int delay) - : Timer(delay, ServerInstance->Time(), false) + : Timer(delay, false) , user(u), channels(chans), ext(ex) { - ServerInstance->Timers->AddTimer(this); + ServerInstance->Timers.AddTimer(this); } bool Tick(time_t time) CXX11_OVERRIDE @@ -62,12 +62,22 @@ class JoinTimer : public Timer class ModuleConnJoin : public Module { SimpleExtItem ext; + std::string defchans; + unsigned int defdelay; public: - ModuleConnJoin() : ext("join_timer", this) + ModuleConnJoin() + : ext("join_timer", ExtensionItem::EXT_USER, this) { } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + ConfigTag* tag = ServerInstance->Config->ConfValue("autojoin"); + defchans = tag->getString("channel"); + defdelay = tag->getInt("delay", 0, 0, 60); + } + void Prioritize() { ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_LAST); @@ -89,14 +99,12 @@ class ModuleConnJoin : public Module if (chanlist.empty()) { - ConfigTag* tag = ServerInstance->Config->ConfValue("autojoin"); - chanlist = tag->getString("channel"); - chandelay = tag->getInt("delay", 0, 0, 60); + if (defchans.empty()) + return; + chanlist = defchans; + chandelay = defdelay; } - if (chanlist.empty()) - return; - if (!chandelay) JoinChannels(localuser, chanlist); else