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

Remove prefix from stanza id

We sent `prof_prefix_uuid` as id. Where the prefix was also optional.
We don't need this at all.
This commit is contained in:
Michael Vetter 2019-10-17 15:40:40 +02:00
parent 827af999b7
commit 53640f6e97
10 changed files with 64 additions and 64 deletions

View File

@ -73,7 +73,7 @@ blocking_request(void)
} }
blocked_ac = autocomplete_new(); blocked_ac = autocomplete_new();
char *id = connection_create_stanza_id("blocked_list_request"); char *id = connection_create_stanza_id();
iq_id_handler_add(id, _blocklist_result_handler, NULL, NULL); iq_id_handler_add(id, _blocklist_result_handler, NULL, NULL);
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -115,7 +115,7 @@ blocked_add(char *jid)
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
char *id = connection_create_stanza_id("block"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
xmpp_stanza_t *block = xmpp_stanza_new(ctx); xmpp_stanza_t *block = xmpp_stanza_new(ctx);
@ -151,7 +151,7 @@ blocked_remove(char *jid)
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
char *id = connection_create_stanza_id("unblock"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
xmpp_stanza_t *block = xmpp_stanza_new(ctx); xmpp_stanza_t *block = xmpp_stanza_new(ctx);

View File

@ -331,7 +331,7 @@ _send_bookmarks(void)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
char *id = connection_create_stanza_id("bookmarks_update"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);

View File

@ -456,7 +456,7 @@ connection_free_uuid(char *uuid)
} }
char* char*
connection_create_stanza_id(char *prefix) connection_create_stanza_id(void)
{ {
unsigned char *digest = (unsigned char*)malloc(XMPP_SHA1_DIGEST_SIZE); unsigned char *digest = (unsigned char*)malloc(XMPP_SHA1_DIGEST_SIZE);
char *msgid = get_random_string(10); char *msgid = get_random_string(10);

View File

@ -62,6 +62,6 @@ void connection_clear_data(void);
void connection_add_available_resource(Resource *resource); void connection_add_available_resource(Resource *resource);
void connection_remove_available_resource(const char *const resource); void connection_remove_available_resource(const char *const resource);
char* connection_create_stanza_id(char *prefix); char* connection_create_stanza_id(void);
#endif #endif

View File

@ -349,7 +349,7 @@ iq_room_list_request(gchar *conferencejid, gchar *filter)
log_debug("Rooms request not cached for: %s", conferencejid); log_debug("Rooms request not cached for: %s", conferencejid);
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("confreq"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_disco_items_iq(ctx, id, conferencejid, NULL); xmpp_stanza_t *iq = stanza_create_disco_items_iq(ctx, id, conferencejid, NULL);
iq_id_handler_add(id, _room_list_id_handler, NULL, filter); iq_id_handler_add(id, _room_list_id_handler, NULL, filter);
@ -394,7 +394,7 @@ iq_http_upload_request(HTTPUpload *upload)
} }
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("http_upload_request"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_http_upload_request(ctx, id, jid, upload); xmpp_stanza_t *iq = stanza_create_http_upload_request(ctx, id, jid, upload);
// TODO add free func // TODO add free func
iq_id_handler_add(id, _http_upload_response_id_handler, NULL, upload); iq_id_handler_add(id, _http_upload_response_id_handler, NULL, upload);
@ -410,7 +410,7 @@ void
iq_disco_info_request(gchar *jid) iq_disco_info_request(gchar *jid)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("disco_info"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, jid, NULL); xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, jid, NULL);
iq_id_handler_add(id, _disco_info_response_id_handler, NULL, NULL); iq_id_handler_add(id, _disco_info_response_id_handler, NULL, NULL);
@ -425,7 +425,7 @@ void
iq_disco_info_request_onconnect(gchar *jid) iq_disco_info_request_onconnect(gchar *jid)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("disco_info_onconnect"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, jid, NULL); xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, jid, NULL);
iq_id_handler_add(id, _disco_info_response_id_handler_onconnect, NULL, NULL); iq_id_handler_add(id, _disco_info_response_id_handler_onconnect, NULL, NULL);
@ -440,7 +440,7 @@ void
iq_last_activity_request(gchar *jid) iq_last_activity_request(gchar *jid)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("lastactivity"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_last_activity_iq(ctx, id, jid); xmpp_stanza_t *iq = stanza_create_last_activity_iq(ctx, id, jid);
iq_id_handler_add(id, _last_activity_response_id_handler, NULL, NULL); iq_id_handler_add(id, _last_activity_response_id_handler, NULL, NULL);
@ -455,7 +455,7 @@ void
iq_room_info_request(const char *const room, gboolean display_result) iq_room_info_request(const char *const room, gboolean display_result)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("room_disco_info"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, room, NULL); xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, room, NULL);
ProfRoomInfoData *cb_data = malloc(sizeof(ProfRoomInfoData)); ProfRoomInfoData *cb_data = malloc(sizeof(ProfRoomInfoData));
@ -731,7 +731,7 @@ void
iq_command_list(const char *const target) iq_command_list(const char *const target)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
const char *id = connection_create_stanza_id("cmdlist"); const char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_disco_items_iq(ctx, id, target, STANZA_NS_COMMAND); xmpp_stanza_t *iq = stanza_create_disco_items_iq(ctx, id, target, STANZA_NS_COMMAND);
iq_id_handler_add(id, _command_list_result_handler, NULL, NULL); iq_id_handler_add(id, _command_list_result_handler, NULL, NULL);

