forked from cory/tildefriends
ssb: Make the invite.use reponse flags match the docs exactly, and add some connection state paranoia.
This commit is contained in:
parent
373d742751
commit
857f47bf55
@ -1775,7 +1775,7 @@ static void _tf_ssb_invite_use_message_store_callback(const char* id, bool verif
|
|||||||
{
|
{
|
||||||
invite_t* work = user_data;
|
invite_t* work = user_data;
|
||||||
tf_ssb_connection_t* connection = work->connection;
|
tf_ssb_connection_t* connection = work->connection;
|
||||||
if (verified && is_new)
|
if (verified && is_new && tf_ssb_connection_is_connected(connection) && !tf_ssb_connection_is_closing(connection))
|
||||||
{
|
{
|
||||||
tf_ssb_t* ssb = tf_ssb_connection_get_ssb(connection);
|
tf_ssb_t* ssb = tf_ssb_connection_get_ssb(connection);
|
||||||
JSContext* context = tf_ssb_get_context(ssb);
|
JSContext* context = tf_ssb_get_context(ssb);
|
||||||
@ -1783,7 +1783,7 @@ static void _tf_ssb_invite_use_message_store_callback(const char* id, bool verif
|
|||||||
JSValue message = JS_ParseJSON(context, work->message, strlen(work->message), NULL);
|
JSValue message = JS_ParseJSON(context, work->message, strlen(work->message), NULL);
|
||||||
JS_SetPropertyStr(context, payload, "key", JS_NewString(context, id));
|
JS_SetPropertyStr(context, payload, "key", JS_NewString(context, id));
|
||||||
JS_SetPropertyStr(context, payload, "value", message);
|
JS_SetPropertyStr(context, payload, "value", message);
|
||||||
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_end_error, -work->request_number, NULL, payload, NULL, NULL, NULL);
|
tf_ssb_connection_rpc_send_json(connection, 0, -work->request_number, NULL, payload, NULL, NULL, NULL);
|
||||||
JS_FreeValue(context, payload);
|
JS_FreeValue(context, payload);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user