@@ -588,6 +588,7 @@ class ModuleReputation final
588588 user->WriteNotice (" /REPUTATION <ip> <value> Set reputation score of IP" );
589589 user->WriteNotice (" /REPUTATION <channel> List users in channel along with their reputation score" );
590590 user->WriteNotice (" /REPUTATION <NN List users with reputation score below NN" );
591+ user->WriteNotice (" /REPUTATION >NN List users with reputation score above NN" );
591592 }
592593
593594 void ShowRecord (User* user, const std::string& ip)
@@ -691,6 +692,28 @@ class ModuleReputation final
691692 user->WriteNotice (" End of list." );
692693 }
693694
695+ void ListQueryAbove (User* user, unsigned long minscore)
696+ {
697+ user->WriteNotice (INSP_FORMAT (" Users and reputation scores >{}:" , minscore));
698+ for (const auto & [_, target] : ServerInstance->Users .GetUsers ())
699+ {
700+ if (!target || IS_SERVER (target) || target->server ->IsService ())
701+ continue ;
702+
703+ const auto score = static_cast <unsigned long >(std::max<intptr_t >(0 , repouserext.Get (target)));
704+ if (score <= minscore)
705+ continue ;
706+
707+ user->WriteNotice (INSP_FORMAT (" {}!{}@{} [{}] (score: {})" ,
708+ target->nick ,
709+ target->GetUser (false ),
710+ target->GetRealHost (),
711+ target->GetAddress (),
712+ score));
713+ }
714+ user->WriteNotice (" End of list." );
715+ }
716+
694717public:
695718 ModuleReputation ()
696719 : Module(VF_VENDOR, " Provides a scoring system for known IPs." )
@@ -853,7 +876,7 @@ CommandReputation::CommandReputation(Module* Creator, ModuleReputation& Parent)
853876 // in the command parser). We enforce oper-only access for local users in
854877 // Handle() instead.
855878 access_needed = CmdAccess::NORMAL;
856- syntax = { " [<nick|ip|#channel|<N>] [<value>]" };
879+ syntax = { " [<nick|ip|#channel|<N|>N >] [<value>]" };
857880}
858881
859882RouteDescriptor CommandReputation::GetRouting (User* user, const Params& parameters)
@@ -913,6 +936,18 @@ CmdResult CommandReputation::Handle(User* user, const Params& parameters)
913936 return CmdResult::SUCCESS;
914937 }
915938
939+ if (!target.empty () && target[0 ] == ' >' )
940+ {
941+ unsigned long min = ConvToNum<unsigned long >(target.substr (1 ));
942+ if (min < 1 )
943+ {
944+ localuser->WriteNotice (" REPUTATION: Invalid search value. Use e.g. /REPUTATION >1" );
945+ return CmdResult::FAILURE;
946+ }
947+ parent.ListQueryAbove (localuser, min);
948+ return CmdResult::SUCCESS;
949+ }
950+
916951 std::string ip;
917952 if (LooksLikeIP (target))
918953 {
0 commit comments