X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sslmodes.cpp;h=1a596f5e0424b0332b344566e965ef9011132425;hb=9e64fb83aab4f4c0c6964fcdbef4bca0846e930a;hp=65933cc141126a265f21a2c1bbcbfa987669fe5b;hpb=ad523652ae0ab92df728796a1f082f339f6ddbb6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 65933cc14..1a596f5e0 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -24,8 +24,6 @@ #include "inspircd.h" #include "modules/ssl.h" -/* $ModDesc: Provides channel mode +z to allow for Secure/SSL only channels */ - /** Handle channel mode +z */ class SSLMode : public ModeHandler @@ -43,25 +41,25 @@ class SSLMode : public ModeHandler { if (adding) { - if (!channel->IsModeSet('z')) + if (!channel->IsModeSet(this)) { if (IS_LOCAL(source)) { if (!API) return MODEACTION_DENY; - const UserMembList* userlist = channel->GetUsers(); - for(UserMembCIter i = userlist->begin(); i != userlist->end(); i++) + const Channel::MemberMap& userlist = channel->GetUsers(); + for (Channel::MemberMap::const_iterator i = userlist.begin(); i != userlist.end(); ++i) { ssl_cert* cert = API->GetCertificate(i->first); - if (!cert && !ServerInstance->ULine(i->first->server)) + if (!cert && !i->first->server->IsULine()) { - source->WriteNumeric(ERR_ALLMUSTSSL, "%s %s :all members of the channel must be connected via SSL", source->nick.c_str(), channel->name.c_str()); + source->WriteNumeric(ERR_ALLMUSTSSL, "%s :all members of the channel must be connected via SSL", channel->name.c_str()); return MODEACTION_DENY; } } } - channel->SetMode('z',true); + channel->SetMode(this, true); return MODEACTION_ALLOW; } else @@ -71,9 +69,9 @@ class SSLMode : public ModeHandler } else { - if (channel->IsModeSet('z')) + if (channel->IsModeSet(this)) { - channel->SetMode('z',false); + channel->SetMode(this, false); return MODEACTION_ALLOW; } @@ -93,16 +91,9 @@ class ModuleSSLModes : public Module { } - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->AddService(sslm); - Implementation eventlist[] = { I_OnUserPreJoin, I_OnCheckBan, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE { - if(chan && chan->IsModeSet('z')) + if(chan && chan->IsModeSet(sslm)) { if (!sslm.API) return MOD_RES_DENY; @@ -116,7 +107,7 @@ class ModuleSSLModes : public Module else { // Deny - user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick.c_str(), cname.c_str()); + user->WriteNumeric(489, "%s :Cannot join channel; SSL users only (+z)", cname.c_str()); return MOD_RES_DENY; } }