1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Use libstrophe xmpp_message_new convenience function

This commit is contained in:
James Booth 2016-08-20 19:08:13 +01:00
parent 45048e3ac8
commit 39ff399626
2 changed files with 12 additions and 22 deletions

View File

@ -602,12 +602,10 @@ void
_message_send_receipt(const char *const fulljid, const char *const message_id)
{
xmpp_ctx_t * const ctx = connection_get_ctx();
xmpp_stanza_t *message = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(message, STANZA_NAME_MESSAGE);
char *id = create_unique_id("receipt");
xmpp_stanza_set_id(message, id);
xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, fulljid, id);
free(id);
xmpp_stanza_set_to(message, fulljid);
xmpp_stanza_t *receipt = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(receipt, "received");

View File

@ -319,12 +319,9 @@ stanza_disable_carbons(xmpp_ctx_t *ctx)
xmpp_stanza_t*
stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char *const state)
{
xmpp_stanza_t *msg = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE);
xmpp_stanza_set_type(msg, STANZA_TYPE_CHAT);
xmpp_stanza_set_to(msg, fulljid);
_stanza_add_unique_id(msg, NULL);
char *id = create_unique_id(NULL);
xmpp_stanza_t *msg = xmpp_message_new(ctx, STANZA_TYPE_CHAT, fulljid, id);
free(id);
xmpp_stanza_t *chat_state = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(chat_state, state);
@ -338,10 +335,7 @@ stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char
xmpp_stanza_t*
stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char *const room, const char *const subject)
{
xmpp_stanza_t *msg = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE);
xmpp_stanza_set_type(msg, STANZA_TYPE_GROUPCHAT);
xmpp_stanza_set_to(msg, room);
xmpp_stanza_t *msg = xmpp_message_new(ctx, STANZA_TYPE_GROUPCHAT, room, NULL);
xmpp_stanza_t *subject_st = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(subject_st, STANZA_NAME_SUBJECT);
@ -517,10 +511,9 @@ xmpp_stanza_t*
stanza_create_invite(xmpp_ctx_t *ctx, const char *const room,
const char *const contact, const char *const reason, const char *const password)
{
xmpp_stanza_t *message = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(message, STANZA_NAME_MESSAGE);
xmpp_stanza_set_to(message, contact);
_stanza_add_unique_id(message, NULL);
char *id = create_unique_id(NULL);
xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, contact, id);
free(id);
xmpp_stanza_t *x = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(x, STANZA_NAME_X);
@ -544,10 +537,9 @@ xmpp_stanza_t*
stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
const char *const contact, const char *const reason)
{
xmpp_stanza_t *message = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(message, STANZA_NAME_MESSAGE);
xmpp_stanza_set_to(message, room);
_stanza_add_unique_id(message, NULL);
char *id = create_unique_id(NULL);
xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, room, id);
free(id);
xmpp_stanza_t *x = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(x, STANZA_NAME_X);