X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_conn_join.cpp;h=fdcf82dccdd3a6066350bb52a012fa1c4c42cfe6;hb=074727e7a74f8dcef6c250faf6a757f0274d27db;hp=6b13ab1aab8da7556d193cd8249b4e394c9ef391;hpb=84a1569cd60daa64b1ae52a1fff62c0dc4d78850;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index 6b13ab1aa..fdcf82dcc 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -22,45 +22,37 @@ #include "inspircd.h" -/* $ModDesc: Forces users to join the specified channel(s) on connect */ - class ModuleConnJoin : public Module { public: - void init() - { - Implementation eventlist[] = { I_OnPostConnect }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - void Prioritize() { ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_LAST); } - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Forces users to join the specified channel(s) on connect", VF_VENDOR); } - void OnPostConnect(User* user) + void OnPostConnect(User* user) CXX11_OVERRIDE { - if (!IS_LOCAL(user)) + LocalUser* localuser = IS_LOCAL(user); + if (!localuser) return; std::string chanlist = ServerInstance->Config->ConfValue("autojoin")->getString("channel"); - chanlist = user->GetClass()->config->getString("autojoin", chanlist); + chanlist = localuser->GetClass()->config->getString("autojoin", chanlist); irc::commasepstream chans(chanlist); std::string chan; while (chans.GetToken(chan)) { - if (ServerInstance->IsChannel(chan.c_str(), ServerInstance->Config->Limits.ChanMax)) - Channel::JoinUser(user, chan.c_str(), false, "", false, ServerInstance->Time()); + if (ServerInstance->IsChannel(chan)) + Channel::JoinUser(localuser, chan); } } }; - MODULE_INIT(ModuleConnJoin)