summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-08-21 18:29:50 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-08-21 18:30:47 (GMT)
commitd786e1aeff062ef4f0a962d55ddce7d41c5f512e (patch)
treee66ed4b836096e2f9a8c43902fede6738900d6dd /Swift/Controllers
parent734cdf96ee07357382914c1e38e19a5bf1f5078d (diff)
downloadswift-d786e1aeff062ef4f0a962d55ddce7d41c5f512e.zip
swift-d786e1aeff062ef4f0a962d55ddce7d41c5f512e.tar.bz2
Revert "Store avatars per profile."
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp22
-rw-r--r--Swift/Controllers/MainController.h8
2 files changed, 6 insertions, 24 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index cef09eb..b267dd2 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -51,7 +51,6 @@
#include "Swiften/Queries/Requests/GetDiscoInfoRequest.h"
#include "Swiften/Queries/Requests/GetVCardRequest.h"
#include "Swiften/Avatars/AvatarFileStorage.h"
-#include "Swiften/Avatars/AvatarStorageFactory.h"
#include "Swiften/Avatars/AvatarManager.h"
#include "Swiften/StringCodecs/SHA1.h"
#include "Swiften/StringCodecs/Hexify.h"
@@ -64,7 +63,7 @@ static const String CLIENT_VERSION = "1.0-devel";
static const String CLIENT_NODE = "http://swift.im";
-MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorageFactory* avatarStorageFactory, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency)
+MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency)
: timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), settings_(settings), loginWindow_(NULL), useDelayForLatency_(useDelayForLatency) {
presenceOracle_ = NULL;
avatarManager_ = NULL;
@@ -89,7 +88,7 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF
chatListWindowFactory_ = chatListWindowFactory;
uiEventStream_ = new UIEventStream();
- avatarStorageFactory_ = avatarStorageFactory;
+ avatarStorage_ = avatarStorage;
eventController_ = new EventController();
eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1));
@@ -131,15 +130,11 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF
MainController::~MainController() {
delete systemTrayController_;
delete soundEventController_;
- delete avatarStorageFactory_;
+ delete avatarStorage_;
delete xmlConsoleController_;
delete uiEventStream_;
delete eventController_;
resetClient();
- for(std::map<JID, AvatarStorage*>::const_iterator i = avatarStorages_.begin(); i != avatarStorages_.end(); ++i) {
- delete i->second;
- }
- avatarStorages_.clear();
}
void MainController::resetClient() {
@@ -205,7 +200,7 @@ void MainController::handleConnected() {
presenceOracle_ = new PresenceOracle(client_);
nickResolver_ = new NickResolver(xmppRoster_);
- avatarManager_ = new AvatarManager(client_, client_, getAvatarStorageForProfile(jid_));
+ avatarManager_ = new AvatarManager(client_, client_, avatarStorage_);
rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, nickResolver_, presenceOracle_, eventController_, uiEventStream_, client_);
rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2));
@@ -475,13 +470,4 @@ void MainController::handleOwnVCardReceived(boost::shared_ptr<VCard> vCard, cons
}
}
-AvatarStorage* MainController::getAvatarStorageForProfile(const JID& jid) {
- std::pair< std::map<JID, AvatarStorage*>::iterator, bool > r = avatarStorages_.insert(std::make_pair<JID,AvatarStorage*>(jid, NULL));
- if (r.second) {
- r.first->second = avatarStorageFactory_->createAvatarStorage(jid);
- }
- return r.first->second;
-}
-
-
}
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index e68e6d5..e220211 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -9,7 +9,6 @@
#include "Swiften/Base/boost_bsignals.h"
#include <boost/shared_ptr.hpp>
#include <vector>
-#include <map>
#include "Swiften/Network/BoostIOServiceThread.h"
#include "Swiften/Network/BoostTimerFactory.h"
@@ -29,7 +28,6 @@
#include "Swiften/Roster/XMPPRoster.h"
namespace Swift {
- class AvatarStorageFactory;
class AvatarStorage;
class Application;
class Client;
@@ -68,12 +66,11 @@ namespace Swift {
class MainController {
public:
- MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorageFactory* avatarStorageFactory, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency);
+ MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency);
~MainController();
private:
- AvatarStorage* getAvatarStorageForProfile(const JID&);
void resetClient();
void handleConnected();
void handleLoginRequest(const String& username, const String& password, const String& certificateFile, bool remember, bool loginAutomatically);
@@ -107,7 +104,7 @@ namespace Swift {
EventWindowFactory* eventWindowFactory_;
SettingsProvider *settings_;
ProfileSettingsProvider* profileSettings_;
- AvatarStorageFactory* avatarStorageFactory_;
+ AvatarStorage* avatarStorage_;
ApplicationMessageDisplay* applicationMessageDisplay_;
ChatController* chatController_;
XMPPRosterController* xmppRosterController_;
@@ -140,6 +137,5 @@ namespace Swift {
int timeBeforeNextReconnect_;
Timer::ref reconnectTimer_;
StatusTracker* statusTracker_;
- std::map<JID, AvatarStorage*> avatarStorages_;
};
}