slidge.plugins.signal.group#

Module Contents#

Classes#

Participant

MUC

Abstract base class for generic types.

Bookmarks

Abstract base class for generic types.

Functions#

class slidge.plugins.signal.group.Participant(muc, nickname=None, is_user=False, is_system=False)[source]#

Bases: slidge.plugins.signal.util.AttachmentSenderMixin, slidge.LegacyParticipant

Parameters:
contact: slidge.plugins.signal.contact.Contact[source]#
muc: MUC[source]#
signal_address: aiosignald.generated.JsonAddressv1[source]#
send_text(body, legacy_msg_id=None, **k)[source]#

Transmit a message from the entity to the user

Parameters:
  • body (str) – Content of the message

  • legacy_msg_id – If you want to be able to transport read markers from the gateway user to the legacy network, specify this

  • when – when the message was sent, for a “delay” tag (XEP-0203)

  • reply_to – Quote another message (XEP-0461)

  • hints

  • thread

  • carbon – (only in 1:1) Reflect a message sent to this Contact by the user. Use this to synchronize outgoing history for legacy official apps.

  • correction – whether this message is a correction or not

  • archive_only – (only in groups) Do not send this message to user, but store it in the archive. Meant to be used during MUC.backfill()

class slidge.plugins.signal.group.MUC(*a, **k)[source]#

Bases: slidge.LegacyMUC[str, int, Participant, str]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
REACTIONS_SINGLE_EMOJI = True[source]#
session: slidge.plugins.signal.session.Session[source]#
type[source]#
async get_signal_group()[source]#
Return type:

aiosignald.generated.JsonGroupV2Infov1

async fill_participants()[source]#

In here, call self.get_participant(), self.get_participant_by_contact(), of self.get_user_participant() to make an initial list of participants.

async get_participant_by_contact(contact)[source]#

Get a non-anonymous participant.

This is what should be used in non-anonymous groups ideally, to ensure that the Contact jid is associated to this participant

Parameters:
  • c – The LegacyContact instance corresponding to this contact

  • kwargs – additional parameters for the Participant construction (optional)

Returns:

async update_info()[source]#

Fetch information about this group from the legacy network

This is awaited on MUC instantiation, and should be overridden to update the attributes of the group chat, like title, subject, number of participants etc.

class slidge.plugins.signal.group.Bookmarks(session)[source]#

Bases: slidge.LegacyBookmarks[str, MUC]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
Parameters:

session (slidge.core.session.BaseSession) –

session: slidge.plugins.signal.session.Session[source]#
async jid_local_part_to_legacy_id(local_part)[source]#
Parameters:

local_part (str) –

async legacy_id_to_jid_local_part(legacy_id)[source]#
Parameters:

legacy_id (str) –

async fill()[source]#

Establish a user’s known groups.

This has to be overridden in plugins with group support and at the minimum, this should await self.by_legacy_id(group_id) for all the groups a user is part of.

Ideally, set the group subject, friendly, number, etc. in this method

Slidge internals will call this on successful BaseSession.login()

slidge.plugins.signal.group.local_part_to_group_id(s)[source]#
Parameters:

s (str) –

slidge.plugins.signal.group.group_id_to_local_part(s)[source]#
Parameters:

s (str) –