about summary refs log tree commit diff stats
path: root/src/xmpp
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/xmpp
parent0db7bcbdcdbc2039033b6c18d5610372969556bc (diff)
downloadprofani-tty-acd2d2309f164a4902c3cfd7dc5b1ed5d2f7aa71.tar.gz
Moved pgp signature generation to cl_ev_presence_send
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/presence.c32
-rw-r--r--src/xmpp/xmpp.h3
2 files changed, 12 insertions, 23 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index ba2af538..a245155c 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -196,7 +196,7 @@ presence_reset_sub_request_search(void)
 }
 
 void
-presence_send(const resource_presence_t presence_type, const char * const msg, const int idle)
+presence_send(const resource_presence_t presence_type, const char * const msg, const int idle, char *signed_status)
 {
     if (jabber_get_connection_status() != JABBER_CONNECTED) {
         log_warning("Error setting presence, not connected.");
@@ -224,27 +224,17 @@ presence_send(const resource_presence_t presence_type, const char * const msg, c
 
     stanza_attach_status(ctx, presence, msg);
 
-#ifdef HAVE_LIBGPGME
-    char *account_name = jabber_get_account_name();
-    ProfAccount *account = accounts_get_account(account_name);
-    if (account->pgp_keyid) {
-        char *signed_status = p_gpg_sign(msg, account->pgp_keyid);
-
-        if (signed_status) {
-            xmpp_stanza_t *x = xmpp_stanza_new(ctx);
-            xmpp_stanza_set_name(x, STANZA_NAME_X);
-            xmpp_stanza_set_ns(x, STANZA_NS_SIGNED);
-            xmpp_stanza_t *signed_text = xmpp_stanza_new(ctx);
-            xmpp_stanza_set_text(signed_text, signed_status);
-            xmpp_stanza_add_child(x, signed_text);
-            xmpp_stanza_release(signed_text);
-            xmpp_stanza_add_child(presence, x);
-            xmpp_stanza_release(x);
-
-            free(signed_status);
-        }
+    if (signed_status) {
+        xmpp_stanza_t *x = xmpp_stanza_new(ctx);
+        xmpp_stanza_set_name(x, STANZA_NAME_X);
+        xmpp_stanza_set_ns(x, STANZA_NS_SIGNED);
+        xmpp_stanza_t *signed_text = xmpp_stanza_new(ctx);
+        xmpp_stanza_set_text(signed_text, signed_status);
+        xmpp_stanza_add_child(x, signed_text);
+        xmpp_stanza_release(signed_text);
+        xmpp_stanza_add_child(presence, x);
+        xmpp_stanza_release(x);
     }
-#endif
 
     stanza_attach_priority(ctx, presence, pri);
     stanza_attach_last_activity(ctx, presence, idle);
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 398c9f46..80b680b0 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -168,8 +168,7 @@ char * presence_sub_request_find(const char * const search_str);
 void presence_join_room(char *room, char *nick, char * passwd);
 void presence_change_room_nick(const char * const room, const char * const nick);
 void presence_leave_chat_room(const char * const room_jid);
-void presence_send(resource_presence_t status, const char * const msg,
-    int idle);
+void presence_send(resource_presence_t status, const char * const msg, int idle, char *signed_status);
 gboolean presence_sub_request_exists(const char * const bare_jid);
 
 // iq functions