diff options
| author | Tofu Linden <tofu.linden@lindenlab.com> | 2009-11-11 17:00:30 +0000 | 
|---|---|---|
| committer | Tofu Linden <tofu.linden@lindenlab.com> | 2009-11-11 17:00:30 +0000 | 
| commit | a0dd5b825be7ec31ab69894c3e4fc81ba6aacdd4 (patch) | |
| tree | b55f2de0eaff9134fa83a268c1b845f8f132f0b5 | |
| parent | 4c3878ee9238318924067def7d186dbf0acbf51e (diff) | |
| parent | 0d01300762a8413c3b137e433ee4c02070798792 (diff) | |
merge.
| -rw-r--r-- | indra/newview/llimview.cpp | 141 | ||||
| -rw-r--r-- | indra/newview/llimview.h | 13 | ||||
| -rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llvoicechannel.cpp | 6 | 
4 files changed, 161 insertions, 1 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 14f94d5a88..33bd483367 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1100,6 +1100,147 @@ LLIMMgr::onConfirmForceCloseError(  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLOutgoingCallDialog +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) : +	LLModalDialog(payload), +	mPayload(payload) +{ +} + +BOOL LLOutgoingCallDialog::postBuild() +{ +	LLSD caller_id = mPayload["caller_id"]; +	EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); + +	std::string call_type = getString("VoiceInviteP2P"); +	std::string caller_name = mPayload["caller_name"].asString(); +	if (caller_name == "anonymous") +	{ +		caller_name = getString("anonymous"); +	} +	 +	setTitle(caller_name + " " + call_type); +	 +	// If it is not a P2P invite, then it's an AdHoc invite +	if ( type != IM_SESSION_P2P_INVITE ) +	{ +		call_type = getString("VoiceInviteAdHoc"); +	} + +	LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name"); +	caller_name_widget->setValue(caller_name + " " + call_type); +	LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon"); +	icon->setValue(caller_id); + +	//childSetAction("Reject", onReject, this); + +	return TRUE; +} + +void LLOutgoingCallDialog::processCallResponse(S32 response) +{ +	if (!gIMMgr) +		return; + +	LLUUID session_id = mPayload["session_id"].asUUID(); +	EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); +	LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger(); +	bool voice = true; +	switch(response) +	{ +	case 2: // start IM: just don't start the voice chat +	{ +		voice = false; +		/* FALLTHROUGH */ +	} +	case 0: // accept +	{ +		if (type == IM_SESSION_P2P_INVITE) +		{ +			// create a normal IM session +			session_id = gIMMgr->addP2PSession( +				mPayload["session_name"].asString(), +				mPayload["caller_id"].asUUID(), +				mPayload["session_handle"].asString()); + +			if (voice) +			{ +				if (gIMMgr->startCall(session_id)) +				{ +					// always open IM window when connecting to voice +					LLIMFloater::show(session_id); +				} +			} + +			gIMMgr->clearPendingAgentListUpdates(session_id); +			gIMMgr->clearPendingInvitation(session_id); +		} +		else +		{ +			LLUUID session_id = gIMMgr->addSession( +				mPayload["session_name"].asString(), +				type, +				session_id); +			if (session_id != LLUUID::null) +			{ +				LLIMFloater::show(session_id); +			} + +			std::string url = gAgent.getRegion()->getCapability( +				"ChatSessionRequest"); + +			if (voice) +			{ +				LLSD data; +				data["method"] = "accept invitation"; +				data["session-id"] = session_id; +				LLHTTPClient::post( +					url, +					data, +					new LLViewerChatterBoxInvitationAcceptResponder( +						session_id, +						inv_type)); +			} +		} +		if (voice) +		{ +			break; +		} +	} +	case 1: // decline +	{ +		if (type == IM_SESSION_P2P_INVITE) +		{ +			if(gVoiceClient) +			{ +				std::string s = mPayload["session_handle"].asString(); +				gVoiceClient->declineInvite(s); +			} +		} +		else +		{ +			std::string url = gAgent.getRegion()->getCapability( +				"ChatSessionRequest"); + +			LLSD data; +			data["method"] = "decline invitation"; +			data["session-id"] = session_id; +			LLHTTPClient::post( +				url, +				data, +				NULL); +		} +	} + +	gIMMgr->clearPendingAgentListUpdates(session_id); +	gIMMgr->clearPendingInvitation(session_id); +	} +} + + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  // Class LLIncomingCallDialog  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) : diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index c566b111ca..942a8f96d0 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -418,6 +418,19 @@ private:  	LLSD mPayload;  }; +class LLOutgoingCallDialog : public LLModalDialog +{ +public: +	LLOutgoingCallDialog(const LLSD& payload); + +	/*virtual*/ BOOL postBuild(); + +private: +	void processCallResponse(S32 response); + +	LLSD mPayload; +}; +  // Globals  extern LLIMMgr *gIMMgr; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index edbac69e1b..7cd660110f 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -195,7 +195,7 @@ void LLViewerFloaterReg::registerFloaters()  	LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationConsole>);  	LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOpenObject>); -	 +	LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>);  	LLFloaterReg::add("parcel_info", "floater_preview_url.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterParcelInfo>);  	LLFloaterPayUtil::registerFloater(); diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index 89649407ff..04ae44e08d 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -378,9 +378,15 @@ void LLVoiceChannel::setURI(std::string uri)  void LLVoiceChannel::setState(EState state)  { +	LLSD payload; +	payload["session_id"] = mSessionID; +	payload["session_name"] = mSessionName; +  	switch(state)  	{  	case STATE_RINGING: +		LLFloaterReg::showInstance("outgoing_call", payload, TRUE); +		llinfos << "RINGINGGGGGGGG " << mSessionName << llendl;  		gIMMgr->addSystemMessage(mSessionID, "ringing", mNotifyArgs);  		break;  	case STATE_CONNECTED:  | 
