X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_message.cpp;h=26573c8bf9262b07fb8c78ac83a087bb6766b6c4;hb=f3f2388a81b6463e1229fa5bf2b8c427440bf406;hp=b4404995df2de07a48ac4c98850e7a73da544c71;hpb=cbe5b993142c218e09ae972bdce91681cc0ba485;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_message.cpp b/src/coremods/core_message.cpp index b4404995d..26573c8bf 100644 --- a/src/coremods/core_message.cpp +++ b/src/coremods/core_message.cpp @@ -1,7 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2017-2019 Sadie Powell + * Copyright (C) 2017-2020 Sadie Powell * Copyright (C) 2013, 2017-2018 Attila Molnar * Copyright (C) 2012, 2019 Robby * Copyright (C) 2009 Daniel De Graaf @@ -174,7 +174,10 @@ class CommandMessage : public Command // If the source isn't allowed to mass message users then reject // the attempt to mass-message users. if (!source->HasPrivPermission("users/mass-message")) + { + source->WriteNumeric(ERR_NOPRIVILEGES, "Permission Denied - You do not have the required operator privileges"); return CMD_FAILURE; + } // Extract the server glob match from the target parameter. std::string servername(parameters[0], 1); @@ -247,21 +250,21 @@ class CommandMessage : public Command return CMD_FAILURE; } - // If the target is away then inform the user. - if (target->IsAway() && msgtype == MSG_PRIVMSG) - source->WriteNumeric(RPL_AWAY, target->nick, target->awaymsg); - // Fire the pre-message events. MessageTarget msgtarget(target); MessageDetailsImpl msgdetails(msgtype, parameters[1], parameters.GetTags()); if (!FirePreEvents(source, msgtarget, msgdetails)) return CMD_FAILURE; + // If the target is away then inform the user. + if (target->IsAway() && msgdetails.type == MSG_PRIVMSG) + source->WriteNumeric(RPL_AWAY, target->nick, target->awaymsg); + LocalUser* const localtarget = IS_LOCAL(target); if (localtarget) { // Send to the target if they are a local user. - ClientProtocol::Messages::Privmsg privmsg(ClientProtocol::Messages::Privmsg::nocopy, source, localtarget->nick, msgdetails.text, msgtype); + ClientProtocol::Messages::Privmsg privmsg(ClientProtocol::Messages::Privmsg::nocopy, source, localtarget->nick, msgdetails.text, msgdetails.type); privmsg.AddTags(msgdetails.tags_out); privmsg.SetSideEffect(true); localtarget->Send(ServerInstance->GetRFCEvents().privmsg, privmsg);