summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp24
-rw-r--r--Swift/Controllers/Chat/ChatController.h9
2 files changed, 5 insertions, 28 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) {
diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h
index 26686ff..601ae1b 100644
--- a/Swift/Controllers/Chat/ChatController.h
+++ b/Swift/Controllers/Chat/ChatController.h
@@ -4,18 +4,17 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_ChatController_H
-#define SWIFTEN_ChatController_H
+#pragma once
#include "Swift/Controllers/Chat/ChatControllerBase.h"
namespace Swift {
class AvatarManager;
class ChatStateNotifier;
- class ChatStateMessageSender;
class ChatStateTracker;
class NickResolver;
class EntityCapsManager;
+
class ChatController : public ChatControllerBase {
public:
ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool isInMUC, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsManager* entityCapsManager);
@@ -34,19 +33,15 @@ namespace Swift {
virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const;
void handleStanzaAcked(boost::shared_ptr<Stanza> stanza);
void dayTicked() {lastWasPresence_ = false;}
- void handleCapsChanged(const JID& jid);
private:
NickResolver* nickResolver_;
ChatStateNotifier* chatStateNotifier_;
- ChatStateMessageSender* chatStateMessageSender_;
ChatStateTracker* chatStateTracker_;
- EntityCapsManager* entityCapsManager_;
bool isInMUC_;
bool lastWasPresence_;
String lastStatusChangeString_;
std::map<boost::shared_ptr<Stanza>, String> unackedStanzas_;
};
}
-#endif