diff options
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/bookmark.c | 18 | ||||
-rw-r--r-- | src/xmpp/connection.c | 13 | ||||
-rw-r--r-- | src/xmpp/connection.h | 1 |
3 files changed, 11 insertions, 21 deletions
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c index e6d5efe3..dd4cebe1 100644 --- a/src/xmpp/bookmark.c +++ b/src/xmpp/bookmark.c @@ -18,21 +18,25 @@ static int _bookmark_handle_result(xmpp_conn_t * const conn, void bookmark_request(void) { - int id; - char id_str[10]; + char *id; xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); - xmpp_stanza_t *iq = stanza_create_storage_bookmarks(ctx); + xmpp_stanza_t *iq; - id = jabber_get_id(); - snprintf(id_str, sizeof(id_str), "%u", id); + id = get_unique_id(); + if (!id) { + return; + } /* TODO: timed handler to remove this id_handler */ - xmpp_id_handler_add(conn, _bookmark_handle_result, id_str, ctx); + xmpp_id_handler_add(conn, _bookmark_handle_result, id, ctx); - xmpp_stanza_set_id(iq, id_str); + iq = stanza_create_storage_bookmarks(ctx); + xmpp_stanza_set_id(iq, id); xmpp_send(conn, iq); xmpp_stanza_release(iq); + + g_free(id); } static int diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 600e813a..5040aa91 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -232,19 +232,6 @@ jabber_set_autoping(const int seconds) } } -int -jabber_get_id(void) -{ - static int xmpp_id; - - ++xmpp_id; - if (xmpp_id < 0) { - xmpp_id = 1; - } - - return xmpp_id; -} - GList * jabber_get_available_resources(void) { diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h index 81a6e3b3..b5701252 100644 --- a/src/xmpp/connection.h +++ b/src/xmpp/connection.h @@ -31,7 +31,6 @@ xmpp_conn_t *connection_get_conn(void); xmpp_ctx_t *connection_get_ctx(void); int connection_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -int jabber_get_id(void); void connection_set_priority(int priority); void connection_set_presence_message(const char * const message); void connection_add_available_resource(Resource *resource); |