]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_who.cpp
Add support for blocking tag messages with the deaf mode.
[user/henk/code/inspircd.git] / src / coremods / core_who.cpp
index 52af2d2cee76b7af23d8d010518bb24afc989a1e..aa19efe97db3f156ce432fa394750e3911c03818 100644 (file)
@@ -1,10 +1,16 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2018 Peter Powell <petpow@saberuk.com>
- *   Copyright (C) 2014 Adam <Adam@anope.org>
+ *   Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
+ *   Copyright (C) 2018 Adam <Adam@anope.org>
+ *   Copyright (C) 2017-2019, 2021 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2013-2014, 2016 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2009 John Brooks <special@inspircd.org>
+ *   Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2006-2008, 2010 Craig Edwards <brain@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -39,7 +45,7 @@ static const char who_field_order[] = "cuhsnf";
 
 struct WhoData : public Who::Request
 {
-       bool GetFlagIndex(char flag, size_t& out) const CXX11_OVERRIDE
+       bool GetFieldIndex(char flag, size_t& out) const CXX11_OVERRIDE
        {
                if (!whox)
                {
@@ -71,9 +77,6 @@ struct WhoData : public Who::Request
                if (matchtext == "0")
                        matchtext = "*";
 
-               // Fuzzy matches are when the source has not specified a specific user.
-               fuzzy_match = (parameters.size() > 1) || (matchtext.find_first_of("*?.") != std::string::npos);
-
                // If flags have been specified by the source.
                if (parameters.size() > 1)
                {
@@ -102,6 +105,9 @@ struct WhoData : public Who::Request
                                current_bitset->set(chr);
                        }
                }
+
+               // Fuzzy matches are when the source has not specified a specific user.
+               fuzzy_match = flags.any() || (matchtext.find_first_of("*?.") != std::string::npos);
        }
 };
 
@@ -385,13 +391,14 @@ void CommandWho::WhoChannel(LocalUser* source, const std::vector<std::string>& p
 template<typename T>
 void CommandWho::WhoUsers(LocalUser* source, const std::vector<std::string>& parameters, const T& users, WhoData& data)
 {
+       bool source_has_users_auspex = source->HasPrivPermission("users/auspex");
        for (typename T::const_iterator iter = users.begin(); iter != users.end(); ++iter)
        {
                User* user = GetUser(iter);
 
                // Only show users in response to a fuzzy WHO if we can see them normally.
                bool can_see_normally = user == source || source->SharesChannelWith(user) || !user->IsModeSet(invisiblemode);
-               if (data.fuzzy_match && !can_see_normally && !source->HasPrivPermission("users/auspex"))
+               if (data.fuzzy_match && !can_see_normally && !source_has_users_auspex)
                        continue;
 
                // Skip the user if it doesn't match the query.