slidge.plugins.signal.contact#

Module Contents#

Classes#

Contact

This class centralizes actions in relation to a specific legacy contact.

Roster

Virtual roster of a gateway user, that allows to represent all

Functions#

get_filename(attachment)

Attributes#

log

class slidge.plugins.signal.contact.Contact(*a, **k)[source]#

Bases: slidge.LegacyContact[slidge.plugins.signal.session.Session]

This class centralizes actions in relation to a specific legacy contact.

You shouldn’t create instances of contacts manually, but rather rely on LegacyRoster.by_legacy_id() to ensure that contact instances are singletons. The LegacyRoster instance of a session is accessible through the BaseSession.contacts attribute.

Typically, your plugin should have methods hook to the legacy events and call appropriate methods here to transmit the “legacy action” to the xmpp user. This should look like this:

Parameters
  • session – The session this contact is part of

  • legacy_id – The contact’s legacy ID

  • jid_username – User part of this contact’s ‘puppet’ JID. NB: case-insensitive, and some special characters are not allowed

CORRECTION = False[source]#
signal_address()[source]#
async get_identities()[source]#
async carbon_send_attachments(attachments)[source]#
Parameters

attachments (list[aiosignald.generated.JsonAttachmentv1]) –

async send_attachments(attachments, /, legacy_msg_id=None, reply_to_msg_id=None, when=None)[source]#
Parameters
async update_info(profile=None)[source]#
Parameters

profile (Optional[aiosignald.generated.Profilev1]) –

async update_and_add()[source]#
slidge.plugins.signal.contact.get_filename(attachment)[source]#
Parameters

attachment (aiosignald.generated.JsonAttachmentv1) –

class slidge.plugins.signal.contact.Roster(session)[source]#

Bases: slidge.LegacyRoster[Contact, slidge.plugins.signal.session.Session]

Virtual roster of a gateway user, that allows to represent all of their contacts as singleton instances (if used properly and not too bugged).

Every BaseSession instance will have its own LegacyRoster instance accessible via the BaseSession.contacts attribute.

Typically, you will mostly use the LegacyRoster.by_legacy_id() function to retrieve a contact instance.

You might need to override LegacyRoster.legacy_id_to_jid_username() and/or LegacyRoster.jid_username_to_legacy_id() to incorporate some custom logic if you need some characters when translation JID user parts and legacy IDs.

Parameters

session (slidge.core.session.SessionType) –

by_json_address(address)[source]#
Parameters

address (aiosignald.generated.JsonAddressv1) –

slidge.plugins.signal.contact.log[source]#