fix: scope server pins by port (fumi-core rev 1468f3c)
This commit is contained in:
parent
996e879509
commit
7d2a147fec
16 changed files with 109 additions and 79 deletions
|
|
@ -109,15 +109,15 @@ class SmolFfi {
|
|||
Void Function(Pointer<Void>),
|
||||
void Function(Pointer<Void>)>("smol_flag_free");
|
||||
|
||||
late final int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>)
|
||||
late final int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, int)
|
||||
_pinServer = _lib.lookupFunction<
|
||||
Int32 Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>),
|
||||
int Function(
|
||||
Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>)>("smol_pin_server");
|
||||
late final Pointer<Utf8> Function(Pointer<Void>, Pointer<Utf8>)
|
||||
Int32 Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, Uint16),
|
||||
int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>,
|
||||
int)>("smol_pin_server");
|
||||
late final Pointer<Utf8> Function(Pointer<Void>, Pointer<Utf8>, int)
|
||||
_serverPin = _lib.lookupFunction<
|
||||
Pointer<Utf8> Function(Pointer<Void>, Pointer<Utf8>),
|
||||
Pointer<Utf8> Function(Pointer<Void>, Pointer<Utf8>)>(
|
||||
Pointer<Utf8> Function(Pointer<Void>, Pointer<Utf8>, Uint16),
|
||||
Pointer<Utf8> Function(Pointer<Void>, Pointer<Utf8>, int)>(
|
||||
"smol_server_pin");
|
||||
late final Pointer<Utf8> Function(Pointer<Void>) _storeAccount = _lib
|
||||
.lookupFunction<Pointer<Utf8> Function(Pointer<Void>),
|
||||
|
|
@ -226,9 +226,11 @@ class SmolFfi {
|
|||
Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, Int32),
|
||||
int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>,
|
||||
int)>("smol_contact_save");
|
||||
late final int Function(Pointer<Void>, Pointer<Utf8>) _unpinServer = _lib
|
||||
.lookupFunction<Int32 Function(Pointer<Void>, Pointer<Utf8>),
|
||||
int Function(Pointer<Void>, Pointer<Utf8>)>("smol_unpin_server");
|
||||
late final int Function(Pointer<Void>, Pointer<Utf8>, int) _unpinServer =
|
||||
_lib.lookupFunction<
|
||||
Int32 Function(Pointer<Void>, Pointer<Utf8>, Uint16),
|
||||
int Function(
|
||||
Pointer<Void>, Pointer<Utf8>, int)>("smol_unpin_server");
|
||||
late final Pointer<Utf8> Function(Pointer<Void>) _pins = _lib.lookupFunction<
|
||||
Pointer<Utf8> Function(Pointer<Void>),
|
||||
Pointer<Utf8> Function(Pointer<Void>)>("smol_pins");
|
||||
|
|
@ -334,12 +336,14 @@ class SmolFfi {
|
|||
|
||||
void freeFlag(int flag) => _flagFree(_h(flag));
|
||||
|
||||
void pinServer(int store, String host, String keyB32) {
|
||||
if (_pinServer(_h(store), _text(host), _text(keyB32)) != smolOk) _fail();
|
||||
void pinServer(int store, String host, String keyB32, int port) {
|
||||
if (_pinServer(_h(store), _text(host), _text(keyB32), port) != smolOk) {
|
||||
_fail();
|
||||
}
|
||||
}
|
||||
|
||||
void unpinServer(int store, String host) {
|
||||
if (_unpinServer(_h(store), _text(host)) != smolOk) _fail();
|
||||
void unpinServer(int store, String host, int port) {
|
||||
if (_unpinServer(_h(store), _text(host), port) != smolOk) _fail();
|
||||
}
|
||||
|
||||
/// Every pin: [{host, key}] with keys as base32.
|
||||
|
|
@ -355,8 +359,8 @@ class SmolFfi {
|
|||
_h(store), _text(address), _text(keyB32), verified ? 1 : 0);
|
||||
|
||||
/// Null when nothing is pinned.
|
||||
String? serverPin(int store, String host) {
|
||||
final text = take(_serverPin(_h(store), _text(host)));
|
||||
String? serverPin(int store, String host, int port) {
|
||||
final text = take(_serverPin(_h(store), _text(host), port));
|
||||
return text.isEmpty ? null : text;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue