fix formatting

This commit is contained in:
Adam Van Ymeren 2022-02-04 06:56:32 +00:00
parent 3ab04e65c8
commit 779e591e60

View file

@ -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)