Explorar o código

Send all ogg audio from WhatsApp as voice messages

For some reason WhatsApp removes the `ptt` flag when a message is
forwarded, but still renders them as voice messages.
Tulir Asokan %!s(int64=2) %!d(string=hai) anos
pai
achega
c00fa4dd24
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      portal.go

+ 1 - 1
portal.go

@@ -3014,7 +3014,7 @@ func (portal *Portal) convertMediaMessageContent(intent *appservice.IntentAPI, m
 			"duration": int(audioMessage.GetSeconds()) * 1000,
 			"waveform": waveform,
 		}
-		if audioMessage.GetPtt() {
+		if audioMessage.GetPtt() || audioMessage.GetMimetype() == "audio/ogg; codecs/opus" {
 			extraContent["org.matrix.msc3245.voice"] = map[string]interface{}{}
 		}
 	}