diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-27 21:22:16 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-29 18:09:04 (GMT) |
commit | bbd3bbf5747c28ec5925a89ea43fd4767d135f6e (patch) | |
tree | 7082ca4c7aa66cf66e3b1ebb24a90a5c1d37a1cd /Swift/Controllers/Chat/ChatController.cpp | |
parent | 420654a8e323beb7c8877453393568240a3f2a07 (diff) | |
download | swift-contrib-bbd3bbf5747c28ec5925a89ea43fd4767d135f6e.zip swift-contrib-bbd3bbf5747c28ec5925a89ea43fd4767d135f6e.tar.bz2 |
Make ChatStateNotifier use StanzaChannel directly.
Diffstat (limited to 'Swift/Controllers/Chat/ChatController.cpp')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index f465ef1..eb68abd 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -11,7 +11,6 @@ #include "Swiften/Avatars/AvatarManager.h" #include "Swiften/Chat/ChatStateNotifier.h" -#include "Swiften/Chat/ChatStateMessageSender.h" #include "Swiften/Chat/ChatStateTracker.h" #include "Swiften/Client/StanzaChannel.h" #include "Swiften/Disco/EntityCapsManager.h" @@ -29,11 +28,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ : ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, contact, presenceOracle, avatarManager, useDelayForLatency, eventStream, eventController, timerFactory) { isInMUC_ = isInMUC; lastWasPresence_ = false; - entityCapsManager_ = entityCapsManager; - chatStateNotifier_ = new ChatStateNotifier(); - entityCapsManager_->onCapsChanged.connect(boost::bind(&ChatController::handleCapsChanged, this, _1)); - handleCapsChanged(toJID_); - chatStateMessageSender_ = new ChatStateMessageSender(chatStateNotifier_, stanzaChannel, contact); + chatStateNotifier_ = new ChatStateNotifier(stanzaChannel, contact, entityCapsManager); chatStateTracker_ = new ChatStateTracker(); nickResolver_ = nickResolver; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatController::handlePresenceChange, this, _1)); @@ -64,23 +59,12 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ ChatController::~ChatController() { delete chatStateNotifier_; - delete chatStateMessageSender_; delete chatStateTracker_; } -void ChatController::handleCapsChanged(const JID& jid) { - if (jid == toJID_) { - DiscoInfo::ref caps = entityCapsManager_->getCaps(toJID_); - bool hasCSN = caps && caps->hasFeature(ChatState::getFeatureNamespace()); - chatStateNotifier_->setContactHas85Caps(hasCSN); - } -} - void ChatController::setToJID(const JID& jid) { - chatStateNotifier_->contactJIDHasChanged(); - chatStateMessageSender_->setContact(jid); + chatStateNotifier_->setContact(jid); ChatControllerBase::setToJID(jid); - handleCapsChanged(jid); Presence::ref presence; if (isInMUC_) { presence = presenceOracle_->getLastPresence(jid); @@ -112,9 +96,7 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> me } void ChatController::preSendMessageRequest(boost::shared_ptr<Message> message) { - if (chatStateNotifier_->contactShouldReceiveStates()) { - message->addPayload(boost::shared_ptr<Payload>(new ChatState(ChatState::Active))); - } + chatStateNotifier_->addChatStateRequest(message); } void ChatController::postSendMessage(const String& body, boost::shared_ptr<Stanza> sentStanza) { |