diff options
author | simon <simon@lindenlab.com> | 2023-02-13 15:19:27 -0800 |
---|---|---|
committer | simon <simon@lindenlab.com> | 2023-02-13 15:19:27 -0800 |
commit | f257ee7d3c7464b8aee3bf8c5f5c84cd278836cc (patch) | |
tree | 2981d9b20321e2502d20568c85606415fd8ffb33 /indra/newview/llimview.h | |
parent | f60f12d94ebe3862f5b1eef55795dabc0ba72693 (diff) |
SL-18268 - Viewer update to read group chat history.
Feature described at https://community.secondlife.com/blogs/entry/12652-coming-soon-to-a-viewer-near-you-group-chat-history/
Diffstat (limited to 'indra/newview/llimview.h')
-rw-r--r-- | indra/newview/llimview.h | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 5e99cc7fca..946eb02f26 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -42,6 +42,7 @@ class LLAvatarName; class LLFriendObserver; class LLCallDialogManager; class LLIMSpeakerMgr; + /** * Timeout Timer for outgoing Ad-Hoc/Group IM sessions which being initialized by the server */ @@ -63,11 +64,14 @@ private: class LLIMModel : public LLSingleton<LLIMModel> { LLSINGLETON(LLIMModel); + public: - struct LLIMSession : public boost::signals2::trackable + typedef std::list<LLSD> chat_message_list_t; + + struct LLIMSession : public boost::signals2::trackable { - typedef enum e_session_type + typedef enum e_session_type { // for now we have 4 predefined types for a session P2P_SESSION, GROUP_SESSION, @@ -75,15 +79,23 @@ public: NONE_SESSION, } SType; - LLIMSession(const LLUUID& session_id, const std::string& name, + LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg); virtual ~LLIMSession(); 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, bool is_region_msg = false); - void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction); - + void addMessagesFromHistoryCache(const std::list<LLSD>& history); // From local file + void addMessagesFromServerHistory(const LLSD& history, const std::string& target_from, const std::string& target_message, U32 timestamp); // From chat server + void addMessage(const std::string& from, + const LLUUID& from_id, + const std::string& utf8_text, + const std::string& time, + const bool is_history, + const bool is_region_msg, + U32 timestamp); + + void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction); + /** @deprecated */ static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata); @@ -112,6 +124,10 @@ public: uuid_vec_t mInitialTargetIDs; std::string mHistoryFileName; + // Saved messages from the last minute of history read from the local group chat cache file + std::string mLastHistoryCacheDateTime; + chat_message_list_t mLastHistoryCacheMsgs; + // connection to voice channel state change signal boost::signals2::connection mVoiceChannelStateChangeConnection; @@ -121,7 +137,7 @@ public: // does include all incoming messages S32 mNumUnread; - std::list<LLSD> mMsgs; + chat_message_list_t mMsgs; LLVoiceChannel* mVoiceChannel; LLIMSpeakerMgr* mSpeakers; @@ -208,14 +224,27 @@ public: * and also saved into a file if log2file is specified. * It sends new message signal for each added message. */ - void addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, bool log2file = true, bool is_region_msg = false); - void processAddingMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, bool log2file = true, bool is_region_msg = false); + void addMessage(const LLUUID& session_id, + const std::string& from, + const LLUUID& other_participant_id, + const std::string& utf8_text, + bool log2file = true, + bool is_region_msg = false, + U32 time_stamp = 0); + + void processAddingMessage(const LLUUID& session_id, + const std::string& from, + const LLUUID& from_id, + const std::string& utf8_text, + bool log2file, + bool is_region_msg, + U32 time_stamp); /** * 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, bool is_region_msg = false); + LLIMModel::LLIMSession* addMessageSilently(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, + const std::string& utf8_text, bool log2file = true, bool is_region_msg = false, U32 timestamp = 0); /** * Add a system message to an IM Model @@ -223,15 +252,15 @@ public: void proccessOnlineOfflineNotification(const LLUUID& session_id, const std::string& utf8_text); /** - * Get a session's name. - * For a P2P chat - it's an avatar's name, + * Get a session's name. + * For a P2P chat - it's an avatar's name, * For a group chat - it's a group's name * For an incoming ad-hoc chat - is received from the server and is in a from of "<Avatar's name> Conference" * It is updated in LLIMModel::LLIMSession's constructor to localize the "Conference". */ const std::string getName(const LLUUID& session_id) const; - /** + /** * Get number of unread messages in a session with session_id * Returns -1 if the session with session_id doesn't exist */ @@ -283,7 +312,7 @@ public: bool logToFile(const std::string& file_name, const std::string& from, const LLUUID& from_id, const std::string& utf8_text); private: - + /** * Populate supplied std::list with messages starting from index specified by start_index without * emitting no unread messages signal. @@ -293,7 +322,7 @@ private: /** * 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 is_region_msg = false); + bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, bool is_region_msg, U32 timestamp); }; @@ -335,7 +364,8 @@ public: U32 parent_estate_id = 0, const LLUUID& region_id = LLUUID::null, const LLVector3& position = LLVector3::zero, - bool is_region_msg = false); + bool is_region_msg = false, + U32 timestamp = 0); void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args); |