about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2015-07-01 09:04:54 -0500
committerSam Whited <sam@samwhited.com>2015-07-01 09:04:54 -0500
commit167ee28ec0fdc0b0e6da6703e6371e96b99d4640 (patch)
treee6397def20e7dc742218514d3c76a0fbbd642725 /src/xmpp
parentd5f79c7b358507288dfc6d32b59d11164c9c377a (diff)
downloadprofani-tty-167ee28ec0fdc0b0e6da6703e6371e96b99d4640.tar.gz
Add no-copy and no-store hints to OTR messages
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/message.c2
-rw-r--r--src/xmpp/stanza.c24
-rw-r--r--src/xmpp/stanza.h3
3 files changed, 29 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 9aa278c1..5105a1d3 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -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);
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index beb03f45..ed188a3b 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -306,6 +306,30 @@ 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 *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)
 {
     xmpp_stanza_t *receipet_request = xmpp_stanza_new(ctx);
diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h
index 2dd1a141..8cae0dc3 100644
--- a/src/xmpp/stanza.h
+++ b/src/xmpp/stanza.h
@@ -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,