|
|
|
@ -28,149 +28,12 @@ m.room.message msgtypes
|
|
|
|
|
.. TODO-spec
|
|
|
|
|
How a client should handle unknown message types.
|
|
|
|
|
|
|
|
|
|
.. TODO-spec
|
|
|
|
|
We've forgotten m.file...
|
|
|
|
|
|
|
|
|
|
.. TODO-spec
|
|
|
|
|
It's really confusing that the m. prefix is used both for event types and
|
|
|
|
|
for msgtypes. We should namespace them differently somehow.
|
|
|
|
|
|
|
|
|
|
Each ``m.room.message`` MUST have a ``msgtype`` key which identifies the type
|
|
|
|
|
of message being sent. Each type has their own required and optional keys, as
|
|
|
|
|
outlined below:
|
|
|
|
|
|
|
|
|
|
``m.text``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``body`` : "string" - The body of the message.
|
|
|
|
|
Optional keys:
|
|
|
|
|
None.
|
|
|
|
|
Example:
|
|
|
|
|
``{ "msgtype": "m.text", "body": "I am a fish" }``
|
|
|
|
|
|
|
|
|
|
``m.emote``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``body`` : "string" - The emote action to perform.
|
|
|
|
|
Optional keys:
|
|
|
|
|
None.
|
|
|
|
|
Example:
|
|
|
|
|
``{ "msgtype": "m.emote", "body": "tries to come up with a witty explanation" }``
|
|
|
|
|
|
|
|
|
|
``m.notice``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``body`` : "string" - The body of the message.
|
|
|
|
|
Optional keys:
|
|
|
|
|
None.
|
|
|
|
|
Example:
|
|
|
|
|
``{ "msgype": "m.notice", "body": "some kind of automated announcement" }``
|
|
|
|
|
|
|
|
|
|
A ``m.notice`` message should be considered similar to a plain ``m.text``
|
|
|
|
|
message except that clients should visually distinguish it in some way. It is
|
|
|
|
|
intended to be used by automated clients, such as bots, bridges, and other
|
|
|
|
|
entities, rather than humans. Additionally, such automated agents which watch
|
|
|
|
|
a room for messages and respond to them ought to ignore ``m.notice`` messages.
|
|
|
|
|
This helps to prevent infinite-loop situations where two automated clients
|
|
|
|
|
continuously exchange messages, as each responds to the other.
|
|
|
|
|
|
|
|
|
|
``m.image``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``url`` : "string" - The URL to the image.
|
|
|
|
|
Optional keys:
|
|
|
|
|
- ``info`` : "string" - info : JSON object (ImageInfo) - The image info for
|
|
|
|
|
image referred to in ``url``.
|
|
|
|
|
- ``thumbnail_url`` : "string" - The URL to the thumbnail.
|
|
|
|
|
- ``thumbnail_info`` : JSON object (ImageInfo) - The image info for the
|
|
|
|
|
image referred to in ``thumbnail_url``.
|
|
|
|
|
- ``body`` : "string" - The alt text of the image, or some kind of content
|
|
|
|
|
description for accessibility e.g. "image attachment".
|
|
|
|
|
|
|
|
|
|
ImageInfo:
|
|
|
|
|
Information about an image::
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"size" : integer (size of image in bytes),
|
|
|
|
|
"w" : integer (width of image in pixels),
|
|
|
|
|
"h" : integer (height of image in pixels),
|
|
|
|
|
"mimetype" : "string (e.g. image/jpeg)",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
``m.audio``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``url`` : "string" - The URL to the audio.
|
|
|
|
|
Optional keys:
|
|
|
|
|
- ``info`` : JSON object (AudioInfo) - The audio info for the audio
|
|
|
|
|
referred to in ``url``.
|
|
|
|
|
- ``body`` : "string" - A description of the audio e.g. "Bee Gees - Stayin'
|
|
|
|
|
Alive", or some kind of content description for accessibility e.g.
|
|
|
|
|
"audio attachment".
|
|
|
|
|
AudioInfo:
|
|
|
|
|
Information about a piece of audio::
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"mimetype" : "string (e.g. audio/aac)",
|
|
|
|
|
"size" : integer (size of audio in bytes),
|
|
|
|
|
"duration" : integer (duration of audio in milliseconds),
|
|
|
|
|
}
|
|
|
|
|
outlined below.
|
|
|
|
|
|
|
|
|
|
``m.video``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``url`` : "string" - The URL to the video.
|
|
|
|
|
Optional keys:
|
|
|
|
|
- ``info`` : JSON object (VideoInfo) - The video info for the video
|
|
|
|
|
referred to in ``url``.
|
|
|
|
|
- ``body`` : "string" - A description of the video e.g. "Gangnam style", or
|
|
|
|
|
some kind of content description for accessibility e.g. "video
|
|
|
|
|
attachment".
|
|
|
|
|
|
|
|
|
|
VideoInfo:
|
|
|
|
|
Information about a video::
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"mimetype" : "string (e.g. video/mp4)",
|
|
|
|
|
"size" : integer (size of video in bytes),
|
|
|
|
|
"duration" : integer (duration of video in milliseconds),
|
|
|
|
|
"w" : integer (width of video in pixels),
|
|
|
|
|
"h" : integer (height of video in pixels),
|
|
|
|
|
"thumbnail_url" : "string (URL to image)",
|
|
|
|
|
"thumbanil_info" : JSON object (ImageInfo)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
``m.location``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``geo_uri`` : "string" - The geo URI representing the location.
|
|
|
|
|
Optional keys:
|
|
|
|
|
- ``thumbnail_url`` : "string" - The URL to a thumnail of the location
|
|
|
|
|
being represented.
|
|
|
|
|
- ``thumbnail_info`` : JSON object (ImageInfo) - The image info for the
|
|
|
|
|
image referred to in ``thumbnail_url``.
|
|
|
|
|
- ``body`` : "string" - A description of the location e.g. "Big Ben,
|
|
|
|
|
London, UK", or some kind of content description for accessibility e.g.
|
|
|
|
|
"location attachment".
|
|
|
|
|
|
|
|
|
|
``m.file``
|
|
|
|
|
Required keys:
|
|
|
|
|
- ``url`` : "string" - The URL for the file
|
|
|
|
|
- ``filename`` : "string" - The original filename of the uploaded file
|
|
|
|
|
Optional keys:
|
|
|
|
|
- ``info`` : JSON object (FileInfo) - The info for the file
|
|
|
|
|
referred to in ``url``.
|
|
|
|
|
- ``thumbnail_url`` : "string" - The URL to a thumnail of the location
|
|
|
|
|
being represented.
|
|
|
|
|
- ``thumbnail_info`` : JSON object (ImageInfo) - The image info for the
|
|
|
|
|
image referred to in ``thumbnail_url``.
|
|
|
|
|
- ``body`` : "string" - A human-readable description of the file for
|
|
|
|
|
backwards compatibility. This is recommended to be the filename of the
|
|
|
|
|
original upload.
|
|
|
|
|
|
|
|
|
|
FileInfo:
|
|
|
|
|
Information about a file::
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"size" : integer (size of file in bytes),
|
|
|
|
|
"mimetype" : "string (e.g. image/jpeg)",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.. TODO-spec
|
|
|
|
|
Make the definitions "inherit" from FileInfo where necessary...
|
|
|
|
|
{{msgtype_events}}
|
|
|
|
|
|
|
|
|
|
Presence Events
|
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|