diff options
| -rw-r--r-- | indra/newview/llconversationlog.cpp | 38 | ||||
| -rw-r--r-- | indra/newview/llconversationlog.h | 9 | 
2 files changed, 33 insertions, 14 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index df9350407d..137b97326c 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -140,6 +140,31 @@ void LLConversation::setListenIMFloaterOpened()  	}  }  /************************************************************************/ +/*             LLConversationLogFriendObserver implementation           */ +/************************************************************************/ + +// Note : An LLSingleton like LLConversationLog cannot be an LLFriendObserver  +// at the same time. +// This is because avatar observers are deleted by the observed object which  +// conflicts with the way LLSingleton are deleted. + +class LLConversationLogFriendObserver : public LLFriendObserver +{ +public: +	LLConversationLogFriendObserver() {} +	virtual ~LLConversationLogFriendObserver() {} +	virtual void changed(U32 mask); +}; + +void LLConversationLogFriendObserver::changed(U32 mask) +{ +	if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE)) +	{ +		LLConversationLog::instance().notifyObservers(); +	} +} + +/************************************************************************/  /*             LLConversationLog implementation                         */  /************************************************************************/ @@ -148,7 +173,9 @@ LLConversationLog::LLConversationLog()  	loadFromFile(getFileName());  	LLIMMgr::instance().addSessionObserver(this); -	LLAvatarTracker::instance().addObserver(this); +	 +	mFriendObserver = new LLConversationLogFriendObserver; +	LLAvatarTracker::instance().addObserver(mFriendObserver);  }  void LLConversationLog::logConversation(const LLConversation& conversation)  { @@ -204,15 +231,6 @@ void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string  	}  } -// LLFriendObserver -void LLConversationLog::changed(U32 mask) -{ -	if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE)) -	{ -		notifyObservers(); -	} -} -  void LLConversationLog::cache()  {  	saveToFile(getFileName()); diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 18865bb80e..a7457d55e3 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -99,7 +99,7 @@ private:   * To distinguish two conversations with the same sessionID it's also needed to compare their creation date.   */ -class LLConversationLog : public LLSingleton<LLConversationLog>, LLIMSessionObserver, LLFriendObserver +class LLConversationLog : public LLSingleton<LLConversationLog>, LLIMSessionObserver  {  	friend class LLSingleton<LLConversationLog>;  public: @@ -126,8 +126,8 @@ public:  	virtual void sessionRemoved(const LLUUID& session_id){}										// Stub  	virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id){}	// Stub -	// LLFriendObserver trigger -	virtual void changed(U32 mask); +	// Triggered by LLFriendObserver change +	void notifyObservers();  	/**  	 * public method which is called on viewer exit to save conversation log @@ -137,7 +137,6 @@ public:  private:  	LLConversationLog(); -	void notifyObservers();  	/**  	 * constructs file name in which conversations log will be saved @@ -152,6 +151,8 @@ private:  	typedef std::vector<LLConversation> conversations_vec_t;  	std::vector<LLConversation>				mConversations;  	std::set<LLConversationLogObserver*>	mObservers; + +	LLFriendObserver* mFriendObserver;		// Observer of the LLAvatarTracker instance  };  class LLConversationLogObserver  | 
