about summary refs log tree commit diff stats
path: root/src/event/client_events.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-08 00:07:21 +0100
committerJames Booth <boothj5@gmail.com>2015-05-08 00:07:21 +0100
commitacd2d2309f164a4902c3cfd7dc5b1ed5d2f7aa71 (patch)
treea3cad163417ad8b182ed04a75474ece1ff701fd7 /src/event/client_events.c
parent0db7bcbdcdbc2039033b6c18d5610372969556bc (diff)
downloadprofani-tty-acd2d2309f164a4902c3cfd7dc5b1ed5d2f7aa71.tar.gz
Moved pgp signature generation to cl_ev_presence_send
Diffstat (limited to 'src/event/client_events.c')
-rw-r--r--src/event/client_events.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c
index f0f763a6..3465d5ee 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -42,6 +42,9 @@
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
+#ifdef HAVE_LIBGPGME
+#include "pgp/gpg.h"
+#endif
 
 jabber_conn_status_t
 cl_ev_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port)
@@ -63,7 +66,19 @@ cl_ev_connect_account(ProfAccount *account)
 void
 cl_ev_presence_send(const resource_presence_t presence_type, const char * const msg, const int idle)
 {
-    presence_send(presence_type, msg, idle);
+    char *signed_status = NULL;
+
+#ifdef HAVE_LIBGPGME
+    char *account_name = jabber_get_account_name();
+    ProfAccount *account = accounts_get_account(account_name);
+    if (account->pgp_keyid) {
+        signed_status = p_gpg_sign(msg, account->pgp_keyid);
+    }
+#endif
+
+    presence_send(presence_type, msg, idle, signed_status);
+
+    free(signed_status);
 }
 
 void