summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychat.cpp
diff options
context:
space:
mode:
authorIgor Borovkov <iborovkov@productengine.com>2010-02-02 14:39:28 +0200
committerIgor Borovkov <iborovkov@productengine.com>2010-02-02 14:39:28 +0200
commit5faa8b44d557756425e8442b6dac7e7512861f2b (patch)
tree92539df0f13b7ebd02e31139fe0ab6c071ebe0e7 /indra/newview/llnearbychat.cpp
parent0e9bf5e3e5db3f059ac2534dfc8d1eeacd268d07 (diff)
parent0763fac7653d0c280ed2fd808f2c1bb594c2e804 (diff)
merge
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llnearbychat.cpp')
-rw-r--r--indra/newview/llnearbychat.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 90482eb74d..49ab61556f 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)
@@ -194,6 +200,18 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
mMessageArchive.push_back(chat);
if(mMessageArchive.size()>200)
mMessageArchive.erase(mMessageArchive.begin());
+
+ if (gSavedPerAccountSettings.getBOOL("LogChat"))
+ {
+ if (chat.mChatType != CHAT_TYPE_WHISPER && chat.mChatType != CHAT_TYPE_SHOUT)
+ {
+ LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText);
+ }
+ else
+ {
+ LLLogChat::saveHistory("chat", "", chat.mFromID, chat.mFromName + " " + chat.mText);
+ }
+ }
}
}
@@ -262,6 +280,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 +329,4 @@ void LLNearbyChat::onFocusLost()
setBackgroundOpaque(false);
LLPanel::onFocusLost();
}
+