This commit is contained in:
Fabio Manganiello 2022-08-04 03:08:54 +02:00
parent c17d0080b5
commit cbe2e7bbfe
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
6 changed files with 942 additions and 522 deletions

View File

@ -138,15 +138,12 @@ latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
@ -156,8 +153,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'platypush.tex', 'platypush Documentation',
'BlackLight', 'manual'),
(master_doc, 'platypush.tex', 'platypush Documentation', 'BlackLight', 'manual'),
]
@ -165,10 +161,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'platypush', 'platypush Documentation',
[author], 1)
]
man_pages = [(master_doc, 'platypush', 'platypush Documentation', [author], 1)]
# -- Options for Texinfo output ----------------------------------------------
@ -177,9 +170,15 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'platypush', 'platypush Documentation',
author, 'platypush', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
'platypush',
'platypush Documentation',
author,
'platypush',
'One line description of project.',
'Miscellaneous',
),
]
@ -199,99 +198,101 @@ autodoc_default_options = {
'inherited-members': True,
}
autodoc_mock_imports = ['googlesamples.assistant.grpc.audio_helpers',
'google.assistant.embedded',
'google.assistant.library',
'google.assistant.library.event',
'google.assistant.library.file_helpers',
'google.oauth2.credentials',
'oauth2client',
'apiclient',
'tenacity',
'smartcard',
'Leap',
'oauth2client',
'rtmidi',
'bluetooth',
'gevent.wsgi',
'Adafruit_IO',
'pyperclip',
'pydbus',
'inputs',
'inotify',
'omxplayer',
'plexapi',
'cwiid',
'sounddevice',
'soundfile',
'numpy',
'cv2',
'nfc',
'ndef',
'bcrypt',
'google',
'feedparser',
'kafka',
'googlesamples',
'icalendar',
'httplib2',
'mpd',
'serial',
'pyHS100',
'grpc',
'envirophat',
'gps',
'picamera',
'pmw3901',
'PIL',
'croniter',
'pyaudio',
'avs',
'PyOBEX',
'todoist',
'trello',
'telegram',
'telegram.ext',
'pyfirmata2',
'cups',
'graphyte',
'cpuinfo',
'psutil',
'openzwave',
'deepspeech',
'wave',
'pvporcupine ',
'pvcheetah',
'pyotp',
'linode_api4',
'pyzbar',
'tensorflow',
'keras',
'pandas',
'samsungtvws',
'paramiko',
'luma',
'zeroconf',
'dbus',
'gi',
'gi.repository',
'twilio',
'Adafruit_Python_DHT',
'RPi.GPIO',
'RPLCD',
'imapclient',
'pysmartthings',
'aiohttp',
'watchdog',
'pyngrok',
'irc',
'irc.bot',
'irc.strings',
'irc.client',
'irc.connection',
'irc.events',
'defusedxml',
]
autodoc_mock_imports = [
'googlesamples.assistant.grpc.audio_helpers',
'google.assistant.embedded',
'google.assistant.library',
'google.assistant.library.event',
'google.assistant.library.file_helpers',
'google.oauth2.credentials',
'oauth2client',
'apiclient',
'tenacity',
'smartcard',
'Leap',
'oauth2client',
'rtmidi',
'bluetooth',
'gevent.wsgi',
'Adafruit_IO',
'pyperclip',
'pydbus',
'inputs',
'inotify',
'omxplayer',
'plexapi',
'cwiid',
'sounddevice',
'soundfile',
'numpy',
'cv2',
'nfc',
'ndef',
'bcrypt',
'google',
'feedparser',
'kafka',
'googlesamples',
'icalendar',
'httplib2',
'mpd',
'serial',
'pyHS100',
'grpc',
'envirophat',
'gps',
'picamera',
'pmw3901',
'PIL',
'croniter',
'pyaudio',
'avs',
'PyOBEX',
'todoist',
'trello',
'telegram',
'telegram.ext',
'pyfirmata2',
'cups',
'graphyte',
'cpuinfo',
'psutil',
'openzwave',
'deepspeech',
'wave',
'pvporcupine ',
'pvcheetah',
'pyotp',
'linode_api4',
'pyzbar',
'tensorflow',
'keras',
'pandas',
'samsungtvws',
'paramiko',
'luma',
'zeroconf',
'dbus',
'gi',
'gi.repository',
'twilio',
'Adafruit_Python_DHT',
'RPi.GPIO',
'RPLCD',
'imapclient',
'pysmartthings',
'aiohttp',
'watchdog',
'pyngrok',
'irc',
'irc.bot',
'irc.strings',
'irc.client',
'irc.connection',
'irc.events',
'defusedxml',
'nio',
]
sys.path.insert(0, os.path.abspath('../..'))

