]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_list.cpp
core_list Check whether the chan name/topic has to be Match()ed once, not once per...
[user/henk/code/inspircd.git] / src / coremods / core_list.cpp
index 505b0764caa2e0fe1b82471689fb904d5abe01a2..bf9d9bdaef54245da6ebe2f31c74521de3662396 100644 (file)
@@ -68,6 +68,9 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
                }
        }
 
+       const bool has_privs = user->HasPrivPermission("channels/auspex");
+       const bool match_name_topic = ((!parameters.empty()) && (!parameters[0].empty()) && (parameters[0][0] != '<') && (parameters[0][0] != '>'));
+
        const chan_hash& chans = ServerInstance->GetChans();
        for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ++i)
        {
@@ -80,14 +83,14 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
                if (too_many || too_few)
                        continue;
 
-               if (parameters.size() && !parameters[0].empty() && (parameters[0][0] != '<' && parameters[0][0] != '>'))
+               if (match_name_topic)
                {
                        if (!InspIRCd::Match(i->second->name, parameters[0]) && !InspIRCd::Match(i->second->topic, parameters[0]))
                                continue;
                }
 
                // if the channel is not private/secret, OR the user is on the channel anyway
-               bool n = (i->second->HasUser(user) || user->HasPrivPermission("channels/auspex"));
+               bool n = (has_privs || i->second->HasUser(user));
 
                if (!n && i->second->IsModeSet(privatemode))
                {