slidge.plugins.whatsapp.gateway#

Module Contents#

Classes#

Gateway

Must be subclassed by a plugin to set up various aspects of the XMPP

Functions#

handle_log(level, msg)

Log given message of specified level in system-wide logger.

Attributes#

slidge.plugins.whatsapp.gateway.REGISTRATION_INSTRUCTIONS = 'Continue and scan the resulting QR codes on your main device to complete registration. More...'[source]#
slidge.plugins.whatsapp.gateway.WELCOME_MESSAGE = 'Thank you for registering! Please scan the following QR code on your main device to complete...'[source]#
class slidge.plugins.whatsapp.gateway.Gateway[source]#

Bases: slidge.BaseGateway

Must be subclassed by a plugin to set up various aspects of the XMPP component behaviour, such as its display name or its registration process.

On slidge launch, a singleton is instantiated, and it will be made available to public classes such LegacyContact or BaseSession as the .xmpp attribute. Since it inherits from slixmpp.componentxmpp.ComponentXMPP, this gives you a hand on low-level XMPP interactions via slixmpp plugins, e.g.:

self.send_presence(
    pfrom="somebody@component.example.com",
    pto="someonwelse@anotherexample.com",
)

However, you should not need to do so often since the classes of the plugin API provides higher level abstractions around most commonly needed use-cases, such as sending messages, or displaying a custom status.

COMPONENT_NAME = 'WhatsApp (slidge)'[source]#
COMPONENT_TYPE = 'whatsapp'[source]#
COMPONENT_AVATAR = 'https://www.whatsapp.com/apple-touch-icon.png'[source]#
REGISTRATION_INSTRUCTIONS[source]#
WELCOME_MESSAGE[source]#
REGISTRATION_FIELDS = [][source]#
ROSTER_GROUP = 'WhatsApp'[source]#
MARK_ALL_MESSAGES = True[source]#
GROUPS = True[source]#
PROPER_RECEIPTS = True[source]#
async unregister(user)[source]#

Optionally override this if you need to clean additional stuff after a user has been removed from the permanent user_store.

You may need to manually logout the legacy session in here, Session.logout() will not be called automatically.

Parameters:

user (slidge.GatewayUser) –

slidge.plugins.whatsapp.gateway.handle_log(level, msg)[source]#

Log given message of specified level in system-wide logger.

Parameters:

msg (str) –

slidge.plugins.whatsapp.gateway.log[source]#