1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Merge branch 'master' into plugins

Conflicts:
	.travis.yml
	configure.ac
	src/profanity.c
This commit is contained in:
James Booth 2014-05-22 20:20:24 +01:00
commit e1b53df036
10 changed files with 56 additions and 26 deletions

View File

@ -1,8 +1,8 @@
language: c
install:
- sudo apt-get update
- sudo apt-get -y install libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr2-dev
- sudo apt-get -y install autoconf-archive libtool python-dev lua5.1 liblua5.1-0-dev
- sudo apt-get -y install libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr2-dev autoconf-archive libgcrypt11-dev
- sudo apt-get -y install libtool python-dev lua5.1 liblua5.1-0-dev
- git clone git://github.com/strophe/libstrophe.git
- cd libstrophe
- ./bootstrap.sh

View File

@ -221,8 +221,7 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
[AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
PKG_CHECK_MODULES([curl], [libcurl], [],
[AC_MSG_ERROR([libcurl is required for profanity])])
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.8.0], [],
[AC_MSG_ERROR([gnutls is required for profanity])])
AX_LIB_GCRYPT([yes])
AS_IF([test "x$PLATFORM" = xosx], [LIBS="$LIBS -lcurl"])
@ -319,9 +318,9 @@ AM_CFLAGS="-Wall -Wno-deprecated-declarations"
AS_IF([test "x$PACKAGE_STATUS" = xdevelopment],
[AM_CFLAGS="$AM_CFLAGS -Wunused -Werror"])
AM_LDFLAGS="$AM_LDFLAGS $PYTHON_LDFLAGS $RUBY_LDFLAGS $LUA_LIB -export-dynamic"
AM_CPPFLAGS="$AM_CPPFLAGS $glib_CFLAGS $curl_CFLAGS $libnotify_CFLAGS $LIBGNUTLS_CFLAGS $PYTHON_CPPFLAGS $RUBY_CPPFLAGS $LUA_INCLUDE"
AM_CPPFLAGS="$AM_CPPFLAGS $glib_CFLAGS $curl_CFLAGS $libnotify_CFLAGS $GCRYPT_CFLAGS $PYTHON_CPPFLAGS $RUBY_CPPFLAGS $LUA_INCLUDE"
AM_CPPFLAGS="$AM_CPPFLAGS -DTHEMES_PATH=\"\\\"$THEMES_PATH\\\"\""
LIBS="$LIBS $glib_LIBS $curl_LIBS $libnotify_LIBS $LIBGNUTLS_LIBS"
LIBS="$LIBS $glib_LIBS $curl_LIBS $libnotify_LIBS $GCRYPT_LIBS"
AC_SUBST(AM_LDFLAGS)
AC_SUBST(AM_CFLAGS)

View File

@ -24,7 +24,7 @@ debian_prepare()
echo
echo Profanity installer... installing dependencies
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 libgnutls-dev
sudo apt-get -y install git automake autoconf autoconf-archive libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr5-dev libgcrypt11-dev
}
@ -36,7 +36,7 @@ fedora_prepare()
ARCH=`arch`
sudo yum -y install gcc git autoconf automake openssl-devel.$ARCH expat-devel.$ARCH ncurses-devel.$ARCH glib2-devel.$ARCH libnotify-devel.$ARCH libcurl-devel.$ARCH libXScrnSaver-devel.$ARCH libotr3-devel.$ARCH gnutls-devel.$ARCH
sudo yum -y install gcc git autoconf autoconf-archive automake openssl-devel.$ARCH expat-devel.$ARCH ncurses-devel.$ARCH glib2-devel.$ARCH libnotify-devel.$ARCH libcurl-devel.$ARCH libXScrnSaver-devel.$ARCH libotr3-devel.$ARCH libgcrypt-devel.$ARCH
}
opensuse_prepare()
@ -44,7 +44,7 @@ opensuse_prepare()
echo
echo Profanity installer...installing dependencies
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 libgnutls-devel
sudo zypper -n in gcc git automake make autoconf autoconf-archive libopenssl-devel expat libexpat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel libgcrypt-devel
}
cygwin_prepare()
@ -59,9 +59,9 @@ cygwin_prepare()
mv apt-cyg /usr/local/bin/
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 gnutls-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
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 gnutls-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
fi

View File

