:py:mod:`matridge.session`
==========================

.. py:module:: matridge.session


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   matridge.session.Session



Functions
~~~~~~~~~

.. autoapisummary::

   matridge.session.no_dm



Attributes
~~~~~~~~~~

.. autoapisummary::

   matridge.session.Sender
   matridge.session.Recipient
   matridge.session.PRESENCE_DICT


.. py:data:: Sender
   

   

.. py:data:: Recipient
   

   

.. py:function:: no_dm(func)


.. py:class:: Session(*a)

   Bases: :py:obj:`slidge.BaseSession`\ [\ :py:obj:`str`\ , :py:obj:`Recipient`\ ]

   The session of a registered :term:`User`.

   Represents a gateway user logged in to the legacy network and performing actions.

   Will be instantiated automatically on slidge startup for each registered user,
   or upon registration for new (validated) users.

   Must be subclassed for a functional :term:`Legacy Module`.

   .. py:attribute:: bookmarks
      :annotation: :matridge.group.Bookmarks

      

   .. py:attribute:: contacts
      :annotation: :matridge.contact.Roster

      

   .. py:attribute:: matrix
      :annotation: :matridge.matrix.Client

      

   .. py:attribute:: MESSAGE_IDS_ARE_THREAD_IDS
      :annotation: = True

      

   .. py:method:: login()
      :async:

      Logs in the gateway user to the legacy network.

      Triggered when the gateway start and on user registration.
      It is recommended that this function returns once the user is logged in,
      so if you need to await forever (for instance to listen to incoming events),
      it's a good idea to wrap your listener in an asyncio.Task.

      :return: Optionally, a text to use as the gateway status, e.g., "Connected as 'dude@legacy.network'"


   .. py:method:: logout()
      :async:

      Logs out the gateway user from the legacy network.

      Called on gateway shutdown.


   .. py:method:: __relates_to(room_id, content, reply_to_msg_id, thread)
      :async:


   .. py:method:: __handle_response(response)
      :async:


   .. py:method:: __room_send(chat, content, message_type='m.room.message')
      :async:


   .. py:method:: send_text(chat, text, *, reply_to_msg_id = None, reply_to_fallback_text = None, reply_to = None, thread = None)
      :async:


   .. py:method:: send_file(chat, url, *, http_response, reply_to_msg_id = None, reply_to_fallback_text = None, reply_to = None, thread = None)
      :async:


   .. py:method:: active(c, thread = None)
      :async:


   .. py:method:: inactive(c, thread = None)
      :async:


   .. py:method:: composing(c, thread = None)
      :async:


   .. py:method:: paused(c, thread = None)
      :async:


   .. py:method:: displayed(c, legacy_msg_id, thread = None)
      :async:


   .. py:method:: correct(c, text, legacy_msg_id, thread = None)
      :async:


   .. py:method:: search(form_values)
      :async:


   .. py:method:: react(c, legacy_msg_id, emojis, thread = None)
      :async:


   .. py:method:: retract(c, legacy_msg_id, thread = None)
      :async:


   .. py:method:: presence(resource, show, status, resources, merged_resource)
      :async:



.. py:data:: PRESENCE_DICT
   :annotation: :dict[slidge.util.types.PseudoPresenceShow, str]

   

