diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 89ea5b7d..bd31f594 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -88,10 +88,10 @@ _message_send(const char * const msg, const char * const recipient) if (prefs_get_boolean(PREF_STATES) && chat_session_get_recipient_supports(jid)) { chat_session_set_active(jid); message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT, - msg, STANZA_NAME_ACTIVE, NULL); + msg, STANZA_NAME_ACTIVE); } else { message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT, - msg, NULL, NULL); + msg, NULL); } xmpp_send(conn, message); @@ -104,7 +104,7 @@ _message_send_groupchat(const char * const msg, const char * const recipient) xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_stanza_t *message = stanza_create_message(ctx, recipient, - STANZA_TYPE_GROUPCHAT, msg, NULL, NULL); + STANZA_TYPE_GROUPCHAT, msg, NULL); xmpp_send(conn, message); xmpp_stanza_release(message); @@ -116,7 +116,7 @@ _message_send_duck(const char * const query) xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_stanza_t *message = stanza_create_message(ctx, "im@ddg.gg", - STANZA_TYPE_CHAT, query, NULL, NULL); + STANZA_TYPE_CHAT, query, NULL); xmpp_send(conn, message); xmpp_stanza_release(message); diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index 635d12db..5249d51b 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -115,7 +115,7 @@ stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const recipient, xmpp_stanza_t * stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient, const char * const type, const char * const message, - const char * const state, const char * const id) + const char * const state) { xmpp_stanza_t *msg, *body, *text; @@ -123,9 +123,8 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient, xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); xmpp_stanza_set_type(msg, type); xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, recipient); - if (id != NULL) { - xmpp_stanza_set_id(msg, id); - } + char *id = generate_unique_id(NULL); + xmpp_stanza_set_id(msg, id); body = xmpp_stanza_new(ctx); xmpp_stanza_set_name(body, STANZA_NAME_BODY); diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index 6b647258..16aa076a 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -124,7 +124,7 @@ xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient, const char * const type, - const char * const message, const char * const state, const char * const id); + const char * const message, const char * const state); xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t * const ctx, const char * const full_room_jid);