@ -31,8 +31,7 @@
#include <curl/curl.h>
#include <curl/easy.h>
#include <glib.h>
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#include <gcrypt.h>
#include "log.h"
#include "common.h"
@ -65,7 +64,6 @@ p_utf8_substring(const gchar *str, glong start_pos, glong end_pos)
return out;
}
// backwards compatibility for GLib version < 2.28
void
p_slist_free_full(GSList *items, GDestroyNotify free_func)
{
@ -73,6 +71,31 @@ p_slist_free_full(GSList *items, GDestroyNotify free_func)
g_slist_free (items);
}
void
p_list_free_full(GList *items, GDestroyNotify free_func)
{
g_list_foreach (items, (GFunc) free_func, NULL);
g_list_free (items);
}
gboolean
p_hash_table_add(GHashTable *hash_table, gpointer key)
{
// doesn't handle when key exists, but value == NULL
gpointer found = g_hash_table_lookup(hash_table, key);
g_hash_table_replace(hash_table, key, key);
return (found == NULL);
}
gboolean
p_hash_table_contains(GHashTable *hash_table, gconstpointer key)
{
// doesn't handle when key exists, but value == NULL
gpointer found = g_hash_table_lookup(hash_table, key);
return (found != NULL);
}
gboolean
create_dir(char *name)
{
@ -393,16 +416,12 @@ generate_unique_id(char *prefix)
char *
sha1_hash(char *str)
{
gnutls_hash_hd_t dig;
gnutls_digest_algorithm_t algorithm = GNUTLS_DIG_SHA1;
int msg_length = strlen(str);
int hash_length = gcry_md_get_algo_dlen(GCRY_MD_SHA1);
unsigned char hash[ hash_length ];
gcry_md_hash_buffer(GCRY_MD_SHA1, hash, str, msg_length);
gnutls_hash_init(&dig, algorithm);
gnutls_hash(dig, str, strlen(str));
unsigned char output[20];
gnutls_hash_output(dig, output);
return g_base64_encode(output, sizeof(output));
return g_base64_encode(hash, sizeof(hash));
}
int

View File

@ -29,12 +29,18 @@
#if !GLIB_CHECK_VERSION(2,28,0)
#define g_slist_free_full(items, free_func) p_slist_free_full(items, free_func)
#define g_list_free_full(items, free_func) p_list_free_full(items, free_func)
#endif
#if !GLIB_CHECK_VERSION(2,30,0)
#define g_utf8_substring(str, start_pos, end_pos) p_utf8_substring(str, start_pos, end_pos)
#endif
#if !GLIB_CHECK_VERSION(2,32,0)
#define g_hash_table_add(hash_table, key) p_hash_table_add(hash_table, key)
#define g_hash_table_contains(hash_table, key) p_hash_table_contains(hash_table, key)
#endif
#ifndef NOTIFY_CHECK_VERSION
#define notify_notification_new(summary, body, icon) notify_notification_new(summary, body, icon, NULL)
#endif
@ -72,6 +78,10 @@ typedef enum {
gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos);
void p_slist_free_full(GSList *items, GDestroyNotify free_func);
void p_list_free_full(GList *items, GDestroyNotify free_func);
gboolean p_hash_table_add(GHashTable *hash_table, gpointer key);
gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key);
gboolean create_dir(char *name);
gboolean mkdir_recursive(const char *dir);
char * str_replace(const char *string, const char *substr,

View File

@ -27,6 +27,7 @@
#include "jid.h"
#include "config/account.h"
#include "common.h"
ProfAccount*
account_new(const gchar * const name, const gchar * const jid,

View File

@ -26,6 +26,7 @@
#include <glib.h>
#include "contact.h"
#include "common.h"
#include "jid.h"
#include "tools/autocomplete.h"

View File

@ -31,7 +31,6 @@
#include <string.h>
#include <glib.h>
#include <gnutls/gnutls.h>
#include "profanity.h"
#include "chat_session.h"
@ -262,7 +261,6 @@ _init(const int disable_tls, char *log_level)
setlocale(LC_ALL, "");
// ignore SIGPIPE
signal(SIGPIPE, SIG_IGN);
gnutls_global_init();
_create_directories();
log_level_t prof_log_level = log_level_from_string(log_level);
prefs_load();
@ -314,7 +312,6 @@ _shutdown(void)
cmd_uninit();
log_close();
plugins_shutdown();
gnutls_global_deinit();
}
static void

View File

@ -25,6 +25,8 @@
#include <glib.h>
#include "common.h"
/*
* Take a full line of input and return an array of strings representing
* the arguments of a command.

View File

@ -12,6 +12,7 @@
#include "xmpp/mock_xmpp.h"
#include "muc.h"
#include "common.h"
#include "command/commands.h"