summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-07 13:37:37 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-07 13:37:37 +0100
commit4533d1b59b2e8fc534ad3de7a896aaa8514fe653 (patch)
tree38b4d2398d66a0e18cd8e4dcd47efba0ad5326a1 /indra/newview/llimview.cpp
parent92f630871386bafc4548eb9beb45063e40b6139c (diff)
parentadce2ecdf8f3a0efcd4907699d286012124ac496 (diff)
merge from viewer-trunk
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp158
1 files changed, 62 insertions, 96 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index f748603bfa..e0f155a6a9 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2,25 +2,31 @@
* @file LLIMMgr.cpp
* @brief Container for Instant Messaging
*
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
@@ -37,7 +43,6 @@
#include "llhttpclient.h"
#include "llsdutil_math.h"
#include "llstring.h"
-#include "lltextutil.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
@@ -60,6 +65,7 @@
#include "llnearbychat.h"
#include "llspeakers.h" //for LLIMSpeakerMgr
#include "lltextbox.h"
+#include "lltextutil.h"
#include "llviewercontrol.h"
#include "llviewerparcelmgr.h"
@@ -251,8 +257,9 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction)
{
- std::string you_joined_call = LLTrans::getString("you_joined_call");
- std::string you_started_call = LLTrans::getString("you_started_call");
+ std::string you = LLTrans::getString("You");
+ std::string started_call = LLTrans::getString("started_call");
+ std::string joined_call = LLTrans::getString("joined_call");
std::string other_avatar_name = "";
std::string message;
@@ -270,15 +277,13 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
switch(new_state)
{
case LLVoiceChannel::STATE_CALL_STARTED :
- {
- LLStringUtil::format_map_t string_args;
- string_args["[NAME]"] = other_avatar_name;
- message = LLTrans::getString("name_started_call", string_args);
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
- break;
- }
+ message = other_avatar_name + " " + started_call;
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
+
+ break;
case LLVoiceChannel::STATE_CONNECTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
+ message = you + " " + joined_call;
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
default:
break;
}
@@ -288,10 +293,11 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
switch(new_state)
{
case LLVoiceChannel::STATE_CALL_STARTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
+ message = you + " " + started_call;
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
break;
case LLVoiceChannel::STATE_CONNECTED :
- message = LLTrans::getString("answered_call");
+ message = other_avatar_name + " " + joined_call;
LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
default:
break;
@@ -306,7 +312,8 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
switch(new_state)
{
case LLVoiceChannel::STATE_CONNECTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
+ message = you + " " + joined_call;
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
default:
break;
}
@@ -316,7 +323,8 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
switch(new_state)
{
case LLVoiceChannel::STATE_CALL_STARTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
+ message = you + " " + started_call;
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
break;
default:
break;
@@ -336,13 +344,13 @@ LLIMModel::LLIMSession::~LLIMSession()
mSpeakers = NULL;
// End the text IM session if necessary
- if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
+ if(gVoiceClient && mOtherParticipantID.notNull())
{
switch(mType)
{
case IM_NOTHING_SPECIAL:
case IM_SESSION_P2P_INVITE:
- LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
+ gVoiceClient->endUserIMSession(mOtherParticipantID);
break;
default:
@@ -917,7 +925,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
{
// User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice.
- sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
+ sent = gVoiceClient->sendTextMessage(other_participant_id, utf8_text);
}
if(!sent)
@@ -1016,14 +1024,6 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
}
else
{
- // IM_SESSION_INVITE means that this is an Ad-hoc incoming chat
- // (it can be also Group chat but it is checked above)
- // In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added
- // to Recent People to prevent showing of an item with (???)(???). See EXT-8246.
- // Concrete participants will be added into this list once they sent message in chat.
- if (IM_SESSION_INVITE == dialog) return;
-
- // implemented adding of all participants of an outgoing to Recent People List. See EXT-5694.
for(uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();
it!=session->mInitialTargetIDs.end();++it)
{
@@ -1459,13 +1459,7 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
}
sSession = session;
-
- static boost::signals2::connection prev_channel_state_changed_connection;
- // disconnect previously connected callback to avoid have invalid sSession in onVoiceChannelStateChanged()
- prev_channel_state_changed_connection.disconnect();
- prev_channel_state_changed_connection =
- sSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
-
+ sSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
if(sCurrentSessionlName != session->mName)
{
sPreviousSessionlName = sCurrentSessionlName;
@@ -1719,10 +1713,11 @@ void LLOutgoingCallDialog::show(const LLSD& key)
channel_name = LLTextUtil::formatPhoneNumber(channel_name);
}
childSetTextArg("nearby", "[VOICE_CHANNEL_NAME]", channel_name);
+ childSetTextArg("nearby_P2P_by_other", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString());
// skipping "You will now be reconnected to nearby" in notification when call is ended by disabling voice,
// so no reconnection to nearby chat happens (EXT-4397)
- bool voice_works = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+ bool voice_works = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
std::string reconnect_nearby = voice_works ? LLTrans::getString("reconnect_nearby") : std::string();
childSetTextArg("nearby", "[RECONNECT_NEARBY]", reconnect_nearby);
@@ -1767,8 +1762,6 @@ void LLOutgoingCallDialog::show(const LLSD& key)
getChild<LLTextBox>("leaving")->setVisible(true);
}
break;
- // STATE_READY is here to show appropriate text for ad-hoc and group calls when floater is shown(EXT-6893)
- case LLVoiceChannel::STATE_READY :
case LLVoiceChannel::STATE_RINGING :
if(show_oldchannel)
{
@@ -1849,8 +1842,8 @@ LLCallDialog(payload)
void LLIncomingCallDialog::onLifetimeExpired()
{
- std::string session_handle = mPayload["session_handle"].asString();
- if (LLVoiceClient::getInstance()->isValidChannel(session_handle))
+ // check whether a call is valid or not
+ if (LLVoiceClient::getInstance()->findSession(mPayload["caller_id"].asUUID()))
{
// restart notification's timer if call is still valid
mLifetimeTimer.start();
@@ -1900,6 +1893,8 @@ BOOL LLIncomingCallDialog::postBuild()
// check to see if this is an Avaline call
bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
+ childSetVisible("Start IM", is_avatar); // no IM for avaline
+
if (caller_name == "anonymous")
{
caller_name = getString("anonymous");
@@ -1931,10 +1926,6 @@ BOOL LLIncomingCallDialog::postBuild()
mLifetimeTimer.stop();
}
- //it's not possible to connect to existing Ad-Hoc/Group chat through incoming ad-hoc call
- //and no IM for avaline
- childSetVisible("Start IM", is_avatar && notify_box_type != "VoiceInviteAdHoc" && notify_box_type != "VoiceInviteGroup");
-
setCanDrag(FALSE);
return TRUE;
@@ -1945,24 +1936,15 @@ void LLIncomingCallDialog::onOpen(const LLSD& key)
{
LLCallDialog::onOpen(key);
- LLStringUtil::format_map_t args;
- LLGroupData data;
- // if it's a group call, retrieve group name to use it in question
- if (gAgent.getGroupData(key["session_id"].asUUID(), data))
- {
- args["[GROUP]"] = data.mName;
- }
// tell the user which voice channel they would be leaving
LLVoiceChannel *voice = LLVoiceChannel::getCurrentVoiceChannel();
if (voice && !voice->getSessionName().empty())
{
- args["[CURRENT_CHAT]"] = voice->getSessionName();
- childSetText("question", getString(key["question_type"].asString(), args));
+ childSetTextArg("question", "[CURRENT_CHAT]", voice->getSessionName());
}
else
{
- args["[CURRENT_CHAT]"] = getString("localchat");
- childSetText("question", getString(key["question_type"].asString(), args));
+ childSetTextArg("question", "[CURRENT_CHAT]", getString("localchat"));
}
}
@@ -2080,9 +2062,8 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
// send notification message to the corresponding chat
if (mPayload["notify_box_type"].asString() == "VoiceInviteGroup" || mPayload["notify_box_type"].asString() == "VoiceInviteAdHoc")
{
- LLStringUtil::format_map_t string_args;
- string_args["[NAME]"] = mPayload["caller_name"].asString();
- std::string message = LLTrans::getString("name_started_call", string_args);
+ std::string started_call = LLTrans::getString("started_call");
+ std::string message = mPayload["caller_name"].asString() + " " + started_call;
LLIMModel::getInstance()->addMessageSilently(session_id, SYSTEM_FROM, LLUUID::null, message);
}
}
@@ -2096,10 +2077,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
{
if (type == IM_SESSION_P2P_INVITE)
{
- if(LLVoiceClient::getInstance())
+ if(gVoiceClient)
{
std::string s = mPayload["session_handle"].asString();
- LLVoiceClient::getInstance()->declineInvite(s);
+ gVoiceClient->declineInvite(s);
}
}
else
@@ -2187,8 +2168,11 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
{
if (type == IM_SESSION_P2P_INVITE)
{
- std::string s = payload["session_handle"].asString();
- LLVoiceClient::getInstance()->declineInvite(s);
+ if(gVoiceClient)
+ {
+ std::string s = payload["session_handle"].asString();
+ gVoiceClient->declineInvite(s);
+ }
}
else
{
@@ -2315,20 +2299,12 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
}
else // going to IM session
{
- message = LLTrans::getString(message_name + "-im");
- message.setArgs(args);
if (hasSession(session_id))
{
+ message = LLTrans::getString(message_name + "-im");
+ message.setArgs(args);
gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString());
}
- // log message to file
- else
- {
- std::string session_name;
- // since we select user to share item with - his name is already in cache
- gCacheName->getFullName(args["user_id"], session_name);
- LLIMModel::instance().logToFile(session_name, SYSTEM_FROM, LLUUID::null, message.getString());
- }
}
}
@@ -2501,8 +2477,6 @@ void LLIMMgr::inviteToSession(
}
std::string notify_box_type;
- // voice invite question is different from default only for group call (EXT-7118)
- std::string question_type = "VoiceInviteQuestionDefault";
BOOL ad_hoc_invite = FALSE;
if(type == IM_SESSION_P2P_INVITE)
@@ -2514,7 +2488,6 @@ void LLIMMgr::inviteToSession(
{
//only really old school groups have voice invitations
notify_box_type = "VoiceInviteGroup";
- question_type = "VoiceInviteQuestionGroup";
}
else if ( inv_type == INVITATION_TYPE_VOICE )
{
@@ -2539,7 +2512,6 @@ void LLIMMgr::inviteToSession(
payload["session_handle"] = session_handle;
payload["session_uri"] = session_uri;
payload["notify_box_type"] = notify_box_type;
- payload["question_type"] = question_type;
LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
if (channelp && channelp->callStarted())
@@ -2767,12 +2739,6 @@ bool LLIMMgr::endCall(const LLUUID& session_id)
if (!voice_channel) return false;
voice_channel->deactivate();
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
- if (im_session)
- {
- // need to update speakers' state
- im_session->mSpeakers->update(FALSE);
- }
return true;
}
@@ -3112,7 +3078,7 @@ public:
return;
}
- if(!LLVoiceClient::getInstance()->voiceEnabled() || !LLVoiceClient::getInstance()->isVoiceWorking())
+ if(!LLVoiceClient::voiceEnabled())
{
// Don't display voice invites unless the user has voice enabled.
return;