diff options
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/client_events.c | 17 | ||||
-rw-r--r-- | src/event/server_events.c | 11 | ||||
-rw-r--r-- | src/event/server_events.h | 3 |
3 files changed, 27 insertions, 4 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c index 54cc0247..e9a42d32 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -43,6 +43,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) @@ -64,7 +67,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 diff --git a/src/event/server_events.c b/src/event/server_events.c index e2e910a3..270e7c98 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -47,6 +47,9 @@ #ifdef HAVE_LIBOTR #include "otr/otr.h" #endif +#ifdef HAVE_LIBGPGME +#include "pgp/gpg.h" +#endif #include "ui/ui.h" @@ -280,7 +283,7 @@ sv_ev_contact_offline(char *barejid, char *resource, char *status) } void -sv_ev_contact_online(char *barejid, Resource *resource, GDateTime *last_activity) +sv_ev_contact_online(char *barejid, Resource *resource, GDateTime *last_activity, char *pgpsig) { gboolean updated = roster_update_presence(barejid, resource, last_activity); @@ -288,6 +291,12 @@ sv_ev_contact_online(char *barejid, Resource *resource, GDateTime *last_activity ui_contact_online(barejid, resource, last_activity); } +#ifdef HAVE_LIBGPGME + if (pgpsig) { + p_gpg_verify(barejid, pgpsig); + } +#endif + rosterwin_roster(); chat_session_remove(barejid); } diff --git a/src/event/server_events.h b/src/event/server_events.h index 46d485da..c663cd3a 100644 --- a/src/event/server_events.h +++ b/src/event/server_events.h @@ -62,8 +62,7 @@ void sv_ev_gone(const char * const barejid, const char * const resource); void sv_ev_subscription(const char *from, jabber_subscr_t type); void sv_ev_message_receipt(char *barejid, char *id); void sv_ev_contact_offline(char *contact, char *resource, char *status); -void sv_ev_contact_online(char *contact, Resource *resource, - GDateTime *last_activity); +void sv_ev_contact_online(char *contact, Resource *resource, GDateTime *last_activity, char *pgpkey); void sv_ev_leave_room(const char * const room); void sv_ev_room_destroy(const char * const room); void sv_ev_room_occupant_offline(const char * const room, const char * const nick, |