mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
Farewell glib-1.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4509 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
cb1287ab63
commit
afa4292466
@ -83,8 +83,7 @@ if test -z "$*"; then
|
||||
echo
|
||||
fi
|
||||
|
||||
rm -f aclocal.m4 glib.m4 glib-2.0.m4
|
||||
cp glib.m4_ glib.m4
|
||||
rm -f aclocal.m4 glib-2.0.m4
|
||||
cp glib-2.0.m4_ glib-2.0.m4
|
||||
echo "Running autoreconf ..."
|
||||
autoreconf -i || exit 1
|
||||
|
47
configure.in
47
configure.in
@ -123,7 +123,7 @@ if test "x$prefix" != "xNONE"; then
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(gc,
|
||||
[ --with-gc Use garbage collector, requires GLIB2],
|
||||
[ --with-gc Use garbage collector],
|
||||
if test x$withval = xyes; then
|
||||
want_gc=yes
|
||||
else
|
||||
@ -135,19 +135,6 @@ AC_ARG_WITH(gc,
|
||||
fi,
|
||||
want_gc=no)
|
||||
|
||||
AC_ARG_WITH(glib1,
|
||||
[ --with-glib1 Use GLIB 1.2 instead of 2.0 if both exist],
|
||||
if test x$withval = xyes; then
|
||||
want_glib1=yes
|
||||
else
|
||||
if test "x$withval" = xno; then
|
||||
want_glib1=no
|
||||
else
|
||||
want_glib1=yes
|
||||
fi
|
||||
fi,
|
||||
want_glib1=no)
|
||||
|
||||
AC_ARG_WITH(perl-staticlib,
|
||||
[ --with-perl-staticlib Specify that we want to link perl libraries
|
||||
statically in irssi, default is no],
|
||||
@ -331,27 +318,14 @@ dnl **
|
||||
dnl ** fe-text checks
|
||||
dnl **
|
||||
|
||||
if test "x$want_glib1" = "xyes"; then
|
||||
dnl * check only for glib1
|
||||
checks="1 2"
|
||||
else
|
||||
dnl * check glib2 then glib1
|
||||
checks="3 4 1 2"
|
||||
fi
|
||||
|
||||
for try in $checks; do
|
||||
glib_config_args=
|
||||
if test $try = 1 -o $try = 3; then
|
||||
for try in 1 2; do
|
||||
if test $try = 1; then
|
||||
glib_modules=gmodule
|
||||
else
|
||||
echo "*** trying without -lgmodule"
|
||||
glib_modules=
|
||||
fi
|
||||
if test $try = 1 -o $try = 2; then
|
||||
AM_PATH_GLIB(1.2.0,,, $glib_modules)
|
||||
else
|
||||
AM_PATH_GLIB_2_0(2.0.0,,, $glib_modules)
|
||||
fi
|
||||
if test "$GLIB_LIBS"; then
|
||||
if test $glib_modules = gmodule; then
|
||||
AC_DEFINE(HAVE_GMODULE)
|
||||
@ -398,7 +372,6 @@ dnl **
|
||||
dnl ** Garbage Collector
|
||||
dnl **
|
||||
if test "x$want_gc" = xyes; then
|
||||
if test "$glib_config_major_version" = "2"; then
|
||||
AC_CHECK_LIB(gc, GC_malloc, [
|
||||
AC_CHECK_HEADER(gc/gc.h, [
|
||||
AC_DEFINE(HAVE_GC_GC_H)
|
||||
@ -416,20 +389,6 @@ if test "x$want_gc" = xyes; then
|
||||
], [
|
||||
want_gc=no
|
||||
])
|
||||
else
|
||||
want_gc=no
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl **
|
||||
dnl ** Recode
|
||||
dnl **
|
||||
AC_MSG_CHECKING([if we can use recode, requires GLIB2])
|
||||
if test "$glib_config_major_version" = "2"; then
|
||||
AC_DEFINE(HAVE_GLIB2)
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no, using glib1])
|
||||
fi
|
||||
|
||||
dnl **
|
||||
|
196
glib.m4_
196
glib.m4_
@ -1,196 +0,0 @@
|
||||
# Configure paths for GLIB
|
||||
# Owen Taylor 97-11-3
|
||||
|
||||
dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
|
||||
dnl gthread is specified in MODULES, pass to glib-config
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_GLIB,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the glib-config script
|
||||
dnl
|
||||
AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
|
||||
glib_config_prefix="$withval", glib_config_prefix="")
|
||||
AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
|
||||
glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
|
||||
, enable_glibtest=yes)
|
||||
|
||||
if test x$glib_config_exec_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
if test x$glib_config_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gmodule)
|
||||
glib_config_args="$glib_config_args gmodule"
|
||||
;;
|
||||
gthread)
|
||||
glib_config_args="$glib_config_args gthread"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
|
||||
min_glib_version=ifelse([$1], ,0.99.7,$1)
|
||||
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
|
||||
no_glib=""
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
no_glib=yes
|
||||
else
|
||||
GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
|
||||
GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
|
||||
glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_glibtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$GLIB_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
|
||||
dnl checks the results of glib-config to some extent
|
||||
dnl
|
||||
rm -f conf.glibtest
|
||||
AC_TRY_RUN([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.glibtest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_glib_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_glib_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((glib_major_version != $glib_config_major_version) ||
|
||||
(glib_minor_version != $glib_config_minor_version) ||
|
||||
(glib_micro_version != $glib_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
|
||||
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf ("*** was found! If glib-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
|
||||
printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
|
||||
(glib_minor_version != GLIB_MINOR_VERSION) ||
|
||||
(glib_micro_version != GLIB_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
|
||||
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((glib_major_version > major) ||
|
||||
((glib_major_version == major) && (glib_minor_version > minor)) ||
|
||||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the glib-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of glib-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_glib" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
echo "*** The glib-config script installed by GLIB could not be found"
|
||||
echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the GLIB_CONFIG environment variable to the"
|
||||
echo "*** full path to glib-config."
|
||||
else
|
||||
if test -f conf.glibtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GLIB test program, checking why..."
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$LIBS $GLIB_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
|
||||
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
echo "***"
|
||||
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||
echo "*** came with the system with the command"
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
|
||||
echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GLIB_CFLAGS=""
|
||||
GLIB_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
rm -f conf.glibtest
|
||||
])
|
@ -94,146 +94,6 @@ static gboolean irssi_ssl_verify(SSL *ssl, SSL_CTX *ctx, X509 *cert)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#if GLIB_MAJOR_VERSION < 2
|
||||
|
||||
static GIOError ssl_errno(gint e)
|
||||
{
|
||||
switch(e)
|
||||
{
|
||||
case EINVAL:
|
||||
return G_IO_ERROR_INVAL;
|
||||
case EINTR:
|
||||
case EAGAIN:
|
||||
return G_IO_ERROR_AGAIN;
|
||||
default:
|
||||
return G_IO_ERROR_INVAL;
|
||||
}
|
||||
/*UNREACH*/
|
||||
return G_IO_ERROR_INVAL;
|
||||
}
|
||||
|
||||
static GIOError irssi_ssl_cert_step(GIOSSLChannel *chan)
|
||||
{
|
||||
X509 *cert;
|
||||
gint err;
|
||||
switch(err = SSL_do_handshake(chan->ssl))
|
||||
{
|
||||
case 1:
|
||||
if(!(cert = SSL_get_peer_certificate(chan->ssl)))
|
||||
{
|
||||
g_warning("SSL server supplied no certificate");
|
||||
return G_IO_ERROR_INVAL;
|
||||
}
|
||||
if (chan->verify && ! irssi_ssl_verify(chan->ssl, chan->ctx, cert)) {
|
||||
X509_free(cert);
|
||||
return G_IO_ERROR_INVAL;
|
||||
}
|
||||
X509_free(cert);
|
||||
return G_IO_ERROR_NONE;
|
||||
default:
|
||||
if(SSL_get_error(chan->ssl, err) == SSL_ERROR_WANT_READ)
|
||||
return G_IO_ERROR_AGAIN;
|
||||
return ssl_errno(errno);
|
||||
}
|
||||
/*UNREACH*/
|
||||
return G_IO_ERROR_INVAL;
|
||||
}
|
||||
|
||||
static GIOError irssi_ssl_read(GIOChannel *handle, gchar *buf, guint len, guint *ret)
|
||||
{
|
||||
GIOSSLChannel *chan = (GIOSSLChannel *)handle;
|
||||
gint err;
|
||||
|
||||
if(! chan->got_cert)
|
||||
{
|
||||
gint cert_err = irssi_ssl_cert_step(chan);
|
||||
if(cert_err != G_IO_ERROR_NONE)
|
||||
return cert_err;
|
||||
}
|
||||
|
||||
err = SSL_read(chan->ssl, buf, len);
|
||||
if(err < 0)
|
||||
{
|
||||
*ret = 0;
|
||||
if(SSL_get_error(chan->ssl, err) == SSL_ERROR_WANT_READ)
|
||||
return G_IO_ERROR_AGAIN;
|
||||
return ssl_errno(errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ret = err;
|
||||
return G_IO_ERROR_NONE;
|
||||
}
|
||||
/*UNREACH*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
static GIOError irssi_ssl_write(GIOChannel *handle, gchar *buf, guint len, guint *ret)
|
||||
{
|
||||
GIOSSLChannel *chan = (GIOSSLChannel *)handle;
|
||||
gint err;
|
||||
|
||||
if(chan->got_cert)
|
||||
{
|
||||
gint cert_err = irssi_ssl_cert_step(chan);
|
||||
if(cert_err != G_IO_ERROR_NONE)
|
||||
return cert_err;
|
||||
}
|
||||
|
||||
|
||||
err = SSL_write(chan->ssl, (const char *)buf, len);
|
||||
if(err < 0)
|
||||
{
|
||||
*ret = 0;
|
||||
if(SSL_get_error(chan->ssl, err) == SSL_ERROR_WANT_READ)
|
||||
return G_IO_ERROR_AGAIN;
|
||||
return ssl_errno(errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ret = err;
|
||||
return G_IO_ERROR_NONE;
|
||||
}
|
||||
/*UNREACH*/
|
||||
return G_IO_ERROR_INVAL;
|
||||
}
|
||||
|
||||
static GIOError irssi_ssl_seek(GIOChannel *handle, gint offset, GSeekType type)
|
||||
{
|
||||
GIOSSLChannel *chan = (GIOSSLChannel *)handle;
|
||||
GIOError e;
|
||||
e = g_io_channel_seek(chan->giochan, offset, type);
|
||||
return (e == G_IO_ERROR_NONE) ? G_IO_ERROR_NONE : G_IO_ERROR_INVAL;
|
||||
}
|
||||
|
||||
static void irssi_ssl_close(GIOChannel *handle)
|
||||
{
|
||||
GIOSSLChannel *chan = (GIOSSLChannel *)handle;
|
||||
g_io_channel_close(chan->giochan);
|
||||
}
|
||||
|
||||
static guint irssi_ssl_create_watch(GIOChannel *handle, gint priority, GIOCondition cond,
|
||||
GIOFunc func, gpointer data, GDestroyNotify notify)
|
||||
{
|
||||
GIOSSLChannel *chan = (GIOSSLChannel *)handle;
|
||||
|
||||
return chan->giochan->funcs->io_add_watch(handle, priority, cond, func, data, notify);
|
||||
}
|
||||
|
||||
/* ssl function pointers */
|
||||
static GIOFuncs irssi_ssl_channel_funcs =
|
||||
{
|
||||
irssi_ssl_read,
|
||||
irssi_ssl_write,
|
||||
irssi_ssl_seek,
|
||||
irssi_ssl_close,
|
||||
irssi_ssl_create_watch,
|
||||
irssi_ssl_free
|
||||
};
|
||||
|
||||
#else /* GLIB_MAJOR_VERSION < 2 */
|
||||
|
||||
static GIOStatus ssl_errno(gint e)
|
||||
{
|
||||
switch(e)
|
||||
@ -383,8 +243,6 @@ static GIOFuncs irssi_ssl_channel_funcs = {
|
||||
irssi_ssl_get_flags
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static gboolean irssi_ssl_init(void)
|
||||
{
|
||||
SSL_library_init();
|
||||
|
@ -356,14 +356,6 @@ GSList *nicklist_get_same_unique(SERVER_REC *server, void *id)
|
||||
return rec.list;
|
||||
}
|
||||
|
||||
#if GLIB_MAJOR_VERSION < 2
|
||||
/* glib1 doesn't have g_slist_sort_with_data, so non-standard prefixes won't be sorted correctly */
|
||||
int nicklist_compare_glib1(NICK_REC *p1, NICK_REC *p2)
|
||||
{
|
||||
return nicklist_compare(p1, p2, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* nick record comparision for sort functions */
|
||||
int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix)
|
||||
{
|
||||
|
@ -49,9 +49,6 @@ void nicklist_update_flags_unique(SERVER_REC *server, void *id,
|
||||
void nicklist_set_own(CHANNEL_REC *channel, NICK_REC *nick);
|
||||
|
||||
/* Nick record comparison for sort functions */
|
||||
#if GLIB_MAJOR_VERSION < 2
|
||||
int nicklist_compare_glib1(NICK_REC *p1, NICK_REC *p2);
|
||||
#endif
|
||||
int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix);
|
||||
|
||||
/* Check is `msg' is meant for `nick'. */
|
||||
|
@ -32,11 +32,7 @@ static gboolean recode_get_charset(const char **charset)
|
||||
/* we use the same test as in src/fe-text/term.c:123 */
|
||||
return (g_strcasecmp(*charset, "utf-8") == 0);
|
||||
|
||||
#ifdef HAVE_GLIB2
|
||||
return g_get_charset(charset);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean is_utf8(void)
|
||||
@ -46,7 +42,6 @@ gboolean is_utf8(void)
|
||||
return recode_get_charset(&charset);
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLIB2
|
||||
static gboolean is_translit(const char *charset)
|
||||
{
|
||||
char *pos;
|
||||
@ -54,11 +49,9 @@ static gboolean is_translit(const char *charset)
|
||||
pos = stristr(charset, "//translit");
|
||||
return (pos != NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean is_valid_charset(const char *charset)
|
||||
{
|
||||
#ifdef HAVE_GLIB2
|
||||
const char *from="UTF-8";
|
||||
const char *str="irssi";
|
||||
char *recoded, *to = NULL;
|
||||
@ -75,11 +68,6 @@ gboolean is_valid_charset(const char *charset)
|
||||
g_free(recoded);
|
||||
g_free(to);
|
||||
return valid;
|
||||
#else
|
||||
if (!charset || *charset =='\0')
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static char *find_conversion(const SERVER_REC *server, const char *target)
|
||||
@ -100,7 +88,6 @@ static char *find_conversion(const SERVER_REC *server, const char *target)
|
||||
|
||||
char *recode_in(const SERVER_REC *server, const char *str, const char *target)
|
||||
{
|
||||
#ifdef HAVE_GLIB2
|
||||
const char *from = NULL;
|
||||
const char *to = NULL;
|
||||
char *translit_to = NULL;
|
||||
@ -162,14 +149,10 @@ char *recode_in(const SERVER_REC *server, const char *str, const char *target)
|
||||
}
|
||||
g_free(translit_to);
|
||||
return recoded;
|
||||
#else
|
||||
return g_strdup(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *recode_out(const SERVER_REC *server, const char *str, const char *target)
|
||||
{
|
||||
#ifdef HAVE_GLIB2
|
||||
char *recoded = NULL;
|
||||
const char *from = NULL;
|
||||
const char *to = NULL;
|
||||
@ -205,9 +188,6 @@ char *recode_out(const SERVER_REC *server, const char *str, const char *target)
|
||||
recoded = g_strdup(str);
|
||||
|
||||
return recoded;
|
||||
#else
|
||||
return g_strdup(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
void recode_init(void)
|
||||
|
@ -37,54 +37,6 @@ char *irssi_binary = NULL;
|
||||
|
||||
static char **session_args;
|
||||
|
||||
#ifndef HAVE_GLIB2
|
||||
static char *g_find_program_in_path(const char *path)
|
||||
{
|
||||
const char *envpath;
|
||||
char **paths, **tmp;
|
||||
char *str;
|
||||
char *result = NULL;
|
||||
|
||||
if (g_path_is_absolute(path)) {
|
||||
/* full path - easy */
|
||||
if(access(path, X_OK) == -1)
|
||||
return NULL;
|
||||
else
|
||||
return g_strdup(path);
|
||||
}
|
||||
|
||||
if (strchr(path, G_DIR_SEPARATOR) != NULL) {
|
||||
/* relative path */
|
||||
str = g_get_current_dir();
|
||||
result = g_strconcat(str, G_DIR_SEPARATOR_S, path, NULL);
|
||||
g_free(str);
|
||||
if (access(result, X_OK) == -1) {
|
||||
g_free(result);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
/* we'll need to find it from path. */
|
||||
envpath = g_getenv("PATH");
|
||||
if (envpath == NULL) return NULL;
|
||||
|
||||
paths = g_strsplit(envpath, ":", -1);
|
||||
for (tmp = paths; *tmp != NULL; tmp++) {
|
||||
str = g_strconcat(*tmp, G_DIR_SEPARATOR_S, path, NULL);
|
||||
if (access(str, X_OK) == 0) {
|
||||
result = str;
|
||||
break;
|
||||
}
|
||||
g_free(str);
|
||||
}
|
||||
g_strfreev(paths);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
void session_set_binary(const char *path)
|
||||
{
|
||||
g_free_and_null(irssi_binary);
|
||||
|
@ -508,12 +508,7 @@ void fe_channels_nicklist(CHANNEL_REC *channel, int flags)
|
||||
g_slist_free(nicklist);
|
||||
|
||||
/* sort the nicklist */
|
||||
#if GLIB_MAJOR_VERSION < 2
|
||||
/* glib1 doesn't have g_slist_sort_with_data, so non-standard prefixes won't be sorted correctly */
|
||||
sorted = g_slist_sort(sorted, (GCompareFunc)nicklist_compare_glib1);
|
||||
#else
|
||||
sorted = g_slist_sort_with_data(sorted, (GCompareDataFunc) nicklist_compare, (void *)nick_flags);
|
||||
#endif
|
||||
|
||||
/* display the nicks */
|
||||
if ((flags & CHANNEL_NICKLIST_FLAG_COUNT) == 0) {
|
||||
|
@ -38,7 +38,6 @@ for ((var) = (head); \
|
||||
(var); \
|
||||
(var) = g_slist_next((var)))
|
||||
|
||||
#ifdef HAVE_GLIB2
|
||||
char *recode_fallback = NULL;
|
||||
char *recode_out_default = NULL;
|
||||
char *term_charset = NULL;
|
||||
@ -210,27 +209,20 @@ static void read_settings(void)
|
||||
g_free(old_recode_fallback);
|
||||
g_free(old_recode_out_default);
|
||||
}
|
||||
#endif
|
||||
|
||||
void fe_recode_init (void)
|
||||
{
|
||||
/* FIXME: print this is not supported instead */
|
||||
#ifdef HAVE_GLIB2
|
||||
command_bind("recode", NULL, (SIGNAL_FUNC) fe_recode_cmd);
|
||||
command_bind("recode add", NULL, (SIGNAL_FUNC) fe_recode_add_cmd);
|
||||
command_bind("recode remove", NULL, (SIGNAL_FUNC) fe_recode_remove_cmd);
|
||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
read_settings();
|
||||
#endif
|
||||
}
|
||||
|
||||
void fe_recode_deinit (void)
|
||||
{
|
||||
/* FIXME: print this is not supported instead */
|
||||
#ifdef HAVE_GLIB2
|
||||
command_unbind("recode", (SIGNAL_FUNC) fe_recode_cmd);
|
||||
command_unbind("recode add", (SIGNAL_FUNC) fe_recode_add_cmd);
|
||||
command_unbind("recode remove", (SIGNAL_FUNC) fe_recode_remove_cmd);
|
||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
#endif
|
||||
}
|
||||
|
@ -32,10 +32,8 @@
|
||||
#include "formats.h"
|
||||
#include "themes.h"
|
||||
#include "translation.h"
|
||||
#ifdef HAVE_GLIB2
|
||||
#include "recode.h"
|
||||
#include "utf8.h"
|
||||
#endif
|
||||
|
||||
static const char *format_backs = "04261537";
|
||||
static const char *format_fores = "kbgcrmyw";
|
||||
@ -299,7 +297,7 @@ void format_create_dest_tag(TEXT_DEST_REC *dest, void *server,
|
||||
dest->window = window != NULL ? window :
|
||||
window_find_closest(server, target, level);
|
||||
}
|
||||
#ifdef HAVE_GLIB2
|
||||
|
||||
static int advance (char const **str, gboolean utf8)
|
||||
{
|
||||
if (utf8) {
|
||||
@ -315,21 +313,17 @@ static int advance (char const **str, gboolean utf8)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return length of text part in string (ie. without % codes) */
|
||||
int format_get_length(const char *str)
|
||||
{
|
||||
GString *tmp;
|
||||
int len;
|
||||
#ifdef HAVE_GLIB2
|
||||
gboolean utf8;
|
||||
#endif
|
||||
|
||||
g_return_val_if_fail(str != NULL, 0);
|
||||
|
||||
#ifdef HAVE_GLIB2
|
||||
utf8 = is_utf8() && g_utf8_validate(str, -1, NULL);
|
||||
#endif
|
||||
|
||||
tmp = g_string_new(NULL);
|
||||
len = 0;
|
||||
@ -346,12 +340,8 @@ int format_get_length(const char *str)
|
||||
if (*str != '%')
|
||||
len++;
|
||||
}
|
||||
#ifdef HAVE_GLIB2
|
||||
|
||||
len += advance(&str, utf8);
|
||||
#else
|
||||
len++;
|
||||
str++;
|
||||
#endif
|
||||
}
|
||||
|
||||
g_string_free(tmp, TRUE);
|
||||
@ -365,16 +355,13 @@ int format_real_length(const char *str, int len)
|
||||
{
|
||||
GString *tmp;
|
||||
const char *start;
|
||||
#ifdef HAVE_GLIB2
|
||||
const char *oldstr;
|
||||
gboolean utf8;
|
||||
#endif
|
||||
|
||||
g_return_val_if_fail(str != NULL, 0);
|
||||
g_return_val_if_fail(len >= 0, 0);
|
||||
|
||||
#ifdef HAVE_GLIB2
|
||||
utf8 = is_utf8() && g_utf8_validate(str, -1, NULL);
|
||||
#endif
|
||||
|
||||
start = str;
|
||||
tmp = g_string_new(NULL);
|
||||
@ -394,15 +381,10 @@ int format_real_length(const char *str, int len)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLIB2
|
||||
oldstr = str;
|
||||
len -= advance(&str, utf8);
|
||||
if (len < 0)
|
||||
str = oldstr;
|
||||
#else
|
||||
len--;
|
||||
str++;
|
||||
#endif
|
||||
}
|
||||
|
||||
g_string_free(tmp, TRUE);
|
||||
|
@ -571,11 +571,8 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key)
|
||||
g_strconcat(keyboard->key_state, "-", key, NULL);
|
||||
g_free_and_null(keyboard->key_state);
|
||||
|
||||
#if GLIB_MAJOR_VERSION == 2
|
||||
# define GSearchFunc GCompareFunc
|
||||
#endif
|
||||
rec = g_tree_search(key_states,
|
||||
(GSearchFunc) key_states_search,
|
||||
(GCompareFunc) key_states_search,
|
||||
combo);
|
||||
if (rec == NULL) {
|
||||
/* unknown key combo, eat the invalid key
|
||||
|
@ -584,13 +584,8 @@ static void perl_register_protocol(CHAT_PROTOCOL_REC *rec)
|
||||
chat_type = chat_protocol_lookup(rec->name);
|
||||
g_return_if_fail(chat_type >= 0);
|
||||
|
||||
#if GLIB_MAJOR_VERSION < 2
|
||||
name = g_strdup(rec->name);
|
||||
g_strdown(name+1);
|
||||
#else
|
||||
name = g_ascii_strdown(rec->name,-1);
|
||||
*name = *(rec->name);
|
||||
#endif
|
||||
|
||||
/* window items: channel, query */
|
||||
type = module_get_uniq_id_str("WINDOW ITEM TYPE", "CHANNEL");
|
||||
|
Loading…
Reference in New Issue
Block a user