00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <Swiften/Base/boost_bsignals.h>
00010 #include <boost/shared_ptr.hpp>
00011
00012 #include <Swiften/Base/API.h>
00013 #include <Swiften/Elements/Message.h>
00014 #include <Swiften/Elements/ChatState.h>
00015 #include <Swiften/JID/JID.h>
00016
00017 namespace Swift {
00018 class StanzaChannel;
00019 class EntityCapsProvider;
00020
00021 class SWIFTEN_API ChatStateNotifier {
00022 public:
00023 ChatStateNotifier(StanzaChannel* stanzaChannel, const JID& contact, EntityCapsProvider* entityCapsManager);
00024 ~ChatStateNotifier();
00025
00026 void setContact(const JID& contact);
00027
00028 void addChatStateRequest(Message::ref message);
00029
00030 void setUserIsTyping();
00031 void userSentMessage();
00032 void userCancelledNewMessage();
00033
00034 void receivedMessageFromContact(bool hasActiveElement);
00035 void setContactIsOnline(bool online);
00036
00037 private:
00038 bool contactShouldReceiveStates();
00039 void changeState(ChatState::ChatStateType type);
00040 void handleCapsChanged(const JID& contact);
00041
00042 private:
00043 StanzaChannel* stanzaChannel_;
00044 EntityCapsProvider* entityCapsManager_;
00045 JID contact_;
00046 bool contactHas85Caps_;
00047 bool contactHasSentActive_;
00048 bool userIsTyping_;
00049 bool contactIsOnline_;
00050 };
00051 }