X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fchannels.cpp;h=0ff252c9517835100e8f7385668f35023aa9c061;hb=ca161e8637384af9ba7e437c1e45611560517fdf;hp=c9816db4b006795fc0dde9faef88ade67a6d07b7;hpb=b2ac8cc0a6405946a388b80df3be21bc276a61f3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/channels.cpp b/src/channels.cpp index c9816db4b..0ff252c95 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -40,7 +40,8 @@ Channel::Channel(const std::string &cname, time_t ts) void Channel::SetMode(ModeHandler* mh, bool on) { - modes[mh->GetId()] = on; + if (mh && mh->GetId() != ModeParser::MODEID_MAX) + modes[mh->GetId()] = on; } void Channel::SetTopic(User* u, const std::string& ntopic, time_t topicts, const std::string* setter) @@ -177,7 +178,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co unsigned int maxchans = user->GetClass()->maxchans; if (user->IsOper()) { - unsigned int opermaxchans = ConvToInt(user->oper->getConfig("maxchans")); + unsigned int opermaxchans = ConvToNum(user->oper->getConfig("maxchans")); // If not set, use 2.0's , if that's not set either, use limit from CC if (!opermaxchans && user->HasPrivPermission("channels/high-join-limit")) opermaxchans = ServerInstance->Config->OperMaxChans; @@ -241,7 +242,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co { if (chan->IsBanned(user)) { - user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (You're banned)"); + user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (you're banned)"); return NULL; } } @@ -435,7 +436,7 @@ void Channel::Write(ClientProtocol::Event& protoev, char status, const CUList& e } } -const char* Channel::ChanModes(bool showkey) +const char* Channel::ChanModes(bool showsecret) { static std::string scratch; std::string sparam; @@ -454,9 +455,9 @@ const char* Channel::ChanModes(bool showkey) if (!pm) continue; - if (n == 'k' - 65 && !showkey) + if (pm->IsParameterSecret() && !showsecret) { - sparam += " "; + sparam += " <" + pm->name + ">"; } else {