about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2020-06-11 02:51:07 +0300
committerDmitry Podgorny <pasis.ua@gmail.com>2020-06-11 02:51:07 +0300
commit424918c5ede603c07bcc4635906e0ee942c1d6e9 (patch)
treeb0a704d1d4bf561f0253ccee571f4a93cc9d9c5c /src
parentc0163f71f7d3fc9874cbb5977547af793c106bd4 (diff)
downloadprofani-tty-424918c5ede603c07bcc4635906e0ee942c1d6e9.tar.gz
Make legacy auth optional
Some systems don't provide recent libstrophe releases. When older
version of libstrophe is detected, don't build legacy auth support.

To simplify this patch, report about unsupported legacy auth and
keep commands option as is.
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/connection.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 78f72579..e6d72d84 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -59,6 +59,7 @@
 #include "xmpp/connection.h"
 #include "xmpp/session.h"
 #include "xmpp/iq.h"
+#include "ui/ui.h"
 
 typedef struct prof_conn_t {
     xmpp_log_t *xmpp_log;
@@ -191,7 +192,13 @@ connection_connect(const char *const jid, const char *const passwd, const char *
     }
 
     if (auth_policy && (g_strcmp0(auth_policy, "legacy") == 0)) {
+#ifdef HAVE_LIBSTROPHE_LT_0_9_3
+        log_warning("Legacy authentication is requested, but it hasn't been "
+                    "built. Update libstrophe and rebuild Profanity.");
+        cons_show("Legacy authentication is requested, but it hasn't been built.");
+#else
         flags |= XMPP_CONN_FLAG_LEGACY_AUTH;
+#endif /* HAVE_LIBSTROPHE_LT_0_9_3 */
     }
 
     xmpp_conn_set_flags(conn.xmpp_conn, flags);
@@ -204,7 +211,9 @@ connection_connect(const char *const jid, const char *const passwd, const char *
         LOG_FLAG_IF_SET(XMPP_CONN_FLAG_TRUST_TLS);
         LOG_FLAG_IF_SET(XMPP_CONN_FLAG_DISABLE_TLS);
         LOG_FLAG_IF_SET(XMPP_CONN_FLAG_LEGACY_SSL);
+#ifndef HAVE_LIBSTROPHE_LT_0_9_3
         LOG_FLAG_IF_SET(XMPP_CONN_FLAG_LEGACY_AUTH);
+#endif /* HAVE_LIBSTROPHE_LT_0_9_3 */
 #undef LOG_FLAG_IF_SET
     }