conn: added API xmpp_conn_is_secured()

This patch is provided by @kjkao. New API is already used in
WorksSystems/wks_xep0047.
This commit is contained in:
Dmitry Podgorny
2015-10-13 00:10:02 +03:00
parent 36af7afa27
commit b7fbc81740
4 changed files with 13 additions and 1 deletions

View File

@@ -21,9 +21,13 @@ void conn_handler(xmpp_conn_t * const conn, const xmpp_conn_event_t status,
void * const userdata)
{
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
int secured;
if (status == XMPP_CONN_CONNECT) {
fprintf(stderr, "DEBUG: connected\n");
secured = xmpp_conn_is_secured(conn);
fprintf(stderr, "DEBUG: connection is %s.\n",
secured ? "secured" : "NOT secured");
xmpp_disconnect(conn);
}
else {
@@ -74,7 +78,7 @@ int main(int argc, char **argv)
/* create a connection */
conn = xmpp_conn_new(ctx);
/* configure connection properties */
/* configure connection properties (optional) */
if (opt_disable_tls)
xmpp_conn_disable_tls(conn);
if (opt_old_ssl)