diff options
| author | Kevin Smith <git@kismith.co.uk> | 2011-07-09 10:42:47 (GMT) | 
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2011-07-09 10:42:47 (GMT) | 
| commit | c2dc47077e505ba1d45f203772dc6aa4f26656e4 (patch) | |
| tree | 097cba7a95bffb3f8e7d251164d0df8a07e52822 /Swift/Controllers/Chat | |
| parent | 21e1e2d829690a127386071f173ffd8ad2e21db4 (diff) | |
| download | swift-c2dc47077e505ba1d45f203772dc6aa4f26656e4.zip swift-c2dc47077e505ba1d45f203772dc6aa4f26656e4.tar.bz2  | |
Remember status type for chat list items.
Resolves: #905
Diffstat (limited to 'Swift/Controllers/Chat')
| -rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 19 | 
1 files changed, 17 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index a2abbad..0efbdfd 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -132,7 +132,9 @@ void ChatsManager::loadRecents() {  		std::string activity(recent[1]);  		bool isMUC = recent[2] == "true";  		std::string nick(recent[3]); -		ChatListWindow::Chat chat(jid, nickResolver_->jidToNick(jid), activity, 0, isMUC, nick); +		Presence::ref presence = presenceOracle_->getHighestPriorityPresence(jid.toBare()); +		StatusShow::Type type = presence ? presence->getShow() : StatusShow::None; +		ChatListWindow::Chat chat(jid, nickResolver_->jidToNick(jid), activity, 0, type, isMUC, nick);  		prependRecent(chat);  	}  	handleUnreadCountChanged(NULL); @@ -177,7 +179,10 @@ ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const  	if (controller) {  		unreadCount = controller->getUnreadCount();  	} -	return ChatListWindow::Chat(jid, nickResolver_->jidToNick(jid), activity, unreadCount, false); + +	Presence::ref presence = presenceOracle_->getHighestPriorityPresence(jid.toBare()); +	StatusShow::Type type = presence ? presence->getShow() : StatusShow::None; +	return ChatListWindow::Chat(jid, nickResolver_->jidToNick(jid), activity, unreadCount, type, false);  }  void ChatsManager::handleChatActivity(const JID& jid, const std::string& activity) { @@ -265,6 +270,16 @@ void ChatsManager::handleUIEvent(boost::shared_ptr<UIEvent> event) {   */  void ChatsManager::handlePresenceChange(boost::shared_ptr<Presence> newPresence) {  	if (mucRegistry_->isMUC(newPresence->getFrom().toBare())) return; + +	foreach (ChatListWindow::Chat& chat, recentChats_) { +		if (newPresence->getFrom().toBare() == chat.jid.toBare()) { +			Presence::ref presence = presenceOracle_->getHighestPriorityPresence(chat.jid.toBare()); +			chat.setStatusType(presence ? presence->getShow() : StatusShow::None); +			chatListWindow_->setRecents(recentChats_); +			break; +		} +	} +  	//if (newPresence->getType() != Presence::Unavailable) return;  	JID fullJID(newPresence->getFrom());  	std::map<JID, ChatController*>::iterator it = chatControllers_.find(fullJID);  | 
 Swift