summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp90
1 files changed, 80 insertions, 10 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index ffa943092f..be719c0a78 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -70,6 +70,8 @@
#include "lltoolbar.h"
#include "llviewermessage.h"
#include "llviewerwindow.h"
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
#include "llnotify.h"
#include "llnearbychat.h"
#include "llviewerregion.h"
@@ -120,7 +122,7 @@ void toast_callback(const LLSD& msg){
args["FROM_ID"] = msg["from_id"];
args["SESSION_ID"] = msg["session_id"];
- LLNotifications::instance().add("IMToast", args, LLSD(), boost::bind(&LLIMFloater::show, msg["session_id"].asUUID()));
+ LLNotificationsUtil::add("IMToast", args, LLSD(), boost::bind(&LLIMFloater::show, msg["session_id"].asUUID()));
}
void LLIMModel::setActiveSessionID(const LLUUID& session_id)
@@ -163,6 +165,11 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
{
mVoiceChannel = new LLVoiceChannelGroup(session_id, name);
}
+
+ if(mVoiceChannel)
+ {
+ mVoiceChannel->setStateChangedCallback(boost::bind(&LLIMSession::onVoiceChannelStateChanged, this, _1, _2));
+ }
mSpeakers = new LLIMSpeakerMgr(mVoiceChannel);
// All participants will be added to the list of people we've recently interacted with.
@@ -189,6 +196,56 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
LLLogChat::loadHistory(mName, &chatFromLogFile, (void *)this);
}
+void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
+{
+ bool is_p2p_session = dynamic_cast<LLVoiceChannelP2P*>(mVoiceChannel);
+ bool is_incoming_call = false;
+ std::string other_avatar_name;
+
+ if(is_p2p_session)
+ {
+ is_incoming_call = static_cast<LLVoiceChannelP2P*>(mVoiceChannel)->isIncomingCall();
+ gCacheName->getFullName(mOtherParticipantID, other_avatar_name);
+
+ if(is_incoming_call)
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, other_avatar_name, mOtherParticipantID, "Started a voice call");
+ break;
+ case LLVoiceChannel::STATE_CONNECTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, "You", gAgent.getID(), "Joined the voice call");
+ default:
+ break;
+ }
+ }
+ else // outgoing call
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, "You", gAgent.getID(), "Started a voice call");
+ break;
+ case LLVoiceChannel::STATE_CONNECTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, other_avatar_name, mOtherParticipantID, "Joined the voice call");
+ default:
+ break;
+ }
+ }
+
+ // Update speakers list when connected
+ if (LLVoiceChannel::STATE_CONNECTED == new_state)
+ {
+ mSpeakers->update(true);
+ }
+ }
+ else // group || ad-hoc calls
+ {
+
+ }
+}
+
LLIMModel::LLIMSession::~LLIMSession()
{
delete mSpeakers;
@@ -394,6 +451,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"))
@@ -428,7 +498,7 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
const std::string& utf8_text, bool log2file /* = true */) {
LLIMSession* session = findIMSession(session_id);
- if (!session)
+ if (!session)
{
llwarns << "session " << session_id << "does not exist " << llendl;
return false;
@@ -1015,7 +1085,7 @@ LLIMMgr::showSessionStartError(
LLSD payload;
payload["session_id"] = session_id;
- LLNotifications::instance().add(
+ LLNotificationsUtil::add(
"ChatterBoxSessionStartError",
args,
payload,
@@ -1038,7 +1108,7 @@ LLIMMgr::showSessionEventError(
LLTrans::getString(event_string);
args["RECIPIENT"] = floater->getTitle();
- LLNotifications::instance().add(
+ LLNotificationsUtil::add(
"ChatterBoxSessionEventError",
args);
}
@@ -1059,7 +1129,7 @@ LLIMMgr::showSessionForceClose(
LLSD payload;
payload["session_id"] = session_id;
- LLNotifications::instance().add(
+ LLNotificationsUtil::add(
"ForceCloseChatterBoxSession",
args,
payload,
@@ -1148,7 +1218,7 @@ BOOL LLOutgoingCallDialog::postBuild()
childSetAction("Cancel", onCancel, this);
// dock the dialog to the sys well, where other sys messages appear
- setDockControl(new LLDockControl(LLBottomTray::getInstance()->getSysWell(),
+ setDockControl(new LLDockControl(LLBottomTray::getInstance()->getChild<LLPanel>("speak_panel"),
this, getDockTongue(), LLDockControl::TOP,
boost::bind(&LLOutgoingCallDialog::getAllowedRect, this, _1)));
@@ -1225,7 +1295,7 @@ void LLIncomingCallDialog::onOpen(const LLSD& key)
}
// dock the dialog to the sys well, where other sys messages appear
- setDockControl(new LLDockControl(LLBottomTray::getInstance()->getSysWell(),
+ setDockControl(new LLDockControl(LLBottomTray::getInstance()->getChild<LLPanel>("speak_panel"),
this, getDockTongue(), LLDockControl::TOP,
boost::bind(&LLIncomingCallDialog::getAllowedRect, this, _1)));
}
@@ -1363,7 +1433,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
LLUUID session_id = payload["session_id"].asUUID();
EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch(option)
{
case 0: // accept
@@ -1876,7 +1946,7 @@ void LLIMMgr::inviteToSession(
args["NAME"] = caller_name;
args["GROUP"] = session_name;
- LLNotifications::instance().add(notify_box_type, args, payload, &inviteUserResponse);
+ LLNotificationsUtil::add(notify_box_type, args, payload, &inviteUserResponse);
}
}
mPendingInvitations[session_id.asString()] = LLSD();
@@ -1899,7 +1969,7 @@ void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::stri
LLSD args;
args["NAME"] = payload["caller_name"].asString();
- LLNotifications::instance().add(
+ LLNotificationsUtil::add(
payload["notify_box_type"].asString(),
args,
payload,