]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix fuzzy matching in core_who.
authorSadie Powell <sadie@witchery.services>
Tue, 2 Mar 2021 19:55:54 +0000 (19:55 +0000)
committerSadie Powell <sadie@witchery.services>
Tue, 2 Mar 2021 19:55:54 +0000 (19:55 +0000)
Previously this code would consider requests with fields but no
flags as fuzzy. This is incorrect as users can make requests like:

    WHO Sadie %n

Reported by @ilbelkyr.

src/coremods/core_who.cpp

index fdf8919a22e33a6c2af29001d535546b52d2f5c9..135504b84ce73cb1132908a462b2ead217f7ff62 100644 (file)
@@ -77,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)
                {
@@ -108,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);
        }
 };