diff mcabber/src/jabglue.c @ 1055:6eb1efea75d0

PGP: Visual encryption flag
author Mikael Berthe <mikael@lilotux.net>
date Mon, 27 Nov 2006 23:39:40 +0100
parents 1ec7ec9bda60
children c0d44a9a99bc
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Mon Nov 27 21:40:26 2006 +0100
+++ b/mcabber/src/jabglue.c	Mon Nov 27 23:39:40 2006 +0100
@@ -506,8 +506,11 @@
   return g_strdup_printf("%u%d", msg_idn, (int)(now%10L));
 }
 
+//  jb_send_msg(jid, test, type, subject, msgid, *encrypted)
+// When encrypted is not NULL, the function set *encrypted to TRUE if the
+// message has been PGP-encrypted.
 void jb_send_msg(const char *jid, const char *text, int type,
-                 const char *subject, const char *msgid)
+                 const char *subject, const char *msgid, guint *encrypted)
 {
   xmlnode x;
   gchar *strtype;
@@ -522,6 +525,9 @@
 #endif
   gchar *enc = NULL;
 
+  if (encrypted)
+    *encrypted = FALSE;
+
   if (!online) return;
 
   if (type == ROSTER_TYPE_ROOM)
@@ -562,6 +568,8 @@
     y = xmlnode_insert_tag(x, "x");
     xmlnode_put_attrib(y, "xmlns", NS_ENCRYPTED);
     xmlnode_insert_cdata(y, enc, (unsigned) -1);
+    if (encrypted)
+      *encrypted = TRUE;
     g_free(enc);
   }
 
@@ -1546,7 +1554,8 @@
       (roster_getsubscription(jid) & sub_from) ||
       (type && strcmp(type, "chat")) ||
       ((s = settings_opt_get("server")) != NULL && !strcasecmp(jid, s))) {
-    hk_message_in(jid, rname, timestamp, body, type);
+    hk_message_in(jid, rname, timestamp, body, type,
+                  (decrypted ? TRUE : FALSE));
   } else {
     scr_LogPrint(LPRINT_LOGNORM, "Blocked a message from <%s>", jid);
   }