public:
JoinTimer(LocalUser* u, SimpleExtItem<JoinTimer>& 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
class ModuleConnJoin : public Module
{
SimpleExtItem<JoinTimer> 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);
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