From 552c77d13eb3fe2e22d44808500a56d1d4f6c727 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 16 Aug 2020 20:11:23 +0200 Subject: [PATCH] Fix AntiSpam checking the owner for object chat instead of the object itself in local chat --- indra/newview/llviewermessage.cpp | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 4b95abd6ca..e5071f2c88 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2859,10 +2859,28 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mChatType = (EChatType)type_temp; // NaCL - Antispam Registry - if (chat.mChatType != CHAT_TYPE_START && chat.mChatType != CHAT_TYPE_STOP) + static LLCachedControl useAntiSpam(gSavedSettings, "UseAntiSpam"); + static LLCachedControl useAntiSpamMine(gSavedSettings, "FSUseAntiSpamMine"); + bool deferred_spam_check = false; + if (useAntiSpam && chat.mChatType != CHAT_TYPE_START && chat.mChatType != CHAT_TYPE_STOP) { + if (chat.mSourceType == CHAT_SOURCE_OBJECT) + { + LLViewerObject* source = gObjectList.findObject(from_id); + if (source) + { + if (source->permYouOwner() && useAntiSpamMine) + { + deferred_spam_check = true; + } + else if (!source->permYouOwner() && NACLAntiSpamRegistry::instance().checkQueue(ANTISPAM_QUEUE_CHAT, from_id, ANTISPAM_SOURCE_OBJECT)) + { + return; + } + } + } // owner_id = from_id for agents - if (NACLAntiSpamRegistry::instance().checkQueue(ANTISPAM_QUEUE_CHAT, owner_id, ANTISPAM_SOURCE_AGENT)) + else if (NACLAntiSpamRegistry::instance().checkQueue(ANTISPAM_QUEUE_CHAT, owner_id, ANTISPAM_SOURCE_AGENT)) { return; } @@ -2990,8 +3008,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // NaCl - Newline flood protection static LLCachedControl useAntiSpam(gSavedSettings, "UseAntiSpam"); // FIRE-23138: Add option to antispam user's own objects - bool deferred_spam_check = false; - static LLCachedControl useAntiSpamMine(gSavedSettings, "FSUseAntiSpamMine"); + bool deferred_newline_spam_check = false; if (useAntiSpam) { bool doCheck = true; @@ -3017,7 +3034,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if (doCheck && useAntiSpamMine) { // If it's the user's object, defer the check so RLV commands still work - deferred_spam_check = true; + deferred_newline_spam_check = true; } // FIRE-23138 } @@ -3288,7 +3305,11 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) break; } // FIRE-23138: Enable spam checking for user's own objects - if (deferred_spam_check && NACLAntiSpamRegistry::instance().checkNewlineFlood(ANTISPAM_QUEUE_CHAT, from_id, mesg)) + if (deferred_spam_check && NACLAntiSpamRegistry::instance().checkQueue(ANTISPAM_QUEUE_CHAT, from_id, ANTISPAM_SOURCE_OBJECT)) + { + return; + } + if (deferred_newline_spam_check && NACLAntiSpamRegistry::instance().checkNewlineFlood(ANTISPAM_QUEUE_CHAT, from_id, mesg)) { return; }