Skip to content

Commit a21a4f7

Browse files
committed
Officially deprecate xmpp_conn_disable_tls()
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
1 parent f40fcbe commit a21a4f7

3 files changed

Lines changed: 24 additions & 21 deletions

File tree

src/conn.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,9 @@ int xmpp_connect_component(xmpp_conn_t *conn,
799799
return XMPP_EINVOP;
800800

801801
/* XEP-0114 does not support TLS */
802-
xmpp_conn_disable_tls(conn);
802+
long flags = xmpp_conn_get_flags(conn);
803+
flags |= XMPP_CONN_FLAG_DISABLE_TLS;
804+
(void)xmpp_conn_set_flags(conn, flags);
803805
if (!conn->tls_disabled) {
804806
strophe_error(conn->ctx, "conn",
805807
"Failed to disable TLS. "
@@ -1203,25 +1205,6 @@ int xmpp_conn_set_flags(xmpp_conn_t *conn, long flags)
12031205
return 0;
12041206
}
12051207

1206-
/** Disable TLS for this connection, called by users of the library.
1207-
* Occasionally a server will be misconfigured to send the starttls
1208-
* feature, but will not support the handshake.
1209-
*
1210-
* @param conn a Strophe connection object
1211-
*
1212-
* @note this function is deprecated
1213-
* @see xmpp_conn_set_flags()
1214-
*
1215-
* @ingroup Connections
1216-
*/
1217-
void xmpp_conn_disable_tls(xmpp_conn_t *conn)
1218-
{
1219-
long flags = xmpp_conn_get_flags(conn);
1220-
1221-
flags |= XMPP_CONN_FLAG_DISABLE_TLS;
1222-
(void)xmpp_conn_set_flags(conn, flags);
1223-
}
1224-
12251208
/** Return whether TLS session is established or not.
12261209
*
12271210
* @return TRUE if TLS session is established and FALSE otherwise

src/deprecated.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,22 @@ void xmpp_conn_set_keepalive(xmpp_conn_t *conn, int timeout, int interval)
255255
conn->ka_count = 0;
256256
xmpp_conn_set_sockopt_callback(conn, xmpp_sockopt_cb_keepalive);
257257
}
258+
259+
/** Disable TLS for this connection, called by users of the library.
260+
* Occasionally a server will be misconfigured to send the starttls
261+
* feature, but will not support the handshake.
262+
*
263+
* @param conn a Strophe connection object
264+
*
265+
* @note this function is deprecated
266+
* @see xmpp_conn_set_flags()
267+
*
268+
* @ingroup Deprecated
269+
*/
270+
void xmpp_conn_disable_tls(xmpp_conn_t *conn)
271+
{
272+
long flags = xmpp_conn_get_flags(conn);
273+
274+
flags |= XMPP_CONN_FLAG_DISABLE_TLS;
275+
(void)xmpp_conn_set_flags(conn, flags);
276+
}

strophe.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ char *xmpp_conn_cert_xmppaddr(xmpp_conn_t *conn, unsigned int n);
382382
const char *xmpp_conn_get_pass(const xmpp_conn_t *conn);
383383
void xmpp_conn_set_pass(xmpp_conn_t *conn, const char *pass);
384384
xmpp_ctx_t *xmpp_conn_get_context(xmpp_conn_t *conn);
385-
void xmpp_conn_disable_tls(xmpp_conn_t *conn);
386385
int xmpp_conn_is_secured(xmpp_conn_t *conn);
387386
void xmpp_conn_set_sockopt_callback(xmpp_conn_t *conn,
388387
xmpp_sockopt_callback callback);
@@ -743,6 +742,8 @@ void xmpp_debug_verbose(
743742

744743
XMPP_DEPRECATED(xmpp_conn_set_sockopt_callback)
745744
void xmpp_conn_set_keepalive(xmpp_conn_t *conn, int timeout, int interval);
745+
XMPP_DEPRECATED(xmpp_conn_set_flags)
746+
void xmpp_conn_disable_tls(xmpp_conn_t *conn);
746747

747748
#ifdef __cplusplus
748749
}

0 commit comments

Comments
 (0)