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

Use libstrophe xmpp_presence_new convenience function

This commit is contained in:
James Booth 2016-08-20 20:37:48 +01:00
parent 27263508c7
commit 583fb2b8c6
3 changed files with 5 additions and 20 deletions

View File

@ -172,10 +172,9 @@ presence_subscription(const char *const jid, const jabber_subscr_t action)
break; break;
} }
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
char *id = create_unique_id("sub"); char *id = create_unique_id("sub");
xmpp_stanza_set_id(presence, id); xmpp_stanza_set_id(presence, id);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_type(presence, type); xmpp_stanza_set_type(presence, type);
xmpp_stanza_set_to(presence, jidp->barejid); xmpp_stanza_set_to(presence, jidp->barejid);
_send_presence_stanza(presence); _send_presence_stanza(presence);
@ -258,7 +257,7 @@ presence_send(const resource_presence_t presence_type, const char *const msg, co
connection_set_presence_msg(msg); connection_set_presence_msg(msg);
connection_set_priority(pri); connection_set_priority(pri);
xmpp_stanza_t *presence = stanza_create_presence(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
char *id = create_unique_id("presence"); char *id = create_unique_id("presence");
xmpp_stanza_set_id(presence, id); xmpp_stanza_set_id(presence, id);
stanza_attach_show(ctx, presence, show); stanza_attach_show(ctx, presence, show);

View File

@ -554,8 +554,7 @@ xmpp_stanza_t*
stanza_create_room_join_presence(xmpp_ctx_t *const ctx, stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
const char *const full_room_jid, const char *const passwd) const char *const full_room_jid, const char *const passwd)
{ {
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_to(presence, full_room_jid); xmpp_stanza_set_to(presence, full_room_jid);
_stanza_add_unique_id(presence, "join"); _stanza_add_unique_id(presence, "join");
@ -584,9 +583,8 @@ xmpp_stanza_t*
stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, stanza_create_room_newnick_presence(xmpp_ctx_t *ctx,
const char *const full_room_jid) const char *const full_room_jid)
{ {
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
_stanza_add_unique_id(presence, "sub"); _stanza_add_unique_id(presence, "sub");
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_to(presence, full_room_jid); xmpp_stanza_set_to(presence, full_room_jid);
return presence; return presence;
@ -600,8 +598,7 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room,
g_string_append(full_jid, "/"); g_string_append(full_jid, "/");
g_string_append(full_jid, nick); g_string_append(full_jid, nick);
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_type(presence, STANZA_TYPE_UNAVAILABLE); xmpp_stanza_set_type(presence, STANZA_TYPE_UNAVAILABLE);
xmpp_stanza_set_to(presence, full_jid->str); xmpp_stanza_set_to(presence, full_jid->str);
_stanza_add_unique_id(presence, "leave"); _stanza_add_unique_id(presence, "leave");
@ -867,15 +864,6 @@ stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const
return iq; return iq;
} }
xmpp_stanza_t*
stanza_create_presence(xmpp_ctx_t *const ctx)
{
xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
return presence;
}
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid) stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid)
{ {

View File

@ -237,8 +237,6 @@ xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t *ctx,
xmpp_stanza_t* stanza_create_room_leave_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); const char *const room, const char *const nick);
xmpp_stanza_t* stanza_create_presence(xmpp_ctx_t *const ctx);
xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx); xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx);
xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target); xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target);
xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id,