diff options
Diffstat (limited to 'Swiften/Chat/ChatStateMessageSender.cpp')
-rw-r--r-- | Swiften/Chat/ChatStateMessageSender.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Swiften/Chat/ChatStateMessageSender.cpp b/Swiften/Chat/ChatStateMessageSender.cpp index d053cb5..ad1495f 100644 --- a/Swiften/Chat/ChatStateMessageSender.cpp +++ b/Swiften/Chat/ChatStateMessageSender.cpp @@ -1,5 +1,22 @@ #include "Swiften/Chat/ChatStateMessageSender.h" +#include <boost/bind.hpp> + +#include "Swiften/Client/StanzaChannel.h" + namespace Swift { +ChatStateMessageSender::ChatStateMessageSender(ChatStateNotifier* notifier, StanzaChannel* stanzaChannel, const JID& contact) : contact_(contact) { + notifier_ = notifier; + stanzaChannel_ = stanzaChannel; + notifier_->onChatStateChanged.connect(boost::bind(&ChatStateMessageSender::handleChatStateChanged, this, _1)); +} + +void ChatStateMessageSender::handleChatStateChanged(ChatState::ChatStateType state) { + boost::shared_ptr<Message> message(new Message()); + message->setTo(contact_); + message->addPayload(boost::shared_ptr<Payload>(new ChatState(state))); + stanzaChannel_->sendMessage(message); +} + } |