mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-27 01:36:21 +00:00
xep-0308: Implement /correct to correct the last send message
So far the correction is sent. But the UI in Profanity itself is not updated. Also autocompletion for `/correct` with the last sent message is missing.
This commit is contained in:
@@ -259,8 +259,7 @@ message_pubsub_event_handler_add(const char *const node, ProfMessageCallback fun
|
||||
}
|
||||
|
||||
char*
|
||||
message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url,
|
||||
gboolean request_receipt)
|
||||
message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url, gboolean request_receipt, const char *const replace_id)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
|
||||
@@ -284,6 +283,10 @@ message_send_chat(const char *const barejid, const char *const msg, const char *
|
||||
stanza_attach_receipt_request(ctx, message);
|
||||
}
|
||||
|
||||
if (replace_id) {
|
||||
stanza_attach_correction(ctx, message, replace_id);
|
||||
}
|
||||
|
||||
_send_message_stanza(message);
|
||||
xmpp_stanza_release(message);
|
||||
|
||||
|
||||
@@ -2606,3 +2606,15 @@ stanza_create_avatar_retrieve_data_request(xmpp_ctx_t *ctx, const char *stanza_i
|
||||
|
||||
return iq;
|
||||
}
|
||||
|
||||
xmpp_stanza_t*
|
||||
stanza_attach_correction(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const replace_id)
|
||||
{
|
||||
xmpp_stanza_t *replace_stanza = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(replace_stanza, "replace");
|
||||
xmpp_stanza_set_id(replace_stanza, replace_id);
|
||||
xmpp_stanza_set_ns(replace_stanza, STANZA_NS_LAST_MESSAGE_CORRECTION);
|
||||
xmpp_stanza_add_child(stanza, replace_stanza);
|
||||
|
||||
return stanza;
|
||||
}
|
||||
|
||||
@@ -245,6 +245,7 @@ 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);
|
||||
xmpp_stanza_t* stanza_attach_origin_id(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const id);
|
||||
xmpp_stanza_t* stanza_attach_correction(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const replace_id);
|
||||
|
||||
xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
|
||||
const char *const full_room_jid, const char *const passwd);
|
||||
|
||||
@@ -171,8 +171,7 @@ char* connection_jid_for_feature(const char *const feature);
|
||||
|
||||
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);
|
||||
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_pgp(const char *const barejid, const char *const msg, gboolean request_receipt);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user