tomatrix: avoid multipart messages
This commit is contained in:
@@ -199,6 +199,11 @@ func (tc *TelegramClient) convertToMatrix(
|
|||||||
if mediaPart != nil {
|
if mediaPart != nil {
|
||||||
hasher.Write(mediaHashID)
|
hasher.Write(mediaHashID)
|
||||||
cm.Parts = append(cm.Parts, mediaPart)
|
cm.Parts = append(cm.Parts, mediaPart)
|
||||||
|
// Force stickers into images if there is a caption (usually there shouldn't be)
|
||||||
|
if mediaPart.Type == event.EventSticker && len(cm.Parts) == 2 {
|
||||||
|
mediaPart.Type = event.EventMessage
|
||||||
|
mediaPart.Content.MsgType = event.MsgImage
|
||||||
|
}
|
||||||
cm.MergeCaption()
|
cm.MergeCaption()
|
||||||
|
|
||||||
contentURI = mediaPart.Content.URL
|
contentURI = mediaPart.Content.URL
|
||||||
@@ -252,6 +257,12 @@ func (tc *TelegramClient) convertToMatrix(
|
|||||||
log.Warn().Type("reply_to", replyTo).Msg("unhandled reply to type")
|
log.Warn().Type("reply_to", replyTo).Msg("unhandled reply to type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(cm.Parts) > 1 {
|
||||||
|
log.Warn().Int("part_count", len(cm.Parts)).Msg("Message has multiple parts")
|
||||||
|
for i, part := range cm.Parts[1:] {
|
||||||
|
part.ID = networkid.PartID(strconv.Itoa(i + 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ttl, ok := msg.GetTTLPeriod(); ok && disappearingSetting == nil {
|
if ttl, ok := msg.GetTTLPeriod(); ok && disappearingSetting == nil {
|
||||||
cm.Disappear = database.DisappearingSetting{
|
cm.Disappear = database.DisappearingSetting{
|
||||||
|
|||||||
Reference in New Issue
Block a user