From 24896a3bfbdd21e71e7ff5476a33bb87ebf114dd Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 31 Oct 2015 23:22:23 +0000 Subject: [PATCH 1/3] Added HAVE_LIBOTR checks --- src/ui/chatwin.c | 2 ++ src/ui/ui.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 0e78fc24..047352c5 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -79,6 +79,7 @@ chatwin_receipt_received(ProfChatWin *chatwin, const char *const id) win_mark_received(win, id); } +#ifdef HAVE_LIBOTR void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted) { @@ -201,6 +202,7 @@ chatwin_otr_untrust(ProfChatWin *chatwin) title_bar_switch(); } } +#endif void chatwin_recipient_gone(ProfChatWin *chatwin) diff --git a/src/ui/ui.h b/src/ui/ui.h index 088a5953..cf3bff01 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -38,7 +38,9 @@ #include "command/commands.h" #include "ui/win_types.h" #include "muc.h" +#ifdef HAVE_LIBOTR #include "otr/otr.h" +#endif #define NO_ME 1 #define NO_DATE 2 @@ -65,11 +67,15 @@ void ui_sigwinch_handler(int sig); ProfChatWin* chatwin_new(const char *const barejid); void chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode); + +#ifdef HAVE_LIBOTR void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted); void chatwin_otr_unsecured(ProfChatWin *chatwin); void chatwin_otr_trust(ProfChatWin *chatwin); void chatwin_otr_untrust(ProfChatWin *chatwin); void chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, void *data); +#endif + void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id); void chatwin_recipient_gone(ProfChatWin *chatwin); void chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode); From 8a7e2c19f9939fb738a89de23998d59a6a7bc5cf Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 31 Oct 2015 23:24:47 +0000 Subject: [PATCH 2/3] Fixed tests --- tests/unittests/ui/stub_ui.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 5e0ac484..e232fab0 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -66,11 +66,13 @@ GSList* ui_get_chat_recipients(void) void ui_switch_win(ProfWin *win) {} +#ifdef HAVE_LIBOTR void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted) {} void chatwin_otr_unsecured(ProfChatWin *chatwin) {} void chatwin_otr_trust(ProfChatWin *chatwin) {} void chatwin_otr_untrust(ProfChatWin *chatwin) {} void chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, void *data) {} +#endif void ui_sigwinch_handler(int sig) {} From 17488ca3462380cfc3be5ec1d6bac2675a45cc90 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 31 Oct 2015 23:38:08 +0000 Subject: [PATCH 3/3] Added missing config.h includes --- src/command/command.c | 4 ++-- src/event/client_events.c | 3 ++- src/event/server_events.c | 4 ++-- src/main.c | 4 +++- src/ui/chatwin.c | 5 +++++ src/ui/ui.h | 2 ++ tests/unittests/ui/stub_ui.c | 5 +++++ 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/command/command.c b/src/command/command.c index 9e8ebe02..31d063e6 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -32,6 +32,8 @@ * */ +#include "config.h" + #include #include #include @@ -41,8 +43,6 @@ #include -#include "config.h" - #include "chat_session.h" #include "command/command.h" #include "command/commands.h" diff --git a/src/event/client_events.c b/src/event/client_events.c index 0579b07d..f1872202 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -32,10 +32,11 @@ * */ +#include "config.h" + #include #include -#include "config.h" #include "log.h" #include "ui/ui.h" #include "window_list.h" diff --git a/src/event/server_events.c b/src/event/server_events.c index b607c4f8..aea6a4ea 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -32,12 +32,12 @@ * */ +#include "config.h" + #include #include #include -#include "config.h" - #include "chat_session.h" #include "log.h" #include "muc.h" diff --git a/src/main.c b/src/main.c index 968ddf8a..0a49180b 100644 --- a/src/main.c +++ b/src/main.c @@ -31,10 +31,12 @@ * source files in the program, then also delete it here. * */ + +#include "config.h" + #include #include -#include "config.h" #ifdef HAVE_GIT_VERSION #include "gitversion.h" #endif diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 047352c5..c34cc1fc 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -32,6 +32,8 @@ * */ +#include "config.h" + #include #include #include @@ -44,6 +46,9 @@ #include "ui/ui.h" #include "ui/window.h" #include "ui/titlebar.h" +#ifdef HAVE_LIBOTR +#include "otr/otr.h" +#endif static void _chatwin_history(ProfChatWin *chatwin, const char *const contact); diff --git a/src/ui/ui.h b/src/ui/ui.h index cf3bff01..70c02da0 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -35,6 +35,8 @@ #ifndef UI_UI_H #define UI_UI_H +#include "config.h" + #include "command/commands.h" #include "ui/win_types.h" #include "muc.h" diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index e232fab0..39f4445a 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -1,3 +1,5 @@ +#include "config.h" + #include #include @@ -6,6 +8,9 @@ #include "ui/window.h" #include "ui/ui.h" +#ifdef HAVE_LIBOTR +#include "otr/otr.h" +#endif #include "tests/unittests/ui/stub_ui.h"