View File

@ -254,7 +254,7 @@ message_send_chat(const char *const barejid, const char *const msg, const char *
char *state = chat_session_get_state(barejid); char *state = chat_session_get_state(barejid);
char *jid = chat_session_get_jid(barejid); char *jid = chat_session_get_jid(barejid);
char *id = connection_create_stanza_id("msg"); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id); xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id);
xmpp_message_set_body(message, msg); xmpp_message_set_body(message, msg);
@ -285,7 +285,7 @@ message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean
char *state = chat_session_get_state(barejid); char *state = chat_session_get_state(barejid);
char *jid = chat_session_get_jid(barejid); char *jid = chat_session_get_jid(barejid);
char *id = connection_create_stanza_id("msg"); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = NULL; xmpp_stanza_t *message = NULL;
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
@ -344,7 +344,7 @@ message_send_chat_otr(const char *const barejid, const char *const msg, gboolean
char *state = chat_session_get_state(barejid); char *state = chat_session_get_state(barejid);
char *jid = chat_session_get_jid(barejid); char *jid = chat_session_get_jid(barejid);
char *id = connection_create_stanza_id("msg"); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, barejid, id); xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, barejid, id);
xmpp_message_set_body(message, msg); xmpp_message_set_body(message, msg);
@ -381,11 +381,11 @@ message_send_chat_omemo(const char *const jid, uint32_t sid, GList *keys,
char *id; char *id;
xmpp_stanza_t *message; xmpp_stanza_t *message;
if (muc) { if (muc) {
id = connection_create_stanza_id("muc"); id = connection_create_stanza_id();
message = xmpp_message_new(ctx, STANZA_TYPE_GROUPCHAT, jid, id); message = xmpp_message_new(ctx, STANZA_TYPE_GROUPCHAT, jid, id);
stanza_attach_origin_id(ctx, message, id); stanza_attach_origin_id(ctx, message, id);
} else { } else {
id = connection_create_stanza_id("msg"); id = connection_create_stanza_id();
message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id); message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id);
} }
@ -485,7 +485,7 @@ void
message_send_private(const char *const fulljid, const char *const msg, const char *const oob_url) message_send_private(const char *const fulljid, const char *const msg, const char *const oob_url)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("prv"); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, fulljid, id); xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, fulljid, id);
xmpp_message_set_body(message, msg); xmpp_message_set_body(message, msg);
@ -504,7 +504,7 @@ char*
message_send_groupchat(const char *const roomjid, const char *const msg, const char *const oob_url) message_send_groupchat(const char *const roomjid, const char *const msg, const char *const oob_url)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("muc"); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_GROUPCHAT, roomjid, id); xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_GROUPCHAT, roomjid, id);
stanza_attach_origin_id(ctx, message, id); stanza_attach_origin_id(ctx, message, id);
@ -841,7 +841,7 @@ _message_send_receipt(const char *const fulljid, const char *const message_id)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("receipt"); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, fulljid, id); xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, fulljid, id);
free(id); free(id);

View File

