diff mcabber/src/hooks.c @ 1484:7b36b91a4388

New UI message flag (O) when OTR is used When PGP is used, the flag is still '~'. When OTR is used (and PGP is not), the encryption flag is 'O'.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 20 Apr 2008 14:30:25 +0200
parents c6ebf66a4f80
children a087125d8fc8
line wrap: on
line diff
--- a/mcabber/src/hooks.c	Sun Apr 20 11:45:01 2008 +0200
+++ b/mcabber/src/hooks.c	Sun Apr 20 14:30:25 2008 +0200
@@ -70,8 +70,10 @@
   unsigned mucnicklen = 0;
   const char *ename = NULL;
 
-  if (encrypted)
+  if (encrypted == ENCRYPTED_PGP)
     message_flags |= HBB_PREFIX_PGPCRYPT;
+  else if (encrypted == ENCRYPTED_OTR)
+    message_flags |= HBB_PREFIX_OTRCRYPT;
 
   if (type && !strcmp(type, "groupchat")) {
     rtype = ROSTER_TYPE_ROOM;
@@ -250,6 +252,7 @@
                            time_t timestamp, const char *msg, guint encrypted)
 {
   char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL;
+  guint cryptflag = 0;
 
   if (nick) {
     wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg);
@@ -271,7 +274,11 @@
   // Note: the hlog_write should not be called first, because in some
   // cases scr_WriteOutgoingMessage() will load the history and we'd
   // have the message twice...
-  scr_WriteOutgoingMessage(bjid, wmsg, (encrypted ? HBB_PREFIX_PGPCRYPT : 0));
+  if (encrypted == ENCRYPTED_PGP)
+    cryptflag = HBB_PREFIX_PGPCRYPT;
+  else if (encrypted == ENCRYPTED_OTR)
+    cryptflag = HBB_PREFIX_OTRCRYPT;
+  scr_WriteOutgoingMessage(bjid, wmsg, cryptflag);
 
   // We don't log private messages
   if (!nick)