mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 17:33:48 +01:00
fix formatting
This commit is contained in:
parent
3ab04e65c8
commit
779e591e60
1 changed files with 18 additions and 18 deletions
24
portal.go
24
portal.go
|
@ -1510,9 +1510,9 @@ func (portal *Portal) convertTextMessage(intent *appservice.IntentAPI, msg *waPr
|
|||
}
|
||||
expiresIn = contextInfo.GetExpiration()
|
||||
|
||||
preview := portal.convertUrlPreview(msg.GetExtendedTextMessage());
|
||||
preview := portal.convertUrlPreview(msg.GetExtendedTextMessage())
|
||||
|
||||
if ( preview != nil ) {
|
||||
if preview != nil {
|
||||
extraAttrs["com.beeper.linkpreview"] = preview
|
||||
}
|
||||
}
|
||||
|
@ -2070,20 +2070,20 @@ func (portal *Portal) convertWebPtoPNG(webpImage []byte) ([]byte, error) {
|
|||
}
|
||||
|
||||
func (portal *Portal) convertUrlPreview(source *waProto.ExtendedTextMessage) map[string]interface{} {
|
||||
if ( source == nil ) {
|
||||
if source == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
matchedText := source.GetMatchedText()
|
||||
|
||||
if ( matchedText == "" ) {
|
||||
if matchedText == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
canonicalUrl := source.GetCanonicalUrl()
|
||||
|
||||
url := matchedText
|
||||
if ( canonicalUrl != "" ) {
|
||||
if canonicalUrl != "" {
|
||||
url = canonicalUrl
|
||||
}
|
||||
|
||||
|
@ -2099,9 +2099,9 @@ func (portal *Portal) convertUrlPreview(source *waProto.ExtendedTextMessage) map
|
|||
if uploadedThumbnail != nil {
|
||||
cfg, _, _ := image.DecodeConfig(bytes.NewReader(source.GetJpegThumbnail()))
|
||||
result["og:image"] = uploadedThumbnail.ContentURI.CUString()
|
||||
result["og:image:width"] = cfg.Width;
|
||||
result["og:image:height"] = cfg.Height;
|
||||
result["og:image:type"] = thumbnailMime;
|
||||
result["og:image:width"] = cfg.Width
|
||||
result["og:image:height"] = cfg.Height
|
||||
result["og:image:type"] = thumbnailMime
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2109,13 +2109,13 @@ func (portal *Portal) convertUrlPreview(source *waProto.ExtendedTextMessage) map
|
|||
}
|
||||
|
||||
func (portal *Portal) updateExtendedMessageForUrlPreview(source *event.Content, dest *waProto.ExtendedTextMessage) {
|
||||
if ( source == nil ) {
|
||||
if source == nil {
|
||||
return
|
||||
}
|
||||
|
||||
embeddedLink, ok := source.Raw["com.beeper.linkpreview"].(map[string]interface{});
|
||||
embeddedLink, ok := source.Raw["com.beeper.linkpreview"].(map[string]interface{})
|
||||
|
||||
if ( !ok || embeddedLink == nil ) {
|
||||
if !ok || embeddedLink == nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -2130,7 +2130,7 @@ func (portal *Portal) updateExtendedMessageForUrlPreview(source *event.Content,
|
|||
canonical, ok := embeddedLink["og:url"].(string)
|
||||
|
||||
if ok {
|
||||
dest.CanonicalUrl = &canonical;
|
||||
dest.CanonicalUrl = &canonical
|
||||
}
|
||||
|
||||
description, ok := embeddedLink["og:description"].(string)
|
||||
|
|
Loading…
Reference in a new issue