summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2009-12-03 09:17:51 -0800
committerNat Goodspeed <nat@lindenlab.com>2009-12-03 09:17:51 -0800
commit5fd2938da8d6709a6596833088fd83c60d591507 (patch)
tree9186f79b996eb60a9bb1f5cefada86c0596ac850 /indra/newview/llimview.cpp
parent97f97f286ccca1f736c575f516a61c6a32787807 (diff)
parent57b68d9bfe25fc7b9efe41a9fa30935c156acb34 (diff)
Merge with recent viewer-2-0
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp84
1 files changed, 62 insertions, 22 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 2f88578739..5481ca97cd 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -83,19 +83,16 @@
#include "llfirstuse.h"
#include "llagentui.h"
+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");
+
//
// Globals
//
LLIMMgr* gIMMgr = NULL;
-//
-// Statics
-//
-// *FIXME: make these all either UIStrings or Strings
-
-const static std::string IM_SEPARATOR(": ");
-
-
void toast_callback(const LLSD& msg){
// do not show toast in busy mode or it goes from agent
if (gAgent.getBusy() || gAgent.getID() == msg["from_id"])
@@ -193,7 +190,13 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
}
if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
- LLLogChat::loadHistory(mName, &chatFromLogFile, (void *)this);
+ {
+ std::list<LLSD> chat_history;
+
+ //involves parsing of a chat history
+ LLLogChat::loadAllHistory(mName, chat_history);
+ addMessagesFromHistory(chat_history);
+ }
}
void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
@@ -233,6 +236,12 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
break;
}
}
+
+ // Update speakers list when connected
+ if (LLVoiceChannel::STATE_CONNECTED == new_state)
+ {
+ mSpeakers->update(true);
+ }
}
else // group || ad-hoc calls
{
@@ -297,6 +306,30 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& f
}
}
+void LLIMModel::LLIMSession::addMessagesFromHistory(const std::list<LLSD>& 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);
+ }
+
+
+ std::string timestamp = msg[IM_TIME];
+ std::string text = msg[IM_TEXT];
+
+ addMessage(from, from_id, text, timestamp);
+
+ it++;
+ }
+}
+
void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata)
{
if (!userdata) return;
@@ -445,6 +478,19 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from,
return true;
}
+bool LLIMModel::logToFile(const std::string& session_name, const std::string& from, const LLUUID& from_id, const std::string& utf8_text)
+{
+ if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
+ {
+ LLLogChat::saveHistory(session_name, from, from_id, utf8_text);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text)
{
if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
@@ -476,8 +522,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 */)
-{
+ const std::string& utf8_text, bool log2file /* = true */) {
LLIMSession* session = findIMSession(session_id);
if (!session)
@@ -486,7 +531,10 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
return false;
}
- addMessageSilently(*session, from, from_id, utf8_text, log2file);
+ addToHistory(session_id, from, from_id, utf8_text);
+ if (log2file) logToFile(session_id, from, from_id, utf8_text);
+
+ session->mNumUnread++;
// notify listeners
LLSD arg;
@@ -501,15 +549,6 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
return true;
}
-void LLIMModel::addMessageSilently(LLIMSession& session, const std::string& from, const LLUUID& from_id,
- const std::string& utf8_text, bool log2file /* = true */)
-{
- addToHistory(session.mSessionID, from, from_id, utf8_text);
- if (log2file) logToFile(session.mSessionID, from, from_id, utf8_text);
-
- session.mNumUnread++;
-}
-
const std::string& LLIMModel::getName(const LLUUID& session_id) const
{
@@ -1336,7 +1375,8 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
session_id = gIMMgr->addP2PSession(
mPayload["session_name"].asString(),
mPayload["caller_id"].asUUID(),
- mPayload["session_handle"].asString());
+ mPayload["session_handle"].asString(),
+ mPayload["session_uri"].asString());
if (voice)
{