From 6740b1f4e3ce655021ecc3fe57ea09a38498ff3c Mon Sep 17 00:00:00 2001 From: cinder <cinder@cinderblocks.biz> Date: Thu, 1 Dec 2022 13:23:00 -0600 Subject: [PATCH] Plumb im processing with bonus LLSD payloads --- indra/newview/llimprocessing.cpp | 3 ++- indra/newview/llimview.cpp | 21 ++++++++++++--------- indra/newview/llimview.h | 11 ++++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 151b20db0e5..7538ad7b8d1 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -690,7 +690,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, parent_estate_id, region_id, position, - false + false, + LLSD().with("announcement", true) ); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0054f3166cc..3ec60ea148b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -771,7 +771,8 @@ void LLIMModel::LLIMSession::sessionInitReplyReceived(const LLUUID& new_session_ } } -void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time, const bool is_history) +void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, + const std::string& time, const bool is_history, const LLSD& bonus) { LLSD message; message["from"] = from; @@ -780,6 +781,7 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& f message["time"] = time; message["index"] = (LLSD::Integer)mMsgs.size(); message["is_history"] = is_history; + message["is_announcement"] = bonus.has("announcement"); mMsgs.push_front(message); @@ -1144,7 +1146,7 @@ void LLIMModel::sendNoUnreadMessages(const LLUUID& session_id) mNoUnreadMsgsSignal(arg); } -bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) { +bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const LLSD& bonus) { LLIMSession* session = findIMSession(session_id); @@ -1154,7 +1156,7 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, return false; } - session->addMessage(from, from_id, utf8_text, LLLogChat::timestamp(false)); //might want to add date separately + session->addMessage(from, from_id, utf8_text, LLLogChat::timestamp(false), bonus); //might want to add date separately return true; } @@ -1192,9 +1194,9 @@ 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 */) { + const std::string& utf8_text, bool log2file /* = true */, const LLSD& bonus) { - LLIMSession* session = addMessageSilently(session_id, from, from_id, utf8_text, log2file); + LLIMSession* session = addMessageSilently(session_id, from, from_id, utf8_text, log2file, bonus); if (!session) return false; //good place to add some1 to recent list @@ -1219,7 +1221,7 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co } LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, - const std::string& utf8_text, bool log2file /* = true */) + const std::string& utf8_text, bool log2file /* = true */, const LLSD& bonus) { LLIMSession* session = findIMSession(session_id); @@ -1236,7 +1238,7 @@ LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, from_name = SYSTEM_FROM; } - addToHistory(session_id, from_name, from_id, utf8_text); + addToHistory(session_id, from_name, from_id, utf8_text, bonus); if (log2file) { logToFile(getHistoryFileName(session_id), from_name, from_id, utf8_text); @@ -2703,7 +2705,8 @@ void LLIMMgr::addMessage( U32 parent_estate_id, 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 link_name, // If this is true, then we insert the name and link it to a profile + const LLSD& bonus) { LLUUID other_participant_id = target_id; @@ -2809,7 +2812,7 @@ void LLIMMgr::addMessage( if (!LLMuteList::getInstanceFast()->isMuted(other_participant_id, LLMute::flagTextChat)) // [/SL:KB] { - LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg); + LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, bonus); } // Open conversation floater if offline messages are present diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index bece07b19f9..de72e7a256c 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -91,7 +91,7 @@ class LLIMModel final : public LLSingleton<LLIMModel> void sessionInitReplyReceived(const LLUUID& new_session_id); void addMessagesFromHistory(const std::list<LLSD>& history); - void addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time, const bool is_history = false); + void addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time, const bool is_history = false, const LLSD& bonus = LLSD()); void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction); /** @deprecated */ @@ -226,13 +226,13 @@ class LLIMModel final : public LLSingleton<LLIMModel> * and also saved into a file if log2file is specified. * It sends new message signal for each added message. */ - 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, const LLSD& bonus = LLSD()); /** * Similar to addMessage(...) above but won't send a signal about a new message added */ LLIMModel::LLIMSession* addMessageSilently(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, - const std::string& utf8_text, bool log2file = true); + const std::string& utf8_text, bool log2file = true, const LLSD& bonus = LLSD()); /** * Add a system message to an IM Model @@ -310,7 +310,7 @@ class LLIMModel final : public LLSingleton<LLIMModel> /** * Add message to a list of message associated with session specified by session_id */ - bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text); + bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const LLSD& bonus = LLSD()); }; @@ -352,7 +352,8 @@ class LLIMMgr final : public LLSingleton<LLIMMgr> U32 parent_estate_id = 0, const LLUUID& region_id = LLUUID::null, const LLVector3& position = LLVector3::zero, - bool link_name = false); + bool link_name = false, + const LLSD& bonus = LLSD()); void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args); -- GitLab