slidge.core.muc.room
#
Module Contents#
Classes#
Functions#
|
|
|
|
|
|
|
Attributes#
- class slidge.core.muc.room.MucType[source]#
-
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4
Initialize self. See help(type(self)) for accurate signature.
- class slidge.core.muc.room.LegacyMUC(session, legacy_id, jid)[source]#
Bases:
Generic
[slidge.util.types.LegacyGroupIdType
,slidge.util.types.LegacyMessageType
,slidge.util.types.LegacyParticipantType
,slidge.util.types.LegacyUserIdType
],slidge.core.mixins.lock.NamedLockMixin
,slidge.core.mixins.disco.ChatterDiscoMixin
,slidge.core.mixins.recipient.ReactionRecipientMixin
,slidge.core.mixins.recipient.ThreadRecipientMixin
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) –
legacy_id (slidge.util.types.LegacyGroupIdType) –
jid (slixmpp.JID) –
- subject_date: datetime.datetime | None[source]#
- STABLE_ARCHIVE = False[source]#
Because legacy events like reactions, editions, etc. don’t all map to a stanza with a proper legacy ID, slidge usually cannot guarantee the stability of the archive across restarts.
Set this to True if you know what you’re doing, but realistically, this can’t be set to True until archive is permanently stored on disk by slidge.
This is just a flag on archive responses that most clients ignore anyway.
- _ALL_INFO_FILLED_ON_STARTUP = False[source]#
Set this to true if the fill_participants() / fill_participants() design does not fit the legacy API, ie, no lazy loading of the participant list and history.
- Parameters:
p (slixmpp.Presence) –
- async backfill(oldest_message_id=None, oldest_message_date=None)[source]#
Override this if the legacy network provide server-side archive. In it, send history messages using
self.get_participant().send*
, with thearchive_only=True
kwarg.You only need to fetch messages older than
oldest_message_id
.- Parameters:
oldest_message_id (Optional[slidge.util.types.LegacyMessageType]) – The oldest message ID already present in the archive
oldest_message_date (Optional[datetime.datetime]) – The oldest message date already present in the archive
- 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.
- async echo(msg, legacy_msg_id=None)[source]#
- Parameters:
msg (slixmpp.Message) –
legacy_msg_id (Optional[slidge.util.types.LegacyMessageType]) –
- _send_room_presence(user_full_jid=None)[source]#
- Parameters:
user_full_jid (Optional[slixmpp.JID]) –
- async get_user_participant(**kwargs)[source]#
Get the participant representing the gateway user
- Parameters:
kwargs – additional parameters for the
Participant
construction (optional)- Returns:
- Return type:
slidge.util.types.LegacyParticipantType
- async get_participant(nickname, raise_if_not_found=False, fill_first=False, **kwargs)[source]#
Get a participant by their nickname.
In non-anonymous groups, you probably want to use
LegacyMUC.get_participant_by_contact()
instead.- Parameters:
nickname (str) – Nickname of the participant (used as resource part in the MUC)
raise_if_not_found – Raise XMPPError(“item-not-found”) if they are not in the participant list (internal use by slidge, plugins should not need that)
fill_first – Ensure
LegacyMUC.fill_participants()
has been called first (internal use by slidge, plugins should not need that)kwargs – additional parameters for the
Participant
construction (optional)
- Returns:
- Return type:
slidge.util.types.LegacyParticipantType
- get_system_participant()[source]#
Get a pseudo-participant, representing the room itself
Can be useful for events that cannot be mapped to a participant, e.g. anonymous moderation events, or announces from the legacy service :return:
- 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 (slidge.core.contact.LegacyContact) – The
LegacyContact
instance corresponding to this contactkwargs – additional parameters for the
Participant
construction (optional)
- Returns:
- Return type:
slidge.util.types.LegacyParticipantType
- async get_participant_by_legacy_id(legacy_id, **kwargs)[source]#
- Parameters:
legacy_id (slidge.util.types.LegacyUserIdType) –
- Return type:
slidge.util.types.LegacyParticipantType
- async get_participants()[source]#
Get all known participants of the group, ensure
LegacyMUC.fill_participants()
has been awaited once before. Plugins should not use that, internal slidge use only. :return:
- remove_participant(p)[source]#
This ho :param p: :return:
- Parameters:
p (slidge.util.types.LegacyParticipantType) –
- 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 _fill_history(full_jid, maxchars=None, maxstanzas=None, seconds=None, since=None)[source]#
Old-style history join (internal slidge use)
- Parameters:
full_jid (slixmpp.JID) –
maxchars (Optional[int]) –
maxstanzas (Optional[int]) –
seconds (Optional[int]) –
since (Optional[datetime.datetime]) –
- Returns: