+ Add xmpp_conn_get_context() to get the ctx a connection belongs to. Fixes #10
* Properly use altdomain when no SRV record. Fixes #2 - Remove unused function declarations from strophe.h. Fixes #1
This commit is contained in:
17
src/conn.c
17
src/conn.c
@@ -320,6 +320,18 @@ void xmpp_conn_set_pass(xmpp_conn_t * const conn, const char * const pass)
|
|||||||
conn->pass = xmpp_strdup(conn->ctx, pass);
|
conn->pass = xmpp_strdup(conn->ctx, pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the strophe context that the connection is associated with.
|
||||||
|
* @param conn a Strophe connection object
|
||||||
|
*
|
||||||
|
* @return a Strophe context
|
||||||
|
*
|
||||||
|
* @ingroup Connections
|
||||||
|
*/
|
||||||
|
xmpp_ctx_t* xmpp_conn_get_context(xmpp_conn_t * const conn)
|
||||||
|
{
|
||||||
|
return conn->ctx;
|
||||||
|
}
|
||||||
|
|
||||||
/** Initiate a connection to the XMPP server.
|
/** Initiate a connection to the XMPP server.
|
||||||
* This function returns immediately after starting the connection
|
* This function returns immediately after starting the connection
|
||||||
* process to the XMPP server, and notifiations of connection state changes
|
* process to the XMPP server, and notifiations of connection state changes
|
||||||
@@ -359,7 +371,10 @@ int xmpp_connect_client(xmpp_conn_t * const conn,
|
|||||||
if (!sock_srv_lookup("xmpp-client", "tcp", conn->domain, connectdomain, 2048, &connectport))
|
if (!sock_srv_lookup("xmpp-client", "tcp", conn->domain, connectdomain, 2048, &connectport))
|
||||||
{
|
{
|
||||||
xmpp_debug(conn->ctx, "xmpp", "SRV lookup failed.");
|
xmpp_debug(conn->ctx, "xmpp", "SRV lookup failed.");
|
||||||
if (!altdomain) domain = conn->domain;
|
if (!altdomain)
|
||||||
|
domain = conn->domain;
|
||||||
|
else
|
||||||
|
domain = altdomain;
|
||||||
xmpp_debug(conn->ctx, "xmpp", "Using alternate domain %s, port %d", altdomain, altport);
|
xmpp_debug(conn->ctx, "xmpp", "Using alternate domain %s, port %d", altdomain, altport);
|
||||||
strcpy(connectdomain, domain);
|
strcpy(connectdomain, domain);
|
||||||
connectport = altport ? altport : 5222;
|
connectport = altport ? altport : 5222;
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ const char *xmpp_conn_get_jid(const xmpp_conn_t * const conn);
|
|||||||
void xmpp_conn_set_jid(xmpp_conn_t * const conn, const char * const jid);
|
void xmpp_conn_set_jid(xmpp_conn_t * const conn, const char * const jid);
|
||||||
const char *xmpp_conn_get_pass(const xmpp_conn_t * const conn);
|
const char *xmpp_conn_get_pass(const xmpp_conn_t * const conn);
|
||||||
void xmpp_conn_set_pass(xmpp_conn_t * const conn, const char * const pass);
|
void xmpp_conn_set_pass(xmpp_conn_t * const conn, const char * const pass);
|
||||||
|
xmpp_ctx_t* xmpp_conn_get_context(xmpp_conn_t * const conn);
|
||||||
|
|
||||||
int xmpp_connect_client(xmpp_conn_t * const conn,
|
int xmpp_connect_client(xmpp_conn_t * const conn,
|
||||||
const char * const altdomain,
|
const char * const altdomain,
|
||||||
@@ -325,8 +326,6 @@ int xmpp_stanza_set_text_with_size(xmpp_stanza_t *stanza,
|
|||||||
/* common stanza helpers */
|
/* common stanza helpers */
|
||||||
char *xmpp_stanza_get_type(xmpp_stanza_t * const stanza);
|
char *xmpp_stanza_get_type(xmpp_stanza_t * const stanza);
|
||||||
char *xmpp_stanza_get_id(xmpp_stanza_t * const stanza);
|
char *xmpp_stanza_get_id(xmpp_stanza_t * const stanza);
|
||||||
int xmpp_stanza_get_to();
|
|
||||||
int xmpp_stanza_get_from();
|
|
||||||
int xmpp_stanza_set_id(xmpp_stanza_t * const stanza,
|
int xmpp_stanza_set_id(xmpp_stanza_t * const stanza,
|
||||||
const char * const id);
|
const char * const id);
|
||||||
int xmpp_stanza_set_type(xmpp_stanza_t * const stanza,
|
int xmpp_stanza_set_type(xmpp_stanza_t * const stanza,
|
||||||
|
|||||||
Reference in New Issue
Block a user