XEP-0108: User Activity¶
- class slixmpp.plugins.xep_0108.XEP_0108(xmpp, config=None)[source]¶
XEP-0108: User Activity
- dependencies: ClassVar[Set[str]] = {'xep_0163'}¶
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-0108: User Activity'¶
A longer name for the plugin, describing its purpose. For example, a plugin for XEP-0030 would use ‘Service Discovery’ as its description value.
- name: str = 'xep_0108'¶
A short name for the plugin based on the implemented specification. For example, a plugin for XEP-0030 would use ‘xep_0030’.
- publish_activity(general, specific=None, text=None, **pubsubkwargs)[source]¶
Publish the user’s current activity.
- Parameters:
general (
str
) – The required general category of the activity.specific (
Optional
[str
]) – Optional specific activity being done as part of the general category.text (
Optional
[str
]) – Optional natural-language description or reason for the activity.
- Return type:
Future
Stanza elements¶
- class slixmpp.plugins.xep_0108.stanza.UserActivity(xml=None, parent=None)[source]¶
-
- general = {'doing_chores', 'drinking', 'eating', 'exercising', 'grooming', 'having_appointment', 'inactive', 'relaxing', 'talking', 'traveling', 'undefined', 'working'}¶
- interfaces: ClassVar[Set[str]] = {'text', 'value'}¶
The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the
plugin_attrib
value of any registered stanza plugins.
- name: ClassVar[str] = 'activity'¶
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/activity'¶
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'activity'¶
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- specific = {'at_the_spa', 'brushing_teeth', 'buying_groceries', 'cleaning', 'coding', 'commuting', 'cooking', 'cycling', 'dancing', 'day_off', 'doing_maintenance', 'doing_the_dishes', 'doing_the_laundry', 'driving', 'fishing', 'gaming', 'gardening', 'getting_a_haircut', 'going_out', 'hanging_out', 'having_a_beer', 'having_a_snack', 'having_breakfast', 'having_coffee', 'having_dinner', 'having_lunch', 'having_tea', 'hiding', 'hiking', 'in_a_car', 'in_a_meeting', 'in_real_life', 'jogging', 'on_a_bus', 'on_a_plane', 'on_a_train', 'on_a_trip', 'on_the_phone', 'on_vacation', 'on_video_phone', 'other', 'partying', 'playing_sports', 'praying', 'reading', 'rehearsing', 'running', 'running_an_errand', 'scheduled_holiday', 'shaving', 'shopping', 'skiing', 'sleeping', 'smoking', 'socializing', 'studying', 'sunbathing', 'swimming', 'taking_a_bath', 'taking_a_shower', 'thinking', 'walking', 'walking_the_dog', 'watching_a_movie', 'watching_tv', 'working_out', 'writing'}¶
- sub_interfaces: ClassVar[Set[str]] = {'text'}¶
A subset of
interfaces
which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.