summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-04-27 20:42:11 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-04-27 20:58:17 (GMT)
commitf48dbee2fb5acf7c0abc9d7897d736233b1f0d2f (patch)
tree512879020dc60ecb0b0b5e70219bf588c5a2f5af /Swift/Controllers/Chat/ChatsManager.cpp
parent73c97d9222040b6160321a32e55a5a3913923e5e (diff)
downloadswift-contrib-f48dbee2fb5acf7c0abc9d7897d736233b1f0d2f.zip
swift-contrib-f48dbee2fb5acf7c0abc9d7897d736233b1f0d2f.tar.bz2
Start on recent chats list
Diffstat (limited to 'Swift/Controllers/Chat/ChatsManager.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 972501f..bd917e7 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Kevin Smith
+ * Copyright (c) 2010-2011 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -99,7 +99,7 @@ void ChatsManager::setupBookmarks() {
if (chatListWindow_) {
chatListWindow_->setBookmarksEnabled(false);
- chatListWindow_->clear();
+ chatListWindow_->clearBookmarks();
}
}
}
@@ -123,6 +123,15 @@ void ChatsManager::handleMUCBookmarkRemoved(const MUCBookmark& bookmark) {
chatListWindow_->removeMUCBookmark(bookmark);
}
+void ChatsManager::handleChatActivity(const JID& jid, const std::string& activity) {
+ /* FIXME: MUC use requires changes here. */
+ ChatListWindow::Chat chat(jid, nickResolver_->jidToNick(jid), activity, false);
+ /* FIXME: handle nick changes */
+ recentChats_.erase(std::remove(recentChats_.begin(), recentChats_.end(), chat), recentChats_.end());
+ recentChats_.push_front(chat);
+ chatListWindow_->setRecents(recentChats_);
+}
+
void ChatsManager::handleUserLeftMUC(MUCController* mucController) {
std::map<JID, MUCController*>::iterator it;
for (it = mucControllers_.begin(); it != mucControllers_.end(); it++) {
@@ -245,6 +254,7 @@ ChatController* ChatsManager::createNewChatController(const JID& contact) {
ChatController* controller = new ChatController(jid_, stanzaChannel_, iqRouter_, chatWindowFactory_, contact, nickResolver_, presenceOracle_, avatarManager_, mucRegistry_->isMUC(contact.toBare()), useDelayForLatency_, uiEventStream_, eventController_, timerFactory_, entityCapsProvider_);
chatControllers_[contact] = controller;
controller->setAvailableServerFeatures(serverDiscoInfo_);
+ controller->onActivity.connect(boost::bind(&ChatsManager::handleChatActivity, this, contact, _1));
return controller;
}
@@ -303,6 +313,7 @@ void ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional
controller->onUserLeft.connect(boost::bind(&ChatsManager::handleUserLeftMUC, this, controller));
}
mucControllers_[mucJID]->activateChatWindow();
+ /* FIXME: handleChatActivity connection for recents, and changes to that method.*/
}
void ChatsManager::handleSearchMUCRequest() {