1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Moved roster iq creation to stanza

This commit is contained in:
James Booth 2012-11-10 00:25:42 +00:00
parent 244358afb0
commit 0da40a34d5
3 changed files with 22 additions and 14 deletions

View File

@ -309,19 +309,7 @@ jabber_free_resources(void)
static void
_jabber_roster_request(void)
{
xmpp_stanza_t *iq, *query;
iq = xmpp_stanza_new(jabber_conn.ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_id(iq, "roster");
query = xmpp_stanza_new(jabber_conn.ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
xmpp_stanza_set_ns(query, XMPP_NS_ROSTER);
xmpp_stanza_add_child(iq, query);
xmpp_stanza_release(query);
xmpp_stanza_t *iq = stanza_create_roster_iq(jabber_conn.ctx);
xmpp_send(jabber_conn.conn, iq);
xmpp_stanza_release(iq);
}

View File

@ -150,3 +150,21 @@ stanza_create_presence(xmpp_ctx_t *ctx, const char * const show,
return presence;
}
xmpp_stanza_t *
stanza_create_roster_iq(xmpp_ctx_t *ctx)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_id(iq, "roster");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
xmpp_stanza_set_ns(query, XMPP_NS_ROSTER);
xmpp_stanza_add_child(iq, query);
xmpp_stanza_release(query);
return iq;
}

View File

@ -81,7 +81,9 @@ xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t *ctx,
xmpp_stanza_t* stanza_create_room_leave_presence(xmpp_ctx_t *ctx,
const char * const room, const char * const nick);
xmpp_stanza_t * stanza_create_presence(xmpp_ctx_t *ctx, const char * const show,
xmpp_stanza_t* stanza_create_presence(xmpp_ctx_t *ctx, const char * const show,
const char * const status);
xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx);
#endif