diff options
Diffstat (limited to 'xmpp-vala')
-rw-r--r-- | xmpp-vala/CMakeLists.txt | 12 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0368_srv_records_tls.vala | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt index 5836f96f..57347282 100644 --- a/xmpp-vala/CMakeLists.txt +++ b/xmpp-vala/CMakeLists.txt @@ -6,6 +6,16 @@ find_packages(ENGINE_PACKAGES REQUIRED GObject ) +set(ENGINE_DEFINITIONS "") + +find_package(GIO) +if(GIO_VERSION VERSION_GREATER "2.60") + message(STATUS "ALPN support enabled") + set(ENGINE_DEFINITIONS ALPN_SUPPORT) +else() + message(STATUS "No ALPN support, needs GIO >= 2.60") +endif() + vala_precompile(ENGINE_VALA_C SOURCES "src/glib_fixes.vapi" @@ -91,6 +101,8 @@ GENERATE_VAPI xmpp-vala GENERATE_HEADER xmpp-vala +DEFINITIONS + ${ENGINE_DEFINITIONS} ) add_custom_target(xmpp-vala-vapi diff --git a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala index 3d0708fb..5a2a4559 100644 --- a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala +++ b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala @@ -39,6 +39,9 @@ public class TlsConnectionProvider : ConnectionProvider { debug("Connecting to %s %i (tls)", srv_target.get_hostname(), srv_target.get_port()); IOStream? io_stream = yield client.connect_to_host_async(srv_target.get_hostname(), srv_target.get_port()); TlsConnection tls_connection = TlsClientConnection.new(io_stream, new NetworkAddress(stream.remote_name.to_string(), srv_target.get_port())); +#if ALPN_SUPPORT + tls_connection.set_advertised_protocols(new string[]{"xmpp-client"}); +#endif tls_connection.accept_certificate.connect(stream.get_module(Tls.Module.IDENTITY).on_invalid_certificate); stream.add_flag(new Tls.Flag() { finished=true }); return tls_connection; |