Skip to content

Commit

Permalink
ids: add support for split portals
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 14, 2024
1 parent a219b72 commit 33a9954
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
golang.org/x/sync v0.8.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
maunium.net/go/mautrix v0.20.1-0.20240913095532-e12ecbe82d36
maunium.net/go/mautrix v0.20.1-0.20240914094516-d89dac594db0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
maunium.net/go/mautrix v0.20.1-0.20240913095532-e12ecbe82d36 h1:XKDqeDfRHmgke2N16A41eOckQQqezosxaEyehG/rupM=
maunium.net/go/mautrix v0.20.1-0.20240913095532-e12ecbe82d36/go.mod h1:amzKPIZVO7v1piD2JhKG1RvGZoV+5wEZfoHaEXOjjqA=
maunium.net/go/mautrix v0.20.1-0.20240914094516-d89dac594db0 h1:fTX1P8TPv+oUqHGu08jj6FYH+Q/fC9jtmvkXcAw+KTo=
maunium.net/go/mautrix v0.20.1-0.20240914094516-d89dac594db0/go.mod h1:amzKPIZVO7v1piD2JhKG1RvGZoV+5wEZfoHaEXOjjqA=
12 changes: 9 additions & 3 deletions pkg/connector/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ import (
"maunium.net/go/mautrix-whatsapp/pkg/waid"
)

func (wa *WhatsAppClient) makeWAPortalKey(chatJID types.JID) (key networkid.PortalKey) {
key.ID = waid.MakePortalID(chatJID)
func (wa *WhatsAppClient) makeWAPortalKey(chatJID types.JID) networkid.PortalKey {
key := networkid.PortalKey{
ID: waid.MakePortalID(chatJID),
}
switch chatJID.Server {
case types.DefaultUserServer, types.HiddenUserServer, types.BroadcastServer:
key.Receiver = wa.UserLogin.ID
default:
if wa.Main.Bridge.Config.SplitPortals {
key.Receiver = wa.UserLogin.ID
}
}
return
return key
}

func (wa *WhatsAppClient) makeEventSender(id types.JID) bridgev2.EventSender {
Expand Down

0 comments on commit 33a9954

Please sign in to comment.