XEP-0410: MUC Self-Ping (Schrödinger’s Chat)¶
- class slixmpp.plugins.xep_0410.XEP_0410(xmpp, config=None)[source]¶
XEP-0410: MUC Self-Ping (Schrödinger’s Chat)
This plugin provides features for clients (or non-MUC components) to enable or disable self-ping.
Configuration options:
ping_interval: the number of seconds between the last activity and a ping.
Ping status is represented using the
PingStatus
class.Users of this plugin can either schedule the pings manually and send them using send_self_ping, or they can use the provided scheduler with enable_self_ping and disable_self_ping.
Doing so requires calling update_nick if your nickname in a MUC changes, because the plugin is not aware of this. The scheduled ping will trigger a muc_ping_changed event in case the ping status changes, which should be handled properly.
- default_config: ClassVar[Dict[str, Any]] = {'ping_interval': 900, 'ping_timeout': 30}¶
The basic, standard configuration for the plugin, which may be overridden when initializing the plugin. The configuration fields included here may be accessed directly as attributes of the plugin. For example, including the configuration field ‘foo’ would mean accessing plugin.foo returns the current value of plugin.config[‘foo’].
- dependencies: ClassVar[Set[str]] = {'xep_0045', 'xep_0199'}¶
Some plugins may depend on others in order to function properly. Any plugin names included in
dependencies
will be initialized as needed if this plugin is enabled.
- description: str = "XEP-0410: MUC Self-Ping (Schrödinger's Chat)"¶
A longer name for the plugin, describing its purpose. For example, a plugin for XEP-0030 would use ‘Service Discovery’ as its description value.
- disable_self_ping(muc_resource, orig_jid=None)[source]¶
Disable client self-ping. Cancels the scheduled pings for the given MUC resource.
- enable_self_ping(muc_resource, orig_jid=None, interval=None, timeout=None)[source]¶
Enable client self-ping. The given MUC resource will be pinged periodically if the MUC is inactive, and an event will be generated in case of changes.
- get_ping_status(muc_resource, orig_jid=None)[source]¶
Return the last pinged status for a specific muc resource.
- Parameters:
- Return type:
- Returns:
The status, or None if no ping has been sent yet.
- name: str = 'xep_0410'¶
A short name for the plugin based on the implemented specification. For example, a plugin for XEP-0030 would use ‘xep_0030’.
- class slixmpp.plugins.xep_0410.PingStatus(value)[source]¶
Enum representing the status of a ping.
UNTRIED: the ping was not sent yet
JOINED: we were considered still in the MUC at the last ping
JOINED_NICKCHANGED: we were joined but another client just changed the nick.
DISCONNECTED: we got disconnected
TIMEOUT: slixmpp was unable to reach the server