summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-29 18:54:23 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-29 18:54:23 (GMT)
commitd2b07202f6b71b0601d032dbf93778d0a656e808 (patch)
tree975f94343b6ece69406d30cafee449093ecfc768 /Swift/Controllers
parentcf664dd8baa1accc355ec4a727899a9f68f68ed5 (diff)
downloadswift-contrib-d2b07202f6b71b0601d032dbf93778d0a656e808.zip
swift-contrib-d2b07202f6b71b0601d032dbf93778d0a656e808.tar.bz2
Populate the chats list with muc bookmarks
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp2
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index d83c42e..8311726 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -50,7 +50,7 @@ ChatsManager::~ChatsManager() {
void ChatsManager::handleMUCBookmarkAdded(boost::shared_ptr<MUCBookmark> bookmark) {
std::map<JID, MUCController*>::iterator it = mucControllers_.find(bookmark->getRoom());
- if (it == mucControllers_.end()) {
+ if (it == mucControllers_.end() && bookmark->getAutojoin()) {
//FIXME: need vcard stuff here to get a nick
String nick = bookmark->getNick() ? bookmark->getNick().get() : "Swift user";
handleJoinMUCRequest(bookmark->getRoom(), nick);
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index 2bab1df..acc96db 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -6,6 +6,7 @@
#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/ChatListWindowFactory.h"
#include "Swiften/Roster/TreeWidgetFactory.h"
#include "Swiften/Client/Client.h"
#include "Swift/Controllers/Chat/ChatController.h"
@@ -54,15 +55,16 @@ public:
serverDiscoInfo_ = boost::shared_ptr<DiscoInfo>(new DiscoInfo());
presenceSender_ = NULL;
uiEventStream_ = new UIEventStream();
- manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_, uiEventStream_);
+ chatListWindowFactory_ = mocks_->InterfaceMock<ChatListWindowFactory>();
+ manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_, uiEventStream_, chatListWindowFactory_);
avatarManager_ = new MockAvatarManager();
manager_->setAvatarManager(avatarManager_);
};
void tearDown() {
+ delete avatarManager_;
delete manager_;
delete presenceSender_;
- delete avatarManager_;
delete presenceOracle_;
delete nickResolver_;
delete treeWidgetFactory_;
@@ -267,6 +269,7 @@ private:
PresenceSender* presenceSender_;
MockRepository* mocks_;
UIEventStream* uiEventStream_;
+ ChatListWindowFactory* chatListWindowFactory_;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ChatsManagerTest);