Skip to content

Commit

Permalink
Handle group changes properly (mautrix#432)
Browse files Browse the repository at this point in the history
Handle the actual changes instead of resyncing the whole group when something changes
  • Loading branch information
maltee1 authored Feb 11, 2024
1 parent d778a14 commit ed4a148
Show file tree
Hide file tree
Showing 6 changed files with 777 additions and 27 deletions.
1 change: 1 addition & 0 deletions config/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type BridgeConfig struct {
MessageErrorNotices bool `yaml:"message_error_notices"`
SyncDirectChatList bool `yaml:"sync_direct_chat_list"`
ResendBridgeInfo bool `yaml:"resend_bridge_info"`
PublicPortals bool `yaml:"public_portals"`
CaptionInMessage bool `yaml:"caption_in_message"`
FederateRooms bool `yaml:"federate_rooms"`

Expand Down
1 change: 1 addition & 0 deletions config/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func DoUpgrade(helper *up.Helper) {
helper.Copy(up.Bool, "bridge", "message_error_notices")
helper.Copy(up.Bool, "bridge", "sync_direct_chat_list")
helper.Copy(up.Bool, "bridge", "resend_bridge_info")
helper.Copy(up.Bool, "bridge", "public_portals")
helper.Copy(up.Bool, "bridge", "caption_in_message")
helper.Copy(up.Bool, "bridge", "federate_rooms")
helper.Copy(up.Map, "bridge", "double_puppet_server_map")
Expand Down
3 changes: 3 additions & 0 deletions example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ bridge:
# Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
# This field will automatically be changed back to false after it, except if the config file is not writable.
resend_bridge_info: false
# Whether or not to make portals of groups that don't need approval of an admin to join by invite
# link publicly joinable on Matrix.
public_portals: false
# Send captions in the same message as images. This will send data compatible with both MSC2530.
# This is currently not supported in most clients.
caption_in_message: false
Expand Down
46 changes: 46 additions & 0 deletions pkg/libsignalgo/verifysignature.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// mautrix-signal - A Matrix-signal puppeting bridge.
// Copyright (C) 2023 Scott Weber
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

package libsignalgo

/*
#cgo LDFLAGS: -lsignal_ffi -ldl -lm
#include "./libsignal-ffi.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)

type NotarySignature [C.SignalSIGNATURE_LEN]byte

func ServerPublicParamsVerifySignature(
serverPublicParams ServerPublicParams,
messageBytes []byte,
NotarySignature NotarySignature,
) error {
c_notarySignature := (*[C.SignalSIGNATURE_LEN]C.uint8_t)(unsafe.Pointer(&NotarySignature[0]))
c_serverPublicParams := (*[C.SignalSERVER_PUBLIC_PARAMS_LEN]C.uchar)(unsafe.Pointer(&serverPublicParams[0]))
signalFfiError := C.signal_server_public_params_verify_signature(
c_serverPublicParams,
BytesToBuffer(messageBytes),
c_notarySignature,
)
runtime.KeepAlive(messageBytes)
return wrapError(signalFfiError)
}
Loading

0 comments on commit ed4a148

Please sign in to comment.