From 57fca109cae3105b6bc1319e9886c16631bc7374 Mon Sep 17 00:00:00 2001
From: Steven Bennetts <steve@lindenlab.com>
Date: Wed, 21 Oct 2009 04:50:52 +0000
Subject: Merging revisions 2107-2109 of
 https://svn.aws.productengine.com/secondlife/pe/stable-2 into
 P:\svn\viewer-2.0.0, respecting ancestry * Bugs: EXT-1557

---
 indra/newview/llimpanel.cpp     | 16 ++--------
 indra/newview/llimpanel.h       |  2 --
 indra/newview/llimview.cpp      | 65 +++++++++++++++++++++--------------------
 indra/newview/llimview.h        | 12 ++++++++
 indra/newview/llpanelavatar.cpp |  4 +--
 5 files changed, 49 insertions(+), 50 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 0ff3bd24e9..ead74b72bf 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -951,7 +951,6 @@ LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label,
 	mSentTypingState(TRUE),
 	mNumUnreadMessages(0),
 	mShowSpeakersOnConnect(TRUE),
-	mAutoConnect(FALSE),
 	mTextIMPossible(TRUE),
 	mProfileButtonEnabled(TRUE),
 	mCallBackEnabled(TRUE),
@@ -1179,12 +1178,6 @@ void LLFloaterIMPanel::draw()
 		mInputEditor->setLabel(getString("default_text_label"));
 	}
 
-	if (mAutoConnect && enable_connect)
-	{
-		onClickStartCall(this);
-		mAutoConnect = FALSE;
-	}
-
 	// show speakers window when voice first connects
 	if (mShowSpeakersOnConnect && voice_channel->isActive())
 	{
@@ -1525,7 +1518,7 @@ void LLFloaterIMPanel::onClickStartCall(void* userdata)
 {
 	LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
 
-	LLIMModel::getInstance()->getVoiceChannel(self->mSessionUUID)->activate();
+	gIMMgr->startCall(self->mSessionUUID);
 }
 
 // static
@@ -1533,7 +1526,7 @@ void LLFloaterIMPanel::onClickEndCall(void* userdata)
 {
 	LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
 
-	LLIMModel::getInstance()->getVoiceChannel(self->mSessionUUID)->deactivate();
+	gIMMgr->endCall(self->mSessionUUID);
 }
 
 // static
@@ -1712,11 +1705,6 @@ void LLFloaterIMPanel::sessionInitReplyReceived(const LLUUID& session_id)
 	}
 }
 
-void LLFloaterIMPanel::requestAutoConnect()
-{
-	mAutoConnect = TRUE;
-}
-
 void LLFloaterIMPanel::setTyping(BOOL typing)
 {
 	LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h
index 57379b2c0d..af50362f00 100644
--- a/indra/newview/llimpanel.h
+++ b/indra/newview/llimpanel.h
@@ -336,8 +336,6 @@ private:
 
 	BOOL mShowSpeakersOnConnect;
 
-	BOOL mAutoConnect;
-	
 	BOOL mTextIMPossible;
 	BOOL mProfileButtonEnabled;
 	BOOL mCallBackEnabled;
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 6aa6c3f461..20b9cc1f8b 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -854,23 +854,18 @@ public:
 				//in case of race conditions
 				speaker_mgr->updateSpeakers(gIMMgr->getPendingAgentListUpdates(mSessionID));
 			}
-			
-			LLFloaterIMPanel* floaterp =
-				gIMMgr->findFloaterBySession(mSessionID);
 
