Use libstrophe/libmesode uuid generator
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <uuid/uuid.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "chat_session.h"
|
||||
@@ -2267,22 +2266,18 @@ cmd_join(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
if (args[0] == NULL) {
|
||||
uuid_t uuid;
|
||||
uuid_generate(uuid);
|
||||
char *uuid_str = malloc(sizeof(char) * 37);
|
||||
uuid_unparse_lower(uuid, uuid_str);
|
||||
|
||||
char *account_name = jabber_get_account_name();
|
||||
ProfAccount *account = accounts_get_account(account_name);
|
||||
|
||||
GString *room_str = g_string_new("");
|
||||
g_string_append_printf(room_str, "private-chat-%s@%s", uuid_str, account->muc_service);
|
||||
char *uuid = jabber_create_uuid();
|
||||
g_string_append_printf(room_str, "private-chat-%s@%s", uuid, account->muc_service);
|
||||
jabber_free_uuid(uuid);
|
||||
|
||||
presence_join_room(room_str->str, account->muc_nick, NULL);
|
||||
muc_join(room_str->str, account->muc_nick, NULL, FALSE);
|
||||
|
||||
g_string_free(room_str, TRUE);
|
||||
free(uuid_str);
|
||||
account_free(account);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -310,6 +310,20 @@ jabber_get_account_name(void)
|
||||
return saved_account.name;
|
||||
}
|
||||
|
||||
char*
|
||||
jabber_create_uuid(void)
|
||||
{
|
||||
return xmpp_uuid_gen(jabber_conn.ctx);
|
||||
}
|
||||
|
||||
void
|
||||
jabber_free_uuid(char *uuid)
|
||||
{
|
||||
if (uuid) {
|
||||
xmpp_free(jabber_conn.ctx, uuid);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
connection_set_presence_message(const char * const message)
|
||||
{
|
||||
|
||||
@@ -150,6 +150,8 @@ jabber_conn_status_t jabber_get_connection_status(void);
|
||||
char * jabber_get_presence_message(void);
|
||||
char* jabber_get_account_name(void);
|
||||
GList * jabber_get_available_resources(void);
|
||||
char* jabber_create_uuid(void);
|
||||
void jabber_free_uuid(char *uuid);
|
||||
|
||||
// message functions
|
||||
char* message_send_chat(const char * const barejid, const char * const msg);
|
||||
|
||||
Reference in New Issue
Block a user