X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_ircv3_ctctags.cpp;h=8dd83bd7f525777cdf0c089ee32c9c33f107584a;hb=dcafba95960685120b1f6d902de623ca10ed6135;hp=2856579870839a2441b0f2a0b9e9b466ce932ad3;hpb=c9ea418dd7f913ba1c2fbae49a82cf39d22e282f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index 285657987..8dd83bd7f 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -2,7 +2,7 @@ * InspIRCd -- Internet Relay Chat Daemon * * Copyright (C) 2019 linuxdaemon - * Copyright (C) 2018-2020 Sadie Powell + * Copyright (C) 2018-2021 Sadie Powell * * 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 @@ -234,15 +234,26 @@ class CommandTagMsg : public Command if (parameters[0][0] == '$') return HandleServerTarget(user, parameters); - // If the message begins with a status character then look it up. + // If the message begins with one or more status characters then look them up. const char* target = parameters[0].c_str(); - PrefixMode* pmh = ServerInstance->Modes->FindPrefix(target[0]); - if (pmh) - target++; + PrefixMode* targetpfx = NULL; + for (PrefixMode* pfx; (pfx = ServerInstance->Modes->FindPrefix(target[0])); ++target) + { + // We want the lowest ranked prefix specified. + if (!targetpfx || pfx->GetPrefixRank() < targetpfx->GetPrefixRank()) + targetpfx = pfx; + } + + if (!target[0]) + { + // The target consisted solely of prefix modes. + user->WriteNumeric(ERR_NORECIPIENT, "No recipient given"); + return CMD_FAILURE; + } // The target is a channel name. if (*target == '#') - return HandleChannelTarget(user, parameters, target, pmh); + return HandleChannelTarget(user, parameters, target, targetpfx); // The target is a nickname. return HandleUserTarget(user, parameters);