Skip to content

Commit

Permalink
libsignal: update to v0.62.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 15, 2024
1 parent 33ac0b4 commit 45f97de
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v0.7.3 (unreleased)

* Updated libsignal to v0.62.0.
* Added basic support for Signal's new file upload protocol.

# v0.7.2 (2024-10-16)

* Updated to libsignal v0.58.3.
Expand Down
2 changes: 1 addition & 1 deletion pkg/libsignalgo/libsignal
Submodule libsignal updated 134 files
16 changes: 11 additions & 5 deletions pkg/libsignalgo/libsignal-ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ typedef struct {
SignalStoreSignedPreKey store_signed_pre_key;
} SignalSignedPreKeyStore;

typedef void (*SignalLogCallback)(void *ctx, const char *target, SignalLogLevel level, const char *file, uint32_t line, const char *message);
typedef void (*SignalLogCallback)(void *ctx, SignalLogLevel level, const char *file, uint32_t line, const char *message);

typedef void (*SignalLogFlushCallback)(void *ctx);

Expand Down Expand Up @@ -664,6 +664,14 @@ typedef void (*SignalDestroyChatListener)(void *ctx);
* Callbacks will be serialized (i.e. two calls will not come in at the same time), but may not
* always happen on the same thread. Calls should be responded to promptly to avoid blocking later
* messages.
*
* # Safety
*
* This type contains raw pointers. Code that constructs an instance of this type must ensure
* memory safety assuming that
* - the callback function pointer fields are called with `ctx` as an argument;
* - the `destroy` function pointer field is called with `ctx` as an argument;
* - no function pointer fields are called after `destroy` is called.
*/
typedef struct {
void *ctx;
Expand All @@ -673,8 +681,6 @@ typedef struct {
SignalDestroyChatListener destroy;
} SignalFfiChatListenerStruct;

typedef SignalFfiChatListenerStruct SignalFfiMakeChatListenerStruct;

typedef int (*SignalRead)(void *ctx, uint8_t *buf, size_t buf_len, size_t *amount_read);

typedef int (*SignalSkip)(void *ctx, uint64_t amount);
Expand Down Expand Up @@ -1545,9 +1551,9 @@ SignalFfiError *signal_chat_service_auth_send(SignalCPromiseFfiChatResponse *pro

SignalFfiError *signal_chat_service_auth_send_and_debug(SignalCPromiseFfiResponseAndDebugInfo *promise, const SignalTokioAsyncContext *async_runtime, const SignalAuthChat *chat, const SignalHttpRequest *http_request, uint32_t timeout_millis);

SignalFfiError *signal_chat_service_set_listener_auth(const SignalTokioAsyncContext *runtime, const SignalAuthChat *chat, const SignalFfiMakeChatListenerStruct *make_listener);
SignalFfiError *signal_chat_service_set_listener_auth(const SignalTokioAsyncContext *runtime, const SignalAuthChat *chat, const SignalFfiChatListenerStruct *listener);

SignalFfiError *signal_chat_service_set_listener_unauth(const SignalTokioAsyncContext *runtime, const SignalUnauthChat *chat, const SignalFfiMakeChatListenerStruct *make_listener);
SignalFfiError *signal_chat_service_set_listener_unauth(const SignalTokioAsyncContext *runtime, const SignalUnauthChat *chat, const SignalFfiChatListenerStruct *listener);

SignalFfiError *signal_server_message_ack_destroy(SignalServerMessageAck *p);

Expand Down
8 changes: 4 additions & 4 deletions pkg/libsignalgo/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package libsignalgo
#cgo LDFLAGS: -lsignal_ffi -ldl -lm
#include <./libsignal-ffi.h>
extern void signal_log_callback(void *ctx, char *target, SignalLogLevel level, char *file, uint32_t line, char *message);
extern void signal_log_callback(void *ctx, SignalLogLevel level, char *file, uint32_t line, char *message);
extern void signal_log_flush_callback(void *ctx);
*/
import "C"
Expand All @@ -32,8 +32,8 @@ import (
var ffiLogger Logger

//export signal_log_callback
func signal_log_callback(ctx unsafe.Pointer, target *C.char, level C.SignalLogLevel, file *C.char, line C.uint32_t, message *C.char) {
ffiLogger.Log(C.GoString(target), LogLevel(int(level)), C.GoString(file), uint(line), C.GoString(message))
func signal_log_callback(ctx unsafe.Pointer, level C.SignalLogLevel, file *C.char, line C.uint32_t, message *C.char) {
ffiLogger.Log(LogLevel(int(level)), C.GoString(file), uint(line), C.GoString(message))
}

//export signal_log_flush_callback
Expand All @@ -52,7 +52,7 @@ const (
)

type Logger interface {
Log(target string, level LogLevel, file string, line uint, message string)
Log(level LogLevel, file string, line uint, message string)
Flush()
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/libsignalgo/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type FFILogger struct{}

func (FFILogger) Enabled(target string, level libsignalgo.LogLevel) bool { return true }

func (FFILogger) Log(target string, level libsignalgo.LogLevel, file string, line uint, message string) {
func (FFILogger) Log(level libsignalgo.LogLevel, file string, line uint, message string) {
var evt *zerolog.Event
switch level {
case libsignalgo.LogLevelError:
Expand All @@ -47,7 +47,6 @@ func (FFILogger) Log(target string, level libsignalgo.LogLevel, file string, lin
}

evt.Str("component", "libsignal").
Str("target", target).
Str("file", file).
Uint("line", line).
Msg(message)
Expand Down
2 changes: 1 addition & 1 deletion pkg/libsignalgo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package libsignalgo

const Version = "v0.61.0"
const Version = "v0.62.0"
3 changes: 1 addition & 2 deletions pkg/signalmeow/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type FFILogger struct {
logger zerolog.Logger
}

func (l FFILogger) Log(target string, level libsignalgo.LogLevel, file string, line uint, message string) {
func (l FFILogger) Log(level libsignalgo.LogLevel, file string, line uint, message string) {
var evt *zerolog.Event
switch level {
case libsignalgo.LogLevelError:
Expand All @@ -59,7 +59,6 @@ func (l FFILogger) Log(target string, level libsignalgo.LogLevel, file string, l
}

evt.Str("component", "libsignal").
Str("target", target).
Str("file", file).
Uint("line", line).
Msg(message)
Expand Down

0 comments on commit 45f97de

Please sign in to comment.