mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into osx-functional
This commit is contained in:
commit
5172b75542
@ -95,19 +95,17 @@ static GTimer *reconnect_timer;
|
|||||||
static log_level_t _get_log_level(xmpp_log_level_t xmpp_level);
|
static log_level_t _get_log_level(xmpp_log_level_t xmpp_level);
|
||||||
static xmpp_log_level_t _get_xmpp_log_level();
|
static xmpp_log_level_t _get_xmpp_log_level();
|
||||||
|
|
||||||
static void _xmpp_file_logger(void *const userdata,
|
static void _xmpp_file_logger(void *const userdata, const xmpp_log_level_t level, const char *const area,
|
||||||
const xmpp_log_level_t level, const char *const area,
|
|
||||||
const char *const msg);
|
const char *const msg);
|
||||||
|
|
||||||
static xmpp_log_t* _xmpp_get_file_logger();
|
static xmpp_log_t* _xmpp_get_file_logger();
|
||||||
|
|
||||||
static jabber_conn_status_t _jabber_connect(const char *const fulljid,
|
static jabber_conn_status_t _jabber_connect(const char *const fulljid, const char *const passwd,
|
||||||
const char *const passwd, const char *const altdomain, int port, const char *const tls_policy);
|
const char *const altdomain, int port, const char *const tls_policy);
|
||||||
|
|
||||||
static void _jabber_reconnect(void);
|
static void _jabber_reconnect(void);
|
||||||
|
|
||||||
static void _connection_handler(xmpp_conn_t *const conn,
|
static void _connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error,
|
||||||
const xmpp_conn_event_t status, const int error,
|
|
||||||
xmpp_stream_error_t *const stream_error, void *const userdata);
|
xmpp_stream_error_t *const stream_error, void *const userdata);
|
||||||
|
|
||||||
void _connection_free_saved_account(void);
|
void _connection_free_saved_account(void);
|
||||||
@ -125,8 +123,7 @@ jabber_init(void)
|
|||||||
jabber_conn.domain = NULL;
|
jabber_conn.domain = NULL;
|
||||||
presence_sub_requests_init();
|
presence_sub_requests_init();
|
||||||
caps_init();
|
caps_init();
|
||||||
available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free,
|
available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)resource_destroy);
|
||||||
(GDestroyNotify)resource_destroy);
|
|
||||||
xmpp_initialize();
|
xmpp_initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,15 +147,15 @@ jabber_connect_with_account(const ProfAccount *const account)
|
|||||||
// connect with fulljid
|
// connect with fulljid
|
||||||
Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
|
Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
|
||||||
jabber_conn_status_t result =
|
jabber_conn_status_t result =
|
||||||
_jabber_connect(jidp->fulljid, account->password, account->server, account->port, account->tls_policy);
|
_jabber_connect(jidp->fulljid, account->password, account->server, account->port, account->tls_policy);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
jabber_conn_status_t
|
jabber_conn_status_t
|
||||||
jabber_connect_with_details(const char *const jid,
|
jabber_connect_with_details(const char *const jid, const char *const passwd, const char *const altdomain,
|
||||||
const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy)
|
const int port, const char *const tls_policy)
|
||||||
{
|
{
|
||||||
assert(jid != NULL);
|
assert(jid != NULL);
|
||||||
assert(passwd != NULL);
|
assert(passwd != NULL);
|
||||||
@ -195,6 +192,7 @@ jabber_connect_with_details(const char *const jid,
|
|||||||
|
|
||||||
// connect with fulljid
|
// connect with fulljid
|
||||||
log_info("Connecting without account, JID: %s", saved_details.jid);
|
log_info("Connecting without account, JID: %s", saved_details.jid);
|
||||||
|
|
||||||
return _jabber_connect(
|
return _jabber_connect(
|
||||||
saved_details.jid,
|
saved_details.jid,
|
||||||
passwd,
|
passwd,
|
||||||
@ -441,8 +439,8 @@ jabber_conn_is_secured(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jabber_conn_status_t
|
static jabber_conn_status_t
|
||||||
_jabber_connect(const char *const fulljid, const char *const passwd,
|
_jabber_connect(const char *const fulljid, const char *const passwd, const char *const altdomain, int port,
|
||||||
const char *const altdomain, int port, const char *const tls_policy)
|
const char *const tls_policy)
|
||||||
{
|
{
|
||||||
assert(fulljid != NULL);
|
assert(fulljid != NULL);
|
||||||
assert(passwd != NULL);
|
assert(passwd != NULL);
|
||||||
@ -501,17 +499,27 @@ _jabber_connect(const char *const fulljid, const char *const passwd,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBMESODE
|
#ifdef HAVE_LIBMESODE
|
||||||
int connect_status = xmpp_connect_client(jabber_conn.conn, altdomain, port,
|
int connect_status = xmpp_connect_client(
|
||||||
_connection_certfail_cb, _connection_handler, jabber_conn.ctx);
|
jabber_conn.conn,
|
||||||
|
altdomain,
|
||||||
|
port,
|
||||||
|
_connection_certfail_cb,
|
||||||
|
_connection_handler,
|
||||||
|
jabber_conn.ctx);
|
||||||
#else
|
#else
|
||||||
int connect_status = xmpp_connect_client(jabber_conn.conn, altdomain, port,
|
int connect_status = xmpp_connect_client(
|
||||||
_connection_handler, jabber_conn.ctx);
|
jabber_conn.conn,
|
||||||
|
altdomain,
|
||||||
|
port,
|
||||||
|
_connection_handler,
|
||||||
|
jabber_conn.ctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (connect_status == 0)
|
if (connect_status == 0) {
|
||||||
jabber_conn.conn_status = JABBER_CONNECTING;
|
jabber_conn.conn_status = JABBER_CONNECTING;
|
||||||
else
|
} else {
|
||||||
jabber_conn.conn_status = JABBER_DISCONNECTED;
|
jabber_conn.conn_status = JABBER_DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
return jabber_conn.conn_status;
|
return jabber_conn.conn_status;
|
||||||
}
|
}
|
||||||
@ -534,8 +542,7 @@ _jabber_reconnect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_connection_handler(xmpp_conn_t *const conn,
|
_connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error,
|
||||||
const xmpp_conn_event_t status, const int error,
|
|
||||||
xmpp_stream_error_t *const stream_error, void *const userdata)
|
xmpp_stream_error_t *const stream_error, void *const userdata)
|
||||||
{
|
{
|
||||||
// login success
|
// login success
|
||||||
@ -581,11 +588,9 @@ _connection_handler(xmpp_conn_t *const conn,
|
|||||||
iq_enable_carbons();
|
iq_enable_carbons();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_reconnect() != 0) {
|
if ((prefs_get_reconnect() != 0) && reconnect_timer) {
|
||||||
if (reconnect_timer) {
|
g_timer_destroy(reconnect_timer);
|
||||||
g_timer_destroy(reconnect_timer);
|
reconnect_timer = NULL;
|
||||||
reconnect_timer = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (status == XMPP_CONN_DISCONNECT) {
|
} else if (status == XMPP_CONN_DISCONNECT) {
|
||||||
@ -665,8 +670,7 @@ _get_xmpp_log_level()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_xmpp_file_logger(void *const userdata, const xmpp_log_level_t level,
|
_xmpp_file_logger(void *const userdata, const xmpp_log_level_t level, const char *const area, const char *const msg)
|
||||||
const char *const area, const char *const msg)
|
|
||||||
{
|
{
|
||||||
log_level_t prof_level = _get_log_level(level);
|
log_level_t prof_level = _get_log_level(level);
|
||||||
log_msg(prof_level, area, msg);
|
log_msg(prof_level, area, msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user