mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Moved roster request to xmpp_iq
This commit is contained in:
parent
f60864f870
commit
61b4ef9c83
@ -173,6 +173,7 @@ void message_send_gone(const char * const recipient);
|
||||
|
||||
// iq functions
|
||||
void iq_add_handlers(void);
|
||||
void iq_roster_request(void);
|
||||
|
||||
// presence functions
|
||||
void presence_add_handlers(void);
|
||||
|
@ -73,8 +73,6 @@ static jabber_conn_status_t _jabber_connect(const char * const fulljid,
|
||||
const char * const passwd, const char * const altdomain);
|
||||
static void _jabber_reconnect(void);
|
||||
|
||||
static void _jabber_roster_request(void);
|
||||
|
||||
static void _connection_handler(xmpp_conn_t * const conn,
|
||||
const xmpp_conn_event_t status, const int error,
|
||||
xmpp_stream_error_t * const stream_error, void * const userdata);
|
||||
@ -140,23 +138,6 @@ jabber_connect_with_details(const char * const jid,
|
||||
return _jabber_connect(saved_details.jid, passwd, saved_details.altdomain);
|
||||
}
|
||||
|
||||
static void
|
||||
_jabber_reconnect(void)
|
||||
{
|
||||
// reconnect with account.
|
||||
ProfAccount *account = accounts_get_account(saved_account.name);
|
||||
|
||||
if (account == NULL) {
|
||||
log_error("Unable to reconnect, account no longer exists: %s", saved_account.name);
|
||||
} else {
|
||||
char *fulljid = create_fulljid(account->jid, account->resource);
|
||||
log_debug("Attempting reconnect with account %s", account->name);
|
||||
_jabber_connect(fulljid, saved_account.passwd, account->server);
|
||||
free(fulljid);
|
||||
g_timer_start(reconnect_timer);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
jabber_disconnect(void)
|
||||
{
|
||||
@ -372,6 +353,23 @@ _jabber_connect(const char * const fulljid, const char * const passwd,
|
||||
return jabber_conn.conn_status;
|
||||
}
|
||||
|
||||
static void
|
||||
_jabber_reconnect(void)
|
||||
{
|
||||
// reconnect with account.
|
||||
ProfAccount *account = accounts_get_account(saved_account.name);
|
||||
|
||||
if (account == NULL) {
|
||||
log_error("Unable to reconnect, account no longer exists: %s", saved_account.name);
|
||||
} else {
|
||||
char *fulljid = create_fulljid(account->jid, account->resource);
|
||||
log_debug("Attempting reconnect with account %s", account->name);
|
||||
_jabber_connect(fulljid, saved_account.passwd, account->server);
|
||||
free(fulljid);
|
||||
g_timer_start(reconnect_timer);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_connection_handler(xmpp_conn_t * const conn,
|
||||
const xmpp_conn_event_t status, const int error,
|
||||
@ -412,7 +410,7 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
xmpp_timed_handler_add(conn, _ping_timed_handler, millis, ctx);
|
||||
}
|
||||
|
||||
_jabber_roster_request();
|
||||
iq_roster_request();
|
||||
jabber_conn.conn_status = JABBER_CONNECTED;
|
||||
jabber_conn.presence = PRESENCE_ONLINE;
|
||||
|
||||
@ -455,14 +453,6 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_jabber_roster_request(void)
|
||||
{
|
||||
xmpp_stanza_t *iq = stanza_create_roster_iq(jabber_conn.ctx);
|
||||
xmpp_send(jabber_conn.conn, iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
static int
|
||||
_ping_timed_handler(xmpp_conn_t * const conn, void * const userdata)
|
||||
{
|
||||
|
@ -62,6 +62,16 @@ iq_add_handlers(void)
|
||||
HANDLE(STANZA_NS_PING, STANZA_TYPE_GET, _iq_handle_ping_get);
|
||||
}
|
||||
|
||||
void
|
||||
iq_roster_request(void)
|
||||
{
|
||||
xmpp_conn_t * const conn = jabber_get_conn();
|
||||
xmpp_ctx_t * const ctx = jabber_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_roster_iq(ctx);
|
||||
xmpp_send(conn, iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
static int
|
||||
_iq_handle_error(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
void * const userdata)
|
||||
|
Loading…
Reference in New Issue
Block a user