mcabber/src/jabglue.c
changeset 1484 7b36b91a4388
parent 1476 77afd831f8f7
child 1493 1ae5fb9b04ca
equal deleted inserted replaced
1483:e74cc83e7158 1484:7b36b91a4388
   639         if (encrypted)
   639         if (encrypted)
   640           *encrypted = -1;
   640           *encrypted = -1;
   641         return;
   641         return;
   642       }
   642       }
   643     }
   643     }
   644     if (otr_msg && encrypted) {
   644     if (otr_msg && encrypted)
   645       *encrypted = 1;
   645       *encrypted = ENCRYPTED_OTR;
   646     }
       
   647   }
   646   }
   648 #endif
   647 #endif
   649 
   648 
   650 #ifdef HAVE_GPGME
   649 #ifdef HAVE_GPGME
   651   if (type == ROSTER_TYPE_USER && sl_buddy && gpg_enabled()) {
   650   if (type == ROSTER_TYPE_USER && sl_buddy && gpg_enabled()) {
   691     xmlnode y;
   690     xmlnode y;
   692     y = xmlnode_insert_tag(x, "x");
   691     y = xmlnode_insert_tag(x, "x");
   693     xmlnode_put_attrib(y, "xmlns", NS_ENCRYPTED);
   692     xmlnode_put_attrib(y, "xmlns", NS_ENCRYPTED);
   694     xmlnode_insert_cdata(y, enc, (unsigned) -1);
   693     xmlnode_insert_cdata(y, enc, (unsigned) -1);
   695     if (encrypted)
   694     if (encrypted)
   696       *encrypted = 1;
   695       *encrypted = ENCRYPTED_PGP;
   697     g_free(enc);
   696     g_free(enc);
   698   }
   697   }
   699 
   698 
   700 #if defined JEP0022 || defined JEP0085
   699 #if defined JEP0022 || defined JEP0085
   701   // If typing notifications are disabled, we can skip all this stuff...
   700   // If typing notifications are disabled, we can skip all this stuff...
  1839   if (!settings_opt_get_int("block_unsubscribed") ||
  1838   if (!settings_opt_get_int("block_unsubscribed") ||
  1840       (roster_getsubscription(bjid) & sub_from) ||
  1839       (roster_getsubscription(bjid) & sub_from) ||
  1841       (type && strcmp(type, "chat")) ||
  1840       (type && strcmp(type, "chat")) ||
  1842       ((s = settings_opt_get("server")) != NULL && !strcasecmp(bjid, s))) {
  1841       ((s = settings_opt_get("server")) != NULL && !strcasecmp(bjid, s))) {
  1843     gchar *fullbody = NULL;
  1842     gchar *fullbody = NULL;
       
  1843     guint encrypted;
       
  1844 
       
  1845     if (decrypted_pgp)
       
  1846       encrypted = ENCRYPTED_PGP;
       
  1847     else if (otr_msg)
       
  1848       encrypted = ENCRYPTED_OTR;
       
  1849     else
       
  1850       encrypted = 0;
       
  1851 
  1844     if (subject) {
  1852     if (subject) {
  1845       if (body)
  1853       if (body)
  1846         fullbody = g_strdup_printf("[%s]\n%s", subject, body);
  1854         fullbody = g_strdup_printf("[%s]\n%s", subject, body);
  1847       else
  1855       else
  1848         fullbody = g_strdup_printf("[%s]\n", subject);
  1856         fullbody = g_strdup_printf("[%s]\n", subject);
  1849       body = fullbody;
  1857       body = fullbody;
  1850     }
  1858     }
  1851     hk_message_in(bjid, rname, timestamp, body, type,
  1859     hk_message_in(bjid, rname, timestamp, body, type, encrypted);
  1852                   ((decrypted_pgp || otr_msg) ? TRUE : FALSE));
       
  1853     g_free(fullbody);
  1860     g_free(fullbody);
  1854   } else {
  1861   } else {
  1855     scr_LogPrint(LPRINT_LOGNORM, "Blocked a message from <%s>", bjid);
  1862     scr_LogPrint(LPRINT_LOGNORM, "Blocked a message from <%s>", bjid);
  1856   }
  1863   }
  1857 
  1864