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

xep-0308: enable corrections for outgoing encrypted messages

This commit is contained in:
Michael Vetter 2020-02-12 08:54:12 +01:00
parent 38c32be14c
commit 11b6e1bfa0
8 changed files with 55 additions and 44 deletions

View File

@ -7529,7 +7529,7 @@ cmd_otr_start(ProfWin *window, const char *const command, gchar **args)
if (!otr_is_secure(barejid)) { if (!otr_is_secure(barejid)) {
char *otr_query_message = otr_start_query(); char *otr_query_message = otr_start_query();
char *id = message_send_chat_otr(barejid, otr_query_message, FALSE); char *id = message_send_chat_otr(barejid, otr_query_message, FALSE, NULL);
free(id); free(id);
return TRUE; return TRUE;
} }
@ -7562,7 +7562,8 @@ cmd_otr_start(ProfWin *window, const char *const command, gchar **args)
} }
char *otr_query_message = otr_start_query(); char *otr_query_message = otr_start_query();
char *id = message_send_chat_otr(chatwin->barejid, otr_query_message, FALSE); char *id = message_send_chat_otr(chatwin->barejid, otr_query_message, FALSE, NULL);
free(id); free(id);
return TRUE; return TRUE;
} }

View File

@ -149,13 +149,12 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
#ifndef HAVE_OMEMO #ifndef HAVE_OMEMO
if (chatwin->pgp_send) { if (chatwin->pgp_send) {
// TODO: replace_id char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id); free(id);
} else { } else {
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt); gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) { if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id); char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@ -175,7 +174,7 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBOTR #ifdef HAVE_LIBOTR
#ifndef HAVE_LIBGPGME #ifndef HAVE_LIBGPGME
#ifndef HAVE_OMEMO #ifndef HAVE_OMEMO
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt); gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) { if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id); char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@ -195,9 +194,9 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
#ifndef HAVE_OMEMO #ifndef HAVE_OMEMO
if (chatwin->pgp_send) { if (chatwin->pgp_send) {
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt); char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id); free(id);
} else { } else {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id); char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
@ -218,7 +217,7 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifndef HAVE_LIBGPGME #ifndef HAVE_LIBGPGME
#ifdef HAVE_OMEMO #ifdef HAVE_OMEMO
if (chatwin->is_omemo) { if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
free(id); free(id);
@ -241,12 +240,12 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifndef HAVE_LIBGPGME #ifndef HAVE_LIBGPGME
#ifdef HAVE_OMEMO #ifdef HAVE_OMEMO
if (chatwin->is_omemo) { if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
free(id); free(id);
} else { } else {
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt); gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) { if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id); char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@ -267,19 +266,19 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
#ifdef HAVE_OMEMO #ifdef HAVE_OMEMO
if (chatwin->is_omemo) { if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
free(id); free(id);
} else if (chatwin->pgp_send) { } else if (chatwin->pgp_send) {
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt); char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id); free(id);
} else { } else {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt); char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt, replace_id);
free(id); free(id);
} }
@ -295,17 +294,17 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
#ifdef HAVE_OMEMO #ifdef HAVE_OMEMO
if (chatwin->is_omemo) { if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt, replace_id); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt, replace_id);
free(id); free(id);
} else if (chatwin->pgp_send) { } else if (chatwin->pgp_send) {
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt); char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id); free(id);
} else { } else {
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt); gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) { if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id); char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@ -325,9 +324,9 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifndef HAVE_LIBOTR #ifndef HAVE_LIBOTR
#ifndef HAVE_LIBGPGME #ifndef HAVE_LIBGPGME
#ifndef HAVE_OMEMO #ifndef HAVE_OMEMO
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt); char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL); chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt, replace_id);
free(id); free(id);
plugins_post_chat_message_send(chatwin->barejid, plugin_msg); plugins_post_chat_message_send(chatwin->barejid, plugin_msg);
@ -354,7 +353,8 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
#ifdef HAVE_OMEMO #ifdef HAVE_OMEMO
if (mucwin->is_omemo) { if (mucwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE); // TODO: replace_id for MUC
char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE, NULL);
groupchat_log_omemo_msg_out(mucwin->roomjid, plugin_msg); groupchat_log_omemo_msg_out(mucwin->roomjid, plugin_msg);
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_ENC_OMEMO); mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_ENC_OMEMO);
free(id); free(id);

View File

