Skip to content
Back to top
View this page
Edit this page

# slidge.util.types

Typing stuff

## Module Contents

class slidge.util.types.MessageReference

  A “message reply”, ie a “quoted message” (XEP-0461)

  At the very minimum, the legacy message ID attribute must be set, but to ensure that the quote is displayed in all XMPP clients, the author must also be set (use the string “user” if the slidge user is the author of the referenced message). The body is used as a fallback for XMPP clients that do not support XEP-0461 of that failed to find the referenced message.

class slidge.util.types.LegacyAttachment

  A file attachment to a message

  At the minimum, one of the `path`, `steam`, `data` or `url` attribute has to be set

  To be used with `LegacyContact.send_files()` or `LegacyParticipant.send_files()`

  caption: str | None = None

    A caption for this specific image. For a global caption for a list of attachments, use the `body` parameter of `AttachmentMixin.send_files()`

class slidge.util.types.MucType

  Bases: `enum.IntEnum`

  The type of group, private, public, anonymous or not.

  GROUP = 0

    A private group, members-only and non-anonymous, eg a family group.

  CHANNEL = 1

    A public group, aka an anonymous channel.

  CHANNEL_NON_ANONYMOUS = 2

    A public group where participants’ legacy IDs are visible to everybody.

class slidge.util.types.LinkPreview

  Bases: `NamedTuple`

  Embedded metadata from XEP-0511.

  See <https://ogp.me/>_.

  about: str

    URL of the link.

  title: str | None

    Title of the linked page.

  description: str | None

    A description of the page.

  url: str | None

    The canonical URL of the link.

  image: str | pathlib.Path | bytes | None

    An image representing the link. If it is a string, it should represent a URL to an image.

  type: str | None

    Type of the link destination.

  site_name: str | None

    Name of the web site.

class slidge.util.types.UserPreferences

  Bases: `TypedDict`

  dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

  > (key, value) pairs

  dict(iterable) -> new dictionary initialized as if via:

    d = {} for k, v in iterable:

    > d[k] = v

  dict(**kwargs) -> new dictionary initialized with the name=value pairs

    in the keyword argument list. For example: dict(one=1, two=2)