conn: implemented xmpp_connect_raw()

This function is similar to xmpp_connect_client(), but doesn't perform
authentication. Instead, it calls user's connection handler immediately
after establishing the connection. Hence, user can implement own
authendication or registration procedures.

Such a "raw" connection can be useful when user interaction is required
(e.g. Data Forms in XEP-0077, OAuth2).
This commit is contained in:
Dmitry Podgorny
2016-04-26 18:29:47 +00:00
parent 3869906357
commit dc56737b71
6 changed files with 130 additions and 22 deletions

View File

@@ -169,6 +169,7 @@ typedef struct _xmpp_stanza_t xmpp_stanza_t;
/* connect callback */
typedef enum {
XMPP_CONN_CONNECT,
XMPP_CONN_RAW_CONNECT,
XMPP_CONN_DISCONNECT,
XMPP_CONN_FAIL
} xmpp_conn_event_t;
@@ -238,6 +239,14 @@ int xmpp_connect_component(xmpp_conn_t * const conn, const char * const server,
unsigned short port, xmpp_conn_handler callback,
void * const userdata);
int xmpp_connect_raw(xmpp_conn_t * const conn,
const char * const altdomain,
unsigned short altport,
xmpp_conn_handler callback,
void * const userdata);
int xmpp_conn_raw_open_stream(xmpp_conn_t * const conn);
int xmpp_conn_raw_tls_start(xmpp_conn_t * const conn);
void xmpp_disconnect(xmpp_conn_t * const conn);
void xmpp_send(xmpp_conn_t * const conn,