aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/ChatHandler.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-03-22 00:08:20 +0100
committerShauren <shauren.trinity@gmail.com>2023-03-22 00:08:20 +0100
commit922f60fa25569db05a7717b6b55568f321a02f64 (patch)
treeab11e8c8da23ea0a93daf073b602dc92d1f98957 /src/server/game/Handlers/ChatHandler.cpp
parentf18c0644f31f6264bd07345819bb48c432790bc7 (diff)
Core: Update to 10.0.7
Diffstat (limited to 'src/server/game/Handlers/ChatHandler.cpp')
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index 1f482398a0a..256ce0f5aab 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -43,6 +43,13 @@
#include "World.h"
#include <algorithm>
+enum class ChatWhisperTargetStatus : uint8
+{
+ CanWhisper = 0,
+ Offline = 1,
+ WrongFaction = 2
+};
+
inline bool isNasty(uint8 c)
{
if (c == '\t')
@@ -746,3 +753,25 @@ void WorldSession::SendChatRestricted(ChatRestrictionType restriction)
packet.Reason = restriction;
SendPacket(packet.Write());
}
+
+void WorldSession::HandleChatCanLocalWhisperTargetRequest(WorldPackets::Chat::CanLocalWhisperTargetRequest const& canLocalWhisperTargetRequest)
+{
+ ChatWhisperTargetStatus status = [&]
+ {
+ Player* sender = GetPlayer();
+ Player* receiver = ObjectAccessor::FindConnectedPlayer(canLocalWhisperTargetRequest.WhisperTarget);
+ if (!receiver || (!receiver->isAcceptWhispers() && receiver->GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS) && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
+ return ChatWhisperTargetStatus::Offline;
+
+ if (!receiver->IsInWhisperWhiteList(sender->GetGUID()) && !receiver->IsGameMasterAcceptingWhispers())
+ if (GetPlayer()->GetEffectiveTeam() != receiver->GetEffectiveTeam() && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT))
+ return ChatWhisperTargetStatus::WrongFaction;
+
+ return ChatWhisperTargetStatus::CanWhisper;
+ }();
+
+ WorldPackets::Chat::CanLocalWhisperTargetResponse canLocalWhisperTargetResponse;
+ canLocalWhisperTargetResponse.WhisperTarget = canLocalWhisperTargetRequest.WhisperTarget;
+ canLocalWhisperTargetResponse.Status = status;
+ SendPacket(canLocalWhisperTargetResponse.Write());
+}