diff options
author | Igor Borovkov <iborovkov@productengine.com> | 2010-02-02 14:19:15 +0200 |
---|---|---|
committer | Igor Borovkov <iborovkov@productengine.com> | 2010-02-02 14:19:15 +0200 |
commit | f69510e20c14f8afbdaa9fad06f7dbb2ba09b774 (patch) | |
tree | abeeba79b3cdce11e8d0f51ca592b2792ec34fec /indra/newview/llnearbychat.cpp | |
parent | e43d0f18150ee2fae4c1533e643ace5d7e5813f2 (diff) |
added loading/parsing of Nearby Chat history - EXT-4777 Implement saving and loading chat history for Nearby Chat (both plain text and widgeted chat)
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llnearbychat.cpp')
-rw-r--r-- | indra/newview/llnearbychat.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 90482eb74d..1dcb6abf81 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -62,6 +62,12 @@ static const S32 RESIZE_BAR_THICKNESS = 3; +const static std::string IM_TIME("time"); +const static std::string IM_TEXT("message"); +const static std::string IM_FROM("from"); +const static std::string IM_FROM_ID("from_id"); + + LLNearbyChat::LLNearbyChat(const LLSD& key) : LLDockableFloater(NULL, false, false, key) ,mChatHistory(NULL) @@ -262,6 +268,39 @@ void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue) nearby_chat->updateChatHistoryStyle(); } +void LLNearbyChat::loadHistory() +{ + std::list<LLSD> history; + LLLogChat::loadAllHistory("chat", history); + + std::list<LLSD>::const_iterator it = history.begin(); + while (it != history.end()) + { + const LLSD& msg = *it; + + std::string from = msg[IM_FROM]; + LLUUID from_id = LLUUID::null; + if (msg[IM_FROM_ID].isUndefined()) + { + gCacheName->getUUID(from, from_id); + } + + LLChat chat; + chat.mFromName = from; + chat.mFromID = from_id; + chat.mText = msg[IM_TEXT]; + chat.mTimeStr = msg[IM_TIME]; + addMessage(chat); + + it++; + } +} + +//static +LLNearbyChat* LLNearbyChat::getInstance() +{ + return LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); +} //////////////////////////////////////////////////////////////////////////////// // @@ -278,3 +317,4 @@ void LLNearbyChat::onFocusLost() setBackgroundOpaque(false); LLPanel::onFocusLost(); } + |