about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-06-21 20:08:46 +0100
committerJames Booth <boothj5@gmail.com>2015-06-21 20:08:46 +0100
commit566979969063cbeb1067414b745af8112d190752 (patch)
treeb01d6df54368879556fa29eaa7b98f266ff8c1d0 /src/xmpp
parent03a4aa4408ec5f8916a669381d3d1e4d758dd5fa (diff)
downloadprofani-tty-566979969063cbeb1067414b745af8112d190752.tar.gz
Encryption modes for sv_ev_incoming_message
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/message.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 780cb465..4cc440ea 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -705,11 +705,11 @@ _handle_carbons(xmpp_stanza_t * const stanza)
             if (message) {
                 // if we are the recipient, treat as standard incoming message
                 if(g_strcmp0(my_jid->barejid, jid_to->barejid) == 0){
-                    sv_ev_incoming_message(jid_from->barejid, jid_from->resourcepart, message);
+                    sv_ev_incoming_carbon(jid_from->barejid, jid_from->resourcepart, message);
                 }
                 // else treat as a sent message
                 else{
-                    sv_ev_carbon(jid_to->barejid, message);
+                    sv_ev_outgoing_carbon(jid_to->barejid, message);
                 }
                 xmpp_free(ctx, message);
             }
@@ -768,23 +768,12 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * con
             if (delayed) {
                 sv_ev_delayed_message(jid->barejid, message, tv_stamp);
             } else {
-#ifdef HAVE_LIBGPGME
-                gboolean handled = FALSE;
+                char *enc_message = NULL;
                 xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_ENCRYPTED);
                 if (x) {
-                    char *enc_message = xmpp_stanza_get_text(x);
-                    char *decrypted = p_gpg_decrypt(jid->barejid, enc_message);
-                    if (decrypted) {
-                        sv_ev_incoming_message(jid->barejid, jid->resourcepart, decrypted);
-                        handled = TRUE;
-                    }
-                }
-                if (!handled) {
-                    sv_ev_incoming_message(jid->barejid, jid->resourcepart, message);
+                    enc_message = xmpp_stanza_get_text(x);
                 }
-#else
-                sv_ev_incoming_message(jid->barejid, jid->resourcepart, message);
-#endif
+                sv_ev_incoming_message(jid->barejid, jid->resourcepart, message, enc_message);
             }
 
             _receipt_request_handler(stanza);