@ -671,7 +671,7 @@ out:
} }
char * char *
omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc) omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc, const char *const replace_id)
{ {
char *id = NULL; char *id = NULL;
int res; int res;
@ -809,11 +809,11 @@ omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_
if (muc) { if (muc) {
ProfMucWin *mucwin = (ProfMucWin *)win; ProfMucWin *mucwin = (ProfMucWin *)win;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
id = message_send_chat_omemo(mucwin->roomjid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, TRUE); id = message_send_chat_omemo(mucwin->roomjid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, TRUE, replace_id);
} else { } else {
ProfChatWin *chatwin = (ProfChatWin *)win; ProfChatWin *chatwin = (ProfChatWin *)win;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
id = message_send_chat_omemo(chatwin->barejid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, FALSE); id = message_send_chat_omemo(chatwin->barejid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, FALSE, replace_id);
} }
out: out:

View File

@ -92,5 +92,5 @@ void omemo_start_muc_sessions(const char *const roomjid);
void omemo_start_device_session(const char *const jid, uint32_t device_id, GList *prekeys, uint32_t signed_prekey_id, const unsigned char *const signed_prekey, size_t signed_prekey_len, const unsigned char *const signature, size_t signature_len, const unsigned char *const identity_key, size_t identity_key_len); void omemo_start_device_session(const char *const jid, uint32_t device_id, GList *prekeys, uint32_t signed_prekey_id, const unsigned char *const signed_prekey, size_t signed_prekey_len, const unsigned char *const signature, size_t signature_len, const unsigned char *const identity_key, size_t identity_key_len);
gboolean omemo_loaded(void); gboolean omemo_loaded(void);
char * omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc); char * omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc, const char *const replace_id);
char * omemo_on_message_recv(const char *const from, uint32_t sid, const unsigned char *const iv, size_t iv_len, GList *keys, const unsigned char *const payload, size_t payload_len, gboolean muc, gboolean *trusted); char * omemo_on_message_recv(const char *const from, uint32_t sid, const unsigned char *const iv, size_t iv_len, GList *keys, const unsigned char *const payload, size_t payload_len, gboolean muc, gboolean *trusted);

View File

