diff options
author | Sadie Powell <sadie@witchery.services> | 2021-01-30 16:29:01 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-01-30 16:32:43 +0000 |
commit | 219d0fa1a64c5c2c155942ebc52543dd956519b1 (patch) | |
tree | 9ed59ad4e394a7420c100158ec41960ff472e45b /src | |
parent | ce05e885a9258139eb7b076c29a70b5f8d366209 (diff) |
Fix a few issues with SERVLIST.
- Implement support for service type matching based on the service
oper type. This isn't the same as irc2 but its close enough.
- Fix erroneously sending the mask in the <mask> field. This field
is for the service name mask not the service distribution mask.
Diffstat (limited to 'src')
-rw-r--r-- | src/coremods/core_info/cmd_servlist.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/coremods/core_info/cmd_servlist.cpp b/src/coremods/core_info/cmd_servlist.cpp index f400124d2..9490f7280 100644 --- a/src/coremods/core_info/cmd_servlist.cpp +++ b/src/coremods/core_info/cmd_servlist.cpp @@ -32,28 +32,32 @@ CommandServList::CommandServList(Module* parent) , invisiblemode(parent, "invisible") { allow_empty_last_param = false; - syntax = "[<mask>]"; + syntax = "[<mask> [<type>]]"; } CmdResult CommandServList::HandleLocal(LocalUser* user, const Params& parameters) { const std::string& mask = parameters.empty() ? "*" : parameters[0]; + const bool has_type = parameters.size() > 1; for (UserManager::ULineList::const_iterator iter = ServerInstance->Users.all_ulines.begin(); iter != ServerInstance->Users.all_ulines.end(); ++iter) { User* uline = *iter; if (uline->IsModeSet(invisiblemode) || !InspIRCd::Match(uline->nick, mask)) continue; + if (has_type && (!user->IsOper() || !InspIRCd::Match(user->oper->name, parameters[2 ]))) + continue; + Numeric::Numeric numeric(RPL_SERVLIST); numeric .push(uline->nick) .push(uline->server->GetName()) - .push(mask) - .push(0) + .push("*") + .push(user->IsOper() ? user->oper->name : "*") .push(0) .push(uline->GetRealName()); user->WriteNumeric(numeric); } - user->WriteNumeric(RPL_SERVLISTEND, mask, 0, "End of service listing"); + user->WriteNumeric(RPL_SERVLISTEND, mask, has_type ? parameters[1] : "*", "End of service listing"); return CMD_SUCCESS; } |