mirror of
				https://github.com/matrix-org/gomatrix
				synced 2025-11-04 06:18:05 +00:00 
			
		
		
		
	added AudioMessage,LocationMessage,FileMessage
This commit is contained in:
		
							parent
							
								
									64c39d4e4d
								
							
						
					
					
						commit
						94d369014c
					
				
					 1 changed files with 41 additions and 0 deletions
				
			
		
							
								
								
									
										41
									
								
								events.go
									
										
									
									
									
								
							
							
						
						
									
										41
									
								
								events.go
									
										
									
									
									
								
							| 
						 | 
					@ -99,6 +99,47 @@ type HTMLMessage struct {
 | 
				
			||||||
	FormattedBody string `json:"formatted_body"`
 | 
						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("<[^<]+?>")
 | 
					var htmlRegex = regexp.MustCompile("<[^<]+?>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetHTMLMessage returns an HTMLMessage with the body set to a stripped version of the provided HTML, in addition
 | 
					// 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