/* * Copyright (c) 2010 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include "Swiften/Chat/ChatStateMessageSender.h" #include #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(new Message()); message->setTo(contact_); message->addPayload(boost::shared_ptr(new ChatState(state))); stanzaChannel_->sendMessage(message); } }