Checksum Unix support and configure.in cosmetics

This commit is contained in:
Berke Viktor 2012-07-18 14:50:58 +02:00
parent d3effc806f
commit 1b0c07f8ea
4 changed files with 97 additions and 36 deletions

View File

@ -129,9 +129,13 @@ AC_ARG_ENABLE(tcl,
[ --enable-tcl[=PATH] directory with Tcl config file: tclConfig.sh], [ --enable-tcl[=PATH] directory with Tcl config file: tclConfig.sh],
tcl=$enableval, tcl=yes) tcl=$enableval, tcl=yes)
AC_ARG_ENABLE(sasl, AC_ARG_ENABLE(plugin,
[ --disable-sasl disable the SASL plugin], [ --disable-plugin disable plugin support],
sasl=$enableval, sasl=yes) plugin=$enableval, plugin=yes)
AC_ARG_ENABLE(checksum,
[ --disable-checksum disable the Checksum plugin],
checksum=$enableval, checksum=yes)
AC_ARG_ENABLE(doat, AC_ARG_ENABLE(doat,
[ --disable-doat disable the Do At plugin], [ --disable-doat disable the Do At plugin],
@ -141,9 +145,9 @@ AC_ARG_ENABLE(fishlim,
[ --disable-fishlim disable the FiSHLiM plugin], [ --disable-fishlim disable the FiSHLiM plugin],
fishlim=$enableval, fishlim=yes) fishlim=$enableval, fishlim=yes)
AC_ARG_ENABLE(plugin, AC_ARG_ENABLE(sasl,
[ --disable-plugin disable plugin support], [ --disable-sasl disable the SASL plugin],
plugin=$enableval, plugin=yes) sasl=$enableval, sasl=yes)
AC_ARG_ENABLE(dbus, AC_ARG_ENABLE(dbus,
[ --disable-dbus disable DBUS support], [ --disable-dbus disable DBUS support],
@ -496,17 +500,23 @@ if test "$plugin" = yes; then
fi fi
dnl ********************************************************************* dnl *********************************************************************
dnl ** SASL ************************************************************* dnl ** Checksum *********************************************************
dnl ********************************************************************* dnl *********************************************************************
if test "$sasl" != "no"; then if test "$checksum" != "no"; then
AC_MSG_CHECKING(for plugin interface used by SASL) checksum=no
sasl=no AC_MSG_CHECKING(for plugin interface used by Checksum)
if test "$plugin" = yes; then if test "$plugin" = yes; then
sasl=yes
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
AC_MSG_CHECKING(for OpenSSL used by Checksum)
if test "$openssl" = yes; then
checksum=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([OpenSSL cannot be found, use the --enable-openssl option])
fi
else else
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for SASL]) AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option])
fi fi
fi fi
@ -546,6 +556,21 @@ if test "$fishlim" != "no"; then
fi fi
fi fi
dnl *********************************************************************
dnl ** SASL *************************************************************
dnl *********************************************************************
if test "$sasl" != "no"; then
AC_MSG_CHECKING(for plugin interface used by SASL)
sasl=no
if test "$plugin" = yes; then
sasl=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for SASL])
fi
fi
dnl ####################################################################### dnl #######################################################################
dnl # Check for DBUS libraries dnl # Check for DBUS libraries
dnl ####################################################################### dnl #######################################################################
@ -638,10 +663,11 @@ AM_CONDITIONAL(DO_GTK, test "x$gtkfe" = "xyes")
AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes") AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes")
AM_CONDITIONAL(DO_PYTHON, test "x$python" = "xyes") AM_CONDITIONAL(DO_PYTHON, test "x$python" = "xyes")
AM_CONDITIONAL(DO_TCL, test "x$tcl" = "xyes") AM_CONDITIONAL(DO_TCL, test "x$tcl" = "xyes")
AM_CONDITIONAL(DO_SASL, test "x$sasl" = "xyes") AM_CONDITIONAL(DO_PLUGIN, test "x$plugin" = "xyes")
AM_CONDITIONAL(DO_CHECKSUM, test "x$checksum" = "xyes")
AM_CONDITIONAL(DO_DOAT, test "x$doat" = "xyes") AM_CONDITIONAL(DO_DOAT, test "x$doat" = "xyes")
AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes") AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes")
AM_CONDITIONAL(DO_PLUGIN, test "x$plugin" = "xyes") AM_CONDITIONAL(DO_SASL, test "x$sasl" = "xyes")
AM_CONDITIONAL(USE_DBUS, test "x$dbus" = "xyes") AM_CONDITIONAL(USE_DBUS, test "x$dbus" = "xyes")
AM_CONDITIONAL(DO_GCONF, test "x$GCONFTOOL" != "xno") AM_CONDITIONAL(DO_GCONF, test "x$GCONFTOOL" != "xno")
@ -903,9 +929,10 @@ plugins/Makefile
plugins/python/Makefile plugins/python/Makefile
plugins/perl/Makefile plugins/perl/Makefile
plugins/tcl/Makefile plugins/tcl/Makefile
plugins/sasl/Makefile plugins/checksum/Makefile
plugins/doat/Makefile plugins/doat/Makefile
plugins/fishlim/Makefile plugins/fishlim/Makefile
plugins/sasl/Makefile
intl/Makefile intl/Makefile
po/Makefile.in po/Makefile.in
]) ])
@ -913,23 +940,33 @@ po/Makefile.in
echo echo
echo HexChat $VERSION echo HexChat $VERSION
echo echo
echo Building GTK+ Interface .... : $gtkfe echo GTK+ Interface ...... : $gtkfe
echo Building TEXT Interface .... : $textfe echo Text Interface ...... : $textfe
echo echo
echo mmx tinting ......... : $mmx\ spelling .............. : $spell echo MMX tinting ......... : $mmx
echo XShm tinting ........ : $shm\ plugin interface ...... : $plugin echo XShm tinting ........ : $shm
if test "$xft" = no; then if test "$xft" = no; then
echo text backend ........ : pango\ nls/gettext ........... : $USE_NLS echo text backend ........ : pango
else else
echo text backend ........ : xft\ nls/gettext ........... : $USE_NLS echo text backend ........ : xft
fi fi
echo openssl support ..... : $openssl\ ipv6 support .......... : $ipv6 echo openssl support ..... : $openssl
echo dbus support ........ : $dbus\ msproxy ntlm \(ISA\) .... : $have_ntlm echo dbus support ........ : $dbus
echo libnotify support ... : $libnotify echo libnotify support ... : $libnotify
echo spelling ............ : $spell
echo plugin interface .... : $plugin
echo nls/gettext ......... : $USE_NLS
echo ipv6 support ........ : $ipv6
echo msproxy ntlm \(ISA\) .. : $have_ntlm
echo echo
echo Perl ................ : $perl\ SASL .................. : $sasl echo Perl ................ : $perl
echo Python .............. : $python\ Do At ................. : $doat echo Python .............. : $python
echo Tcl ................. : $tcl\ FiSHLiM ............... : $fishlim echo Tcl ................. : $tcl
echo
echo Checksum ............ : $checksum
echo Do At ............... : $doat
echo FiSHLiM ............. : $fishlim
echo SASL ................ : $sasl
echo echo
echo The binary will be installed in $prefix/bin echo The binary will be installed in $prefix/bin
echo echo

