mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge pull request #1788 from profanity-im/minor-improvements
Minor improvements
This commit is contained in:
commit
1105571584
@ -198,6 +198,10 @@ _conn_apply_settings(const char* const jid, const char* const passwd, const char
|
||||
|
||||
long flags = xmpp_conn_get_flags(conn.xmpp_conn);
|
||||
|
||||
/* clear all TLS & auth related flags */
|
||||
flags &= ~(XMPP_CONN_FLAG_DISABLE_TLS | XMPP_CONN_FLAG_MANDATORY_TLS
|
||||
| XMPP_CONN_FLAG_LEGACY_SSL | XMPP_CONN_FLAG_TRUST_TLS
|
||||
| XMPP_CONN_FLAG_LEGACY_AUTH);
|
||||
if (!tls_policy || (g_strcmp0(tls_policy, "force") == 0)) {
|
||||
flags |= XMPP_CONN_FLAG_MANDATORY_TLS;
|
||||
} else if (g_strcmp0(tls_policy, "trust") == 0) {
|
||||
@ -213,8 +217,6 @@ _conn_apply_settings(const char* const jid, const char* const passwd, const char
|
||||
flags |= XMPP_CONN_FLAG_LEGACY_AUTH;
|
||||
}
|
||||
|
||||
xmpp_conn_set_flags(conn.xmpp_conn, flags);
|
||||
|
||||
/* Print debug logs that can help when users share the logs */
|
||||
if (flags != 0) {
|
||||
log_debug("Connecting with flags (0x%lx):", flags);
|
||||
@ -230,6 +232,12 @@ _conn_apply_settings(const char* const jid, const char* const passwd, const char
|
||||
#undef LOG_FLAG_IF_SET
|
||||
}
|
||||
|
||||
if (xmpp_conn_set_flags(conn.xmpp_conn, flags)) {
|
||||
log_error("libstrophe doesn't accept this combination of flags: 0x%x", flags);
|
||||
conn.conn_status = JABBER_DISCONNECTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char* cert_path = prefs_get_tls_certpath();
|
||||
if (cert_path) {
|
||||
xmpp_conn_set_capath(conn.xmpp_conn, cert_path);
|
||||
|
@ -1396,9 +1396,7 @@ _autoping_timed_send(xmpp_conn_t* const conn, void* const userdata)
|
||||
log_warning("Server doesn't advertise %s feature, disabling autoping.", XMPP_FEATURE_PING);
|
||||
prefs_set_autoping(0);
|
||||
cons_show_error("Server ping not supported (%s), autoping disabled.", XMPP_FEATURE_PING);
|
||||
xmpp_conn_t* conn = connection_get_conn();
|
||||
xmpp_timed_handler_delete(conn, _autoping_timed_send);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (autoping_wait) {
|
||||
@ -1464,8 +1462,7 @@ _auto_pong_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||
log_warning("Server ping (id=%s) error type 'cancel', disabling autoping.", id);
|
||||
prefs_set_autoping(0);
|
||||
cons_show_error("Server ping not supported, autoping disabled.");
|
||||
xmpp_conn_t* conn = connection_get_conn();
|
||||
xmpp_timed_handler_delete(conn, _autoping_timed_send);
|
||||
xmpp_timed_handler_delete(connection_get_conn(), _autoping_timed_send);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1533,8 +1530,7 @@ _version_result_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||
log_warning("From attribute specified different JID, using original JID.");
|
||||
}
|
||||
|
||||
xmpp_conn_t* conn = connection_get_conn();
|
||||
xmpp_ctx_t* ctx = xmpp_conn_get_context(conn);
|
||||
xmpp_ctx_t* ctx = connection_get_ctx();
|
||||
|
||||
Jid* jidp = jid_create((char*)userdata);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user