slidge.core.mixins.message#

Module Contents#

Classes#

Attributes#

log

class slidge.core.mixins.message.ChatStateMixin[source]#

Bases: slidge.core.mixins.message_maker.MessageMaker

_chat_state(state, **kwargs)[source]#
Parameters:

state (slidge.util.types.ChatState) –

active(**kwargs)[source]#

Send an “active” chat state (XEP-0085) from this contact to the user.

composing(**kwargs)[source]#

Send a “composing” (ie “typing notification”) chat state (XEP-0085) from this contact to the user.

paused(**kwargs)[source]#

Send a “paused” (ie “typing paused notification”) chat state (XEP-0085) from this contact to the user.

inactive(**kwargs)[source]#

Send an “inactive” (ie “contact has not interacted with the chat session interface for an intermediate period of time”) chat state (XEP-0085) from this contact to the user.

gone(**kwargs)[source]#

Send a “gone” (ie “contact has not interacted with the chat session interface, system, or device for a relatively long period of time”) chat state (XEP-0085) from this contact to the user.

class slidge.core.mixins.message.MarkerMixin[source]#

Bases: slidge.core.mixins.message_maker.MessageMaker

is_group: bool[source]#
_make_marker(legacy_msg_id, marker, carbon=False)[source]#
Parameters:
  • legacy_msg_id (slidge.util.types.LegacyMessageType) –

  • marker (slidge.util.types.Marker) –

ack(legacy_msg_id, **kwargs)[source]#

Send an “acknowledged” message marker (XEP-0333) from this contact to the user.

Parameters:

legacy_msg_id (slidge.util.types.LegacyMessageType) – The message this marker refers to

received(legacy_msg_id, **kwargs)[source]#

Send a “received” message marker (XEP-0333) from this contact to the user. For LegacyContacts, also send a delivery receipt marker (XEP-0184)

Parameters:

legacy_msg_id (slidge.util.types.LegacyMessageType) – The message this marker refers to

displayed(legacy_msg_id, **kwargs)[source]#

Send a “displayed” message marker (XEP-0333) from this contact to the user.

Parameters:

legacy_msg_id (slidge.util.types.LegacyMessageType) – The message this marker refers to

class slidge.core.mixins.message.ContentMessageMixin[source]#

Bases: slidge.core.mixins.attachment.AttachmentMixin

__default_hints(hints=None)[source]#
Parameters:

hints (Optional[Iterable[slidge.util.types.ProcessingHint]]) –

__replace_id(legacy_msg_id)[source]#
Parameters:

legacy_msg_id (slidge.util.types.LegacyMessageType) –

send_text(body, legacy_msg_id=None, *, when=None, reply_to=None, thread=None, hints=None, carbon=False, archive_only=False, correction=False, **send_kwargs)[source]#

Transmit a message from the entity to the user

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

  • legacy_msg_id (Optional[slidge.util.types.LegacyMessageType]) – If you want to be able to transport read markers from the gateway user to the legacy network, specify this

  • when (Optional[datetime.datetime]) – when the message was sent, for a “delay” tag (XEP-0203)

  • reply_to (Optional[slidge.util.types.MessageReference]) – Quote another message (XEP-0461)

  • hints (Optional[Iterable[slidge.util.types.ProcessingHint]]) –

  • thread (Optional[slidge.util.types.LegacyThreadType]) –

  • 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()

correct(legacy_msg_id, new_text, *, when=None, reply_to=None, thread=None, hints=None, carbon=False, archive_only=False, **send_kwargs)[source]#

Call this when a legacy contact has modified his last message content.

Uses last message correction (XEP-0308)

Parameters:
  • new_text (str) – New content of the message

  • legacy_msg_id (slidge.util.types.LegacyMessageType) – The legacy message ID of the message to correct

  • when (Optional[datetime.datetime]) – when the message was sent, for a “delay” tag (XEP-0203)

  • reply_to (Optional[slidge.util.types.MessageReference]) – Quote another message (XEP-0461)

  • hints (Optional[Iterable[slidge.util.types.ProcessingHint]]) –

  • thread (Optional[slidge.util.types.LegacyThreadType]) –

  • 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.

  • 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()

react(legacy_msg_id, emojis=(), thread=None, **kwargs)[source]#

Call this when a legacy contact reacts to a message

Parameters:
  • legacy_msg_id (slidge.util.types.LegacyMessageType) – The message which the reaction refers to.

  • emojis (Iterable[str]) – An iterable of emojis used as reactions

  • thread (Optional[slidge.util.types.LegacyThreadType]) –

retract(legacy_msg_id, thread=None, **kwargs)[source]#

Call this when a legacy contact retracts (XEP-0424) a message

Parameters:
  • legacy_msg_id (slidge.util.types.LegacyMessageType) – Legacy ID of the message to delete

  • thread (Optional[slidge.util.types.LegacyThreadType]) –

class slidge.core.mixins.message.CarbonMessageMixin[source]#

Bases: ContentMessageMixin, MarkerMixin

_privileged_send(msg)[source]#
Parameters:

msg (slixmpp.Message) –

class slidge.core.mixins.message.MessageMixin[source]#

Bases: ChatStateMixin, MarkerMixin, ContentMessageMixin

class slidge.core.mixins.message.MessageCarbonMixin[source]#

Bases: ChatStateMixin, CarbonMessageMixin

slidge.core.mixins.message.log[source]#