1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Add store hints for OMEMO encrypted messages

Store hints are required has some server might discard messages without
body. Here we ensure OMEMO messages are stored on server and delivered
to client when they connect back.

It's really important since it avoid libsignal to desynchronize
counters.
This commit is contained in:
Paul Fariello 2019-03-13 18:39:31 +01:40
parent dbf96dcfc6
commit 36ce21fc6d
3 changed files with 15 additions and 0 deletions

View File

@ -404,6 +404,8 @@ message_send_chat_omemo(const char *const jid, uint32_t sid, GList *keys,
stanza_attach_state(ctx, message, state);
}
stanza_attach_hints_store(ctx, message);
if (request_receipt) {
stanza_attach_receipt_request(ctx, message);
}

View File

@ -395,6 +395,18 @@ stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
return stanza;
}
xmpp_stanza_t*
stanza_attach_hints_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{
xmpp_stanza_t *store = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(store, "store");
xmpp_stanza_set_ns(store, STANZA_NS_HINTS);
xmpp_stanza_add_child(stanza, store);
xmpp_stanza_release(store);
return stanza;
}
xmpp_stanza_t*
stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{

View File

@ -233,6 +233,7 @@ xmpp_stanza_t* stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const
xmpp_stanza_t* stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_attach_hints_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_attach_x_oob_url(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const url);