diff options
author | James Booth <boothj5@gmail.com> | 2015-06-21 19:29:23 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-06-21 19:29:23 +0100 |
commit | 03a4aa4408ec5f8916a669381d3d1e4d758dd5fa (patch) | |
tree | 313759c285963c6a7b4af988617abfa8ba6b3b2c /src | |
parent | 13a612cbc2978496e6587ff54a8df4165575b5ba (diff) | |
download | profani-tty-03a4aa4408ec5f8916a669381d3d1e4d758dd5fa.tar.gz |
Tidied OTR and PGP combinations in client_events.c
Diffstat (limited to 'src')
-rw-r--r-- | src/event/client_events.c | 58 | ||||
-rw-r--r-- | src/ui/titlebar.c | 2 |
2 files changed, 39 insertions, 21 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c index f1af8331..016f8b24 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -87,8 +87,11 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg) { chat_state_active(chatwin->state); +// OTR suported, PGP supported #ifdef HAVE_LIBOTR - if (chatwin->enc_mode == PROF_ENC_NONE || chatwin->enc_mode == PROF_ENC_OTR) { +#ifdef HAVE_LIBGPGME + prof_enc_t enc_mode = chatwin->enc_mode; + if (enc_mode == PROF_ENC_NONE || enc_mode == PROF_ENC_OTR) { gboolean handled = otr_on_message_send(chatwin, msg); if (!handled) { char *id = message_send_chat(chatwin->barejid, msg); @@ -96,44 +99,61 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg) ui_outgoing_chat_msg(chatwin, msg, id); free(id); } - return; - } -#ifdef HAVE_LIBGPGME - if (chatwin->enc_mode == PROF_ENC_PGP) { + } else { // 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 + return; +#endif +#endif -#else // HAVE_LIBOTR +// OTR supported, PGP unsupported +#ifdef HAVE_LIBOTR +#ifndef HAVE_LIBGPGME + 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; +#endif +#endif +// OTR unsupported, PGP supported +#ifndef HAVE_LIBOTR #ifdef HAVE_LIBGPGME - if (chatwin->enc_mode == PROF_ENC_PGP) { + prof_enc_t enc_mode = chatwin->enc_mode; + if (enc_mode == PROF_ENC_NONE) { + char *id = message_send_chat(chatwin->barejid, msg); + chat_log_msg_out(chatwin->barejid, msg); + ui_outgoing_chat_msg(chatwin, msg, id); + free(id); + } else if (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; } - - 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; -#else // HAVE_LIBGPGME +#endif +#endif + +// OTR unsupported, PGP unsupported +#ifndef HAVE_LIBOTR +#ifndef 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 +#endif +#endif } void diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index 81e1f33a..3642417a 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -58,9 +58,7 @@ static GTimer *typing_elapsed; static void _title_bar_draw(void); static void _show_self_presence(void); static void _show_contact_presence(ProfChatWin *chatwin); -#ifdef HAVE_LIBOTR static void _show_privacy(ProfChatWin *chatwin); -#endif void create_title_bar(void) |