diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-09-15 07:36:24 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-09-15 07:38:51 (GMT) |
commit | c557a9771c99012624e104e5bc71aeb93f38a8bf (patch) | |
tree | 72ade858fa4d2e8b16f1af714c310246d38c9c79 /Swift/Controllers/RosterController.cpp | |
parent | 71accda257c880d576b8b55f1e62d6d7178bab25 (diff) | |
download | swift-c557a9771c99012624e104e5bc71aeb93f38a8bf.zip swift-c557a9771c99012624e104e5bc71aeb93f38a8bf.tar.bz2 |
Logout without signout, but without UI notification that you're logged out.
Diffstat (limited to 'Swift/Controllers/RosterController.cpp')
-rw-r--r-- | Swift/Controllers/RosterController.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp index 322d704..e27335b 100644 --- a/Swift/Controllers/RosterController.cpp +++ b/Swift/Controllers/RosterController.cpp @@ -24,19 +24,19 @@ namespace Swift { */ RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster> xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver) : myJID_(jid), xmppRoster_(xmppRoster), mainWindowFactory_(mainWindowFactory), treeWidgetFactory_(treeWidgetFactory), mainWindow_(mainWindowFactory_->createMainWindow()), roster_(new Roster(mainWindow_->getTreeWidget(), treeWidgetFactory_)), offlineFilter_(new OfflineRosterFilter()) { - nickResolver_ = nickResolver; + roster_->addFilter(offlineFilter_); - avatarManager_ = avatarManager; - avatarManager_->onAvatarChanged.connect(boost::bind(&RosterController::handleAvatarChanged, this, _1, _2)); + mainWindow_->onStartChatRequest.connect(boost::bind(&RosterController::handleStartChatRequest, this, _1)); mainWindow_->onJoinMUCRequest.connect(boost::bind(&RosterController::handleJoinMUCRequest, this, _1, _2)); mainWindow_->onChangeStatusRequest.connect(boost::bind(&RosterController::handleChangeStatusRequest, this, _1, _2)); mainWindow_->onShowOfflineToggled.connect(boost::bind(&RosterController::handleShowOfflineToggled, this, _1)); roster_->onUserAction.connect(boost::bind(&RosterController::handleUserAction, this, _1)); xmppRoster_->onJIDAdded.connect(boost::bind(&RosterController::handleOnJIDAdded, this, _1)); + avatarManager_ = NULL; + setAvatarManager(avatarManager); + setNickResolver(nickResolver); - mainWindow_->setMyAvatarPath(avatarManager_->getAvatarPath(myJID_).string()); - mainWindow_->setMyName(nickResolver_->jidToNick(myJID_)); } RosterController::~RosterController() { @@ -44,6 +44,29 @@ RosterController::~RosterController() { } +void RosterController::setNickResolver(NickResolver* nickResolver) { + nickResolver_ = nickResolver; + if (nickResolver_ != NULL) { + mainWindow_->setMyName(nickResolver_->jidToNick(myJID_)); + } +} + +void RosterController::setAvatarManager(AvatarManager* avatarManager) { + if (avatarManager_ != NULL) { + //FIXME: disconnect old signal; + } + avatarManager_ = avatarManager; + if (avatarManager != NULL) { + avatarManager_->onAvatarChanged.connect(boost::bind(&RosterController::handleAvatarChanged, this, _1, _2)); + mainWindow_->setMyAvatarPath(avatarManager_->getAvatarPath(myJID_).string()); + } +} + +void RosterController::setEnabled(bool enabled) { + //FIXME: implement; + h +} + void RosterController::handleShowOfflineToggled(bool state) { if (state) { roster_->removeFilter(offlineFilter_); |