fixed some bugs, added some more

- Added JABBER_RAW_CONNECT[ING/ED] connection states
- Added cl_ev_connect_raw and session_connect_raw to conform to normal
connection functions
- Fixed SIGABRT during registration
- Added a check in cmd_register to ensure it's actually connected before
registering--but this will always fail atm
This commit is contained in:
swirl
2021-07-04 19:02:38 -04:00
parent 5ea1ccbb46
commit 2cc354b6ae
9 changed files with 96 additions and 15 deletions

View File

@@ -342,7 +342,7 @@ connection_connect_raw(const char* const altdomain, int port,
#endif
if (connect_status == 0) {
conn.conn_status = JABBER_CONNECTING;
conn.conn_status = JABBER_RAW_CONNECTING;
} else {
conn.conn_status = JABBER_DISCONNECTED;
}
@@ -686,6 +686,21 @@ _connection_handler(xmpp_conn_t* const xmpp_conn, const xmpp_conn_event_t status
break;
// raw connection success
case XMPP_CONN_RAW_CONNECT:
log_debug("Connection handler: XMPP_CONN_RAW_CONNECT");
conn.conn_status = JABBER_RAW_CONNECTED;
Jid* my_raw_jid = jid_create(xmpp_conn_get_jid(conn.xmpp_conn));
log_debug("jid: %s", xmpp_conn_get_jid(conn.xmpp_conn));
conn.domain = strdup(my_raw_jid->domainpart);
jid_destroy(my_raw_jid);
conn.features_by_jid = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)g_hash_table_destroy);
g_hash_table_insert(conn.features_by_jid, strdup(conn.domain), g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL));
break;
// disconnected
case XMPP_CONN_DISCONNECT:
log_debug("Connection handler: XMPP_CONN_DISCONNECT");