X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_conn_join.cpp;h=182b77b996d2678a5cca68b201bfab33e0b4ebf1;hb=fd1d19d6345943ecdb5ce4ef947f9b3c5c8bca86;hp=7ba2b0c7d992ce636092f87dd3fdbf9ef149db98;hpb=26e7bb0b9a17a595d9935a1cae41b44504ad213e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index 7ba2b0c7d..182b77b99 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -22,12 +22,10 @@ #include "inspircd.h" -/* $ModDesc: Forces users to join the specified channel(s) on connect */ - class ModuleConnJoin : public Module { public: - void init() + void init() CXX11_OVERRIDE { Implementation eventlist[] = { I_OnPostConnect }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); @@ -38,26 +36,27 @@ class ModuleConnJoin : public Module 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, false, "", false, ServerInstance->Time()); + if (ServerInstance->IsChannel(chan)) + Channel::JoinUser(localuser, chan); } } };