ssb: Add a command-line action to generate an invite, and verified that Patchwork can accept it.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 26m50s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 26m50s
This commit is contained in:
@ -1202,6 +1202,18 @@ static void _tf_ssb_rpc_ebt_replicate_server(
|
||||
tf_ssb_connection_add_request(connection, -request_number, "ebt.replicate", _tf_ssb_rpc_ebt_replicate, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void _tf_ssb_rpc_invite_use_callback(
|
||||
tf_ssb_connection_t* connection, uint8_t flags, int32_t request_number, JSValue args, const uint8_t* message, size_t size, void* user_data)
|
||||
{
|
||||
/*
|
||||
** Follow the pub back:
|
||||
** { "type": "contact", "contact": "@VJM7w1W19ZsKmG2KnfaoKIM66BRoreEkzaVm/J//wl8=.ed25519", "following": true }
|
||||
**
|
||||
** Post a pub message:
|
||||
** { "type": "pub", "address": { "host": "one.butt.nz", "port": 8008, "key": "@VJM7w1W19ZsKmG2KnfaoKIM66BRoreEkzaVm/J//wl8=.ed25519" } }
|
||||
*/
|
||||
}
|
||||
|
||||
static void _tf_ssb_rpc_send_invite_use(tf_ssb_connection_t* connection)
|
||||
{
|
||||
tf_ssb_t* ssb = tf_ssb_connection_get_ssb(connection);
|
||||
@ -1219,8 +1231,8 @@ static void _tf_ssb_rpc_send_invite_use(tf_ssb_connection_t* connection)
|
||||
JS_SetPropertyStr(context, object, "feed", JS_NewString(context, id));
|
||||
JS_SetPropertyUint32(context, args, 0, object);
|
||||
JS_SetPropertyStr(context, message, "args", args);
|
||||
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_new_request, tf_ssb_connection_next_request_number(connection), "invite.use", message,
|
||||
_tf_ssb_rpc_connection_tunnel_isRoom_callback, NULL, NULL);
|
||||
tf_ssb_connection_rpc_send_json(
|
||||
connection, k_ssb_rpc_flag_new_request, tf_ssb_connection_next_request_number(connection), "invite.use", message, _tf_ssb_rpc_invite_use_callback, NULL, NULL);
|
||||
JS_FreeValue(context, message);
|
||||
}
|
||||
|
||||
@ -1679,13 +1691,13 @@ static void _tf_ssb_invite_use_message_store_callback(const char* id, bool verif
|
||||
tf_ssb_connection_t* connection = work->connection;
|
||||
if (verified && is_new)
|
||||
{
|
||||
tf_ssb_connection_rpc_send(connection, k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, -work->request_number, NULL,
|
||||
(const uint8_t*)work->message, strlen(work->message), NULL, NULL, NULL);
|
||||
tf_ssb_connection_rpc_send(
|
||||
connection, k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, -work->request_number, NULL, (const uint8_t*)work->message, strlen(work->message), NULL, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
tf_ssb_connection_rpc_send(connection, k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, -work->request_number, NULL,
|
||||
(const uint8_t*)"false", strlen("false"), NULL, NULL, NULL);
|
||||
tf_ssb_connection_rpc_send(
|
||||
connection, k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, -work->request_number, NULL, (const uint8_t*)"false", strlen("false"), NULL, NULL, NULL);
|
||||
}
|
||||
if (work->message)
|
||||
{
|
||||
@ -1722,16 +1734,15 @@ static void _tf_ssb_rpc_invite_use_after_work(tf_ssb_connection_t* connection, i
|
||||
}
|
||||
else
|
||||
{
|
||||
tf_ssb_connection_rpc_send(connection, k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, -work->request_number, NULL,
|
||||
(const uint8_t*)"false", strlen("false"), NULL, NULL, NULL);
|
||||
tf_ssb_connection_rpc_send(
|
||||
connection, k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, -work->request_number, NULL, (const uint8_t*)"false", strlen("false"), NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void _tf_ssb_rpc_invite_use(tf_ssb_connection_t* connection, uint8_t flags, int32_t request_number, JSValue args, const uint8_t* message, size_t size, void* user_data)
|
||||
{
|
||||
invite_t* work = tf_malloc(sizeof(invite_t));
|
||||
*work = (invite_t)
|
||||
{
|
||||
*work = (invite_t) {
|
||||
.connection = connection,
|
||||
.request_number = request_number,
|
||||
};
|
||||
|
Reference in New Issue
Block a user