]> 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 1edc57693dfeb5f1345b1ee95edaa6b958bb3206..7e6555ae80b94d666f22ae46aa60a1d10ae816df 100644 (file)
@@ -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)
        {
@@ -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;
                }
        }