Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Event Index

Mikhail Kashkin edited this page Jul 13, 2015 · 1 revision

Event Index

Event Structure:

Every event is composed of an event name and an optional data object. In most cases, the data object is a message or presence stanza object. Some events do not provide any additional data beyond the default value, which is an empty dictionary.

More recent list of events available on official documentation site

Listening for Events:

To add a custom event handler, use the following:

xmpp.add_event_handler("event_name", my_handler)

Where xmpp is a SleekXMPP client or component object, and my_handler is a function that can accept a single value which is the event data associated with event_name.

Events:

  • connected

    Data: {} Source: ClientXMPP

    Signal that a connection has been made with the XMPP server, but a session has not yet been established.

  • changed_status

    Data: Presence Source: BaseXMPP

    Triggered when a presence stanza is received from a JID with a show type different than the last presence stanza from the same JID.

  • changed_subscription

    Data: Presence Source: BaseXMPP

    Triggered whenever a presence stanza with a type of subscribe, subscribed, unsubscribe, or unsubscribed is received.

    Note that if the values xmpp.auto_authorize and xmpp.auto_subscribe are set to True or False, and not None, then SleekXMPP will either accept or reject all subscription requests before your event handlers are called. Set these values to None if you wish to make more complex subscription decisions.

  • disco_info

    Data: DiscoInfo Source: XEP-0030

    Note: In development.

    Triggered whenever a disco#info result stanza is received.

  • disco_info_request

    Data: DiscoInfo Source: XEP-0030

    Note: In development.

    Notice that a disco#info query has been received and a response is needed. The xep_0030 plugin already handles this event, but that handler will not run if you register your own handler. See the [[XEP-0030 docs|http://wiki.github.com/fritzy/SleekXMPP/XEP-0030:-Working-with-Service-Discovery]] for more information.

  • disco_items

    Data: DiscoItems Source: XEP-0030

    Note: In development.

    Triggered whenever a disco#items result stanza is received.

  • disco_items_request

    Data: DiscoItems Source: XEP-0030

    Note: In development.

    Notice that a disco#items query has been received and a response is needed. The xep_0030 plugin already handles this event, but that handler will not run if you register your own handler. See the [[XEP-0030 docs|http://wiki.github.com/fritzy/SleekXMPP/XEP-0030:-Working-with-Service-Discovery]] for more information.

  • disconnected

    Data: {} Source: ClientXMPP

    Signal that the connection with the XMPP server has been lost.

  • failed_auth

    Data: {} Source: ClientXMPP, XEP-0078

    Signal that the server has rejected the provided login credentials.

  • gmail_notify

    Data: {} Source: Gmail

    Signal that there are unread emails for the Gmail account associated with the current XMPP account.

  • got_online

    Data: Presence Source: BaseXMPP

    If a presence stanza is received from a JID which was previously marked as offline, and the presence has a show type of 'chat', 'dnd', 'away', or 'xa', then this event is triggered as well.

  • got_offline

    Data: Presence Source: BaseXMPP

    Signal that an unavailable presence stanza has been received from a JID.

  • groupchat_message

    Data: Message Source: XEP-0045

    Triggered whenever a message is received from a multi-user chat room.

  • groupchat_presence

    Data: Presence Source: XEP-0045

    Triggered whenever a presence stanza is received from a user in a multi-user chat room.

  • groupchat_subject

    Data: Presence Source: XEP-0045

    Triggered whenever the subject of a multi-user chat room is changed, or announced when joining a room.

  • message

    Data: Message Source: BaseXMPP

    Makes the contents of message stanzas available whenever one is received. Be sure to check the message type in order to handle error messages.

  • message_form

    Data: Form Source: XEP-0004

    Currently the same as message_xform.

  • message_xform

    Data: Form Source: XEP-0004

    Triggered whenever a data form is received inside a message.

  • presence_available

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'available' is received.

  • presence_error

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'error' is received.

  • presence_form

    Data: Form Source: XEP-0004

    This event is present in the XEP-0004 plugin code, but is currently not used.

  • presence_probe

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'probe' is received.

  • presence_subscribe

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'subscribe' is received.

  • presence_subscribed

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'subscribed' is received.

  • presence_unavailable

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'unavailable' is received.

  • presence_unsubscribe

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'unsubscribe' is received.

  • presence_unsubscribed

    Data: Presence Source: BaseXMPP

    A presence stanza with a type of 'unsubscribed' is received.

  • roster_update

    Data: Roster Source: ClientXMPP

    An IQ result containing roster entries is received.

  • sent_presence

    Data: {} Source: BaseXMPP

    Signal that an initial presence stanza has been written to the XML stream.

  • session_start

    Data: {} Source: ClientXMPP, ComponentXMPP, XEP-0078

    Signal that a connection to the XMPP server has been made and a session has been established.