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

Use libstrophe/libmesode uuid generator

This commit is contained in:
James Booth 2015-10-12 23:37:11 +01:00
parent de15d47be4
commit 6e28df66e8
5 changed files with 25 additions and 17 deletions

View File

@ -106,9 +106,6 @@ AS_IF([test "x$PLATFORM" != xosx],
AC_SUBST(AM_LDFLAGS)], AC_SUBST(AM_LDFLAGS)],
[AC_MSG_ERROR([libreadline is required for profanity])])]) [AC_MSG_ERROR([libreadline is required for profanity])])])
AC_CHECK_LIB([uuid], [uuid_generate], [],
[AC_MSG_ERROR([libuuid is required for profanity])])
AS_IF([test "x$PLATFORM" = xosx], [LIBS="-lcurl $LIBS"]) AS_IF([test "x$PLATFORM" = xosx], [LIBS="-lcurl $LIBS"])
### Check for desktop notification support ### Check for desktop notification support

View File

@ -24,7 +24,7 @@ debian_prepare()
echo echo
echo Profanity installer... installing dependencies echo Profanity installer... installing dependencies
echo echo
sudo apt-get -y install git automake autoconf libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr5-dev libreadline-dev libtool libgpgme11-dev uuid-dev sudo apt-get -y install git automake autoconf libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr5-dev libreadline-dev libtool libgpgme11-dev
} }
@ -34,7 +34,7 @@ fedora_prepare()
echo Profanity installer... installing dependencies echo Profanity installer... installing dependencies
echo echo
sudo dnf -y install gcc git autoconf automake openssl-devel expat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr3-devel readline-devel libtool libuuid-devel gpgme-devel sudo dnf -y install gcc git autoconf automake openssl-devel expat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr3-devel readline-devel libtool gpgme-devel
} }
opensuse_prepare() opensuse_prepare()
@ -42,7 +42,7 @@ opensuse_prepare()
echo echo
echo Profanity installer...installing dependencies echo Profanity installer...installing dependencies
echo echo
sudo zypper -n in gcc git automake make autoconf libopenssl-devel expat libexpat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel readline-devel libtool libuuid-devel libgpgme-devel sudo zypper -n in gcc git automake make autoconf libopenssl-devel expat libexpat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel readline-devel libtool libgpgme-devel
} }
centos_prepare() centos_prepare()
@ -54,7 +54,7 @@ centos_prepare()
sudo yum -y install epel-release sudo yum -y install epel-release
sudo yum -y install git sudo yum -y install git
sudo yum -y install gcc autoconf automake cmake sudo yum -y install gcc autoconf automake cmake
sudo yum -y install openssl-devel expat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel readline-devel libtool libuuid-devel gpgme-devel sudo yum -y install openssl-devel expat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel readline-devel libtool gpgme-devel
} }
cygwin_prepare() cygwin_prepare()
@ -70,9 +70,9 @@ cygwin_prepare()
mv apt-cyg /usr/local/bin/ mv apt-cyg /usr/local/bin/
if [ -n "$CYG_MIRROR" ]; then if [ -n "$CYG_MIRROR" ]; then
apt-cyg -m $CYG_MIRROR install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool libuuid-devel apt-cyg -m $CYG_MIRROR install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool
else else
apt-cyg install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool libuuid-devel apt-cyg install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool
fi fi
} }

View File

@ -38,7 +38,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include <uuid/uuid.h>
#include <glib.h> #include <glib.h>
#include "chat_session.h" #include "chat_session.h"
@ -2267,22 +2266,18 @@ cmd_join(ProfWin *window, const char * const command, gchar **args)
} }
if (args[0] == NULL) { 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(); char *account_name = jabber_get_account_name();
ProfAccount *account = accounts_get_account(account_name); ProfAccount *account = accounts_get_account(account_name);
GString *room_str = g_string_new(""); 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); presence_join_room(room_str->str, account->muc_nick, NULL);
muc_join(room_str->str, account->muc_nick, NULL, FALSE); muc_join(room_str->str, account->muc_nick, NULL, FALSE);
g_string_free(room_str, TRUE); g_string_free(room_str, TRUE);
free(uuid_str);
account_free(account); account_free(account);
return TRUE; return TRUE;

View File

@ -310,6 +310,20 @@ jabber_get_account_name(void)
return saved_account.name; 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 void
connection_set_presence_message(const char * const message) connection_set_presence_message(const char * const message)
{ {

View File

@ -150,6 +150,8 @@ jabber_conn_status_t jabber_get_connection_status(void);
char * jabber_get_presence_message(void); char * jabber_get_presence_message(void);
char* jabber_get_account_name(void); char* jabber_get_account_name(void);
GList * jabber_get_available_resources(void); GList * jabber_get_available_resources(void);
char* jabber_create_uuid(void);
void jabber_free_uuid(char *uuid);
// message functions // message functions
char* message_send_chat(const char * const barejid, const char * const msg); char* message_send_chat(const char * const barejid, const char * const msg);