-			if (floaterp)
+			if (LLIMMgr::INVITATION_TYPE_VOICE == mInvitiationType)
 			{
-				if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_VOICE )
-				{
-					floaterp->requestAutoConnect();
-					LLFloaterIMPanel::onClickStartCall(floaterp);
-					// always open IM window when connecting to voice
-					LLFloaterReg::showInstance("communicate", LLSD(), TRUE);
-				}
-				else if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE )
-				{
-					LLFloaterReg::showInstance("communicate", LLSD(), TRUE);
-				}
+				gIMMgr->startCall(mSessionID);
+			}
+
+			if ((mInvitiationType == LLIMMgr::INVITATION_TYPE_VOICE 
+				|| mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE)
+				&& LLIMModel::getInstance()->findIMSession(mSessionID))
+			{
+				// always open IM window when connecting to voice
+				LLIMFloater::show(mSessionID);
 			}
 
 			gIMMgr->clearPendingAgentListUpdates(mSessionID);
@@ -1041,20 +1036,13 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
 
 			if (voice)
 			{
-				LLFloaterIMPanel* im_floater =
-					gIMMgr->findFloaterBySession(
-						session_id);
-
-				if (im_floater)
+				if (gIMMgr->startCall(session_id))
 				{
-					im_floater->requestAutoConnect();
-					LLFloaterIMPanel::onClickStartCall(im_floater);		
+					// always open IM window when connecting to voice
+					LLIMFloater::show(session_id);
 				}
 			}
 
-			// always open IM window when connecting to voice
-			LLFloaterReg::showInstance("communicate", session_id);
-
 			gIMMgr->clearPendingAgentListUpdates(session_id);
 			gIMMgr->clearPendingInvitation(session_id);
 		}
@@ -1159,15 +1147,10 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
 					payload["session_handle"].asString(),
 					payload["session_uri"].asString());
 
-				LLFloaterIMPanel* im_floater =
-					gIMMgr->findFloaterBySession(
-						session_id);
-				if (im_floater)
+				if (gIMMgr->startCall(session_id))
 				{
-					im_floater->requestAutoConnect();
-					LLFloaterIMPanel::onClickStartCall(im_floater);
 					// always open IM window when connecting to voice
-					LLFloaterReg::showInstance("communicate", session_id, TRUE);
+					LLIMFloater::show(session_id);
 				}
 
 				gIMMgr->clearPendingAgentListUpdates(session_id);
@@ -1905,6 +1888,24 @@ void LLIMMgr::removeSessionObserver(LLIMSessionObserver *observer)
 	mSessionObservers.remove(observer);
 }
 
+bool LLIMMgr::startCall(const LLUUID& session_id)
+{
+	LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
+	if (!voice_channel) return false;
+	
+	voice_channel->activate();
+	return true;
+}
+
+bool LLIMMgr::endCall(const LLUUID& session_id)
+{
+	LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
+	if (!voice_channel) return false;
+
+	voice_channel->deactivate();
+	return true;
+}
+
 // create a floater and update internal representation for
 // consistency. Returns the pointer, caller (the class instance since
 // it is a private method) is not responsible for deleting the
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 84646a9a6f..d98b5ca297 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -282,6 +282,18 @@ public:
 	void addSessionObserver(LLIMSessionObserver *);
 	void removeSessionObserver(LLIMSessionObserver *);
 
+	/**
+	 * Start call in a session
+	 * @return false if voice channel doesn't exist
+	 **/
+	bool startCall(const LLUUID& session_id);
+
+	/**
+	 * End call in a session
+	 * @return false if voice channel doesn't exist
+	 **/
+	bool endCall(const LLUUID& session_id);
+
 private:
 	// create a panel and update internal representation for
 	// consistency. Returns the pointer, caller (the class instance
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 7670a5120c..1a2ef8e1bb 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -336,10 +336,10 @@ BOOL LLPanelAvatarProfile::postBuild()
 	childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL);
 
 	LLTextureCtrl* pic = getChild<LLTextureCtrl>("2nd_life_pic");
-	pic->setFallbackImageName("default_land_picture.j2c");
+	pic->setFallbackImageName("default_profile_picture.j2c");
 
 	pic = getChild<LLTextureCtrl>("real_world_pic");
-	pic->setFallbackImageName("default_land_picture.j2c");
+	pic->setFallbackImageName("default_profile_picture.j2c");
 
 	resetControls();
 	resetData();
-- 
cgit v1.2.3