View File

@ -67,6 +67,92 @@ class MatrixMessageEvent(MatrixEvent):
super().__init__(*args, body=body, **kwargs)
class MatrixMediaMessageEvent(MatrixMessageEvent):
"""
Event triggered when a media message is received on a subscribed room.
"""
def __init__(self, *args, url: str, **kwargs):
"""
:param url: The URL of the media file.
"""
super().__init__(*args, url=url, **kwargs)
class MatrixStickerEvent(MatrixMediaMessageEvent):
"""
Event triggered when a sticker is sent to a room.
"""
class MatrixReactionEvent(MatrixEvent):
"""
Event triggered when a user submits a reaction to an event.
"""
def __init__(self, *args, in_response_to_event_id: str, **kwargs):
"""
:param in_response_to_event_id: The ID of the URL related to the reaction.
"""
super().__init__(
*args, in_response_to_event_id=in_response_to_event_id, **kwargs
)
class MatrixEncryptedMessageEvent(MatrixMessageEvent):
"""
Event triggered when a message is received but the client doesn't
have the E2E keys to decrypt it, or encryption has not been enabled.
"""
class MatrixCallEvent(MatrixEvent):
"""
Base class for Matrix call events.
"""
def __init__(
self, *args, call_id: str, version: int, sdp: str | None = None, **kwargs
):
"""
:param call_id: The unique ID of the call.
:param version: An increasing integer representing the version of the call.
:param sdp: SDP text of the session description.
"""
super().__init__(*args, call_id=call_id, version=version, sdp=sdp, **kwargs)
class MatrixCallInviteEvent(MatrixCallEvent):
"""
Event triggered when the user is invited to a call.
"""
def __init__(self, *args, invite_validity: float | None = None, **kwargs):
"""
:param invite_validity: For how long the invite will be valid, in seconds.
:param sdp: SDP text of the session description.
"""
super().__init__(*args, invite_validity=invite_validity, **kwargs)
class MatrixCallAnswerEvent(MatrixCallEvent):
"""
Event triggered by the callee when they wish to answer the call.
"""
class MatrixCallHangupEvent(MatrixCallEvent):
"""
Event triggered when a participant in the call exists.
"""
class MatrixRoomCreatedEvent(MatrixEvent):
"""
Event triggered when a room is created.
"""
class MatrixRoomJoinEvent(MatrixEvent):
"""
Event triggered when a user joins a room.
@ -81,17 +167,11 @@ class MatrixRoomLeaveEvent(MatrixEvent):
class MatrixRoomInviteEvent(MatrixEvent):
"""
Event triggered when a user is invited to a room.
Event triggered when the user is invited to a room.
"""
class MatrixRoomInviteMeEvent(MatrixEvent):
"""
Event triggered when the currently logged in user is invited to a room.
"""
class MatrixRoomTopicChangeEvent(MatrixEvent):
class MatrixRoomTopicChangedEvent(MatrixEvent):
"""
Event triggered when the topic/title of a room changes.
"""

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,25 @@
manifest:
events:
platypush.message.event.matrix.MatrixMessageEvent: when a message is received.
platypush.message.event.matrix.MatrixMediaMessageEvent: when a media message is received.
platypush.message.event.matrix.MatrixRoomCreatedEvent: when a room is created.
platypush.message.event.matrix.MatrixRoomJoinEvent: when a user joins a room.
platypush.message.event.matrix.MatrixRoomLeaveEvent: when a user leaves a room.
platypush.message.event.matrix.MatrixRoomInviteEvent: when a user (other than the currently logged one) is invited to a room.
platypush.message.event.matrix.MatrixRoomMeInviteEvent: when the currently logged in user is invited to a room.
platypush.message.event.matrix.MatrixRoomTopicChangeEvent: when the topic/title of a room changes.
platypush.message.event.matrix.MatrixRoomInviteEvent: when the user is invited to a room.
platypush.message.event.matrix.MatrixRoomTopicChangedEvent: when the topic/title of a room changes.
platypush.message.event.matrix.MatrixCallInviteEvent: when the user is invited to a call.
platypush.message.event.matrix.MatrixCallAnswerEvent: when a called user wishes to pick the call.
platypush.message.event.matrix.MatrixCallHangupEvent: when a called user exits the call.
platypush.message.event.matrix.MatrixStickerEvent: when a sticker is sent to a room.
platypush.message.event.matrix.MatrixEncryptedMessageEvent: |
when a message is received but the client doesn't
have the E2E keys to decrypt it, or encryption has not been enabled.
apt:
- libolm-devel
pacman:
- libolm
pip:
- matrix-nio[e2e]
- async_lru
package: platypush.plugins.matrix
type: plugin

109
platypush/schemas/matrix.py Normal file
View File

@ -0,0 +1,109 @@
from marshmallow import fields
from marshmallow.schema import Schema
from platypush.schemas import DateTime
class MatrixProfileSchema(Schema):
user_id = fields.String(
required=True,
metadata={
'description': 'User ID',
'example': '@myuser:matrix.example.org',
},
)
display_name = fields.String(
attribute='displayname',
metadata={
'description': 'User display name',
'example': 'Foo Bar',
},
)
avatar_url = fields.URL(
metadata={
'description': 'User avatar URL',
'example': 'mxc://matrix.platypush.tech/AbCdEfG0123456789',
}
)
class MatrixRoomSchema(Schema):
room_id = fields.String(
required=True,
metadata={
'description': 'Room ID',
'example': '!aBcDeFgHiJkMnO:matrix.example.org',
},
)
name = fields.String(
metadata={
'description': 'Room name',
'example': 'My Room',
}
)
display_name = fields.String(
metadata={
'description': 'Room display name',
'example': 'My Room',
}
)
topic = fields.String(
metadata={
'description': 'Room topic',
'example': 'My Room Topic',
}
)
avatar_url = fields.URL(
attribute='room_avatar_url',
metadata={
'description': 'Room avatar URL',
'example': 'mxc://matrix.platypush.tech/AbCdEfG0123456789',
},
)
owner_id = fields.String(
attribute='own_user_id',
metadata={
'description': 'Owner user ID',
'example': '@myuser:matrix.example.org',
},
)
encrypted = fields.Bool()
class MatrixDeviceSchema(Schema):
device_id = fields.String(
required=True,
attribute='id',
metadata={
'description': 'ABCDEFG',
},
)
display_name = fields.String(
metadata={
'description': 'Device display name',
'example': 'My Device',
}
)
last_seen_ip = fields.String(
metadata={
'description': 'Last IP associated to this device',
'example': '1.2.3.4',
}
)
last_seen_date = DateTime(
metadata={
'description': 'The last time that the device was reported online',
'example': '2022-07-23T17:20:01.254223',
}
)

View File

@ -268,5 +268,7 @@ setup(
'ngrok': ['pyngrok'],
# Support for IRC integration
'irc': ['irc'],
# Support for the Matrix integration
'matrix': ['matrix-nio'],
},
)