diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/event/server_events.c | 11 | ||||
-rw-r--r-- | src/event/server_events.h | 3 | ||||
-rw-r--r-- | src/xmpp/presence.c | 19 |
3 files changed, 19 insertions, 14 deletions
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, diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index e65b463d..0a7b5c45 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -619,16 +619,6 @@ _available_handler(xmpp_conn_t * const conn, log_debug("Presence available handler fired for: %s", jid); } -#ifdef HAVE_LIBGPGME - xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_SIGNED); - if (x) { - char *sign = xmpp_stanza_get_text(x); - if (sign) { - p_gpg_verify(xmpp_presence->jid->barejid, sign); - } - } -#endif - const char *my_jid_str = xmpp_conn_get_jid(conn); Jid *my_jid = jid_create(my_jid_str); @@ -645,7 +635,14 @@ _available_handler(xmpp_conn_t * const conn, if (g_strcmp0(xmpp_presence->jid->barejid, my_jid->barejid) == 0) { connection_add_available_resource(resource); } else { - sv_ev_contact_online(xmpp_presence->jid->barejid, resource, xmpp_presence->last_activity); + char *pgpsig = NULL; + xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_SIGNED); + if (x) { + pgpsig = xmpp_stanza_get_text(x); + } + sv_ev_contact_online(xmpp_presence->jid->barejid, resource, xmpp_presence->last_activity, pgpsig); + xmpp_ctx_t *ctx = connection_get_ctx(); + xmpp_free(ctx, pgpsig); } jid_destroy(my_jid); |