diff options
| author | Igor Borovkov <iborovkov@productengine.com> | 2009-11-02 16:59:43 +0200 | 
|---|---|---|
| committer | Igor Borovkov <iborovkov@productengine.com> | 2009-11-02 16:59:43 +0200 | 
| commit | d3d53c9e41f6de250e7bd059d4120b9be08d31da (patch) | |
| tree | 4eed3e6791bc9785ac9c3077b1347e85d20f2f4a | |
| parent | 2b259964d59937526e648a1b00c0324628369479 (diff) | |
IM: cleaned u TODO marks and completed minor TODOs.
--HG--
branch : product-engine
| -rw-r--r-- | indra/newview/llimview.cpp | 44 | ||||
| -rw-r--r-- | indra/newview/llimview.h | 6 | ||||
| -rw-r--r-- | indra/newview/llsyswellwindow.cpp | 1 | 
3 files changed, 21 insertions, 30 deletions
| diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 41e2cff3b7..cdcb284cee 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -89,9 +89,6 @@ LLIMMgr* gIMMgr = NULL;  const static std::string IM_SEPARATOR(": "); -std::map<LLUUID, LLIMModel::LLIMSession*> LLIMModel::sSessionsMap; - -  void toast_callback(const LLSD& msg){  	// do not show toast in busy mode or it goes from agent @@ -238,6 +235,12 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& f  	message["index"] = (LLSD::Integer)mMsgs.size();   	mMsgs.push_front(message);  + +	if (mSpeakers && from_id.notNull()) +	{ +		mSpeakers->speakerChatted(from_id); +		mSpeakers->setSpeakerTyping(from_id, FALSE); +	}  }  void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata) @@ -258,12 +261,11 @@ void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const  LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const  { -	return get_if_there(LLIMModel::instance().sSessionsMap, session_id, +	return get_if_there(mId2SessionMap, session_id,  		(LLIMModel::LLIMSession*) NULL);  } -//*TODO change name to represent session initialization aspect (IB) -void LLIMModel::updateSessionID(const LLUUID& old_session_id, const LLUUID& new_session_id) +void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id)  {  	LLIMSession* session = findIMSession(old_session_id);  	if (session) @@ -272,8 +274,8 @@ void LLIMModel::updateSessionID(const LLUUID& old_session_id, const LLUUID& new_  		if (old_session_id != new_session_id)  		{ -			sSessionsMap.erase(old_session_id); -			sSessionsMap[new_session_id] = session; +			mId2SessionMap.erase(old_session_id); +			mId2SessionMap[new_session_id] = session;  			gIMMgr->notifyObserverSessionIDUpdated(old_session_id, new_session_id);  		} @@ -322,14 +324,14 @@ void LLIMModel::testMessages()  bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,   						   const LLUUID& other_participant_id, const std::vector<LLUUID>& ids)  { -	if (is_in_map(sSessionsMap, session_id)) +	if (findIMSession(session_id))  	{  		llwarns << "IM Session " << session_id << " already exists" << llendl;  		return false;  	}  	LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids); -	sSessionsMap[session_id] = session; +	mId2SessionMap[session_id] = session;  	LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, name, other_participant_id); @@ -339,9 +341,9 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co  bool LLIMModel::clearSession(const LLUUID& session_id)  { -	if (sSessionsMap.find(session_id) == sSessionsMap.end()) return false; -	delete (sSessionsMap[session_id]); -	sSessionsMap.erase(session_id); +	if (mId2SessionMap.find(session_id) == mId2SessionMap.end()) return false; +	delete (mId2SessionMap[session_id]); +	mId2SessionMap.erase(session_id);  	return true;  } @@ -389,7 +391,6 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from,  	return true;  } -//*TODO rewrite chat history persistence using LLSD serialization (IB)  bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text)  {  	S32 im_log_option =  gSavedPerAccountSettings.getS32("IMLogOptions"); @@ -570,8 +571,7 @@ void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_p  	}  } - -//*TODO update list of messages in a LLIMSession (IB) +//*TODO this method is better be moved to the LLIMMgr  void LLIMModel::sendMessage(const std::string& utf8_text,  					 const LLUUID& im_session_id,  					 const LLUUID& other_participant_id, @@ -1466,14 +1466,6 @@ void LLIMMgr::addMessage(  	else  	{  		floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message - -		//*TODO consider moving that speaker management stuff into model (IB) -		LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(new_session_id); -		if (speaker_mgr) -		{ -			speaker_mgr->speakerChatted(gAgentID); -			speaker_mgr->setSpeakerTyping(gAgentID, FALSE); -		}  	}  	LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg); @@ -1539,7 +1531,7 @@ S32 LLIMMgr::getNumberOfUnreadIM()  	std::map<LLUUID, LLIMModel::LLIMSession*>::iterator it;  	S32 num = 0; -	for(it = LLIMModel::sSessionsMap.begin(); it != LLIMModel::sSessionsMap.end(); ++it) +	for(it = LLIMModel::getInstance()->mId2SessionMap.begin(); it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)  	{  		num += (*it).second->mNumUnread;  	} @@ -2139,7 +2131,7 @@ public:  		{  			session_id = body["session_id"].asUUID(); -			LLIMModel::getInstance()->updateSessionID(temp_session_id, session_id); +			LLIMModel::getInstance()->processSessionInitializedReply(temp_session_id, session_id);  			LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);  			if (speaker_mgr) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index b3fe698ec7..f986d9dcdb 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -92,8 +92,8 @@ public:  	void	resetActiveSessionID() { mActiveSessionID.setNull(); }  	LLUUID	getActiveSessionID() { return mActiveSessionID; } -	//*TODO make it non-static as LLIMMOdel is a singleton (IB) -	static std::map<LLUUID, LLIMSession*> sSessionsMap;  //mapping session_id to session +	/** Session id to session object */ +	std::map<LLUUID, LLIMSession*> mId2SessionMap;  	typedef boost::signals2::signal<void(const LLSD&)> session_signal_t;  	typedef boost::function<void(const LLSD&)> session_callback_t; @@ -109,7 +109,7 @@ public:  	/**  	 * Rebind session data to a new session id.  	 */ -	void updateSessionID(const LLUUID& old_session_id, const LLUUID& new_session_id); +	void processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id);  	boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); }  	boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); } diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 419603e14e..c255418429 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -409,7 +409,6 @@ bool LLSysWellWindow::isWindowEmpty()  void LLSysWellWindow::sessionAdded(const LLUUID& session_id,  		const std::string& name, const LLUUID& other_participant_id)  { -	//*TODO get rid of get_session_value, session_id's are unique, cause performance degradation with lots chiclets (IB)  	if (mMessageList->getItemByValue(session_id) == NULL)  	{  		S32 chicletCounter = LLIMModel::getInstance()->getNumUnread(session_id); | 
