Public Member Functions | List of all members
ChatStateFilter Class Reference

#include <chatstatefilter.h>

Inheritance diagram for ChatStateFilter:
Inheritance graph
Collaboration diagram for ChatStateFilter:
Collaboration graph

Public Member Functions

 ChatStateFilter (MessageSession *parent)
virtual ~ChatStateFilter ()
void setChatState (ChatStateType state)
void registerChatStateHandler (ChatStateHandler *csh)
void removeChatStateHandler ()
virtual void decorate (Tag *tag)
virtual void filter (Stanza *stanza)
- Public Member Functions inherited from MessageFilter
 MessageFilter (MessageSession *parent)
virtual ~MessageFilter ()
virtual void attachTo (MessageSession *session)

Detailed Description

This class adds Chat State Notifications (XEP-0085) support to a MessageSession.

This implementation of Chat States is fully transparent to the user of the class. If the remote entity does not request chat states, ChatStateFilter will not send any, even if the user requests it. (This is required by the protocol specification.) You MUST annouce this capability by use of Disco (associated namespace is XMLNS_CHAT_STATES). (This is also required by the protocol specification.)

Jakob Schroeter

Definition at line 40 of file chatstatefilter.h.

Constructor & Destructor Documentation

Contstructs a new Chat State filter for a MessageSession.

parentThe MessageSession to decorate.

Definition at line 23 of file chatstatefilter.cpp.

~ChatStateFilter ( )

Virtual destructor.

Definition at line 29 of file chatstatefilter.cpp.

Member Function Documentation

void decorate ( Tag tag)

This function receives a message right before it is sent out (there may be other filters which get to see the message after this filter, though).

tagThe tag to decorate. It contains the message to be sent.

Implements MessageFilter.

Definition at line 110 of file chatstatefilter.cpp.

void filter ( Stanza stanza)

This function receives a message stanza right after it was received (there may be other filters which got to see the stanza before this filter, though).

stanzaThe complete message stanza.

Implements MessageFilter.

Definition at line 33 of file chatstatefilter.cpp.

void registerChatStateHandler ( ChatStateHandler csh)

The ChatStateHandler registered here will receive Chat States according to XEP-0085.

cshThe ChatStateHandler to register.

Definition at line 119 of file chatstatefilter.cpp.

void removeChatStateHandler ( )

This function clears the internal pointer to the ChatStateHandler. Chat States will not be delivered anymore after calling this function until another ChatStateHandler is registered.

Definition at line 124 of file chatstatefilter.cpp.

void setChatState ( ChatStateType  state)

Use this function to set a chat state as defined in XEP-0085.

The Spec states that Chat States shall not be sent to an entity which did not request them. Reasonable effort is taken in this function to avoid spurious state sending. You should be safe to call this even if Message Events were not requested by the remote entity. However, calling setChatState( CHAT_STATE_COMPOSING ) for every keystroke still is discouraged. ;)
stateThe state to set.

Definition at line 71 of file chatstatefilter.cpp.

The documentation for this class was generated from the following files: