changeset 2152:2ce6dd6861ea

Use the Carbons <private/> element for outgoing encrypted messages
author Mikael Berthe <mikael@lilotux.net>
date Sat, 04 Oct 2014 18:31:46 +0200
parents 8819bab88053
children befa2a46d497
files mcabber/mcabber/carbons.c mcabber/mcabber/carbons.h mcabber/mcabber/xmpp.c
diffstat 3 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/carbons.c	Sat Oct 04 18:31:41 2014 +0200
+++ b/mcabber/mcabber/carbons.c	Sat Oct 04 18:31:46 2014 +0200
@@ -45,6 +45,11 @@
   }
 }
 
+gboolean carbons_enabled()
+{
+  return (_carbons_enabled != 0);
+}
+
 void carbons_enable()
 {
   LmMessage *iq;
--- a/mcabber/mcabber/carbons.h	Sat Oct 04 18:31:41 2014 +0200
+++ b/mcabber/mcabber/carbons.h	Sat Oct 04 18:31:46 2014 +0200
@@ -1,10 +1,13 @@
 #ifndef __MCABBER_CARBONS_H__
 #define __MCABBER_CARBONS_H__ 1
 
+#include <glib.h>
+
 void carbons_available();
 void carbons_enable();
 void carbons_disable();
 void carbons_info();
 void carbons_reset();
+gboolean carbons_enabled();
 
 #endif //__MCABBER_CARBONS_H__
--- a/mcabber/mcabber/xmpp.c	Sat Oct 04 18:31:41 2014 +0200
+++ b/mcabber/mcabber/xmpp.c	Sat Oct 04 18:31:46 2014 +0200
@@ -417,6 +417,11 @@
     g_free(enc);
   }
 
+  // We probably don't want Carbons for encrypted messages, since the other
+  // resources won't be able to decrypt them.
+  if (carbons_enabled())
+    lm_message_node_add_child(x->node, "private", NS_CARBONS_2);
+
   // XEP-0184: Message Receipts
   if (sl_buddy && xep184 &&
       caps_has_feature(buddy_resource_getcaps(sl_buddy->data, rname),