slidgnal.group#

Classes#

Participant

A legacy participant of a legacy group chat.

MUC

A room, a.k.a. a Multi-User Chat.

Bookmarks

This is instantiated once per BaseSession

Functions#

Module Contents#

class slidgnal.group.Participant(*a, **kw)[source]#

Bases: slidgnal.util.AttachmentSenderMixin, slidge.LegacyParticipant

A legacy participant of a legacy group chat.

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

Send a text message from this XMPP Entity.

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 used if called on a LegacyContact) Set this to True if this is actually a message sent to the LegacyContact by the User. Use this to synchronize outgoing history for legacy official apps.

  • correction – whether this message is a correction or not

  • correction_event_id – in the case where an ID is associated with the legacy ‘correction event’, specify it here to use it on the XMPP side. If not specified, a random ID will be used.

  • link_previews – A little of sender (or server, or gateway)-generated previews of URLs linked in the body.

  • 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 slidgnal.group.MUC(*a, **k)[source]#

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

A room, a.k.a. a Multi-User Chat.

MUC instances are obtained by calling slidge.group.bookmarks.LegacyBookmarks() on the user’s slidge.core.session.BaseSession.

REACTIONS_SINGLE_EMOJI = True[source]#
session: slidgnal.session.Session[source]#
type[source]#
sent[source]#
user_reactions[source]#
async get_signal_group()[source]#
Return type:

aiosignald.generated.JsonGroupV2Infov1

async fill_participants()[source]#

This method should yield the list of all members of this group.

Typically, use participant = self.get_participant(), self.get_participant_by_contact(), of self.get_user_participant(), and update their affiliation, hats, etc. before yielding them.

async get_participant_by_contact(c, **kwargs)[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:

Return type:

Participant

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.

To take advantage of the slidge avatar cache, you can check the .avatar property to retrieve the “legacy file ID” of the cached avatar. If there is no change, you should not call slidge.core.mixins.avatar.AvatarMixin.set_avatar() or attempt to modify the :attr:.avatar property.

class slidgnal.group.Bookmarks(session)[source]#

Bases: slidge.LegacyBookmarks[str, MUC]

This is instantiated once per BaseSession

Parameters:

session (slidge.core.session.BaseSession) –

session: slidgnal.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.

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

slidgnal.group.local_part_to_group_id(s)[source]#
Parameters:

s (str) –

slidgnal.group.group_id_to_local_part(s)[source]#
Parameters:

s (str) –