diff options
Diffstat (limited to 'Swiften/Chat/ChatStateNotifier.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Chat/ChatStateNotifier.cpp | 45 |
2 files changed, 0 insertions, 45 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Chat/ChatStateNotifier.cpp b/Swiften/Chat/ChatStateNotifier.cpp deleted file mode 100644 index 7c6560f..0000000 --- a/Swiften/Chat/ChatStateNotifier.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "Swiften/Chat/ChatStateNotifier.h" - -namespace Swift { - -ChatStateNotifier::ChatStateNotifier() { - contactHas85Caps_ = false; - isInConversation_ = false; - contactHasSentActive_ = false; - userIsTyping_ = false; -} - -void ChatStateNotifier::setContactHas85Caps(bool hasCaps) { - contactHas85Caps_ = hasCaps; -} - -void ChatStateNotifier::setUserIsTyping() { - if (contactShouldReceiveStates() && !userIsTyping_) { - userIsTyping_ = true; - onChatStateChanged(ChatState::Composing); - } -} - -void ChatStateNotifier::userSentMessage() { - userIsTyping_ = false; -} - -void ChatStateNotifier::userCancelledNewMessage() { - if (userIsTyping_) { - userIsTyping_ = false; - onChatStateChanged(ChatState::Active); - } -} - -void ChatStateNotifier::receivedMessageFromContact(bool hasActiveElement) { - isInConversation_ = true; - contactHasSentActive_ = hasActiveElement; -} - -bool ChatStateNotifier::contactShouldReceiveStates() { - /* So, yes, the XEP says to look at caps, but it also says that once you've - heard from the contact, the active state overrides this.*/ - return contactHasSentActive_ || (contactHas85Caps_ && !isInConversation_);; -} - -} |