View File

@ -29,5 +29,9 @@ if DO_FISHLIM
fishlimdir = fishlim fishlimdir = fishlim
endif endif
if DO_CHECKSUM
checksumdir = checksum
endif
#SUBDIRS = . $(pythondir) $(perldir) mailcheck xdcc #SUBDIRS = . $(pythondir) $(perldir) mailcheck xdcc
SUBDIRS = . $(pythondir) $(perldir) $(tcldir) $(sasldir) $(doatdir) $(fishlimdir) SUBDIRS = . $(pythondir) $(perldir) $(tcldir) $(sasldir) $(doatdir) $(fishlimdir) $(checksumdir)

View File

@ -0,0 +1,9 @@
EXTRA_DIST = INSTALL LICENSE README
libdir = $(hexchatlibdir)/plugins
lib_LTLIBRARIES = checksum.la
checksum_la_SOURCES = checksum.c
checksum_la_LDFLAGS = -avoid-version -module
checksum_la_LIBADD =
INCLUDES = $(COMMON_CFLAGS) -I$(srcdir)/..

View File

@ -22,28 +22,39 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <malloc.h> #include <malloc.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <openssl/sha.h> #include <openssl/sha.h>
#include <glib.h>
#include "xchat-plugin.h" #ifdef WIN32
#define BUFSIZE 32768
#define DEFAULT_LIMIT 256 /* default size is 256 MiB */
#ifndef snprintf #ifndef snprintf
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
#ifndef stat64 #ifndef stat64
#define stat64 _stat64 #define stat64 _stat64
#endif #endif
#else
/* for INT_MAX */
#include <limits.h>
#define __USE_LARGEFILE64
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#include <sys/stat.h>
#include "xchat-plugin.h"
#define BUFSIZE 32768
#define DEFAULT_LIMIT 256 /* default size is 256 MiB */
static xchat_plugin *ph; /* plugin handle */ static xchat_plugin *ph; /* plugin handle */
static const char name[] = "Checksum"; static const char name[] = "Checksum";
static const char desc[] = "Calculate checksum for DCC file transfers"; static const char desc[] = "Calculate checksum for DCC file transfers";
static const char version[] = "3.0"; static const char version[] = "3.1";
/* Use of OpenSSL SHA256 interface: http://adamlamers.com/?p=5 */ /* Use of OpenSSL SHA256 interface: http://adamlamers.com/?p=5 */
static void static void
@ -217,11 +228,11 @@ dccoffer_cb (char *word[], void *userdata)
static void static void
checksum (char *word[], void *userdata) checksum (char *word[], void *userdata)
{ {
if (!stricmp ("GET", word[2])) if (!g_ascii_strcasecmp ("GET", word[2]))
{ {
print_limit (); print_limit ();
} }
else if (!stricmp ("SET", word[2])) else if (!g_ascii_strcasecmp ("SET", word[2]))
{ {
set_limit (word[3]); set_limit (word[3]);
} }