@ -118,7 +118,7 @@ static void
cb_inject_message(void *opdata, const char *accountname, cb_inject_message(void *opdata, const char *accountname,
const char *protocol, const char *recipient, const char *message) const char *protocol, const char *recipient, const char *message)
{ {
char *id = message_send_chat_otr(recipient, message, FALSE); char *id = message_send_chat_otr(recipient, message, FALSE, NULL);
free(id); free(id);
} }
@ -315,7 +315,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
memmove(whitespace_base, whitespace_base+tag_length, tag_length); memmove(whitespace_base, whitespace_base+tag_length, tag_length);
char *otr_query_message = otr_start_query(); char *otr_query_message = otr_start_query();
cons_show("OTR Whitespace pattern detected. Attempting to start OTR session..."); cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
char *id = message_send_chat_otr(barejid, otr_query_message, FALSE); char *id = message_send_chat_otr(barejid, otr_query_message, FALSE, NULL);
free(id); free(id);
} }
} }
@ -329,7 +329,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
if (policy == PROF_OTRPOLICY_ALWAYS && *decrypted == FALSE && !whitespace_base) { if (policy == PROF_OTRPOLICY_ALWAYS && *decrypted == FALSE && !whitespace_base) {
char *otr_query_message = otr_start_query(); char *otr_query_message = otr_start_query();
cons_show("Attempting to start OTR session..."); cons_show("Attempting to start OTR session...");
char *id = message_send_chat_otr(barejid, otr_query_message, FALSE); char *id = message_send_chat_otr(barejid, otr_query_message, FALSE, NULL);
free(id); free(id);
} }
@ -337,7 +337,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
} }
gboolean gboolean
otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt) otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt, const char *const replace_id)
{ {
char *id = NULL; char *id = NULL;
prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid); prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid);
@ -346,10 +346,9 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean re
if (otr_is_secure(chatwin->barejid)) { if (otr_is_secure(chatwin->barejid)) {
char *encrypted = otr_encrypt_message(chatwin->barejid, message); char *encrypted = otr_encrypt_message(chatwin->barejid, message);
if (encrypted) { if (encrypted) {
id = message_send_chat_otr(chatwin->barejid, encrypted, request_receipt); id = message_send_chat_otr(chatwin->barejid, encrypted, request_receipt, replace_id);
chat_log_otr_msg_out(chatwin->barejid, message, NULL); chat_log_otr_msg_out(chatwin->barejid, message, NULL);
// TODO replace_id chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_OTR, request_receipt, replace_id);
chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_OTR, request_receipt, NULL);
otr_free_message(encrypted); otr_free_message(encrypted);
free(id); free(id);
return TRUE; return TRUE;
@ -368,9 +367,8 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean re
// tag and send for policy opportunistic // tag and send for policy opportunistic
if (policy == PROF_OTRPOLICY_OPPORTUNISTIC) { if (policy == PROF_OTRPOLICY_OPPORTUNISTIC) {
char *otr_tagged_msg = otr_tag_message(message); char *otr_tagged_msg = otr_tag_message(message);
id = message_send_chat_otr(chatwin->barejid, otr_tagged_msg, request_receipt); id = message_send_chat_otr(chatwin->barejid, otr_tagged_msg, request_receipt, replace_id);
//TODO replace_id chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_PLAIN, request_receipt, replace_id);
chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_PLAIN, request_receipt, NULL);
chat_log_msg_out(chatwin->barejid, message, NULL); chat_log_msg_out(chatwin->barejid, message, NULL);
free(otr_tagged_msg); free(otr_tagged_msg);
free(id); free(id);

View File

@ -73,7 +73,7 @@ void otr_poll(void);
void otr_on_connect(ProfAccount *account); void otr_on_connect(ProfAccount *account);
char* otr_on_message_recv(const char *const barejid, const char *const resource, const char *const message, gboolean *decrypted); char* otr_on_message_recv(const char *const barejid, const char *const resource, const char *const message, gboolean *decrypted);
gboolean otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt); gboolean otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt, const char *const replace_id);
void otr_keygen(ProfAccount *account); void otr_keygen(ProfAccount *account);

View File

@ -294,7 +294,7 @@ message_send_chat(const char *const barejid, const char *const msg, const char *
} }
char* char*
message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean request_receipt) message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean request_receipt, const char *const replace_id)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -346,6 +346,10 @@ message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean
stanza_attach_receipt_request(ctx, message); stanza_attach_receipt_request(ctx, message);
} }
if (replace_id) {
stanza_attach_correction(ctx, message, replace_id);
}
_send_message_stanza(message); _send_message_stanza(message);
xmpp_stanza_release(message); xmpp_stanza_release(message);
@ -353,7 +357,7 @@ message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean
} }
char* char*
message_send_chat_otr(const char *const barejid, const char *const msg, gboolean request_receipt) message_send_chat_otr(const char *const barejid, const char *const msg, gboolean request_receipt, const char *const replace_id)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -378,6 +382,10 @@ message_send_chat_otr(const char *const barejid, const char *const msg, gboolean
stanza_attach_receipt_request(ctx, message); stanza_attach_receipt_request(ctx, message);
} }
if (replace_id) {
stanza_attach_correction(ctx, message, replace_id);
}
_send_message_stanza(message); _send_message_stanza(message);
xmpp_stanza_release(message); xmpp_stanza_release(message);
@ -389,7 +397,7 @@ char*
message_send_chat_omemo(const char *const jid, uint32_t sid, GList *keys, message_send_chat_omemo(const char *const jid, uint32_t sid, GList *keys,
const unsigned char *const iv, size_t iv_len, const unsigned char *const iv, size_t iv_len,
const unsigned char *const ciphertext, size_t ciphertext_len, const unsigned char *const ciphertext, size_t ciphertext_len,
gboolean request_receipt, gboolean muc) gboolean request_receipt, gboolean muc, const char *const replace_id)
{ {
char *state = chat_session_get_state(jid); char *state = chat_session_get_state(jid);
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -489,6 +497,10 @@ message_send_chat_omemo(const char *const jid, uint32_t sid, GList *keys,
stanza_attach_receipt_request(ctx, message); stanza_attach_receipt_request(ctx, message);
} }
if (replace_id) {
stanza_attach_correction(ctx, message, replace_id);
}
_send_message_stanza(message); _send_message_stanza(message);
xmpp_stanza_release(message); xmpp_stanza_release(message);

View File

@ -172,9 +172,9 @@ char* connection_jid_for_feature(const char *const feature);
const char* connection_get_profanity_identifier(void); const char* connection_get_profanity_identifier(void);
char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url, gboolean request_receipt, const char *const replace_id); char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url, gboolean request_receipt, const char *const replace_id);
char* message_send_chat_otr(const char *const barejid, const char *const msg, gboolean request_receipt); char* message_send_chat_otr(const char *const barejid, const char *const msg, gboolean request_receipt, const char *const replace_id);
char* message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean request_receipt); char* message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean request_receipt, const char *const replace_id);
char* message_send_chat_omemo(const char *const jid, uint32_t sid, GList *keys, const unsigned char *const iv, size_t iv_len, const unsigned char *const ciphertext, size_t ciphertext_len, gboolean request_receipt, gboolean muc); char* message_send_chat_omemo(const char *const jid, uint32_t sid, GList *keys, const unsigned char *const iv, size_t iv_len, const unsigned char *const ciphertext, size_t ciphertext_len, gboolean request_receipt, gboolean muc, const char *const replace_id);
void message_send_private(const char *const fulljid, const char *const msg, const char *const oob_url); void message_send_private(const char *const fulljid, const char *const msg, const char *const oob_url);
char* message_send_groupchat(const char *const roomjid, const char *const msg, const char *const oob_url); char* message_send_groupchat(const char *const roomjid, const char *const msg, const char *const oob_url);
void message_send_groupchat_subject(const char *const roomjid, const char *const subject); void message_send_groupchat_subject(const char *const roomjid, const char *const subject);