Commits

Merov Linden committed a1a97e1 Merge

STORM-680 : pull into viewer-development

Comments (0)

Files changed (6)

indra/newview/llavatarlist.cpp

 	LLAvalineListItem* item = new LLAvalineListItem(/*hide_number=*/false);
 	item->setAvatarId(item_id, session_id, true, false);
 	item->setName(item_name);
+	item->showLastInteractionTime(mShowLastInteractionTime);
+	item->showSpeakingIndicator(mShowSpeakingIndicator);
+	item->setOnline(false);
 
 	addItem(item, item_id);
 	mIDs.push_back(item_id);
 			{
 				// *NOTE: If you change the UI to show a different string,
 				// be sure to change the filter code below.
-				addNewItem(buddy_id, 
-					       av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, 
-						   LLAvatarTracker::instance().isBuddyOnline(buddy_id));
+				if (LLRecentPeople::instance().isAvalineCaller(buddy_id))
+				{
+					const LLSD& call_data = LLRecentPeople::instance().getData(buddy_id);
+					addAvalineItem(buddy_id, call_data["session_id"].asUUID(), call_data["call_number"].asString());
+				}
+				else
+				{
+					addNewItem(buddy_id, 
+						av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, 
+						LLAvatarTracker::instance().isBuddyOnline(buddy_id));
+				}
+				
 				modified = true;
 				nadded++;
 			}
 BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask)
 {
 	BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
-	if ( mContextMenu )
+	if ( mContextMenu && !isAvalineItemSelected())
 	{
 		uuid_vec_t selected_uuids;
 		getSelectedUUIDs(selected_uuids);
 	return handled;
 }
 
+bool LLAvatarList::isAvalineItemSelected()
+{
+	std::vector<LLPanel*> selected_items;
+	getSelectedItems(selected_items);
+	std::vector<LLPanel*>::iterator it = selected_items.begin();
+	
+	for(; it != selected_items.end(); ++it)
+	{
+		if (dynamic_cast<LLAvalineListItem*>(*it))
+			return true;
+	}
+
+	return false;
+}
+
 void LLAvatarList::setVisible(BOOL visible)
 {
 	if ( visible == FALSE && mContextMenu )

indra/newview/llavatarlist.h

 
 private:
 
+	bool isAvalineItemSelected();
+
 	bool mIgnoreOnlineStatus;
 	bool mShowLastInteractionTime;
 	bool mDirty;

indra/newview/llrecentpeople.cpp

 
 using namespace LLOldEvents;
 
-bool LLRecentPeople::add(const LLUUID& id)
+bool LLRecentPeople::add(const LLUUID& id, const LLSD& userdata)
 {
 	if (id == gAgent.getID())
 		return false;
 
 	if (is_not_group_id)
 	{
-		LLDate date_added = LLDate::now();
+		// For each avaline call the id of caller is different even if
+		// the phone number is the same.
+		// To avoid duplication of avaline list items in the recent list
+		// of panel People, deleting id's with similar phone number.
+		const LLUUID& caller_id = getIDByPhoneNumber(userdata);
+		if (caller_id.notNull())
+			mPeople.erase(caller_id);
 
-		//[] instead of insert to replace existing id->date with new date value
-		mPeople[id] = date_added;
+		//[] instead of insert to replace existing id->llsd["date"] with new date value
+		mPeople[id] = userdata;
 		mChangedSignal();
 	}
 
 		result.push_back((*pos).first);
 }
 
-const LLDate& LLRecentPeople::getDate(const LLUUID& id) const
+const LLDate LLRecentPeople::getDate(const LLUUID& id) const
 {
 	recent_people_t::const_iterator it = mPeople.find(id);
-	if (it!= mPeople.end()) return (*it).second;
+	if (it!= mPeople.end()) return it->second["date"].asDate();
 
 	static LLDate no_date = LLDate();
 	return no_date;
 }
 
+const LLSD& LLRecentPeople::getData(const LLUUID& id) const
+{
+	recent_people_t::const_iterator it = mPeople.find(id);
+
+	if (it != mPeople.end())
+		return it->second;
+
+	static LLSD no_data = LLSD();
+	return no_data;
+}
+
+bool LLRecentPeople::isAvalineCaller(const LLUUID& id) const
+{
+	recent_people_t::const_iterator it = mPeople.find(id);
+
+	if (it != mPeople.end())
+	{
+		const LLSD& user = it->second;		
+		return user["avaline_call"].asBoolean();
+	}
+
+	return false;
+}
+
+const LLUUID& LLRecentPeople::getIDByPhoneNumber(const LLSD& userdata)
+{
+	if (!userdata["avaline_call"].asBoolean())
+		return LLUUID::null;
+
+	for (recent_people_t::const_iterator it = mPeople.begin(); it != mPeople.end(); ++it)
+	{
+		const LLSD& user_info = it->second;
+		
+		if (user_info["call_number"].asString() == userdata["call_number"].asString())
+			return it->first;
+	}
+	
+	return LLUUID::null;
+}
+
 // virtual
 bool LLRecentPeople::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
 {

indra/newview/llrecentpeople.h

 	 * Add specified avatar to the list if it's not there already.
 	 *
 	 * @param id avatar to add.
+	 *
+	 * @param userdata additional information about last interaction party.
+	 *				   For example when last interaction party is not an avatar
+	 *				   but an avaline caller, additional info (such as phone
+	 *				   number, session id and etc.) should be added.
+	 *
 	 * @return false if the avatar is in the list already, true otherwise
 	 */
-	bool add(const LLUUID& id);
+	bool add(const LLUUID& id, const LLSD& userdata = LLSD().with("date", LLDate::now()));
 
 	/**
 	 * @param id avatar to search.
 	 */
 	void get(uuid_vec_t& result) const;
 
-	const LLDate& getDate(const LLUUID& id) const;
+	/**
+	 * Returns last interaction time with specified participant
+	 *
+	 */
+	const LLDate getDate(const LLUUID& id) const;
+
+	/**
+	 * Returns data about specified participant
+	 *
+	 * @param id identifier of specific participant
+	 */
+	const LLSD& getData(const LLUUID& id) const;
+
+	/**
+	 * Checks whether specific participant is an avaline caller
+	 *
+	 * @param id identifier of specific participant
+	 */
+	bool isAvalineCaller(const LLUUID& id) const;
 
 	/**
 	 * Set callback to be called when the list changed.
 	/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
 
 private:
-	typedef std::map<LLUUID, LLDate> recent_people_t;
+
+	const LLUUID& getIDByPhoneNumber(const LLSD& userdata);
+
+	typedef std::map<LLUUID, LLSD> recent_people_t;
 	recent_people_t		mPeople;
 	signal_t			mChangedSignal;
 };

indra/newview/llvoicechannel.cpp

 		}
 
 		// Add the party to the list of people with which we've recently interacted.
-		LLRecentPeople::instance().add(mOtherUserID);
+		addToTheRecentPeopleList();
 
 		//Default mic is ON on initiating/joining P2P calls
 		if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
 
 	LLVoiceChannel::setState(state);
 }
+
+void LLVoiceChannelP2P::addToTheRecentPeopleList()
+{
+	bool avaline_call = LLIMModel::getInstance()->findIMSession(mSessionID)->isAvalineSessionType();
+	
+	if (avaline_call)
+	{
+		LLSD call_data;
+		std::string call_number = LLVoiceChannel::getSessionName();
+		
+		call_data["avaline_call"]	= true;
+		call_data["session_id"]		= mSessionID;
+		call_data["call_number"]	= call_number;
+		call_data["date"]			= LLDate::now();
+		
+		LLRecentPeople::instance().add(mOtherUserID, call_data);
+	}
+	else
+	{
+		LLRecentPeople::instance().add(mOtherUserID);
+	}
+}

indra/newview/llvoicechannel.h

 	virtual void setState(EState state);
 
 private:
+
+	/**
+	* Add the caller to the list of people with which we've recently interacted
+	*
+	**/
+	void addToTheRecentPeopleList();
+
 	std::string	mSessionHandle;
 	LLUUID		mOtherUserID;
 	BOOL		mReceivedCall;