diff options
author | James Booth <boothj5@gmail.com> | 2015-06-21 01:48:25 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-06-21 01:48:25 +0100 |
commit | e45afd5c09a5a4bea9cbf8f16eb6af3908344dba (patch) | |
tree | 5832dce58ec4eea210ba2c2adffcf38715296e24 /src/event | |
parent | 6617bb5a2b432d9c4178984386855f30be76ecf3 (diff) | |
download | profani-tty-e45afd5c09a5a4bea9cbf8f16eb6af3908344dba.tar.gz |
Added pgp checks for message sending
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/client_events.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c index e9a42d32..f1af8331 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -88,13 +88,52 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg) chat_state_active(chatwin->state); #ifdef HAVE_LIBOTR - otr_on_message_send(chatwin, msg); -#else + if (chatwin->enc_mode == PROF_ENC_NONE || chatwin->enc_mode == PROF_ENC_OTR) { + gboolean handled = otr_on_message_send(chatwin, msg); + if (!handled) { + char *id = message_send_chat(chatwin->barejid, msg); + chat_log_msg_out(chatwin->barejid, msg); + ui_outgoing_chat_msg(chatwin, msg, id); + free(id); + } + return; + } +#ifdef HAVE_LIBGPGME + if (chatwin->enc_mode == PROF_ENC_PGP) { + char *id = message_send_chat_pgp(chatwin->barejid, msg); + // TODO pgp message logger + chat_log_msg_out(chatwin->barejid, msg); + ui_outgoing_chat_msg(chatwin, msg, id); + free(id); + return; + } +#endif // HAVE_LIBGPGME + +#else // HAVE_LIBOTR + +#ifdef HAVE_LIBGPGME + if (chatwin->enc_mode == PROF_ENC_PGP) { + char *id = message_send_chat_pgp(chatwin->barejid, msg); + chat_log_msg_out(chatwin->barejid, msg); + ui_outgoing_chat_msg(chatwin, msg, id); + free(id); + return; + } + char *id = message_send_chat(chatwin->barejid, msg); chat_log_msg_out(chatwin->barejid, msg); ui_outgoing_chat_msg(chatwin, msg, id); free(id); -#endif + return; +#else // HAVE_LIBGPGME + char *id = message_send_chat(chatwin->barejid, msg); + chat_log_msg_out(chatwin->barejid, msg); + ui_outgoing_chat_msg(chatwin, msg, id); + free(id); + return; +#endif // HAVE_LIBGPGME + +#endif // HAVE_LIBOTR } void |