chatstates – Chat State Notification support (XEP-0085)¶
This module provides support to implement Chat State Notifications.
XSOs¶
The module registers an attribute xep0085_chatstate with
aioxmpp.Message to represent the chat state
notification tags, it takes values from the following enumeration (or
None if no tag is present):
Helpers¶
The module provides the following helper class, that handles the state management for chat state notifications:
- class aioxmpp.chatstates.ChatStateManager(strategy=None)[source]¶
Manage the state of our chat state.
- Parameters:
strategy (a subclass of
ChatStateStrategy) – the strategy used to decide whether to send notifications (defaults toDiscoverSupport)
- handle(state, message=False)[source]¶
Handle a state update.
- Parameters:
state (
ChatState) – the new chat statemessage (
bool) – pass true to indicate that we handle theACTIVEstate that is implied by sending a content message.
- Returns:
whether a standalone notification must be sent for this state update, respective if a chat state notification must be included with the message.
- Raises:
ValueError – if message is true and a state other than
ACTIVEis passed.
Methods to pass in protocol level information:
Its operation is controlled by one of the chat state strategies:
- class aioxmpp.chatstates.DoNotEmit[source]¶
Chat state strategy: Do not emit chat state notifications.