From 2e0a7fd8736d9ae219e51ea53cc9cb40d68c0345 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 6 Mar 2015 23:53:20 +0100 Subject: [PATCH] Prepare LLIMModel and LLIMMgr to pass through info if we already performed a keyword alert so we can filter out basically duplicate notifications in Growl if it will be requested --- indra/newview/growlmanager.cpp | 2 +- indra/newview/llimview.cpp | 10 ++++++---- indra/newview/llimview.h | 5 +++-- indra/newview/llviewermessage.cpp | 18 +++++++++++++++--- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/indra/newview/growlmanager.cpp b/indra/newview/growlmanager.cpp index 497a3067cc..bf14e15618 100644 --- a/indra/newview/growlmanager.cpp +++ b/indra/newview/growlmanager.cpp @@ -317,7 +317,7 @@ bool GrowlManager::filterOldNotifications(LLNotificationPtr pNotification) void GrowlManager::onInstantMessage(const LLSD& im) { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(im["session_id"].asUUID()); - if (session->isP2PSessionType()) + if (session->isP2PSessionType()/* && !im["keyword_alert"].asBoolean()*/) // Ansariel: Comment this out to filter IM duplication due to keyword alerts { // Don't show messages from ourselves or the system. LLUUID from_id = im["from_id"].asUUID(); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 58188774bb..df139dc1ec 100755 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1263,7 +1263,7 @@ bool LLIMModel::proccessOnlineOfflineNotification( //bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, // const std::string& utf8_text, bool log2file /* = true */) { bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, - const std::string& utf8_text, bool log2file /* = true */, bool is_announcement /* = false */) { + const std::string& utf8_text, bool log2file /* = true */, bool is_announcement /* = false */, bool keyword_alert /* = false */) { LLIMSession* session = addMessageSilently(session_id, from, from_id, utf8_text, log2file, is_announcement); if (!session) return false; @@ -1284,7 +1284,8 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co arg["from_id"] = from_id; arg["time"] = LLLogChat::timestamp(false); arg["session_type"] = session->mSessionType; - arg["is_announcement"] = is_announcement; // Ansariel: Indicator if it's an announcement + arg["is_announcement"] = is_announcement; // Indicator if it's an announcement + arg["keyword_alert"] = keyword_alert; // Pass info if keyword alert has been performed mNewMsgSignal(arg); return true; @@ -2949,7 +2950,8 @@ void LLIMMgr::addMessage( const LLUUID& region_id, const LLVector3& position, bool link_name, // If this is true, then we insert the name and link it to a profile - bool is_announcement) // Special parameter indicating announcements + bool is_announcement, // Special parameter indicating announcements + bool keyword_alert) // Pass info if keyword alert has been performed { LLUUID other_participant_id = target_id; @@ -3165,7 +3167,7 @@ void LLIMMgr::addMessage( { // Added is_announcement parameter //LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg); - LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_announcement); + LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_announcement, keyword_alert); } // Open conversation floater if offline messages are present diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 4b1197900e..209c3919ac 100755 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -241,7 +241,7 @@ public: */ // Added is_announcement parameter //bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true); - bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true, bool is_announcement = false); + bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true, bool is_announcement = false, bool keyword_alert = false); /** * Similar to addMessage(...) above but won't send a signal about a new message added @@ -375,7 +375,8 @@ public: const LLUUID& region_id = LLUUID::null, const LLVector3& position = LLVector3::zero, bool link_name = false, - bool is_announcement = false // Special parameter indicating announcement + bool is_announcement = false, // Special parameter indicating announcement + bool keyword_alert = false // Pass info if keyword alert has been performed ); void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 08c95859a7..7d1971ec3f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2960,9 +2960,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM) chat.mText = buffer; + bool keyword_alert = false; if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) { FSKeywords::notify(chat); + keyword_alert = true; } // @@ -2978,7 +2980,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) parent_estate_id, region_id, position, - true); + true, + false, + keyword_alert); // Old "do not disturb" message behavior: only send once if session not open //if (!gIMMgr->isDNDMessageSend(session_id)) @@ -3093,9 +3097,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM) chat.mText = message; + bool keyword_alert = false; if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) { FSKeywords::notify(chat); + keyword_alert = true; } // @@ -3112,7 +3118,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) parent_estate_id, region_id, position, - true); + true, + false, + keyword_alert); } else { @@ -3666,9 +3674,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM) chat.mText = message; + bool keyword_alert = false; if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) { FSKeywords::notify(chat); + keyword_alert = true; } // @@ -3694,7 +3704,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) parent_estate_id, region_id, position, - true); + true, + false, + keyword_alert); } break;