mirror of
https://github.com/matrix-org/gomatrix
synced 2025-05-15 20:13:22 +00:00
added AudioMessage,LocationMessage,FileMessage and comments where helpful
This commit is contained in:
parent
9f4eb0fd6d
commit
f801209a7f
1 changed files with 45 additions and 4 deletions
49
events.go
49
events.go
|
@ -48,10 +48,10 @@ type TextMessage struct {
|
|||
|
||||
// ImageInfo contains info about an image - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-image
|
||||
type ImageInfo struct {
|
||||
Height uint `json:"h,omitempty"`
|
||||
Width uint `json:"w,omitempty"`
|
||||
Height uint `json:"h,omitempty"` //image height in pixels
|
||||
Width uint `json:"w,omitempty"` //image width in pixels
|
||||
Mimetype string `json:"mimetype,omitempty"`
|
||||
Size uint `json:"size,omitempty"`
|
||||
Size uint `json:"size,omitempty"` //filesize in bytes
|
||||
}
|
||||
|
||||
// VideoInfo contains info about a video - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-video
|
||||
|
@ -62,7 +62,7 @@ type VideoInfo struct {
|
|||
Height uint `json:"h,omitempty"`
|
||||
Width uint `json:"w,omitempty"`
|
||||
Duration uint `json:"duration,omitempty"`
|
||||
Size uint `json:"size,omitempty"`
|
||||
Size uint `json:"size,omitempty"` //filesize in bytes
|
||||
}
|
||||
|
||||
// VideoMessage is an m.video - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-video
|
||||
|
@ -91,6 +91,47 @@ type HTMLMessage struct {
|
|||
FormattedBody string `json:"formatted_body"`
|
||||
}
|
||||
|
||||
// FileInfo contains info about an file - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-file
|
||||
type FileInfo struct {
|
||||
Mimetype string `json:"mimetype,omitempty"`
|
||||
Size uint `json:"size,omitempty"` //filesize in bytes
|
||||
}
|
||||
|
||||
// FileMessage is an m.file event - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-file
|
||||
type FileMessage struct {
|
||||
MsgType string `json:"msgtype"`
|
||||
Body string `json:"body"`
|
||||
URL string `json:"url"`
|
||||
Filename string `json:"filename"`
|
||||
Info FileInfo `json:"info,omitempty"`
|
||||
ThumbnailURL string `json:"thumbnail_url,omitempty"`
|
||||
ThumbnailInfo ImageInfo `json:"thumbnail_info,omitempty"`
|
||||
}
|
||||
|
||||
// LocationMessage is an m.location event - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-location
|
||||
type LocationMessage struct {
|
||||
MsgType string `json:"msgtype"`
|
||||
Body string `json:"body"`
|
||||
GeoURI string `json:"geo_uri"`
|
||||
ThumbnailURL string `json:"thumbnail_url,omitempty"`
|
||||
ThumbnailInfo ImageInfo `json:"thumbnail_info,omitempty"`
|
||||
}
|
||||
|
||||
// AudioInfo contains info about an file - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-audio
|
||||
type AudioInfo struct {
|
||||
Mimetype string `json:"mimetype,omitempty"`
|
||||
Size uint `json:"size,omitempty"` //filesize in bytes
|
||||
Duration uint `json:"duration,omitempty"` //audio duration in ms
|
||||
}
|
||||
|
||||
// AudioMessage is an m.audio event - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-audio
|
||||
type AudioMessage struct {
|
||||
MsgType string `json:"msgtype"`
|
||||
Body string `json:"body"`
|
||||
URL string `json:"url"`
|
||||
Info AudioInfo `json:"info,omitempty"`
|
||||
}
|
||||
|
||||
var htmlRegex = regexp.MustCompile("<[^<]+?>")
|
||||
|
||||
// GetHTMLMessage returns an HTMLMessage with the body set to a stripped version of the provided HTML, in addition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue