]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Merge pull request #1446 from B00mX0r/master+wrongnumeric
[user/henk/code/inspircd.git] / src / channels.cpp
index 49fa75f9830c23bbb51fcb3a4fd3f8f829b689a5..7e6555ae80b94d666f22ae46aa60a1d10ae816df 100644 (file)
@@ -181,7 +181,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co
                {
                        unsigned int opermaxchans = ConvToInt(user->oper->getConfig("maxchans"));
                        // If not set, use 2.0's <channels:opers>, if that's not set either, use limit from CC
-                       if (!opermaxchans)
+                       if (!opermaxchans && user->HasPrivPermission("channels/high-join-limit"))
                                opermaxchans = ServerInstance->Config->OperMaxChans;
                        if (opermaxchans)
                                maxchans = opermaxchans;
@@ -267,7 +267,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co
                                if (!limit.empty())
                                {
                                        FIRST_MOD_RESULT(OnCheckLimit, MOD_RESULT, (user, chan));
-                                       if (!MOD_RESULT.check((chan->GetUserCounter() < atol(limit.c_str()))))
+                                       if (!MOD_RESULT.check(chan->GetUserCounter() < ConvToNum<size_t>(limit)))
                                        {
                                                user->WriteNumeric(ERR_CHANNELISFULL, chan->name, "Cannot join channel (Channel is full)");
                                                return NULL;
@@ -349,6 +349,9 @@ bool Channel::IsBanned(User* user)
                return (result == MOD_RES_DENY);
 
        ListModeBase* banlm = static_cast<ListModeBase*>(*ban);
+       if (!banlm)
+               return false;
+
        const ListModeBase::ModeList* bans = banlm->GetList(this);
        if (bans)
        {
@@ -381,8 +384,8 @@ bool Channel::CheckBan(User* user, const std::string& mask)
        if (InspIRCd::Match(nickIdent, prefix, NULL))
        {
                std::string suffix(mask, at + 1);
-               if (InspIRCd::Match(user->host, suffix, NULL) ||
-                       InspIRCd::Match(user->dhost, suffix, NULL) ||
+               if (InspIRCd::Match(user->GetRealHost(), suffix, NULL) ||
+                       InspIRCd::Match(user->GetDisplayedHost(), suffix, NULL) ||
                        InspIRCd::MatchCIDR(user->GetIPString(), suffix, NULL))
                        return true;
        }
@@ -397,12 +400,18 @@ ModResult Channel::GetExtBanStatus(User *user, char type)
                return rv;
 
        ListModeBase* banlm = static_cast<ListModeBase*>(*ban);
+       if (!banlm)
+               return MOD_RES_PASSTHRU;
+
        const ListModeBase::ModeList* bans = banlm->GetList(this);
        if (bans)
        {
                for (ListModeBase::ModeList::const_iterator it = bans->begin(); it != bans->end(); ++it)
                {
-                       if (CheckBan(user, it->mask))
+                       if (it->mask.length() <= 2 || it->mask[0] != type || it->mask[1] != ':')
+                               continue;
+
+                       if (CheckBan(user, it->mask.substr(2)))
                                return MOD_RES_DENY;
                }
        }