1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Add no-copy and no-store hints to OTR messages

This commit is contained in:
Sam Whited 2015-07-01 09:04:54 -05:00
parent d5f79c7b35
commit 167ee28ec0
3 changed files with 29 additions and 0 deletions

View File

@ -213,6 +213,8 @@ message_send_chat_otr(const char * const barejid, const char * const msg)
}
stanza_attach_carbons_private(ctx, message);
stanza_attach_hints_no_copy(ctx, message);
stanza_attach_hints_no_store(ctx, message);
if (prefs_get_boolean(PREF_RECEIPTS_REQUEST)) {
stanza_attach_receipt_request(ctx, message);

View File

@ -305,6 +305,30 @@ stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
return stanza;
}
xmpp_stanza_t *
stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{
xmpp_stanza_t *no_copy = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(no_copy, "no-copy");
xmpp_stanza_set_ns(no_copy, STANZA_NS_HINTS);
xmpp_stanza_add_child(stanza, no_copy);
xmpp_stanza_release(no_copy);
return stanza;
}
xmpp_stanza_t *
stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{
xmpp_stanza_t *no_store = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(no_store, "no-store");
xmpp_stanza_set_ns(no_store, STANZA_NS_HINTS);
xmpp_stanza_add_child(stanza, no_store);
xmpp_stanza_release(no_store);
return stanza;
}
xmpp_stanza_t *
stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{

View File

@ -158,6 +158,7 @@
#define STANZA_NS_CAPTCHA "urn:xmpp:captcha"
#define STANZA_NS_PUBSUB "http://jabber.org/protocol/pubsub"
#define STANZA_NS_CARBONS "urn:xmpp:carbons:2"
#define STANZA_NS_HINTS "urn:xmpp:hints"
#define STANZA_NS_FORWARD "urn:xmpp:forward:0"
#define STANZA_NS_RECEIPTS "urn:xmpp:receipts"
#define STANZA_NS_SIGNED "jabber:x:signed"
@ -195,6 +196,8 @@ xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t *ctx,
xmpp_stanza_t * stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const state);
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_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx, char *id,