diff options
| author | Merov Linden <merov@lindenlab.com> | 2012-07-03 18:12:48 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2012-07-03 18:12:48 -0700 | 
| commit | c63be504e48cfbfd45689694f69c79da008c4c1f (patch) | |
| tree | 7493f3480d17808fa5704839308cfea6ecee904c | |
| parent | 52bf9e20454181d8acb0ac419a882cc1a0e3af9e (diff) | |
| parent | ac0243a006fa28e872e4ee88f7c1588eaefeaecf (diff) | |
Pull merge from richard/viewer-chui
| -rwxr-xr-x | indra/newview/llavataractions.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/llavataractions.h | 4 | ||||
| -rw-r--r-- | indra/newview/llchathistory.cpp | 47 | ||||
| -rw-r--r-- | indra/newview/llimfloater.cpp | 137 | ||||
| -rw-r--r-- | indra/newview/llimfloater.h | 2 | ||||
| -rw-r--r-- | indra/newview/llpanelpeoplemenus.cpp | 2 | 
6 files changed, 118 insertions, 78 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 21367c224d..56c9533e11 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -235,7 +235,7 @@ void LLAvatarActions::startCall(const LLUUID& id)  }  // static -void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) +void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floater_id)  {  	if (ids.size() == 0)  	{ @@ -252,7 +252,7 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids)  	// create the new ad hoc voice session  	const std::string title = LLTrans::getString("conference-title");  	LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, -										   ids[0], id_array, true); +										   ids[0], id_array, true, floater_id);  	if (session_id == LLUUID::null)  	{  		return; diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 46830eb22c..259e87c336 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -82,9 +82,9 @@ public:  	static void startCall(const LLUUID& id);  	/** -	 * Start an ad-hoc conference voice call with multiple users +	 * Start an ad-hoc conference voice call with multiple users in a specific IM floater.  	 */ -	static void startAdhocCall(const uuid_vec_t& ids); +	static void startAdhocCall(const uuid_vec_t& ids, const LLUUID& floater_id = LLUUID::null);  	/**  	 * Start conference chat with the given avatars in a specific IM floater. diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index dcd6d25888..80be753d9e 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -734,17 +734,23 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  	}  	LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); +	LLColor4 name_color(txt_color); +  	LLViewerChat::getChatColor(chat,txt_color);  	LLFontGL* fontp = LLViewerChat::getChatFont();	  	std::string font_name = LLFontGL::nameFromFont(fontp);  	std::string font_size = LLFontGL::sizeFromFont(fontp); -	LLStyle::Params style_params; -	style_params.color(txt_color); -	style_params.readonly_color(txt_color); -	style_params.font.name(font_name); -	style_params.font.size(font_size);	 -	style_params.font.style(input_append_params.font.style); +	LLStyle::Params body_message_params; +	body_message_params.color(txt_color); +	body_message_params.readonly_color(txt_color); +	body_message_params.font.name(font_name); +	body_message_params.font.size(font_size); +	body_message_params.font.style(input_append_params.font.style); + +	LLStyle::Params name_params(body_message_params); +	name_params.color(name_color); +	name_params.readonly_color(name_color);  	std::string prefix = chat.mText.substr(0, 4); @@ -767,7 +773,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  	if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC)  	{  		delimiter = LLStringUtil::null; -		style_params.font.style = "ITALIC"; +		name_params.font.style = "ITALIC";  	}  	bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY; @@ -775,18 +781,20 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  	if (message_from_log)  	{  		txt_color = LLColor4::grey; -		style_params.color(txt_color); -		style_params.readonly_color(txt_color); +		body_message_params.color(txt_color); +		body_message_params.readonly_color(txt_color); +		name_params.color(txt_color); +		name_params.readonly_color(txt_color);  	}  	bool prependNewLineState = mEditor->getText().size() != 0; -	// show timestamps and names in the compact mode +	// compact mode: show a timestamp and name  	if (use_plain_text_chat_history)  	{  		square_brackets = chat.mFromName == SYSTEM_FROM; -		LLStyle::Params timestamp_style(style_params); +		LLStyle::Params timestamp_style(body_message_params);  		// out of the timestamp  		if (args["show_time"].asBoolean()) @@ -804,7 +812,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL          // out the opening square bracket (if need)  		if (square_brackets)  		{ -			mEditor->appendText("[", prependNewLineState, style_params); +			mEditor->appendText("[", prependNewLineState, body_message_params);  			prependNewLineState = false;  		} @@ -819,7 +827,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  				// set the link for the object name to be the objectim SLapp  				// (don't let object names with hyperlinks override our objectim Url) -				LLStyle::Params link_params(style_params); +				LLStyle::Params link_params(body_message_params);  				LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");  				link_params.color = link_color;  				link_params.readonly_color = link_color; @@ -831,7 +839,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  			}  			else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log)  			{ -				LLStyle::Params link_params(style_params); +				LLStyle::Params link_params(body_message_params);  				link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID));  				if (from_me) @@ -852,7 +860,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  			else  			{  				mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter, -						prependNewLineState, style_params); +						prependNewLineState, body_message_params);  				prependNewLineState = false;  			}  		} @@ -880,7 +888,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  		}  		else  		{ -			view = getHeader(chat, style_params, args); +			view = getHeader(chat, name_params, args);  			if (mEditor->getText().size() == 0)  				p.top_pad = 0;  			else @@ -909,6 +917,9 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  		mIsLastMessageFromLog = message_from_log;  	} +	// body of the message processing + +	// notify processing  	if (chat.mNotifId.notNull())  	{  		LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); @@ -932,6 +943,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  			mEditor->appendWidget(params, "\n", false);  		}  	} + +	// usual messages showing  	else  	{  		std::string message = irc_me ? chat.mText.substr(3) : chat.mText; @@ -959,7 +972,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL  			message += "]";  		} -		mEditor->appendText(message, prependNewLineState, style_params); +		mEditor->appendText(message, prependNewLineState, body_message_params);  		prependNewLineState = false;  	} diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9d3c0f98ce..a506f0f9f3 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -322,7 +322,7 @@ BOOL LLIMFloater::postBuild()  void LLIMFloater::onAddButtonClicked()  { -       LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::onAvatarPicked, this, _1, _2), TRUE, TRUE); +       LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE);         if (!picker)         {                 return; @@ -337,55 +337,94 @@ void LLIMFloater::onAddButtonClicked()         }  } -void LLIMFloater::onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names) +bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids)  { -       if (mIsP2PChat) -       { -               mStartConferenceInSameFloater = true; -               onClose(false); +	if (!mSession +		|| mDialog == IM_SESSION_GROUP_START +		|| mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) +	{ +		return false; +	} -               uuid_vec_t temp_ids; -               temp_ids.push_back(mOtherParticipantUUID); -               temp_ids.insert(temp_ids.end(), ids.begin(), ids.end()); +	if (mIsP2PChat) +	{ +		// For a P2P session just check if we are not adding the other participant. -               LLAvatarActions::startConference(temp_ids, mSessionID); -       } -       else -       { -               inviteToSession(ids); -       } +		for (uuid_vec_t::const_iterator id = uuids.begin(); +				id != uuids.end(); ++id) +		{ +			if (*id == mOtherParticipantUUID) +			{ +				return false; +			} +		} +	} +	else +	{ +		// For a conference session we need to check against the list from LLSpeakerMgr, +		// because this list may change when participants join or leave the session. + +		LLSpeakerMgr::speaker_list_t speaker_list; +		LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); +		if (speaker_mgr) +		{ +			speaker_mgr->getSpeakerList(&speaker_list, true); +		} + +		for (uuid_vec_t::const_iterator id = uuids.begin(); +				id != uuids.end(); ++id) +		{ +			for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin(); +					it != speaker_list.end(); ++it) +			{ +				const LLPointer<LLSpeaker>& speaker = *it; +				if (*id == speaker->mID) +				{ +					return false; +				} +			} +		} +	} + +	return true;  } -bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) +void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids)  { -       if (!mSession -               || mDialog == IM_SESSION_GROUP_START -               || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) -       { -               return false; -       } +	if (mIsP2PChat) +	{ +		mStartConferenceInSameFloater = true; -       for (uuid_vec_t::const_iterator id = uuids.begin(); -                       id != uuids.end(); ++id) -       { -    	   	   // Skip this check for ad hoc conferences, -    	       // conference participants should be listed in mSession->mInitialTargetIDs. -               if (mIsP2PChat && *id == mOtherParticipantUUID) -               { -                       return false; -               } - -               for (uuid_vec_t::const_iterator target_id = mSession->mInitialTargetIDs.begin(); -                               target_id != mSession->mInitialTargetIDs.end(); ++target_id) -               { -                       if (*id == *target_id) -                       { -                               return false; -                       } -               } -       } +		uuid_vec_t temp_ids; + +		// Add the initial participant of a P2P session +		temp_ids.push_back(mOtherParticipantUUID); +		temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end()); + +		LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + +		// first check whether this is a voice session +		bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); -       return true; +		// then we can close the current session +		gIMMgr->leaveSession(mSessionID); +		LLIMConversation::onClose(false); + +		// Start a new ad hoc voice call if we invite new participants to a P2P call, +		// or start a text chat otherwise. +		if (is_voice_call) +		{ +			LLAvatarActions::startAdhocCall(temp_ids, mSessionID); +		} +		else +		{ +			LLAvatarActions::startConference(temp_ids, mSessionID); +		} +	} +	else +	{ +		inviteToSession(uuids); +	}  }  void LLIMFloater::boundVoiceChannel() @@ -1096,19 +1135,7 @@ bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop)  		res = canAddSelectedToChat(ids);  		if(res && drop)  		{ -			if (mIsP2PChat) -			{ -				mStartConferenceInSameFloater = true; -				onClose(false); - -				ids.push_back(mOtherParticipantUUID); - -				LLAvatarActions::startConference(ids, mSessionID); -			} -			else -			{ -				inviteToSession(ids); -			} +			addSessionParticipants(ids);  		}  	} diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 23f9e75e21..2e8fc84746 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -152,7 +152,7 @@ private:  	static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);  	void setTyping(bool typing);  	void onAddButtonClicked(); -	void onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names); +	void addSessionParticipants(const uuid_vec_t& uuids);  	bool canAddSelectedToChat(const uuid_vec_t& uuids);  	void onCallButtonClicked(); diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index ac2109dda4..c9eebe24d3 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -82,7 +82,7 @@ LLContextMenu* NearbyMenu::createMenu()  		// registrar.add("Avatar.AddFriend",	boost::bind(&LLAvatarActions::requestFriendshipDialog,	mUUIDs)); // *TODO: unimplemented  		registrar.add("Avatar.IM",			boost::bind(&LLAvatarActions::startConference,			mUUIDs, LLUUID::null)); -		registrar.add("Avatar.Call",		boost::bind(&LLAvatarActions::startAdhocCall,			mUUIDs)); +		registrar.add("Avatar.Call",		boost::bind(&LLAvatarActions::startAdhocCall,			mUUIDs, LLUUID::null));  		registrar.add("Avatar.OfferTeleport",	boost::bind(&NearbyMenu::offerTeleport,					this));  		registrar.add("Avatar.RemoveFriend",boost::bind(&LLAvatarActions::removeFriendsDialog,		mUUIDs));  		// registrar.add("Avatar.Share",		boost::bind(&LLAvatarActions::startIM,					mUUIDs)); // *TODO: unimplemented  | 