@ -40,7 +40,7 @@ void
omemo_devicelist_request(const char * const jid) omemo_devicelist_request(const char * const jid)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("devicelist_request"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_omemo_devicelist_request(ctx, id, jid); xmpp_stanza_t *iq = stanza_create_omemo_devicelist_request(ctx, id, jid);
iq_id_handler_add(id, _omemo_receive_devicelist, NULL, NULL); iq_id_handler_add(id, _omemo_receive_devicelist, NULL, NULL);
@ -68,7 +68,7 @@ omemo_bundle_publish(gboolean first)
omemo_signed_prekey_signature(&signed_prekey_signature, &signed_prekey_signature_length); omemo_signed_prekey_signature(&signed_prekey_signature, &signed_prekey_signature_length);
omemo_prekeys(&prekeys, &ids, &lengths); omemo_prekeys(&prekeys, &ids, &lengths);
char *id = connection_create_stanza_id("omemo_bundle_publish"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_omemo_bundle_publish(ctx, id, xmpp_stanza_t *iq = stanza_create_omemo_bundle_publish(ctx, id,
omemo_device_id(), identity_key, identity_key_length, signed_prekey, omemo_device_id(), identity_key, identity_key_length, signed_prekey,
signed_prekey_length, signed_prekey_signature, signed_prekey_length, signed_prekey_signature,
@ -97,7 +97,7 @@ void
omemo_bundle_request(const char * const jid, uint32_t device_id, ProfIqCallback func, ProfIqFreeCallback free_func, void *userdata) omemo_bundle_request(const char * const jid, uint32_t device_id, ProfIqCallback func, ProfIqFreeCallback free_func, void *userdata)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("bundle_request"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_omemo_bundle_request(ctx, id, jid, device_id); xmpp_stanza_t *iq = stanza_create_omemo_bundle_request(ctx, id, jid, device_id);
iq_id_handler_add(id, func, free_func, userdata); iq_id_handler_add(id, func, free_func, userdata);
@ -408,7 +408,7 @@ _omemo_bundle_publish_result(xmpp_stanza_t *const stanza, void *const userdata)
log_info("OMEMO: cannot publish bundle with open access model, trying to configure node"); log_info("OMEMO: cannot publish bundle with open access model, trying to configure node");
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
Jid *jid = jid_create(connection_get_fulljid()); Jid *jid = jid_create(connection_get_fulljid());
char *id = connection_create_stanza_id("omemo_bundle_node_configure_request"); char *id = connection_create_stanza_id();
char *node = g_strdup_printf("%s:%d", STANZA_NS_OMEMO_BUNDLES, omemo_device_id()); char *node = g_strdup_printf("%s:%d", STANZA_NS_OMEMO_BUNDLES, omemo_device_id());
xmpp_stanza_t *iq = stanza_create_pubsub_configure_request(ctx, id, jid->barejid, node); xmpp_stanza_t *iq = stanza_create_pubsub_configure_request(ctx, id, jid->barejid, node);
g_free(node); g_free(node);
@ -441,7 +441,7 @@ _omemo_bundle_publish_configure(xmpp_stanza_t *const stanza, void *const userdat
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
Jid *jid = jid_create(connection_get_fulljid()); Jid *jid = jid_create(connection_get_fulljid());
char *id = connection_create_stanza_id("omemo_bundle_node_configure_submit"); char *id = connection_create_stanza_id();
char *node = g_strdup_printf("%s:%d", STANZA_NS_OMEMO_BUNDLES, omemo_device_id()); char *node = g_strdup_printf("%s:%d", STANZA_NS_OMEMO_BUNDLES, omemo_device_id());
xmpp_stanza_t *iq = stanza_create_pubsub_configure_submit(ctx, id, jid->barejid, node, form); xmpp_stanza_t *iq = stanza_create_pubsub_configure_submit(ctx, id, jid->barejid, node, form);
g_free(node); g_free(node);

View File

@ -128,7 +128,7 @@ presence_subscription(const char *const jid, const jabber_subscr_t action)
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
xmpp_stanza_t *presence = xmpp_presence_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
char *id = connection_create_stanza_id("sub"); char *id = connection_create_stanza_id();
xmpp_stanza_set_id(presence, id); xmpp_stanza_set_id(presence, id);
free(id); free(id);
@ -211,7 +211,7 @@ presence_send(const resource_presence_t presence_type, const int idle, char *sig
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
xmpp_stanza_t *presence = xmpp_presence_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
char *id = connection_create_stanza_id("presence"); char *id = connection_create_stanza_id();
xmpp_stanza_set_id(presence, id); xmpp_stanza_set_id(presence, id);
free(id); free(id);
@ -579,7 +579,7 @@ _handle_caps(const char *const jid, XMPPCaps *caps)
caps_map_jid_to_ver(jid, caps->ver); caps_map_jid_to_ver(jid, caps->ver);
} else { } else {
log_info("Capabilities cache miss: %s, for %s, sending service discovery request", caps->ver, jid); log_info("Capabilities cache miss: %s, for %s, sending service discovery request", caps->ver, jid);
char *id = connection_create_stanza_id("caps"); char *id = connection_create_stanza_id();
iq_send_caps_request(jid, id, caps->node, caps->ver); iq_send_caps_request(jid, id, caps->node, caps->ver);
free(id); free(id);
} }
@ -588,14 +588,14 @@ _handle_caps(const char *const jid, XMPPCaps *caps)
// unsupported hash, xep-0115, associate with JID, no cache // unsupported hash, xep-0115, associate with JID, no cache
} else if (caps->hash) { } else if (caps->hash) {
log_info("Hash %s not supported: %s, sending service discovery request", caps->hash, jid); log_info("Hash %s not supported: %s, sending service discovery request", caps->hash, jid);
char *id = connection_create_stanza_id("caps"); char *id = connection_create_stanza_id();
iq_send_caps_request_for_jid(jid, id, caps->node, caps->ver); iq_send_caps_request_for_jid(jid, id, caps->node, caps->ver);
free(id); free(id);
// no hash, legacy caps, cache against node#ver // no hash, legacy caps, cache against node#ver
} else if (caps->node && caps->ver) { } else if (caps->node && caps->ver) {
log_info("No hash specified: %s, legacy request made for %s#%s", jid, caps->node, caps->ver); log_info("No hash specified: %s, legacy request made for %s#%s", jid, caps->node, caps->ver);
char *id = connection_create_stanza_id("caps"); char *id = connection_create_stanza_id();
iq_send_caps_request_legacy(jid, id, caps->node, caps->ver); iq_send_caps_request_legacy(jid, id, caps->node, caps->ver);
free(id); free(id);
} else { } else {

View File

@ -88,7 +88,7 @@ void
roster_send_add_new(const char *const barejid, const char *const name) roster_send_add_new(const char *const barejid, const char *const name)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("roster"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_roster_set(ctx, id, barejid, name, NULL); xmpp_stanza_t *iq = stanza_create_roster_set(ctx, id, barejid, name, NULL);
free(id); free(id);
iq_send_stanza(iq); iq_send_stanza(iq);
@ -108,7 +108,7 @@ void
roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups) roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups)
{ {
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
char *id = connection_create_stanza_id("roster"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = stanza_create_roster_set(ctx, id, barejid, new_name, groups); xmpp_stanza_t *iq = stanza_create_roster_set(ctx, id, barejid, new_name, groups);
free(id); free(id);
iq_send_stanza(iq); iq_send_stanza(iq);
@ -127,7 +127,7 @@ roster_send_add_to_group(const char *const group, PContact contact)
new_groups = g_slist_append(new_groups, strdup(group)); new_groups = g_slist_append(new_groups, strdup(group));
// add an id handler to handle the response // add an id handler to handle the response
char *unique_id = connection_create_stanza_id(NULL); char *unique_id = connection_create_stanza_id();
GroupData *data = malloc(sizeof(GroupData)); GroupData *data = malloc(sizeof(GroupData));
data->group = strdup(group); data->group = strdup(group);
if (p_contact_name(contact)) { if (p_contact_name(contact)) {
@ -170,7 +170,7 @@ roster_send_remove_from_group(const char *const group, PContact contact)
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
// add an id handler to handle the response // add an id handler to handle the response
char *unique_id = connection_create_stanza_id(NULL); char *unique_id = connection_create_stanza_id();
GroupData *data = malloc(sizeof(GroupData)); GroupData *data = malloc(sizeof(GroupData));
data->group = strdup(group); data->group = strdup(group);
if (p_contact_name(contact)) { if (p_contact_name(contact)) {

View File

@ -66,7 +66,7 @@
#include "xmpp/form.h" #include "xmpp/form.h"
#include "xmpp/muc.h" #include "xmpp/muc.h"
static void _stanza_add_unique_id(xmpp_stanza_t *stanza, char *prefix); static void _stanza_add_unique_id(xmpp_stanza_t *stanza);
static char* _stanza_create_sha1_hash(char *str); static char* _stanza_create_sha1_hash(char *str);
#if 0 #if 0
@ -134,7 +134,7 @@ xmpp_stanza_t*
stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char *const jid, stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char *const jid,
const gboolean autojoin, const char *const nick) const gboolean autojoin, const char *const nick)
{ {
char *id = connection_create_stanza_id("bookmark_add"); char *id = connection_create_stanza_id();
xmpp_stanza_t *stanza = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *stanza = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
@ -280,7 +280,7 @@ stanza_create_http_upload_request(xmpp_ctx_t *ctx, const char *const id,
xmpp_stanza_t* xmpp_stanza_t*
stanza_enable_carbons(xmpp_ctx_t *ctx) stanza_enable_carbons(xmpp_ctx_t *ctx)
{ {
char *id = connection_create_stanza_id("carbons"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
@ -297,7 +297,7 @@ stanza_enable_carbons(xmpp_ctx_t *ctx)
xmpp_stanza_t* xmpp_stanza_t*
stanza_disable_carbons(xmpp_ctx_t *ctx) stanza_disable_carbons(xmpp_ctx_t *ctx)
{ {
char *id = connection_create_stanza_id("carbons"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
@ -314,7 +314,7 @@ stanza_disable_carbons(xmpp_ctx_t *ctx)
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char *const state) stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char *const state)
{ {
char *id = connection_create_stanza_id(NULL); char *id = connection_create_stanza_id();
xmpp_stanza_t *msg = xmpp_message_new(ctx, STANZA_TYPE_CHAT, fulljid, id); xmpp_stanza_t *msg = xmpp_message_new(ctx, STANZA_TYPE_CHAT, fulljid, id);
free(id); free(id);
@ -446,7 +446,7 @@ stanza_attach_x_oob_url(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *cons
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid) stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid)
{ {
char *id = connection_create_stanza_id("roster"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
@ -512,7 +512,7 @@ xmpp_stanza_t*
stanza_create_invite(xmpp_ctx_t *ctx, const char *const room, stanza_create_invite(xmpp_ctx_t *ctx, const char *const room,
const char *const contact, const char *const reason, const char *const password) const char *const contact, const char *const reason, const char *const password)
{ {
char *id = connection_create_stanza_id(NULL); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, contact, id); xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, contact, id);
free(id); free(id);
@ -538,7 +538,7 @@ xmpp_stanza_t*
stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room, stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
const char *const contact, const char *const reason) const char *const contact, const char *const reason)
{ {
char *id = connection_create_stanza_id(NULL); char *id = connection_create_stanza_id();
xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, room, id); xmpp_stanza_t *message = xmpp_message_new(ctx, NULL, room, id);
free(id); free(id);
@ -575,7 +575,7 @@ stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
{ {
xmpp_stanza_t *presence = xmpp_presence_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
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);
xmpp_stanza_t *x = xmpp_stanza_new(ctx); xmpp_stanza_t *x = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(x, STANZA_NAME_X); xmpp_stanza_set_name(x, STANZA_NAME_X);
@ -603,7 +603,7 @@ 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_presence_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
_stanza_add_unique_id(presence, "sub"); _stanza_add_unique_id(presence);
xmpp_stanza_set_to(presence, full_room_jid); xmpp_stanza_set_to(presence, full_room_jid);
return presence; return presence;
@ -620,7 +620,7 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t *presence = xmpp_presence_new(ctx); xmpp_stanza_t *presence = xmpp_presence_new(ctx);
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);
g_string_free(full_jid, TRUE); g_string_free(full_jid, TRUE);
@ -630,7 +630,7 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid) stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid)
{ {
char *id = connection_create_stanza_id("room"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room_jid); xmpp_stanza_set_to(iq, room_jid);
@ -656,7 +656,7 @@ stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_ji
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_jid) stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_jid)
{ {
char *id = connection_create_stanza_id("room"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room_jid); xmpp_stanza_set_to(iq, room_jid);
@ -680,7 +680,7 @@ stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_ji
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid) stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid)
{ {
char *id = connection_create_stanza_id("room"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room_jid); xmpp_stanza_set_to(iq, room_jid);
@ -698,7 +698,7 @@ stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid) stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid)
{ {
char *id = connection_create_stanza_id("room"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room_jid); xmpp_stanza_set_to(iq, room_jid);
@ -724,7 +724,7 @@ stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid)
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const affiliation) stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const affiliation)
{ {
char *id = connection_create_stanza_id("affiliation_get"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room); xmpp_stanza_set_to(iq, room);
@ -748,7 +748,7 @@ stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const role) stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const role)
{ {
char *id = connection_create_stanza_id("role_get"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room); xmpp_stanza_set_to(iq, room);
@ -773,7 +773,7 @@ xmpp_stanza_t*
stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid, stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid,
const char *const affiliation, const char *const reason) const char *const affiliation, const char *const reason)
{ {
char *id = connection_create_stanza_id("affiliation_set"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room); xmpp_stanza_set_to(iq, room);
@ -811,7 +811,7 @@ xmpp_stanza_t*
stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick,
const char *const role, const char *const reason) const char *const role, const char *const reason)
{ {
char *id = connection_create_stanza_id("role_set"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room); xmpp_stanza_set_to(iq, room);
@ -849,7 +849,7 @@ xmpp_stanza_t*
stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick,
const char *const reason) const char *const reason)
{ {
char *id = connection_create_stanza_id("room_kick"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room); xmpp_stanza_set_to(iq, room);
@ -886,7 +886,7 @@ stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const
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)
{ {
char *id = connection_create_stanza_id("sv"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, fulljid); xmpp_stanza_set_to(iq, fulljid);
@ -975,7 +975,7 @@ stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id, const char
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form) stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form)
{ {
char *id = connection_create_stanza_id("roomconf_submit"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room); xmpp_stanza_set_to(iq, room);
@ -1052,7 +1052,7 @@ stanza_contains_chat_state(xmpp_stanza_t *stanza)
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target) stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target)
{ {
char *id = connection_create_stanza_id("ping"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id);
free(id); free(id);
if (target) { if (target) {
@ -2122,7 +2122,7 @@ xmpp_stanza_t*
stanza_create_command_exec_iq(xmpp_ctx_t *ctx, const char *const target, stanza_create_command_exec_iq(xmpp_ctx_t *ctx, const char *const target,
const char *const node) const char *const node)
{ {
char *id = connection_create_stanza_id("cmdexec"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, target); xmpp_stanza_set_to(iq, target);
@ -2144,7 +2144,7 @@ xmpp_stanza_t*
stanza_create_command_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, stanza_create_command_config_submit_iq(xmpp_ctx_t *ctx, const char *const room,
const char *const node, const char *const sessionid, DataForm *form) const char *const node, const char *const sessionid, DataForm *form)
{ {
char *id = connection_create_stanza_id("commandconf_submit"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
xmpp_stanza_set_to(iq, room); xmpp_stanza_set_to(iq, room);
@ -2194,7 +2194,7 @@ stanza_create_omemo_devicelist_request(xmpp_ctx_t *ctx, const char *const id,
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_omemo_devicelist_subscribe(xmpp_ctx_t *ctx, const char *const jid) stanza_create_omemo_devicelist_subscribe(xmpp_ctx_t *ctx, const char *const jid)
{ {
char *id = connection_create_stanza_id("omemo_devicelist_subscribe"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
@ -2219,7 +2219,7 @@ stanza_create_omemo_devicelist_subscribe(xmpp_ctx_t *ctx, const char *const jid)
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_omemo_devicelist_publish(xmpp_ctx_t *ctx, GList *const ids) stanza_create_omemo_devicelist_publish(xmpp_ctx_t *ctx, GList *const ids)
{ {
char *id = connection_create_stanza_id("omemo_devicelist_publish"); char *id = connection_create_stanza_id();
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
@ -2457,9 +2457,9 @@ stanza_attach_origin_id(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *cons
} }
static void static void
_stanza_add_unique_id(xmpp_stanza_t *stanza, char *prefix) _stanza_add_unique_id(xmpp_stanza_t *stanza)
{ {
char *id = connection_create_stanza_id(prefix); char *id = connection_create_stanza_id();
xmpp_stanza_set_id(stanza, id); xmpp_stanza_set_id(stanza, id);
free(id); free(id);
} }