summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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);