+class ModuleConnJoin : public Module
+{
+ SimpleExtItem<JoinTimer> ext;
+ std::string defchans;
+ unsigned int defdelay;
+
+ public:
+ 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->getDuration("delay", 0, 0, 60*15);
+ }
+
+ void Prioritize() CXX11_OVERRIDE
+ {
+ ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_LAST);
+ }
+
+ Version GetVersion() CXX11_OVERRIDE
+ {
+ return Version("Allows the server administrator to force users to join one or more channels on connect.", VF_VENDOR);
+ }
+
+ void OnPostConnect(User* user) CXX11_OVERRIDE
+ {
+ LocalUser* localuser = IS_LOCAL(user);
+ if (!localuser)
+ return;
+
+ std::string chanlist = localuser->GetClass()->config->getString("autojoin");
+ unsigned int chandelay = localuser->GetClass()->config->getDuration("autojoindelay", 0, 0, 60*15);
+
+ if (chanlist.empty())