瀏覽代碼

Add support for slightly older voice message identifier

Tulir Asokan 4 年之前
父節點
當前提交
3eb5f44023
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      portal.go

+ 3 - 1
portal.go

@@ -2152,7 +2152,9 @@ func (portal *Portal) convertMatrixMessage(sender *User, evt *event.Event) (*waP
 			FileSha256:    media.FileSHA256,
 			FileSha256:    media.FileSHA256,
 			FileLength:    &media.FileLength,
 			FileLength:    &media.FileLength,
 		}
 		}
-		if _, isVoice := evt.Content.Raw["org.matrix.msc3245.voice"]; isVoice {
+		_, isMSC3245Voice := evt.Content.Raw["org.matrix.msc3245.voice"]
+		_, isMSC2516Voice := evt.Content.Raw["org.matrix.msc2516.voice"]
+		if isMSC3245Voice || isMSC2516Voice {
 			info.Message.AudioMessage.Ptt = &trueVal
 			info.Message.AudioMessage.Ptt = &trueVal
 			// hacky hack to add the codecs param that whatsapp seems to require
 			// hacky hack to add the codecs param that whatsapp seems to require
 			mimeWithCodec := addCodecToMime(content.GetInfo().MimeType, "opus")
 			mimeWithCodec := addCodecToMime(content.GetInfo().MimeType, "opus")