Remove extev v2 option

This commit is contained in:
Tulir Asokan 2022-11-26 18:53:08 +02:00
parent 0232a176d4
commit 4b0302d745
4 changed files with 20 additions and 12 deletions

View File

@ -111,7 +111,7 @@ type BridgeConfig struct {
FederateRooms bool `yaml:"federate_rooms"` FederateRooms bool `yaml:"federate_rooms"`
URLPreviews bool `yaml:"url_previews"` URLPreviews bool `yaml:"url_previews"`
CaptionInMessage bool `yaml:"caption_in_message"` CaptionInMessage bool `yaml:"caption_in_message"`
ExtEvPolls int `yaml:"extev_polls"` ExtEvPolls bool `yaml:"extev_polls"`
SendWhatsAppEdits bool `yaml:"send_whatsapp_edits"` SendWhatsAppEdits bool `yaml:"send_whatsapp_edits"`
MessageHandlingTimeout struct { MessageHandlingTimeout struct {

View File

@ -94,7 +94,15 @@ func DoUpgrade(helper *up.Helper) {
helper.Copy(up.Bool, "bridge", "crash_on_stream_replaced") helper.Copy(up.Bool, "bridge", "crash_on_stream_replaced")
helper.Copy(up.Bool, "bridge", "url_previews") helper.Copy(up.Bool, "bridge", "url_previews")
helper.Copy(up.Bool, "bridge", "caption_in_message") helper.Copy(up.Bool, "bridge", "caption_in_message")
helper.Copy(up.Int, "bridge", "extev_polls") if intPolls, ok := helper.Get(up.Int, "bridge", "extev_polls"); ok {
val := "false"
if intPolls != "0" {
val = "true"
}
helper.Set(up.Bool, val, "bridge", "extev_polls")
} else {
helper.Copy(up.Bool, "bridge", "extev_polls")
}
helper.Copy(up.Bool, "bridge", "send_whatsapp_edits") helper.Copy(up.Bool, "bridge", "send_whatsapp_edits")
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "error_after") helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "error_after")
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "deadline") helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "deadline")

View File

@ -299,9 +299,8 @@ bridge:
# Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552. # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
# This is currently not supported in most clients. # This is currently not supported in most clients.
caption_in_message: false caption_in_message: false
# Should polls be sent using MSC3381 event types? This should either be 1 for original polls MSC, # Should polls be sent using MSC3381 event types?
# 2 for the updated MSC as of November 2022, or 0 to use legacy m.room.message (which doesn't support voting). extev_polls: false
extev_polls: 0
# Should Matrix edits be bridged to WhatsApp edits? # Should Matrix edits be bridged to WhatsApp edits?
# Official WhatsApp clients don't render edits yet, but once they do, the bridge should work with them right away. # Official WhatsApp clients don't render edits yet, but once they do, the bridge should work with them right away.
send_whatsapp_edits: false send_whatsapp_edits: false

View File

@ -2101,7 +2101,7 @@ func (portal *Portal) convertListResponseMessage(intent *appservice.IntentAPI, m
} }
func (portal *Portal) convertPollUpdateMessage(intent *appservice.IntentAPI, source *User, info *types.MessageInfo, msg *waProto.PollUpdateMessage) *ConvertedMessage { func (portal *Portal) convertPollUpdateMessage(intent *appservice.IntentAPI, source *User, info *types.MessageInfo, msg *waProto.PollUpdateMessage) *ConvertedMessage {
if portal.bridge.Config.Bridge.ExtEvPolls == 0 { if !portal.bridge.Config.Bridge.ExtEvPolls {
return nil return nil
} }
pollMessage := portal.bridge.DB.Message.GetByJID(portal.Key, msg.GetPollCreationMessageKey().GetId()) pollMessage := portal.bridge.DB.Message.GetByJID(portal.Key, msg.GetPollCreationMessageKey().GetId())
@ -2123,9 +2123,9 @@ func (portal *Portal) convertPollUpdateMessage(intent *appservice.IntentAPI, sou
} }
evtType := TypeMSC3881PollResponse evtType := TypeMSC3881PollResponse
if portal.bridge.Config.Bridge.ExtEvPolls == 2 { //if portal.bridge.Config.Bridge.ExtEvPolls == 2 {
evtType = TypeMSC3881V2PollResponse // evtType = TypeMSC3881V2PollResponse
} //}
return &ConvertedMessage{ return &ConvertedMessage{
Intent: intent, Intent: intent,
Type: evtType, Type: evtType,
@ -2174,11 +2174,12 @@ func (portal *Portal) convertPollCreationMessage(intent *appservice.IntentAPI, m
maxChoices = len(optionNames) maxChoices = len(optionNames)
} }
evtType := event.EventMessage evtType := event.EventMessage
if portal.bridge.Config.Bridge.ExtEvPolls == 1 { if portal.bridge.Config.Bridge.ExtEvPolls {
evtType.Type = "org.matrix.msc3381.poll.start" evtType.Type = "org.matrix.msc3381.poll.start"
} else if portal.bridge.Config.Bridge.ExtEvPolls == 2 {
evtType.Type = "org.matrix.msc3381.v2.poll.start"
} }
//else if portal.bridge.Config.Bridge.ExtEvPolls == 2 {
// evtType.Type = "org.matrix.msc3381.v2.poll.start"
//}
return &ConvertedMessage{ return &ConvertedMessage{
Intent: intent, Intent: intent,
Type: evtType, Type: evtType,