Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7909738a09 |
@@ -44,11 +44,7 @@ src/common/textenums.h
|
|||||||
src/common/textevents.h
|
src/common/textevents.h
|
||||||
src/fe-gtk/hexchat
|
src/fe-gtk/hexchat
|
||||||
src/fe-text/hexchat-text
|
src/fe-text/hexchat-text
|
||||||
src/htm/Main.resources
|
|
||||||
src/htm/thememan.exe
|
src/htm/thememan.exe
|
||||||
src/htm/thememan.exe.config
|
|
||||||
src/htm/thememan.exe.mdb
|
|
||||||
src/htm/thememan
|
|
||||||
stamp-h1
|
stamp-h1
|
||||||
*.a
|
*.a
|
||||||
*.o
|
*.o
|
||||||
@@ -57,7 +53,6 @@ stamp-h1
|
|||||||
*.gmo
|
*.gmo
|
||||||
*.mo
|
*.mo
|
||||||
*.po~
|
*.po~
|
||||||
*.patch
|
|
||||||
# Win32 generated files
|
# Win32 generated files
|
||||||
plugins/wmpa/wmpa_h.h
|
plugins/wmpa/wmpa_h.h
|
||||||
plugins/wmpa/wmpa_i.c
|
plugins/wmpa/wmpa_i.c
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ language: c
|
|||||||
compiler: gcc
|
compiler: gcc
|
||||||
before_script:
|
before_script:
|
||||||
- sudo apt-get build-dep -qq xchat
|
- sudo apt-get build-dep -qq xchat
|
||||||
- sudo apt-get install -qq libnotify-dev libproxy-dev libpci-dev libcanberra-dev monodevelop
|
- sudo apt-get install -qq libnotify-dev libproxy-dev libpci-dev libcanberra-dev
|
||||||
script:
|
script:
|
||||||
- ./autogen.sh
|
- ./autogen.sh
|
||||||
- ./configure --enable-textfe --with-theme-manager
|
- ./configure --enable-textfe
|
||||||
- make
|
- make
|
||||||
notifications:
|
notifications:
|
||||||
irc:
|
irc:
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
host = https://www.transifex.com
|
host = https://www.transifex.com
|
||||||
|
|
||||||
[hexchat.main]
|
[hexchat.main]
|
||||||
file_filter = po/<lang>.po
|
file_filter = po\<lang>.po
|
||||||
source_file = po/hexchat.pot
|
source_file = po\hexchat.pot
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = PO
|
type = PO
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
|
||||||
|
|
||||||
SUBDIRS = po intl src plugins man share
|
SUBDIRS = po intl src plugins man share
|
||||||
|
|
||||||
EXTRA_DIST = autogen.sh
|
EXTRA_DIST = autogen.sh
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ if test "$?" != "0"; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
echo running libtoolize...
|
echo running libtoolize...
|
||||||
libtoolize --copy --force --install
|
libtoolize --force
|
||||||
if test "$?" != "0"; then
|
if test "$?" != "0"; then
|
||||||
echo libtoolize failed, stopping.
|
echo libtoolize failed, stopping.
|
||||||
exit 3
|
exit 3
|
||||||
@@ -90,7 +90,7 @@ if test "$?" != "0"; then
|
|||||||
exit 4
|
exit 4
|
||||||
fi
|
fi
|
||||||
echo running $AUTOMAKE...
|
echo running $AUTOMAKE...
|
||||||
$AUTOMAKE -a -c
|
$AUTOMAKE -a
|
||||||
if test "$?" != "0"; then
|
if test "$?" != "0"; then
|
||||||
echo automake failed, stopping.
|
echo automake failed, stopping.
|
||||||
exit 5
|
exit 5
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
#define USE_IPV6
|
#define USE_IPV6
|
||||||
#define HAVE_ISO_CODES
|
#define HAVE_ISO_CODES
|
||||||
#define PACKAGE_NAME "hexchat"
|
#define PACKAGE_NAME "hexchat"
|
||||||
#define PACKAGE_VERSION "2.9.6"
|
#define PACKAGE_VERSION "2.9.5"
|
||||||
#define HEXCHATLIBDIR ".\\plugins"
|
#define HEXCHATLIBDIR ".\\plugins"
|
||||||
#define HEXCHATSHAREDIR "."
|
#define HEXCHATSHAREDIR "."
|
||||||
#define OLD_PERL
|
#define OLD_PERL
|
||||||
#define GETTEXT_PACKAGE "hexchat"
|
#define GETTEXT_PACKAGE "hexchat"
|
||||||
#define PACKAGE_TARNAME "hexchat-2.9.6"
|
#define PACKAGE_TARNAME "hexchat-2.9.5"
|
||||||
#ifndef USE_IPV6
|
#ifndef USE_IPV6
|
||||||
#define socklen_t int
|
#define socklen_t int
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_INIT([HexChat],[2.9.6])
|
AC_INIT([HexChat],[2.9.5])
|
||||||
|
|
||||||
AC_PREREQ([2.60])
|
AC_PREREQ([2.60])
|
||||||
AC_COPYRIGHT([Copyright (C) 1998-2010 Peter Zelezny])
|
AC_COPYRIGHT([Copyright (C) 1998-2010 Peter Zelezny])
|
||||||
@@ -8,9 +8,8 @@ AC_COPYRIGHT([Copyright (C) 1998-2010 Peter Zelezny])
|
|||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_SRCDIR([configure.ac])
|
AC_CONFIG_SRCDIR([configure.ac])
|
||||||
|
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.11 dist-bzip2 subdir-objects no-define foreign])
|
AM_INIT_AUTOMAKE([1.11 dist-bzip2 subdir-objects no-define foreign])
|
||||||
|
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
@@ -21,7 +20,6 @@ AC_PROG_CPP
|
|||||||
AM_PROG_AS
|
AM_PROG_AS
|
||||||
AM_DISABLE_STATIC
|
AM_DISABLE_STATIC
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
AC_PATH_PROG(MDTOOL, mdtool, no)
|
|
||||||
|
|
||||||
dnl -----------------------------------------------------------
|
dnl -----------------------------------------------------------
|
||||||
dnl Language Support
|
dnl Language Support
|
||||||
@@ -117,9 +115,8 @@ AC_ARG_ENABLE(xlib,
|
|||||||
xlib=$enableval, xlib=yes)
|
xlib=$enableval, xlib=yes)
|
||||||
|
|
||||||
AC_ARG_ENABLE(python,
|
AC_ARG_ENABLE(python,
|
||||||
[AS_HELP_STRING([--enable-python=pythonversion],[build the python plugin; possible values: "python2", "python3" or specific such as "python3.3" (default on, python2)])],
|
[AS_HELP_STRING([--enable-python=pythonversion],[build the python plugin (default on, python2)])],
|
||||||
python=$enableval, python=python2)
|
python=$enableval, python=python2)
|
||||||
AS_IF([test "x$python" = "xyes"], [python=python2])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(perl,
|
AC_ARG_ENABLE(perl,
|
||||||
[AS_HELP_STRING([--disable-perl],[don\'t build the perl plugin])],
|
[AS_HELP_STRING([--disable-perl],[don\'t build the perl plugin])],
|
||||||
@@ -172,7 +169,7 @@ AC_ARG_ENABLE(shm,
|
|||||||
|
|
||||||
AC_ARG_ENABLE(spell,
|
AC_ARG_ENABLE(spell,
|
||||||
[AS_HELP_STRING([--enable-spell=type],[enable spelling type: none static libsexy gtkspell])],
|
[AS_HELP_STRING([--enable-spell=type],[enable spelling type: none static libsexy gtkspell])],
|
||||||
spell=$enableval, spell=libsexy)
|
spell=$enableval, spell=static)
|
||||||
|
|
||||||
AC_ARG_ENABLE(ntlm,
|
AC_ARG_ENABLE(ntlm,
|
||||||
[AS_HELP_STRING([--enable-ntlm],[enable Microsoft\'s NTLM auth (libntlm) library support (default: no)])],
|
[AS_HELP_STRING([--enable-ntlm],[enable Microsoft\'s NTLM auth (libntlm) library support (default: no)])],
|
||||||
@@ -182,25 +179,6 @@ AC_ARG_ENABLE(libproxy,
|
|||||||
[AS_HELP_STRING([--disable-libproxy],[disable libproxy support (default: auto)])],
|
[AS_HELP_STRING([--disable-libproxy],[disable libproxy support (default: auto)])],
|
||||||
libproxy=$enableval, libproxy=auto)
|
libproxy=$enableval, libproxy=auto)
|
||||||
|
|
||||||
AC_ARG_ENABLE(minimal-flags,
|
|
||||||
[AS_HELP_STRING([--enable-minimal-flags],[only add those CFLAGS that are really needed or not intrusive (default: no)])],
|
|
||||||
minimalflags=$enableval, minimalflags=no)
|
|
||||||
|
|
||||||
AC_ARG_WITH(theme-manager,
|
|
||||||
[AS_HELP_STRING([--with-theme-manager],[compile theme manager (needs monodevelop, default: off)])],
|
|
||||||
theme_manager=$withval, theme_manager=no)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dnl *********************************************************************
|
|
||||||
dnl ** THEME-MANAGER ****************************************************
|
|
||||||
dnl *********************************************************************
|
|
||||||
if test "x$theme_manager" != "xno" ; then
|
|
||||||
if test "x$MDTOOL" = "xno"; then
|
|
||||||
AC_MSG_ERROR([No "mdtool" found, you need to install monodevelop!])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
dnl *********************************************************************
|
dnl *********************************************************************
|
||||||
dnl ** GLIB *************************************************************
|
dnl ** GLIB *************************************************************
|
||||||
@@ -244,14 +222,15 @@ GUI_LIBS="$GUI_LIBS $GTK_LIBS"
|
|||||||
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
|
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
|
||||||
|
|
||||||
#if test "$gnome" = yes; then
|
#if test "$gnome" = yes; then
|
||||||
|
# AC_PATH_PROG(pkgconfigpath, pkg-config)
|
||||||
# AC_MSG_CHECKING(Gnome2 compile flags)
|
# AC_MSG_CHECKING(Gnome2 compile flags)
|
||||||
# GNOME_CFLAGS="`$PKG_CONFIG libgnome-2.0 --cflags 2>/dev/null`"
|
# GNOME_CFLAGS="`$pkgconfigpath libgnome-2.0 --cflags 2>/dev/null`"
|
||||||
# if test "_$GNOME_CFLAGS" = _ ; then
|
# if test "_$GNOME_CFLAGS" = _ ; then
|
||||||
# gnome=no
|
# gnome=no
|
||||||
# AC_MSG_RESULT([Gnome not found, building without it.])
|
# AC_MSG_RESULT([Gnome not found, building without it.])
|
||||||
# else
|
# else
|
||||||
# GNOME_VER="`$PKG_CONFIG libgnome-2.0 --modversion`"
|
# GNOME_VER="`$pkgconfigpath libgnome-2.0 --modversion`"
|
||||||
# GUI_LIBS="$GUI_LIBS `$PKG_CONFIG libgnome-2.0 --libs`"
|
# GUI_LIBS="$GUI_LIBS `$pkgconfigpath libgnome-2.0 --libs`"
|
||||||
# GUI_CFLAGS="$GUI_CFLAGS $GNOME_CFLAGS"
|
# GUI_CFLAGS="$GUI_CFLAGS $GNOME_CFLAGS"
|
||||||
# AC_DEFINE(USE_GNOME)
|
# AC_DEFINE(USE_GNOME)
|
||||||
# AC_MSG_RESULT(ok)
|
# AC_MSG_RESULT(ok)
|
||||||
@@ -270,9 +249,10 @@ dnl ** XFT **************************************************************
|
|||||||
dnl *********************************************************************
|
dnl *********************************************************************
|
||||||
|
|
||||||
if test "$xft" = yes; then
|
if test "$xft" = yes; then
|
||||||
if $PKG_CONFIG xft --exists; then
|
AC_PATH_PROG(pkgconfigpath, pkg-config)
|
||||||
GUI_CFLAGS="$GUI_CFLAGS `$PKG_CONFIG xft --cflags`"
|
if $pkgconfigpath xft --exists; then
|
||||||
GUI_LIBS="$GUI_LIBS `$PKG_CONFIG xft --libs`"
|
GUI_CFLAGS="$GUI_CFLAGS `$pkgconfigpath xft --cflags`"
|
||||||
|
GUI_LIBS="$GUI_LIBS `$pkgconfigpath xft --libs`"
|
||||||
else
|
else
|
||||||
xft=no
|
xft=no
|
||||||
oldCPPFLAGS=$CPPFLAGS
|
oldCPPFLAGS=$CPPFLAGS
|
||||||
@@ -352,27 +332,47 @@ dnl ** PYTHON ***********************************************************
|
|||||||
dnl *********************************************************************
|
dnl *********************************************************************
|
||||||
|
|
||||||
if test "x$python" != xno ; then
|
if test "x$python" != xno ; then
|
||||||
case $python in
|
if test "$python" = yes ; then
|
||||||
dnl set python2 default here
|
# default
|
||||||
python2)
|
python="python2"
|
||||||
PKG_CHECK_MODULES([PY], [python-2.7], [], [AC_MSG_ERROR(Cannot find python-2.7!)])
|
fi
|
||||||
PY_VER="`$PKG_CONFIG --modversion python-2.7`";;
|
AC_PATH_PROG(pythonpath, $python)
|
||||||
dnl set python3 default here
|
if test "_$pythonpath" = _ ; then
|
||||||
python3)
|
AC_PATH_PROG(pythonpath, python)
|
||||||
PKG_CHECK_MODULES([PY], [python-3.3], [], [AC_MSG_ERROR(Cannot find python-3.3!)])
|
fi
|
||||||
PY_VER="`$PKG_CONFIG --modversion python-3.3`";;
|
if test "_$pythonpath" = _ ; then
|
||||||
dnl add broken versions here
|
python=no
|
||||||
python2.5|python2.6|python3.1|python3.2)
|
else
|
||||||
AC_MSG_ERROR(Unsupported Python version ${python}!);;
|
|
||||||
python*)
|
|
||||||
python="python-${python#python}" # stay posix compliant
|
|
||||||
PKG_CHECK_MODULES([PY], [${python}], [], [AC_MSG_ERROR(Cannot find "${python}.pc"!)])
|
|
||||||
PY_VER="`$PKG_CONFIG --modversion ${python}`";;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR(Unsupported Python ${python}!)
|
|
||||||
esac
|
|
||||||
AC_MSG_CHECKING(Python version)
|
AC_MSG_CHECKING(Python version)
|
||||||
|
changequote(<<, >>)dnl
|
||||||
|
PY_VER=`$pythonpath -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_vars("VERSION")[0]);'`
|
||||||
|
PY_LIB=`$pythonpath -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(standard_lib=1));'`
|
||||||
|
PY_INC=`$pythonpath -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc());'`
|
||||||
|
PYPLAT_INC=`$pythonpath -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc(plat_specific=True));'`
|
||||||
|
changequote([, ])dnl
|
||||||
AC_MSG_RESULT($PY_VER)
|
AC_MSG_RESULT($PY_VER)
|
||||||
|
$pythonpath -c "import sys; float(sys.version[[:3]]) >= 2.6 and int(sys.version[[0]]) <= 3 or sys.exit(1)"
|
||||||
|
if test "$?" != "1"; then
|
||||||
|
AC_MSG_CHECKING(Python compile flags)
|
||||||
|
PY_PREFIX=`$pythonpath -c 'import sys; print(sys.prefix)'`
|
||||||
|
PY_EXEC_PREFIX=`$pythonpath -c 'import sys; print(sys.exec_prefix)'`
|
||||||
|
if test -f $PY_INC/Python.h || test -f $PYPLAT_INC/Python.h; then
|
||||||
|
AS_VERSION_COMPARE($PY_VER, 3.0,
|
||||||
|
[PYL="$PY_VER"], # less than
|
||||||
|
[PYL="${PY_VER}m"], # equal
|
||||||
|
[PYL="${PY_VER}m"]) # greater than
|
||||||
|
PY_LIBS="-L$PY_LIB/config -lpython$PYL -lpthread -lutil"
|
||||||
|
PY_CFLAGS="-I$PY_INC -I$PYPLAT_INC"
|
||||||
|
AC_MSG_RESULT(ok)
|
||||||
|
else
|
||||||
|
python=no
|
||||||
|
AC_MSG_RESULT([Can\'t find Python.h])
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Python is too old or too new. Only 2.6-3.x are supported."
|
||||||
|
python=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl *********************************************************************
|
dnl *********************************************************************
|
||||||
@@ -407,10 +407,11 @@ dnl *********************************************************************
|
|||||||
|
|
||||||
retry=no
|
retry=no
|
||||||
if test "$openssl" != no; then
|
if test "$openssl" != no; then
|
||||||
|
AC_PATH_PROG(pkgconfigpath, pkg-config)
|
||||||
AC_MSG_CHECKING(for openssl through pkg-config)
|
AC_MSG_CHECKING(for openssl through pkg-config)
|
||||||
if $PKG_CONFIG openssl --exists; then
|
if $pkgconfigpath openssl --exists; then
|
||||||
CPPFLAGS="$CPPFLAGS `$PKG_CONFIG openssl --cflags`"
|
CPPFLAGS="$CPPFLAGS `$pkgconfigpath openssl --cflags`"
|
||||||
LIBS="$LIBS `$PKG_CONFIG openssl --libs`"
|
LIBS="$LIBS `$pkgconfigpath openssl --libs`"
|
||||||
AC_DEFINE(USE_OPENSSL)
|
AC_DEFINE(USE_OPENSSL)
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
openssl=yes
|
openssl=yes
|
||||||
@@ -486,8 +487,9 @@ if test "$plugin" = yes; then
|
|||||||
fi
|
fi
|
||||||
if test "$have_dl" = yes; then
|
if test "$have_dl" = yes; then
|
||||||
AC_DEFINE(USE_PLUGIN)
|
AC_DEFINE(USE_PLUGIN)
|
||||||
|
AC_PATH_PROG(pkgconfigpath, pkg-config)
|
||||||
dnl we just need the -Wl,--export-dynamic, but not -lgmodule-2.0
|
dnl we just need the -Wl,--export-dynamic, but not -lgmodule-2.0
|
||||||
RDYNAMIC_FLAGS="`$PKG_CONFIG gmodule-2.0 --libs | $sedpath 's/ -lgmodule-2.0//'`"
|
RDYNAMIC_FLAGS="`$pkgconfigpath gmodule-2.0 --libs | $sedpath 's/ -lgmodule-2.0//'`"
|
||||||
LIBS="$LIBS $RDYNAMIC_FLAGS"
|
LIBS="$LIBS $RDYNAMIC_FLAGS"
|
||||||
if test "$LD" = ""; then
|
if test "$LD" = ""; then
|
||||||
VS="`ld --help | grep version-script 2> /dev/null`"
|
VS="`ld --help | grep version-script 2> /dev/null`"
|
||||||
@@ -684,7 +686,6 @@ AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes")
|
|||||||
AM_CONDITIONAL(DO_SYSINFO, test "x$sysinfo" = "xyes")
|
AM_CONDITIONAL(DO_SYSINFO, test "x$sysinfo" = "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")
|
||||||
AM_CONDITIONAL(WITH_TM, test "x$theme_manager" != "xno")
|
|
||||||
|
|
||||||
dnl *********************************************************************
|
dnl *********************************************************************
|
||||||
dnl ** SOCKS5 ***********************************************************
|
dnl ** SOCKS5 ***********************************************************
|
||||||
@@ -724,8 +725,8 @@ dnl *********************************************************************
|
|||||||
if test "$shm" = yes; then
|
if test "$shm" = yes; then
|
||||||
oldl=$LIBS
|
oldl=$LIBS
|
||||||
oldc=$CPPFLAGS
|
oldc=$CPPFLAGS
|
||||||
LIBS="$LIBS `$PKG_CONFIG --libs-only-L xft`"
|
LIBS="$LIBS `$pkgconfigpath --libs-only-L xft`"
|
||||||
CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags-only-I xft`"
|
CPPFLAGS="$CPPFLAGS `$pkgconfigpath --cflags-only-I xft`"
|
||||||
shm=no
|
shm=no
|
||||||
AC_CHECK_LIB(Xext, XShmAttach, shm=yes)
|
AC_CHECK_LIB(Xext, XShmAttach, shm=yes)
|
||||||
if test "$shm" = yes; then
|
if test "$shm" = yes; then
|
||||||
@@ -739,7 +740,7 @@ if test "$shm" = yes; then
|
|||||||
|
|
||||||
LIBS=$oldl
|
LIBS=$oldl
|
||||||
if test "$shm" = yes; then
|
if test "$shm" = yes; then
|
||||||
GUI_LIBS="$GUI_LIBS `$PKG_CONFIG --libs-only-L xft` -lX11 -lXext"
|
GUI_LIBS="$GUI_LIBS `$pkgconfigpath --libs-only-L xft` -lX11 -lXext"
|
||||||
AC_DEFINE(USE_SHM)
|
AC_DEFINE(USE_SHM)
|
||||||
else
|
else
|
||||||
CPPFLAGS=$oldc
|
CPPFLAGS=$oldc
|
||||||
@@ -781,8 +782,6 @@ if test "x$GCC" = "xyes"; then
|
|||||||
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
|
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
|
||||||
CFLAGS="$CFLAGS -Wall"
|
CFLAGS="$CFLAGS -Wall"
|
||||||
fi
|
fi
|
||||||
dnl these flags might be unwanted
|
|
||||||
if test x$minimalflags != xyes; then
|
|
||||||
if test "$system" = "Linux" -o "$system" = "FreeBSD"; then
|
if test "$system" = "Linux" -o "$system" = "FreeBSD"; then
|
||||||
if test -z "`echo "$CFLAGS" | grep "\-pipe" 2> /dev/null`" ; then
|
if test -z "`echo "$CFLAGS" | grep "\-pipe" 2> /dev/null`" ; then
|
||||||
CFLAGS="$CFLAGS -pipe"
|
CFLAGS="$CFLAGS -pipe"
|
||||||
@@ -792,7 +791,6 @@ if test "x$GCC" = "xyes"; then
|
|||||||
CFLAGS="$CFLAGS -g"
|
CFLAGS="$CFLAGS -g"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
dnl does this compiler support -Wno-pointer-sign ?
|
dnl does this compiler support -Wno-pointer-sign ?
|
||||||
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
|
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
|
||||||
@@ -968,8 +966,6 @@ src/common/Makefile
|
|||||||
src/common/dbus/Makefile
|
src/common/dbus/Makefile
|
||||||
src/fe-text/Makefile
|
src/fe-text/Makefile
|
||||||
src/fe-gtk/Makefile
|
src/fe-gtk/Makefile
|
||||||
src/htm/Makefile
|
|
||||||
src/htm/thememan
|
|
||||||
src/pixmaps/Makefile
|
src/pixmaps/Makefile
|
||||||
plugins/Makefile
|
plugins/Makefile
|
||||||
plugins/python/Makefile
|
plugins/python/Makefile
|
||||||
@@ -990,7 +986,6 @@ echo HexChat $VERSION
|
|||||||
echo
|
echo
|
||||||
echo GTK+ interface ........ : $gtkfe
|
echo GTK+ interface ........ : $gtkfe
|
||||||
echo Text interface ........ : $textfe
|
echo Text interface ........ : $textfe
|
||||||
echo Theme manager ......... : $theme_manager
|
|
||||||
echo
|
echo
|
||||||
echo MMX tinting ........... : $mmx
|
echo MMX tinting ........... : $mmx
|
||||||
echo XShm tinting .......... : $shm
|
echo XShm tinting .......... : $shm
|
||||||
@@ -1011,7 +1006,7 @@ echo MS Proxy NTLM \(ISA\) ... : $have_ntlm
|
|||||||
echo libproxy support ...... : $libproxy
|
echo libproxy support ...... : $libproxy
|
||||||
echo
|
echo
|
||||||
echo Perl .................. : $perl
|
echo Perl .................. : $perl
|
||||||
echo Python ................ : python-$PY_VER
|
echo Python ................ : $python
|
||||||
echo
|
echo
|
||||||
echo Checksum .............. : $checksum
|
echo Checksum .............. : $checksum
|
||||||
echo Do At ................. : $doat
|
echo Do At ................. : $doat
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
.TH HEXCHAT "1" "April 2013" "HexChat 2.9.6" "User Commands"
|
.TH HEXCHAT "1" "April 2013" "HexChat 2.9.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
HexChat \- IRC Client
|
HexChat \- IRC Client
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.SS "Usage:"
|
.SS "Usage:"
|
||||||
.IP
|
.IP
|
||||||
hexchat [OPTION...] URL
|
hexchat [OPTION...]
|
||||||
.SS "Help Options:"
|
.SS "Help Options:"
|
||||||
.TP
|
.TP
|
||||||
\fB\-h\fR, \fB\-\-help\fR
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DNS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DNS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;DNS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;DNS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
static hexchat_plugin *ph; /* plugin handle */
|
static hexchat_plugin *ph; /* plugin handle */
|
||||||
static char name[] = "Exec";
|
static char name[] = "Exec";
|
||||||
static char desc[] = "Execute commands inside HexChat";
|
static char desc[] = "Execute commands inside HexChat";
|
||||||
static char version[] = "1.2";
|
static char version[] = "1.1";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
run_command (char *word[], char *word_eol[], void *userdata)
|
run_command (char *word[], char *word_eol[], void *userdata)
|
||||||
@@ -41,10 +41,6 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
time_t start;
|
time_t start;
|
||||||
double timeElapsed;
|
double timeElapsed;
|
||||||
|
|
||||||
char *token;
|
|
||||||
char *context = NULL;
|
|
||||||
int announce = 0;
|
|
||||||
|
|
||||||
HANDLE readPipe;
|
HANDLE readPipe;
|
||||||
HANDLE writePipe;
|
HANDLE writePipe;
|
||||||
STARTUPINFO sInfo;
|
STARTUPINFO sInfo;
|
||||||
@@ -63,8 +59,9 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
|
|
||||||
if (!stricmp("-O", word[2]))
|
if (!stricmp("-O", word[2]))
|
||||||
{
|
{
|
||||||
strcat (commandLine, word_eol[3]);
|
/*strcat (commandLine, word_eol[3]);*/
|
||||||
announce = 1;
|
hexchat_printf (ph, "Printing Exec output to others is not supported yet.\n");
|
||||||
|
return HEXCHAT_EAT_HEXCHAT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -93,18 +90,6 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
{
|
{
|
||||||
/* avoid garbage */
|
/* avoid garbage */
|
||||||
buffer[dwRead] = '\0';
|
buffer[dwRead] = '\0';
|
||||||
|
|
||||||
if (announce)
|
|
||||||
{
|
|
||||||
/* Say each line seperately, TODO: improve... */
|
|
||||||
token = strtok_s (buffer, "\n", &context);
|
|
||||||
while (token != NULL)
|
|
||||||
{
|
|
||||||
hexchat_commandf (ph, "SAY %s", token);
|
|
||||||
token = strtok_s (NULL, "\n", &context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
hexchat_printf (ph, "%s", buffer);
|
hexchat_printf (ph, "%s", buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,9 +100,9 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
}
|
}
|
||||||
timeElapsed = difftime (time (0), start);
|
timeElapsed = difftime (time (0), start);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* display a newline to separate things */
|
/* display a newline to separate things */
|
||||||
if (!announce)
|
|
||||||
hexchat_printf (ph, "\n");
|
hexchat_printf (ph, "\n");
|
||||||
|
|
||||||
if (timeElapsed >= 10)
|
if (timeElapsed >= 10)
|
||||||
@@ -128,11 +113,6 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
CloseHandle (readPipe);
|
CloseHandle (readPipe);
|
||||||
CloseHandle (pInfo.hProcess);
|
CloseHandle (pInfo.hProcess);
|
||||||
CloseHandle (pInfo.hThread);
|
CloseHandle (pInfo.hThread);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hexchat_command (ph, "help exec");
|
|
||||||
}
|
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return HEXCHAT_EAT_HEXCHAT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;EXEC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;EXEC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;EXEC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;EXEC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
/* stdbool.h replacement for MSVC */
|
||||||
|
#define false 0
|
||||||
|
#define true 1
|
||||||
|
#define bool _Bool
|
||||||
|
typedef int _Bool;
|
||||||
@@ -25,7 +25,11 @@
|
|||||||
#ifndef FISH_H
|
#ifndef FISH_H
|
||||||
#define FISH_H
|
#define FISH_H
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include "bool.h"
|
||||||
|
#else
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#endif
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
char *fish_encrypt(const char *key, size_t keylen, const char *message);
|
char *fish_encrypt(const char *key, size_t keylen, const char *message);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -25,7 +25,11 @@
|
|||||||
#ifndef IRC_H
|
#ifndef IRC_H
|
||||||
#define IRC_H
|
#define IRC_H
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include "bool.h"
|
||||||
|
#else
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#endif
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
bool irc_parse_message(const char *words[],
|
bool irc_parse_message(const char *words[],
|
||||||
|
|||||||
@@ -25,7 +25,11 @@
|
|||||||
#ifndef KEYSTORE_H
|
#ifndef KEYSTORE_H
|
||||||
#define KEYSTORE_H
|
#define KEYSTORE_H
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include "bool.h"
|
||||||
|
#else
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#endif
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
char *keystore_get_key(const char *nick);
|
char *keystore_get_key(const char *nick);
|
||||||
|
|||||||
|
After Width: | Height: | Size: 32 KiB |
@@ -0,0 +1,734 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _WIN32_IE 0x0601
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include "hexchat-plugin.h"
|
||||||
|
#include "utility.h"
|
||||||
|
#include "hextray.h"
|
||||||
|
#include "hexchat.h"
|
||||||
|
#include "callbacks.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "sdTray.h"
|
||||||
|
#include "sdAlerts.h"
|
||||||
|
|
||||||
|
HWND g_hPrefTabEvents;
|
||||||
|
HWND g_hPrefTabSettings;
|
||||||
|
HWND g_hPrefTabAlerts;
|
||||||
|
HWND g_hPrefTabAbout;
|
||||||
|
bool g_bCanQuit;
|
||||||
|
int g_iIsActive = 1;
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
|
||||||
|
{
|
||||||
|
TCHAR szTitle[10];
|
||||||
|
GetWindowText(hWnd, szTitle, 9);
|
||||||
|
|
||||||
|
if(_tcsstr(szTitle, _T("HexChat [")))
|
||||||
|
{
|
||||||
|
g_hXchatWnd = hWnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************************************/
|
||||||
|
/******* our HexChat event call back, get the name and info for each event and save it *********/
|
||||||
|
/******* for our alerts later ******************************************************************/
|
||||||
|
/***********************************************************************************************/
|
||||||
|
int event_cb(char *word[], void *userdata)
|
||||||
|
{
|
||||||
|
int iEvent = (int)userdata;
|
||||||
|
|
||||||
|
if(iEvent > 10 && iEvent != 21)
|
||||||
|
return HEXCHAT_EAT_NONE;
|
||||||
|
|
||||||
|
/***************************************************************************************/
|
||||||
|
/***** if the window is minimized or if we're allowed to show alerts when its not **/
|
||||||
|
/***** and if the option to show the specified alert is true and if we're even **/
|
||||||
|
/***** allowed to show alerts at all then we show them (a bit confusing but it works) **/
|
||||||
|
/***************************************************************************************/
|
||||||
|
if(((g_iIsActive == 0) || !(g_dwPrefs & (1<<PREF_OSBWM))) && (g_dwPrefs & (1<<PREF_AMAE)) && (g_dwPrefs & (1<<iEvent)))
|
||||||
|
{
|
||||||
|
/*********************************/
|
||||||
|
/*********** Our Buffers *********/
|
||||||
|
/*********************************/
|
||||||
|
char szInfo[512];
|
||||||
|
char szName[64];
|
||||||
|
DWORD dwInfoFlags;
|
||||||
|
int iTime = g_iTime*1000;
|
||||||
|
char *szTemp = NULL;
|
||||||
|
|
||||||
|
if(g_dwPrefs & (1<<PREF_KAOI))
|
||||||
|
{
|
||||||
|
iTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(iEvent)
|
||||||
|
{
|
||||||
|
case CHAN_HILIGHT:
|
||||||
|
_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Highlight: %s", hexchat_get_info (ph, "channel"));
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case CHAN_MESSAGE:
|
||||||
|
_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Channel Message: %s", hexchat_get_info (ph, "channel"));
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case CHAN_TOPIC_CHANGE:
|
||||||
|
_snprintf(szInfo, 512, "%s has changed the topic to %s", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Topic Change: %s", word[3]);
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case CHAN_INVITE:
|
||||||
|
_snprintf(szInfo, 512, "%s has invited you into %s", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Invite");
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case CHAN_KICKED:
|
||||||
|
_snprintf(szInfo, 512, "Kicked from %s by %s:\r\n%s", word[2], word[3], word[4]);
|
||||||
|
_snprintf(szName, 64, "Kick");
|
||||||
|
dwInfoFlags = NIIF_WARNING;
|
||||||
|
break;
|
||||||
|
case CHAN_BANNED:
|
||||||
|
_snprintf(szInfo, 512, "Cannot join %s You are banned.", word[1]);
|
||||||
|
_snprintf(szName, 64, "Banned");
|
||||||
|
dwInfoFlags = NIIF_WARNING;
|
||||||
|
break;
|
||||||
|
case CTCP_GENERIC:
|
||||||
|
_snprintf(szInfo, 512, "%s:\r\nCTCP %s", word[2], word[1]);
|
||||||
|
_snprintf(szName, 64, "CTCP");
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case PMSG_RECEIVE:
|
||||||
|
_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Private Message");
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case SERV_DISCONNECT:
|
||||||
|
_snprintf(szInfo, 512, "Disconnected\r\nError: %s", word[1]);
|
||||||
|
_snprintf(szName, 64, "Disconnect");
|
||||||
|
dwInfoFlags = NIIF_ERROR;
|
||||||
|
break;
|
||||||
|
case SERV_KILLED:
|
||||||
|
_snprintf(szInfo, 512, "Killed(%s(%s))", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Server Admin has killed you");
|
||||||
|
dwInfoFlags = NIIF_ERROR;
|
||||||
|
break;
|
||||||
|
case SERV_NOTICE:
|
||||||
|
_snprintf(szInfo, 512, "Notice:\r\n%s: %s", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Notice");
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
_snprintf(szInfo, 512, ":\r\n%s: %s", word[1], word[2]);
|
||||||
|
_snprintf(szName, 64, "Notice");
|
||||||
|
dwInfoFlags = NIIF_INFO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
/***** Use windows instead of balloons, and if its a window should we keep it open ****/
|
||||||
|
/***** indefinitely? ****/
|
||||||
|
/**************************************************************************************/
|
||||||
|
szTemp = hexchat_strip_color(szInfo);
|
||||||
|
|
||||||
|
if(g_dwPrefs & (1<<PREF_UWIOB))
|
||||||
|
{
|
||||||
|
sdSystemAlert((HINSTANCE)g_hInstance, IDD_ALERT, szTemp, szName, iTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowBalloon(g_hXchatWnd, 1, szTemp, szName, iTime, dwInfoFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(szTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(g_dwPrefs & (1<<PREF_BLINK) && (g_dwPrefs & (1<<iEvent)))
|
||||||
|
{
|
||||||
|
BlinkIcon(g_hXchatWnd, 1, g_hIcons[0], g_hIcons[(iEvent+1)], 700, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************/
|
||||||
|
/***** pass the events to HexChat **/
|
||||||
|
/***********************************/
|
||||||
|
return HEXCHAT_EAT_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int command_cb(char *word[], char *word_eol[], void *userdata)
|
||||||
|
{
|
||||||
|
char szInfo[512];
|
||||||
|
char *szTemp = NULL;
|
||||||
|
int iTime = g_iTime*1000;
|
||||||
|
|
||||||
|
_snprintf(szInfo, 512, word_eol[2]);
|
||||||
|
szTemp = hexchat_strip_color(szInfo);
|
||||||
|
|
||||||
|
if(g_dwPrefs & (1<<PREF_KAOI))
|
||||||
|
{
|
||||||
|
iTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(((g_iIsActive == 0) || !(g_dwPrefs & (1<<PREF_OSBWM))) && (g_dwPrefs & (1<<PREF_AMAE)))
|
||||||
|
{
|
||||||
|
if(g_dwPrefs & (1<<PREF_UWIOB))
|
||||||
|
{
|
||||||
|
sdSystemAlert((HINSTANCE)g_hInstance, IDD_ALERT, szTemp, "Alert", iTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowBalloon(g_hXchatWnd, 1, szTemp, "Alert", iTime, NIIF_INFO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(szTemp);
|
||||||
|
|
||||||
|
return HEXCHAT_EAT_ALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
if((g_dwPrefs & (1<<PREF_MIOC)) && (g_bCanQuit == false))
|
||||||
|
{
|
||||||
|
/*******************************************/
|
||||||
|
/**** to autoaway or not to autoaway... ***/
|
||||||
|
/*******************************************/
|
||||||
|
if(g_dwPrefs & (1<<PREF_AOM))
|
||||||
|
{
|
||||||
|
hexchat_globally_away(g_szAway);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************/
|
||||||
|
/**** Win32 API call to hide the window and **/
|
||||||
|
/**** save the fact that its minimized for later **/
|
||||||
|
/**************************************************/
|
||||||
|
g_iIsActive = 0;
|
||||||
|
ShowWindow(hWnd, SW_HIDE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(g_hPrefDlg != NULL)
|
||||||
|
{
|
||||||
|
DestroyWindow(g_hPrefDlg);
|
||||||
|
}
|
||||||
|
|
||||||
|
StopBlink(hWnd, 1, g_hIcons[0]);
|
||||||
|
|
||||||
|
if(sdAlertNum())
|
||||||
|
{
|
||||||
|
sdCloseAlerts();
|
||||||
|
HoldClose();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_SIZE:
|
||||||
|
{
|
||||||
|
/******************************************/
|
||||||
|
/***** User wants to minimize HexChat, ****/
|
||||||
|
/***** are we allowed to go to tray? ******/
|
||||||
|
/******************************************/
|
||||||
|
if((g_dwPrefs & (1<<PREF_TOT)) && (wparam == SIZE_MINIMIZED))
|
||||||
|
{
|
||||||
|
/*******************************************/
|
||||||
|
/**** to autoaway or not to autoaway... ***/
|
||||||
|
/*******************************************/
|
||||||
|
if(g_dwPrefs & (1<<PREF_AOM))
|
||||||
|
{
|
||||||
|
hexchat_globally_away(g_szAway);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************/
|
||||||
|
/**** Win32 API call to hide the window and **/
|
||||||
|
/**** save the fact that its minimized for later **/
|
||||||
|
/**************************************************/
|
||||||
|
g_iIsActive = 0;
|
||||||
|
ShowWindow(hWnd, SW_HIDE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
/**********************************/
|
||||||
|
/*** user clicked the tray icon ***/
|
||||||
|
/**********************************/
|
||||||
|
case WM_TRAYMSG:
|
||||||
|
{
|
||||||
|
switch(lparam)
|
||||||
|
{
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
{
|
||||||
|
if(!g_iIsActive)
|
||||||
|
{
|
||||||
|
/*********************************************************/
|
||||||
|
/*** 0: its hiden, restore it and show it, if autoaway ***/
|
||||||
|
/*** is on, set us as back ***/
|
||||||
|
/*********************************************************/
|
||||||
|
SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||||
|
SetForegroundWindow(hWnd);
|
||||||
|
g_iIsActive = 1;
|
||||||
|
|
||||||
|
if(g_dwPrefs & (1<<PREF_AOM))
|
||||||
|
{
|
||||||
|
hexchat_globally_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
{
|
||||||
|
/******************************************/
|
||||||
|
/*** user wants to see the menu find out **/
|
||||||
|
/*** where the mouse is and show it **/
|
||||||
|
/******************************************/
|
||||||
|
POINT pt;
|
||||||
|
int iRet;
|
||||||
|
|
||||||
|
GetCursorPos(&pt);
|
||||||
|
SetForegroundWindow(hWnd);
|
||||||
|
|
||||||
|
ModifyMenu(g_hTrayMenu, 2, (MF_POPUP | MF_BYPOSITION), (UINT)setServerMenu(), _T("Away"));
|
||||||
|
|
||||||
|
Sleep(175);
|
||||||
|
|
||||||
|
iRet = TrackPopupMenuEx(g_hTrayMenu, (TPM_RETURNCMD | TPM_LEFTALIGN), pt.x, pt.y, hWnd, NULL);
|
||||||
|
|
||||||
|
/***********************************/
|
||||||
|
/*** nRet is the users selection, **/
|
||||||
|
/*** process it **/
|
||||||
|
/***********************************/
|
||||||
|
sdTrayProc(hWnd, iRet);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
/*****************************************************/
|
||||||
|
/*** the taskbar has been restarted, re-add our icon */
|
||||||
|
/*****************************************************/
|
||||||
|
if(msg == RegisterWindowMessage(_T("TaskbarCreated")))
|
||||||
|
{
|
||||||
|
char szVersion[64];
|
||||||
|
_snprintf(szVersion, 64, "HexChat [%s]", hexchat_get_info(ph, "version"));
|
||||||
|
AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CallWindowProc(g_hOldProc, hWnd, msg, wparam, lparam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************/
|
||||||
|
/*** process messages from the tray menu ************/
|
||||||
|
/****************************************************/
|
||||||
|
LRESULT CALLBACK sdTrayProc(HWND hWnd, int msg)
|
||||||
|
{
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case ACT_EXIT:
|
||||||
|
{
|
||||||
|
g_bCanQuit = true;
|
||||||
|
PostMessage(hWnd, WM_CLOSE, 0, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ACT_RESTORE:
|
||||||
|
{
|
||||||
|
/*************************************************/
|
||||||
|
/** user wants us to restore the HexChat window **/
|
||||||
|
/** and of autoaway is on, set as back ******** **/
|
||||||
|
/*************************************************/
|
||||||
|
SendMessage(g_hXchatWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||||
|
SetForegroundWindow(hWnd);
|
||||||
|
|
||||||
|
if((!g_iIsActive) && (g_dwPrefs & (1<<PREF_AOM)))
|
||||||
|
{
|
||||||
|
hexchat_globally_back();
|
||||||
|
g_iIsActive = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ACT_SETTINGS:
|
||||||
|
{
|
||||||
|
ShowWindow(g_hPrefDlg, SW_SHOW);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ACT_AWAY:
|
||||||
|
{
|
||||||
|
hexchat_globally_away(g_szAway);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ACT_BACK:
|
||||||
|
{
|
||||||
|
hexchat_globally_back();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if(msg > 0)
|
||||||
|
{
|
||||||
|
hexchat_set_context(ph, hexchat_find_server(msg-1));
|
||||||
|
|
||||||
|
if(!hexchat_get_info(ph, "away"))
|
||||||
|
{
|
||||||
|
hexchat_away(g_szAway);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hexchat_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CALLBACK PrefProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
TCITEM tci1;
|
||||||
|
TCITEM tci2;
|
||||||
|
TCITEM tci3;
|
||||||
|
TCITEM tci4;
|
||||||
|
|
||||||
|
tci1.mask = TCIF_TEXT;
|
||||||
|
tci1.pszText = _T("Settings");
|
||||||
|
tci1.cchTextMax = strlen("Settings");
|
||||||
|
SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 0, (LPARAM)&tci1);
|
||||||
|
|
||||||
|
tci2.mask = TCIF_TEXT;
|
||||||
|
tci2.pszText = _T("Alerts");
|
||||||
|
tci2.cchTextMax = strlen("Alerts");
|
||||||
|
SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 1, (LPARAM)&tci2);
|
||||||
|
|
||||||
|
tci3.mask = TCIF_TEXT;
|
||||||
|
tci3.pszText = _T("Events");
|
||||||
|
tci3.cchTextMax = strlen("Events");
|
||||||
|
SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 2, (LPARAM)&tci3);
|
||||||
|
|
||||||
|
tci4.mask = TCIF_TEXT;
|
||||||
|
tci4.pszText = _T("About");
|
||||||
|
tci4.cchTextMax = strlen("About");
|
||||||
|
SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 3, (LPARAM)&tci4);
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************************/
|
||||||
|
/***********************************************************************************/
|
||||||
|
/***********************************************************************************/
|
||||||
|
|
||||||
|
g_hPrefTabSettings = CreateDialog((HINSTANCE)g_hInstance,
|
||||||
|
MAKEINTRESOURCE(IDD_SETTINGS),
|
||||||
|
hWnd,
|
||||||
|
(DLGPROC)SettingsProc);
|
||||||
|
SetDialog(g_hPrefTabSettings, IDD_SETTINGS);
|
||||||
|
|
||||||
|
g_hPrefTabAlerts = CreateDialog((HINSTANCE)g_hInstance,
|
||||||
|
MAKEINTRESOURCE(IDD_ALERTS),
|
||||||
|
hWnd,
|
||||||
|
(DLGPROC)AlertsProc);
|
||||||
|
SetDialog(g_hPrefTabAlerts, IDD_ALERTS);
|
||||||
|
|
||||||
|
g_hPrefTabEvents = CreateDialog((HINSTANCE)g_hInstance,
|
||||||
|
MAKEINTRESOURCE(IDD_EVENTS),
|
||||||
|
hWnd,
|
||||||
|
(DLGPROC)EventsProc);
|
||||||
|
SetDialog(g_hPrefTabEvents, IDD_EVENTS);
|
||||||
|
|
||||||
|
g_hPrefTabAbout = CreateDialog((HINSTANCE)g_hInstance,
|
||||||
|
MAKEINTRESOURCE(IDD_ABOUT),
|
||||||
|
hWnd,
|
||||||
|
(DLGPROC)AboutProc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_SHOWWINDOW:
|
||||||
|
{
|
||||||
|
if(wparam)
|
||||||
|
{
|
||||||
|
SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_SETCURSEL, 0, 0);
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_SHOW);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_HIDE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
NMHDR *pData = (NMHDR *)lparam;
|
||||||
|
|
||||||
|
switch(pData->code)
|
||||||
|
{
|
||||||
|
case TCN_SELCHANGE:
|
||||||
|
{
|
||||||
|
switch(SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_GETCURSEL, 0, 0))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_SHOW);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_HIDE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_SHOW);
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_HIDE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_SHOW);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_HIDE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_SHOW);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_HIDE);
|
||||||
|
ShowWindow(hWnd, SW_HIDE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch(wparam)
|
||||||
|
{
|
||||||
|
case IDC_PREF_OK:
|
||||||
|
{
|
||||||
|
CheckPrefs(g_hPrefTabEvents, IDD_EVENTS);
|
||||||
|
CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS);
|
||||||
|
CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS);
|
||||||
|
|
||||||
|
SavePrefs(0);
|
||||||
|
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_HIDE);
|
||||||
|
ShowWindow(hWnd, SW_HIDE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDC_PREF_CANCEL:
|
||||||
|
{
|
||||||
|
ShowWindow(g_hPrefTabEvents, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabSettings, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAlerts, SW_HIDE);
|
||||||
|
ShowWindow(g_hPrefTabAbout, SW_HIDE);
|
||||||
|
ShowWindow(hWnd, SW_HIDE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDC_PREF_APPLY:
|
||||||
|
{
|
||||||
|
CheckPrefs(g_hPrefTabEvents, IDD_EVENTS);
|
||||||
|
CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS);
|
||||||
|
CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS);
|
||||||
|
|
||||||
|
SavePrefs(0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_DESTROY:
|
||||||
|
{
|
||||||
|
SendMessage(g_hPrefTabEvents, WM_CLOSE, 0, 0);
|
||||||
|
SendMessage(g_hPrefTabSettings, WM_CLOSE, 0, 0);
|
||||||
|
SendMessage(g_hPrefTabAbout, WM_CLOSE, 0, 0);
|
||||||
|
SendMessage(g_hPrefTabAlerts, WM_CLOSE, 0, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************/
|
||||||
|
/****************************************************/
|
||||||
|
/****************************************************/
|
||||||
|
LRESULT CALLBACK AlertsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch(LOWORD(wparam))
|
||||||
|
{
|
||||||
|
case PREF_AMAE:
|
||||||
|
{
|
||||||
|
SetToggle(hWnd, PREF_OSBWM, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hWnd, PREF_UWIOB, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hWnd, PREF_KAOI, PREF_AMAE, TRUE);
|
||||||
|
|
||||||
|
if(IsDlgButtonChecked(hWnd, PREF_AMAE))
|
||||||
|
{
|
||||||
|
SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_TIME, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_AMAE, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PREF_UWIOB:
|
||||||
|
{
|
||||||
|
SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PREF_KAOI:
|
||||||
|
{
|
||||||
|
SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE);
|
||||||
|
SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************/
|
||||||
|
/****************************************************/
|
||||||
|
/****************************************************/
|
||||||
|
LRESULT CALLBACK AboutProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
if(msg == WM_CLOSE)
|
||||||
|
{
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************/
|
||||||
|
/** Process the events for our event dialog **********/
|
||||||
|
/*****************************************************/
|
||||||
|
LRESULT CALLBACK EventsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
if(msg == WM_CLOSE)
|
||||||
|
{
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************/
|
||||||
|
/** Process the events for our settings dialog this **/
|
||||||
|
/** is alot more complicated because options are **/
|
||||||
|
/** enabled/disabled based on the state of others **/
|
||||||
|
/*****************************************************/
|
||||||
|
LRESULT CALLBACK SettingsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
if(msg == WM_CLOSE)
|
||||||
|
{
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************/
|
||||||
|
/** this is the hotkey message processing function **/
|
||||||
|
/** this window is always open and ready to be told **/
|
||||||
|
/** if someone has hit the hotkey, if they did, we **/
|
||||||
|
/** need to close out all of the tray alerts, for **/
|
||||||
|
/** this I wrote sdCloseAlerts, more info there **/
|
||||||
|
/*****************************************************/
|
||||||
|
LRESULT CALLBACK HotKeyProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
if(msg == WM_CLOSE)
|
||||||
|
{
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(msg == WM_HOTKEY)
|
||||||
|
{
|
||||||
|
sdCloseAlerts();
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _H_CALLBACKS_H
|
||||||
|
#define _H_CALLBACKS_H
|
||||||
|
|
||||||
|
int event_cb (char *word[], void *userdata);
|
||||||
|
int command_cb (char *word[], char *word_eol[], void *userdata);
|
||||||
|
|
||||||
|
LRESULT CALLBACK WindowProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
BOOL CALLBACK EnumWindowsProc (HWND hWnd, LPARAM lParam);
|
||||||
|
LRESULT CALLBACK sdTrayProc (HWND hwnd, int msg);
|
||||||
|
|
||||||
|
LRESULT CALLBACK AlertProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
LRESULT CALLBACK HotKeyProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
LRESULT CALLBACK EventsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
LRESULT CALLBACK AboutProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
LRESULT CALLBACK AlertsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
LRESULT CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
int CALLBACK PrefProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,320 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 1998, 2005 Peter Zelezny, Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include "hexchat-plugin.h"
|
||||||
|
#include "hextray.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "hexchat.h"
|
||||||
|
#include "utility.h"
|
||||||
|
|
||||||
|
// from util.c of HexChat source code ( slightly modified to fit HexTray Syntax )
|
||||||
|
char *hexchat_strip_color (char *text)
|
||||||
|
{
|
||||||
|
int nc = 0;
|
||||||
|
int i = 0;
|
||||||
|
int col = 0;
|
||||||
|
int len = strlen(text);
|
||||||
|
char *new_str = (char *)malloc(len + 2);
|
||||||
|
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
if ((col && isdigit(*text) && (nc < 2)) || (col && isdigit(*(text+1)) && (nc < 3) && (*text == ',')))
|
||||||
|
{
|
||||||
|
nc++;
|
||||||
|
|
||||||
|
if(*text == ',')
|
||||||
|
{
|
||||||
|
nc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
col = 0;
|
||||||
|
|
||||||
|
switch (*text)
|
||||||
|
{
|
||||||
|
case '\003': /*ATTR_COLOR: */
|
||||||
|
{
|
||||||
|
col = 1;
|
||||||
|
nc = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\007': /*ATTR_BEEP: */
|
||||||
|
case '\017': /*ATTR_RESET: */
|
||||||
|
case '\026': /*ATTR_REVERSE: */
|
||||||
|
case '\002': /*ATTR_BOLD: */
|
||||||
|
case '\037': /*ATTR_UNDERLINE: */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
new_str[i] = *text;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
text++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_str[i] = 0;
|
||||||
|
|
||||||
|
return new_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
void check_special_chars (char *cmd)
|
||||||
|
{
|
||||||
|
int occur = 0;
|
||||||
|
int len = strlen (cmd);
|
||||||
|
int i = 0, j = 0;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
if (!len)
|
||||||
|
return;
|
||||||
|
|
||||||
|
buf = (char *)malloc (len + 1);
|
||||||
|
|
||||||
|
if (buf)
|
||||||
|
{
|
||||||
|
while (cmd[j])
|
||||||
|
{
|
||||||
|
switch (cmd[j])
|
||||||
|
{
|
||||||
|
case '%':
|
||||||
|
{
|
||||||
|
occur++;
|
||||||
|
|
||||||
|
switch (cmd[j + 1])
|
||||||
|
{
|
||||||
|
case 'R':
|
||||||
|
buf[i] = '\026';
|
||||||
|
break;
|
||||||
|
case 'U':
|
||||||
|
buf[i] = '\037';
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
buf[i] = '\002';
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
buf[i] = '\003';
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
buf[i] = '\017';
|
||||||
|
break;
|
||||||
|
case '%':
|
||||||
|
buf[i] = '%';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
buf[i] = '%';
|
||||||
|
j--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
buf[i] = cmd[j];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
j++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf[i] = 0;
|
||||||
|
|
||||||
|
if (occur)
|
||||||
|
strcpy (cmd, buf);
|
||||||
|
|
||||||
|
free (buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void hexchat_globally_away(TCHAR *tszAway)
|
||||||
|
{
|
||||||
|
char szTemp[512];
|
||||||
|
char szAway[512];
|
||||||
|
|
||||||
|
ConvertString(tszAway, szAway, 512);
|
||||||
|
_snprintf(szTemp, 512, "ALLSERV AWAY %s\0", szAway);
|
||||||
|
check_special_chars(szTemp);
|
||||||
|
hexchat_exec(szTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hexchat_away(TCHAR *tszAway)
|
||||||
|
{
|
||||||
|
char szTemp[512];
|
||||||
|
char szAway[512];
|
||||||
|
|
||||||
|
ConvertString(tszAway, szAway, 512);
|
||||||
|
_snprintf(szTemp, 512, szAway);
|
||||||
|
check_special_chars(szTemp);
|
||||||
|
hexchat_commandf(ph, "AWAY %s\0", szTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hexchat_globally_back()
|
||||||
|
{
|
||||||
|
std::vector<int> xs;
|
||||||
|
std::vector<int>::iterator xsi;
|
||||||
|
hexchat_list *xl = hexchat_list_get(ph, "channels");
|
||||||
|
|
||||||
|
if(xl)
|
||||||
|
{
|
||||||
|
while(hexchat_list_next(ph, xl))
|
||||||
|
{
|
||||||
|
xsi = std::find(xs.begin(), xs.end(), hexchat_list_int(ph, xl, "id"));
|
||||||
|
|
||||||
|
if((xsi == xs.end()) &&
|
||||||
|
((strlen(hexchat_list_str(ph, xl, "server")) > 0) ||
|
||||||
|
(strlen(hexchat_list_str(ph, xl, "channel")) > 0)))
|
||||||
|
{
|
||||||
|
xs.push_back(hexchat_list_int(ph, xl, "id"));
|
||||||
|
hexchat_set_context(ph, (hexchat_context *)hexchat_list_str(ph, xl, "context"));
|
||||||
|
hexchat_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hexchat_list_free(ph, xl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void hexchat_back()
|
||||||
|
{
|
||||||
|
if(hexchat_get_info(ph, "away"))
|
||||||
|
{
|
||||||
|
hexchat_command(ph, "BACK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HMENU setServerMenu()
|
||||||
|
{
|
||||||
|
HMENU sTemp = CreateMenu();
|
||||||
|
TCHAR wszServer[128];
|
||||||
|
TCHAR wszNick[128];
|
||||||
|
TCHAR wszMenuEntry[256];
|
||||||
|
|
||||||
|
std::vector<int> xs;
|
||||||
|
std::vector<int>::iterator xsi;
|
||||||
|
hexchat_list *xl = hexchat_list_get(ph, "channels");
|
||||||
|
|
||||||
|
AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away"));
|
||||||
|
AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back"));
|
||||||
|
AppendMenu(sTemp, MF_SEPARATOR, 0, NULL);
|
||||||
|
|
||||||
|
if(xl)
|
||||||
|
{
|
||||||
|
while(hexchat_list_next(ph, xl))
|
||||||
|
{
|
||||||
|
xsi = std::find(xs.begin(), xs.end(), hexchat_list_int(ph, xl, "id"));
|
||||||
|
|
||||||
|
if( (xsi == xs.end()) &&
|
||||||
|
((strlen(hexchat_list_str(ph, xl, "server")) > 0) ||
|
||||||
|
(strlen(hexchat_list_str(ph, xl, "channel")) > 0)))
|
||||||
|
{
|
||||||
|
hexchat_set_context(ph, (hexchat_context *)hexchat_list_str(ph, xl, "context"));
|
||||||
|
xs.push_back(hexchat_list_int(ph, xl, "id"));
|
||||||
|
|
||||||
|
char *network = _strdup(hexchat_list_str(ph, xl, "network"));
|
||||||
|
char *server = _strdup(hexchat_list_str(ph, xl, "server"));
|
||||||
|
char *nick = _strdup(hexchat_get_info(ph, "nick"));
|
||||||
|
|
||||||
|
if(network != NULL)
|
||||||
|
{
|
||||||
|
ConvertString(network, wszServer, 128);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConvertString(server, wszServer, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(server != NULL)
|
||||||
|
{
|
||||||
|
ConvertString(nick, wszNick, 128);
|
||||||
|
_sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer);
|
||||||
|
|
||||||
|
if(!hexchat_get_info(ph, "away"))
|
||||||
|
{
|
||||||
|
AppendMenu(sTemp, MF_STRING, (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(network);
|
||||||
|
free(server);
|
||||||
|
free(nick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hexchat_list_free(ph, xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct _hexchat_context *hexchat_find_server(int find_id)
|
||||||
|
{
|
||||||
|
hexchat_context *xc;
|
||||||
|
hexchat_list *xl = hexchat_list_get(ph, "channels");
|
||||||
|
int id;
|
||||||
|
|
||||||
|
if(!xl)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
while(hexchat_list_next(ph, xl))
|
||||||
|
{
|
||||||
|
id = hexchat_list_int(ph, xl, "id");
|
||||||
|
|
||||||
|
if(id == -1)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else if(id == find_id)
|
||||||
|
{
|
||||||
|
xc = (hexchat_context *)hexchat_list_str(ph, xl, "context");
|
||||||
|
|
||||||
|
hexchat_list_free(ph, xl);
|
||||||
|
|
||||||
|
return xc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hexchat_list_free(ph, xl);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void hexchat_exec(char *command)
|
||||||
|
{
|
||||||
|
hexchat_set_context(ph, hexchat_find_context(ph, NULL, NULL));
|
||||||
|
hexchat_command(ph, command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _H_XCHAT_H
|
||||||
|
#define _H_XCHAT_H
|
||||||
|
|
||||||
|
void hexchat_exec (char *);
|
||||||
|
char *hexchat_strip_color (char *);
|
||||||
|
void hexchat_parse (char *);
|
||||||
|
struct _hexchat_context *hexchat_find_server (int);
|
||||||
|
void hexchat_globally_away (TCHAR *);
|
||||||
|
void hexchat_away (TCHAR *);
|
||||||
|
void hexchat_globally_back ();
|
||||||
|
void hexchat_back ();
|
||||||
|
HMENU setServerMenu ();
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _WIN32_IE 0x0601
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <list>
|
||||||
|
#include <string>
|
||||||
|
#include <shobjidl.h>
|
||||||
|
|
||||||
|
#include "hexchat-plugin.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "callbacks.h"
|
||||||
|
#include "utility.h"
|
||||||
|
#include "hextray.h"
|
||||||
|
#include "sdTray.h"
|
||||||
|
#include "sdAlerts.h"
|
||||||
|
|
||||||
|
/*****************************************************/
|
||||||
|
/**** Don't want to pollute the namespace do we? *****/
|
||||||
|
/*****************************************************/
|
||||||
|
std::list<hexchat_hook *> g_vHooks;
|
||||||
|
|
||||||
|
/*****************************************************/
|
||||||
|
/************ Global Identifiers *********************/
|
||||||
|
/*****************************************************/
|
||||||
|
WNDPROC g_hOldProc;
|
||||||
|
hexchat_plugin *ph;
|
||||||
|
|
||||||
|
/*****************************************************/
|
||||||
|
/***************** Resources *************************/
|
||||||
|
/*****************************************************/
|
||||||
|
HWND g_hXchatWnd;
|
||||||
|
HWND g_hHotkeyWnd;
|
||||||
|
HWND g_hPrefDlg;
|
||||||
|
HMENU g_hTrayMenu;
|
||||||
|
HICON g_hIcons[24];
|
||||||
|
HANDLE g_hInstance;
|
||||||
|
/*****************************************************/
|
||||||
|
/***************** Preferences ***********************/
|
||||||
|
/*****************************************************/
|
||||||
|
unsigned int g_dwPrefs;
|
||||||
|
TCHAR g_szAway[512];
|
||||||
|
int g_iTime;
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpVoid)
|
||||||
|
{
|
||||||
|
if((fdwReason == DLL_PROCESS_ATTACH) || (fdwReason == DLL_THREAD_ATTACH))
|
||||||
|
{
|
||||||
|
g_hInstance = hModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||||
|
{
|
||||||
|
ph = plugin_handle;
|
||||||
|
|
||||||
|
*plugin_name = "HexTray";
|
||||||
|
*plugin_desc = "Minimize HexChat to the Windows system tray";
|
||||||
|
*plugin_version = "1.3.0";
|
||||||
|
|
||||||
|
char buffer[256];
|
||||||
|
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/************************* Initialize our preferences if they don't exist yet **********************************************/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
|
||||||
|
if (hexchat_pluginpref_get_int (ph, "settings") == -1)
|
||||||
|
{
|
||||||
|
hexchat_pluginpref_set_int (ph, "settings", HT_DEF_SET);
|
||||||
|
}
|
||||||
|
if (hexchat_pluginpref_get_int (ph, "aot") == -1)
|
||||||
|
{
|
||||||
|
hexchat_pluginpref_set_int (ph, "aot", HT_DEF_AOT);
|
||||||
|
}
|
||||||
|
if (hexchat_pluginpref_get_int (ph, "key") == -1)
|
||||||
|
{
|
||||||
|
hexchat_pluginpref_set_int (ph, "key", HT_DEF_KEY);
|
||||||
|
}
|
||||||
|
if (hexchat_pluginpref_get_int (ph, "mod") == -1)
|
||||||
|
{
|
||||||
|
hexchat_pluginpref_set_int (ph, "mod", HT_DEF_MOD);
|
||||||
|
}
|
||||||
|
if (hexchat_pluginpref_get_str (ph, "away", buffer) == 0)
|
||||||
|
{
|
||||||
|
hexchat_pluginpref_set_str (ph, "away", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/************************* Load our preferences ****************************************************************************/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
LoadPrefs();
|
||||||
|
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/************************* Finds the HexChat window and saves it for later use *********************************************/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
g_hXchatWnd = (HWND)hexchat_get_info(ph, "win_ptr");
|
||||||
|
|
||||||
|
if(g_hXchatWnd == NULL)
|
||||||
|
{
|
||||||
|
EnumThreadWindows(GetCurrentThreadId(), EnumWindowsProc, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hOldProc = (WNDPROC)GetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC, (LONG_PTR)WindowProc);
|
||||||
|
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/************************* Grab the HexChat Icon, Load our menu, create the window to receive the hotkey messages *********/
|
||||||
|
/************************* and register the windows message so we know if explorer crashes ***********/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
g_hTrayMenu = GetSubMenu(LoadMenu((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDR_TRAY_MENU)), 0);
|
||||||
|
g_hHotkeyWnd = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ALERT), NULL, (DLGPROC)HotKeyProc);
|
||||||
|
g_hPrefDlg = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_PREF), g_hXchatWnd, (DLGPROC)PrefProc);
|
||||||
|
|
||||||
|
g_hIcons[0] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_XCHAT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
g_hIcons[2] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_HIGHLIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
g_hIcons[5] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_BANNED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
g_hIcons[6] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_KICKED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
g_hIcons[8] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_PMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
g_hIcons[10]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_SNOTICE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
g_hIcons[11]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_DISCONNECTED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
g_hIcons[22] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_CHANMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
|
||||||
|
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/************************* Add our icon to the tray ************************************************************************/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
char szVersion[64];
|
||||||
|
_snprintf(szVersion, 64, "HexChat %s", hexchat_get_info(ph, "version"));
|
||||||
|
AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG);
|
||||||
|
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
if(g_dwPrefs & (1<<PREF_DNSIT))
|
||||||
|
{
|
||||||
|
DWORD dwStyle;
|
||||||
|
dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE);
|
||||||
|
dwStyle |= (1<<WS_CHILD);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, (LONG_PTR)g_hHotkeyWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
/************************* Set our hooks and save them for later so we can unhook them *************************************/
|
||||||
|
/***************************************************************************************************************************/
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Msg Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Message", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_MESSAGE));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Topic Change", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_TOPIC_CHANGE));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Action Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Channel INVITE", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_INVITE));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "You Kicked", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_KICKED));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Banned", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_BANNED));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "CTCP Generic", HEXCHAT_PRI_NORM, event_cb, (void *)CTCP_GENERIC));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Private Message", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Private Message to Dialog", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Disconnected", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_DISCONNECT));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Killed", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_KILLED));
|
||||||
|
g_vHooks.push_back(hexchat_hook_print(ph, "Notice", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_NOTICE));
|
||||||
|
g_vHooks.push_back(hexchat_hook_command(ph, "tray_alert", HEXCHAT_PRI_NORM, command_cb, "Create an Alert", NULL));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hexchat_plugin_deinit(hexchat_plugin *plugin_handle)
|
||||||
|
{
|
||||||
|
/******************************************/
|
||||||
|
/****** Remove the Icon from the tray *****/
|
||||||
|
/******************************************/
|
||||||
|
StopBlink(g_hXchatWnd, 1, g_hIcons[0]);
|
||||||
|
RemoveIcon(g_hXchatWnd, 1);
|
||||||
|
|
||||||
|
/*******************************************/
|
||||||
|
/*******************************************/
|
||||||
|
/*******************************************/
|
||||||
|
if(g_dwPrefs & (1<<PREF_DNSIT))
|
||||||
|
{
|
||||||
|
DWORD dwStyle;
|
||||||
|
dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE);
|
||||||
|
dwStyle &= ~(1<<WS_CHILD);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/****** Unload our resources **************/
|
||||||
|
/******************************************/
|
||||||
|
DestroyMenu(g_hTrayMenu);
|
||||||
|
|
||||||
|
for(int i = 0; i <= 11; i++)
|
||||||
|
{
|
||||||
|
DestroyIcon(g_hIcons[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/****** Remove our window hook ************/
|
||||||
|
/******************************************/
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC, (LONG_PTR)g_hOldProc);
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/****** Remove our hotkey, and destroy ****/
|
||||||
|
/****** the window that receives its ****/
|
||||||
|
/****** messages ****/
|
||||||
|
/******************************************/
|
||||||
|
UnregisterHotKey(g_hHotkeyWnd, 1);
|
||||||
|
DestroyWindow(g_hHotkeyWnd);
|
||||||
|
DestroyWindow(g_hPrefDlg);
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/************* Clean up Isle 7 ************/
|
||||||
|
/******************************************/
|
||||||
|
if(sdAlertNum())
|
||||||
|
{
|
||||||
|
sdCloseAlerts();
|
||||||
|
}
|
||||||
|
/******************************************/
|
||||||
|
/****** remove our hexchat_hook_*s **********/
|
||||||
|
/******************************************/
|
||||||
|
while(!g_vHooks.empty())
|
||||||
|
{
|
||||||
|
if(g_vHooks.back() != NULL)
|
||||||
|
{
|
||||||
|
hexchat_unhook(ph, g_vHooks.back());
|
||||||
|
}
|
||||||
|
g_vHooks.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
EXPORTS
|
||||||
|
hexchat_plugin_init
|
||||||
|
hexchat_plugin_deinit
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _XTRAY_H
|
||||||
|
#define _XTRAY_H
|
||||||
|
|
||||||
|
/******************** Default settings*****************/
|
||||||
|
#define HT_DEF_SET 13814
|
||||||
|
#define HT_DEF_AOT 5
|
||||||
|
#define HT_DEF_KEY 84
|
||||||
|
#define HT_DEF_MOD 6
|
||||||
|
|
||||||
|
/******************** Globals *************************/
|
||||||
|
extern HWND g_hXchatWnd;
|
||||||
|
extern HWND g_hHotkeyWnd;
|
||||||
|
extern HWND g_hPrefDlg;
|
||||||
|
extern HMENU g_hTrayMenu;
|
||||||
|
extern HICON g_hIcons[24];
|
||||||
|
extern HANDLE g_hInstance;
|
||||||
|
extern unsigned int g_dwPrefs;
|
||||||
|
extern TCHAR g_szAway[512];
|
||||||
|
extern int g_iTime;
|
||||||
|
extern WNDPROC g_hOldProc;
|
||||||
|
extern struct _hexchat_plugin *ph;
|
||||||
|
/******************************************************/
|
||||||
|
|
||||||
|
/******************** Messages ************************/
|
||||||
|
#define WM_TRAYMSG WM_APP
|
||||||
|
/******************************************************/
|
||||||
|
|
||||||
|
/********************* Events *************************/
|
||||||
|
#define CHAN_HILIGHT 1
|
||||||
|
#define CHAN_INVITE 2
|
||||||
|
#define CHAN_TOPIC_CHANGE 3
|
||||||
|
#define CHAN_BANNED 4
|
||||||
|
#define CHAN_KICKED 5
|
||||||
|
|
||||||
|
#define CTCP_GENERIC 6
|
||||||
|
#define PMSG_RECEIVE 7
|
||||||
|
|
||||||
|
#define SERV_KILLED 8
|
||||||
|
#define SERV_NOTICE 9
|
||||||
|
#define SERV_DISCONNECT 10
|
||||||
|
|
||||||
|
/* new events */
|
||||||
|
#define CHAN_MESSAGE 21
|
||||||
|
|
||||||
|
#define PREF_AOM 11 // away on minimize
|
||||||
|
#define PREF_TOT 12 // Tray on Taskbar
|
||||||
|
#define PREF_AMAE 13 // alert me about events
|
||||||
|
#define PREF_OSBWM 14 // Only Show Balloon When Minimized
|
||||||
|
#define PREF_UWIOB 15 // Use Window Instead of Balloon
|
||||||
|
#define PREF_KAOI 16 // Keep alerts open indefinitely
|
||||||
|
#define PREF_MIOC 17 // Minimize instead of close
|
||||||
|
#define PREF_BLINK 18 // blink icon
|
||||||
|
#define PREF_CICO 19 // change icon - not implemented
|
||||||
|
#define PREF_DNSIT 20 // Do not show in taskbar
|
||||||
|
/******************************************************/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
/* use replacement with the same value, and use SetWindowLongPtr instead
|
||||||
|
of SetWindowLong. more info:
|
||||||
|
|
||||||
|
http://msdn.microsoft.com/en-us/library/ms633591.aspx
|
||||||
|
http://msdn.microsoft.com/en-us/library/ms644898.aspx */
|
||||||
|
#define GWL_HWNDPARENT GWLP_HWNDPARENT
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Label="Configuration">
|
||||||
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{3024CF36-85E5-4E00-9608-7002E2C7EF14}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>hextray</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\win32\hexchat.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\win32\hexchat.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(HexChatBin)</OutDir>
|
||||||
|
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||||
|
<TargetName>hchextray</TargetName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(HexChatBin)</OutDir>
|
||||||
|
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||||
|
<TargetName>hchextray</TargetName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;XTRAY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<AdditionalIncludeDirectories>..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>hextray.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;XTRAY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<AdditionalIncludeDirectories>..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>hextray.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="bitmaps\sd.bmp" />
|
||||||
|
<None Include="icons\ban.ico" />
|
||||||
|
<None Include="icons\disconnect.ico" />
|
||||||
|
<None Include="icons\highlight.ico" />
|
||||||
|
<None Include="icons\kick.ico" />
|
||||||
|
<None Include="icons\message.ico" />
|
||||||
|
<None Include="icons\sd.ico" />
|
||||||
|
<None Include="icons\notice.ico" />
|
||||||
|
<None Include="icons\hexchat.ico" />
|
||||||
|
<None Include="hextray.def" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="resource.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="callbacks.cpp" />
|
||||||
|
<ClCompile Include="sdAlerts.cpp" />
|
||||||
|
<ClCompile Include="sdTray.cpp" />
|
||||||
|
<ClCompile Include="utility.cpp" />
|
||||||
|
<ClCompile Include="hexchat.cpp" />
|
||||||
|
<ClCompile Include="hextray.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="callbacks.h" />
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
|
<ClInclude Include="sdAlerts.h" />
|
||||||
|
<ClInclude Include="sdTray.h" />
|
||||||
|
<ClInclude Include="utility.h" />
|
||||||
|
<ClInclude Include="hexchat.h" />
|
||||||
|
<ClInclude Include="hextray.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files\bitmaps">
|
||||||
|
<UniqueIdentifier>{448b49a5-e68b-451e-bfbc-0855da024b2e}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files\icons">
|
||||||
|
<UniqueIdentifier>{8345128a-0635-43d6-9115-a85ad9c77ee2}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="hextray.def">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="bitmaps\sd.bmp">
|
||||||
|
<Filter>Resource Files\bitmaps</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\ban.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\disconnect.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\highlight.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\kick.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\message.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\sd.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\notice.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="icons\hexchat.ico">
|
||||||
|
<Filter>Resource Files\icons</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="resource.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="callbacks.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="sdAlerts.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="sdTray.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="utility.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="hexchat.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="hextray.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="callbacks.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="resource.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="sdAlerts.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="sdTray.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="utility.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="hexchat.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="hextray.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by resource.rc
|
||||||
|
//
|
||||||
|
#define IDD_ALERTS 104
|
||||||
|
#define IDD_EVENTS 105
|
||||||
|
#define IDD_SETTINGS 106
|
||||||
|
#define IDD_ALERT 107
|
||||||
|
#define IDD_PREF 108
|
||||||
|
#define IDD_ABOUT 109
|
||||||
|
#define IDR_TRAY_MENU 110
|
||||||
|
#define ICO_XCHAT 111
|
||||||
|
#define ICO_BANNED 112
|
||||||
|
#define ICO_CHANMSG 113
|
||||||
|
#define ICO_DISCONNECTED 114
|
||||||
|
#define ICO_HIGHLIGHT 115
|
||||||
|
#define ICO_KICKED 116
|
||||||
|
#define ICO_PMSG 117
|
||||||
|
#define ICO_SNOTICE 118
|
||||||
|
#define IDB_SD_LOGO 119
|
||||||
|
#define IDC_PREF_OK 1014
|
||||||
|
#define IDC_PREF_CANCEL 1015
|
||||||
|
#define IDC_PREF_APPLY 1016
|
||||||
|
#define IDC_AWAY_MSG 1017
|
||||||
|
#define IDC_ALERT_TIME 1018
|
||||||
|
#define IDC_TAB_CONTROL 1019
|
||||||
|
#define IDC_ALERT_HOTKEY 1020
|
||||||
|
#define IDC_ALERT_MSG 1021
|
||||||
|
#define IDC_ALERT_HOTKEY_TEXT 1022
|
||||||
|
#define IDC_ALERT_TIME_TEXT 1023
|
||||||
|
#define ACT_EXIT 40001
|
||||||
|
#define ACT_SETTINGS 40002
|
||||||
|
#define ACT_AWAY 40003
|
||||||
|
#define ACT_BACK 40004
|
||||||
|
#define ACT_RESTORE 40005
|
||||||
|
#define IDC_STATIC -1
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 120
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40006
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1024
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,309 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
#include "windows.h"
|
||||||
|
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Dialog
|
||||||
|
//
|
||||||
|
|
||||||
|
IDD_EVENTS DIALOGEX 8, 20, 216, 143
|
||||||
|
STYLE DS_SETFONT | DS_SETFOREGROUND | WS_CHILD
|
||||||
|
FONT 8, "Tahoma", 0, 0, 0x0
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "HexChat Events",IDC_STATIC,5,5,205,77
|
||||||
|
CONTROL "Banned",4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,18,49,10
|
||||||
|
CONTROL "Kicked",5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,32,49,10
|
||||||
|
CONTROL "Killed",8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,49,10
|
||||||
|
CONTROL "Disconnect",10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,60,49,10
|
||||||
|
CONTROL "Private Message",7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,18,69,10
|
||||||
|
CONTROL "Channel Message",21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,32,69,10
|
||||||
|
CONTROL "Highlight",1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,46,69,10
|
||||||
|
CONTROL "CTCP",6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,60,69,10
|
||||||
|
CONTROL "Topic Change",3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,18,55,10
|
||||||
|
CONTROL "Server Notice",9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,32,55,10
|
||||||
|
CONTROL "Invite",2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,46,55,10
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_SETTINGS DIALOGEX 8, 20, 216, 143
|
||||||
|
STYLE DS_SETFONT | WS_CHILD
|
||||||
|
FONT 8, "Tahoma", 0, 0, 0x0
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Options",IDC_STATIC,5,5,205,135
|
||||||
|
CONTROL "Auto away on minimize",11,"Button",BS_AUTOCHECKBOX |
|
||||||
|
WS_TABSTOP,16,60,100,10
|
||||||
|
CONTROL "Minimize HexChat to the system tray",12,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,16,18,133,10
|
||||||
|
CONTROL "Minimize to the tray instead of closing",17,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,16,32,174,9
|
||||||
|
EDITTEXT IDC_AWAY_MSG,33,86,169,50,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Away Msg:",IDC_STATIC,27,72,35,8
|
||||||
|
CONTROL "Remove HexChat from the taskbar (only show in tray)",
|
||||||
|
20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,191,9
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_ALERT DIALOGEX 0, 0, 151, 28
|
||||||
|
STYLE DS_LOCALEDIT | DS_SETFONT | DS_NOIDLEMSG | DS_CENTER | WS_CAPTION |
|
||||||
|
WS_SYSMENU
|
||||||
|
EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW
|
||||||
|
CAPTION "Event Name"
|
||||||
|
FONT 8, "Tahoma", 0, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
LTEXT "Event Text",IDC_ALERT_MSG,3,0,147,27
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_PREF DIALOGEX 0, 0, 233, 190
|
||||||
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION |
|
||||||
|
WS_SYSMENU
|
||||||
|
CAPTION "HexTray Preferences"
|
||||||
|
FONT 8, "Tahoma", 0, 0, 0x0
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "Ok",IDC_PREF_OK,57,173,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDC_PREF_CANCEL,115,173,50,14
|
||||||
|
PUSHBUTTON "Apply",IDC_PREF_APPLY,175,173,50,14
|
||||||
|
CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",0x0,7,7,218,159
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_ABOUT DIALOGEX 8, 20, 216, 143
|
||||||
|
STYLE DS_SETFONT | WS_CHILD
|
||||||
|
FONT 8, "Tahoma", 0, 0, 0x0
|
||||||
|
BEGIN
|
||||||
|
CONTROL 119,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN |
|
||||||
|
WS_BORDER,3,6,88,81
|
||||||
|
CTEXT "HexTray\r\nBy: Michael Hotaling\r\n www.SinisterDevelopments.com",
|
||||||
|
IDC_STATIC,95,33,118,30
|
||||||
|
LTEXT "Folken\r\nBasket\r\nDonatzsky\r\nDaemon404",IDC_STATIC,
|
||||||
|
15,103,64,33
|
||||||
|
GROUPBOX "Special Thanks To:",IDC_STATIC,3,91,89,50
|
||||||
|
GROUPBOX "Version Information:",IDC_STATIC,101,92,109,49
|
||||||
|
LTEXT "1.3.0",IDC_STATIC,170,105,33,8,0,WS_EX_RIGHT
|
||||||
|
LTEXT "Compiled In: ",IDC_STATIC,110,117,54,8
|
||||||
|
LTEXT "2012",IDC_STATIC,170,117,33,8,0,WS_EX_RIGHT
|
||||||
|
LTEXT "Version Number:",IDC_STATIC,110,105,54,8
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_ALERTS DIALOGEX 8, 20, 216, 143
|
||||||
|
STYLE DS_SETFONT | WS_CHILD
|
||||||
|
FONT 8, "Tahoma", 0, 0, 0x0
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Alerts",IDC_STATIC,5,5,205,117
|
||||||
|
CONTROL "Only show alerts while minimized",14,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,27,46,117,10
|
||||||
|
CONTROL "Use tray alerts to notify me about events",13,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,16,32,152,10
|
||||||
|
CONTROL "Use window instead of balloons",15,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,27,60,141,11
|
||||||
|
EDITTEXT IDC_ALERT_TIME,137,101,61,12,ES_AUTOHSCROLL | ES_NUMBER,
|
||||||
|
WS_EX_RIGHT
|
||||||
|
LTEXT "Show alert for x seconds:",IDC_ALERT_TIME_TEXT,40,103,
|
||||||
|
83,9
|
||||||
|
CONTROL "Alert Hotkey",IDC_ALERT_HOTKEY,"msctls_hotkey32",
|
||||||
|
WS_BORDER | WS_TABSTOP,137,74,61,13
|
||||||
|
LTEXT "Close all alerts hotkey:",IDC_ALERT_HOTKEY_TEXT,39,75,
|
||||||
|
76,10
|
||||||
|
CONTROL "Leave alerts open indefinitely",16,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,27,88,115,11
|
||||||
|
CONTROL "Blink Icon to alert me about events",18,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,16,18,127,10
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DESIGNINFO
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
GUIDELINES DESIGNINFO
|
||||||
|
BEGIN
|
||||||
|
IDD_EVENTS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
BOTTOMMARGIN, 56
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_SETTINGS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
BOTTOMMARGIN, 66
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_ALERT, DIALOG
|
||||||
|
BEGIN
|
||||||
|
RIGHTMARGIN, 150
|
||||||
|
BOTTOMMARGIN, 26
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_PREF, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 232
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 176
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_ABOUT, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 209
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 136
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_ALERTS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 208
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 136
|
||||||
|
END
|
||||||
|
END
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||||
|
"#include ""windows.h""\r\n"
|
||||||
|
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"hextray.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
4 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 1,3,0,0
|
||||||
|
PRODUCTVERSION 1,3,0,0
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x2L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "SinisterDevelopments"
|
||||||
|
VALUE "FileDescription", "HexTray"
|
||||||
|
VALUE "FileVersion", "1,3,0,0"
|
||||||
|
VALUE "InternalName", "HexTray"
|
||||||
|
VALUE "LegalCopyright", "Copyright © 2005"
|
||||||
|
VALUE "OriginalFilename", "hchextray.dll"
|
||||||
|
VALUE "ProductName", "HexTray - HexChat Win32 System Tray Plugin"
|
||||||
|
VALUE "ProductVersion", "1,3,0,0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Menu
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_TRAY_MENU MENU
|
||||||
|
BEGIN
|
||||||
|
POPUP "TRAY"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Restore", ACT_RESTORE
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Away", 65535
|
||||||
|
MENUITEM "Settings", ACT_SETTINGS
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Exit", ACT_EXIT
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
ICO_XCHAT ICON "icons\\hexchat.ico"
|
||||||
|
ICO_BANNED ICON "icons\\ban.ico"
|
||||||
|
ICO_CHANMSG ICON "icons\\message.ico"
|
||||||
|
ICO_HIGHLIGHT ICON "icons\\highlight.ico"
|
||||||
|
ICO_KICKED ICON "icons\\kick.ico"
|
||||||
|
ICO_PMSG ICON "icons\\message.ico"
|
||||||
|
ICO_SNOTICE ICON "icons\\notice.ico"
|
||||||
|
ICO_DISCONNECTED ICON "icons\\disconnect.ico"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Bitmap
|
||||||
|
//
|
||||||
|
|
||||||
|
IDB_SD_LOGO BITMAP "bitmaps\\sd.bmp"
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
hextray.h
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <winuser.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "utility.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "sdAlerts.h"
|
||||||
|
|
||||||
|
int g_iAlerts = 0;
|
||||||
|
|
||||||
|
void sdSystemAlert(HINSTANCE hModule, UINT uiDialog, char *szMsg, char *szName, unsigned int iTime)
|
||||||
|
{
|
||||||
|
TCHAR wszMsg[256];
|
||||||
|
TCHAR wszName[64];
|
||||||
|
|
||||||
|
HWND hDialog;
|
||||||
|
RECT rcWorkArea, rcDlg;
|
||||||
|
int ixPos, iyPos;
|
||||||
|
int iNumPerCol;
|
||||||
|
|
||||||
|
hDialog = CreateDialog(hModule, MAKEINTRESOURCE(uiDialog), NULL, (DLGPROC)sdAlertProc);
|
||||||
|
|
||||||
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
|
||||||
|
GetWindowRect(hDialog, &rcDlg);
|
||||||
|
|
||||||
|
iNumPerCol = ((rcWorkArea.bottom - rcWorkArea.top) / (rcDlg.bottom - rcDlg.top));
|
||||||
|
ixPos = rcWorkArea.right - (rcDlg.right - rcDlg.left) + 1;
|
||||||
|
iyPos = rcWorkArea.bottom - (rcDlg.bottom - rcDlg.top);
|
||||||
|
|
||||||
|
if((g_iAlerts >= iNumPerCol) && (iNumPerCol > 0))
|
||||||
|
{
|
||||||
|
ixPos -= ((g_iAlerts / iNumPerCol) * (rcDlg.right - rcDlg.left));
|
||||||
|
iyPos -= ((g_iAlerts - (iNumPerCol * (g_iAlerts / iNumPerCol))) * (rcDlg.bottom - rcDlg.top));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iyPos -= (g_iAlerts * (rcDlg.bottom - rcDlg.top));
|
||||||
|
}
|
||||||
|
SetWindowPos(hDialog, HWND_TOPMOST, ixPos, iyPos, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
|
|
||||||
|
ConvertString(szName, wszName, 64);
|
||||||
|
ConvertString(szMsg, wszMsg, 256);
|
||||||
|
|
||||||
|
SetWindowText(hDialog, wszName);
|
||||||
|
SetDlgItemText(hDialog, IDC_ALERT_MSG, wszMsg);
|
||||||
|
ShowWindow(hDialog, SW_SHOWNA);
|
||||||
|
|
||||||
|
if(iTime > 0)
|
||||||
|
{
|
||||||
|
SetTimer(hDialog, 1, iTime, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_iAlerts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sdCloseAlerts()
|
||||||
|
{
|
||||||
|
PostMessage(HWND_BROADCAST, RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows")), 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK sdAlertProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_CLOSE:
|
||||||
|
if(g_iAlerts > 0){ g_iAlerts--; }
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
case WM_TIMER:
|
||||||
|
if(g_iAlerts > 0){ g_iAlerts--; }
|
||||||
|
AnimateWindow(hwnd, 600, AW_SLIDE | AW_HIDE | AW_VER_POSITIVE);
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if(msg == RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows")))
|
||||||
|
{
|
||||||
|
if(g_iAlerts > 0){ g_iAlerts--; }
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sdAlertNum()
|
||||||
|
{
|
||||||
|
return g_iAlerts;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _H_SDALERTS_H
|
||||||
|
#define _H_SDALERTS_H
|
||||||
|
|
||||||
|
void sdSystemAlert (HINSTANCE, UINT, char *, char *, UINT);
|
||||||
|
LRESULT CALLBACK sdAlertProc (HWND, UINT, WPARAM, LPARAM);
|
||||||
|
int sdAlertNum ();
|
||||||
|
void sdCloseAlerts ();
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
#define _WIN32_IE 0x601
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include "sdTray.h"
|
||||||
|
#include "utility.h"
|
||||||
|
|
||||||
|
HANDLE hThread;
|
||||||
|
iBlink *tData = NULL;
|
||||||
|
|
||||||
|
int AddIcon(HWND hwnd, UINT id, HICON hicon, char *szTip, unsigned short flags, unsigned int cbMsg)
|
||||||
|
{
|
||||||
|
NOTIFYICONDATA nidata;
|
||||||
|
|
||||||
|
nidata.cbSize = NOTIFYICONDATA_V2_SIZE;
|
||||||
|
nidata.hIcon = hicon;
|
||||||
|
nidata.hWnd = hwnd;
|
||||||
|
nidata.uCallbackMessage = cbMsg;
|
||||||
|
nidata.uFlags = flags;
|
||||||
|
nidata.uID = id;
|
||||||
|
|
||||||
|
if(szTip != NULL)
|
||||||
|
{
|
||||||
|
TCHAR *szTemp = new TCHAR[64];
|
||||||
|
|
||||||
|
ConvertString(szTip, szTemp, 64);
|
||||||
|
_tcsncpy(nidata.szTip, szTemp, 64);
|
||||||
|
|
||||||
|
delete[] szTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_ADD, &nidata);
|
||||||
|
}
|
||||||
|
|
||||||
|
int RemoveIcon(HWND hwnd, UINT id)
|
||||||
|
{
|
||||||
|
if(hThread != NULL)
|
||||||
|
{
|
||||||
|
TerminateThread(hThread, 0);
|
||||||
|
hThread = NULL;
|
||||||
|
|
||||||
|
delete tData;
|
||||||
|
}
|
||||||
|
|
||||||
|
NOTIFYICONDATA nidata;
|
||||||
|
|
||||||
|
nidata.cbSize = NOTIFYICONDATA_V2_SIZE;
|
||||||
|
nidata.hWnd = hwnd;
|
||||||
|
nidata.uID = id;
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_DELETE, &nidata);
|
||||||
|
}
|
||||||
|
|
||||||
|
int SetIcon(HWND hwnd, UINT id, HICON hicon)
|
||||||
|
{
|
||||||
|
NOTIFYICONDATA nidata;
|
||||||
|
|
||||||
|
nidata.cbSize = NOTIFYICONDATA_V2_SIZE;
|
||||||
|
nidata.hWnd = hwnd;
|
||||||
|
nidata.uID = id;
|
||||||
|
nidata.hIcon = hicon;
|
||||||
|
nidata.uFlags = NIF_ICON;
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_MODIFY, &nidata);
|
||||||
|
}
|
||||||
|
|
||||||
|
int SetTooltip(HWND hwnd, UINT id, char *szTip)
|
||||||
|
{
|
||||||
|
NOTIFYICONDATA nidata;
|
||||||
|
|
||||||
|
nidata.cbSize = NOTIFYICONDATA_V2_SIZE;
|
||||||
|
nidata.hWnd = hwnd;
|
||||||
|
nidata.uID = id;
|
||||||
|
nidata.uFlags = NIF_TIP;
|
||||||
|
|
||||||
|
if(szTip != NULL)
|
||||||
|
{
|
||||||
|
TCHAR *szTemp = new TCHAR[64];
|
||||||
|
ConvertString(szTip, szTemp, 64);
|
||||||
|
_tcsncpy(nidata.szTip, szTemp, 64);
|
||||||
|
delete[] szTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_MODIFY, &nidata);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ShowBalloon(HWND hwnd, UINT id, char *szInfo, char *szTitle, UINT time, UINT infoFlags)
|
||||||
|
{
|
||||||
|
NOTIFYICONDATA nidata;
|
||||||
|
|
||||||
|
nidata.cbSize = NOTIFYICONDATA_V2_SIZE;
|
||||||
|
nidata.hWnd = hwnd;
|
||||||
|
nidata.uID = id;
|
||||||
|
nidata.uFlags = NIF_INFO;
|
||||||
|
nidata.dwInfoFlags = infoFlags;
|
||||||
|
|
||||||
|
if(time > 0)
|
||||||
|
nidata.uTimeout = time;
|
||||||
|
else
|
||||||
|
nidata.uTimeout = 500000;
|
||||||
|
|
||||||
|
if(szInfo != NULL)
|
||||||
|
{
|
||||||
|
TCHAR *szTemp = new TCHAR[255];
|
||||||
|
|
||||||
|
ConvertString(szInfo, szTemp, 251);
|
||||||
|
szTemp[250] = 0;
|
||||||
|
|
||||||
|
if(strlen(szInfo) > 255)
|
||||||
|
{
|
||||||
|
_sntprintf(szTemp, 255, _T("%s..."), szTemp);
|
||||||
|
}
|
||||||
|
_tcsncpy(nidata.szInfo, szTemp, 255);
|
||||||
|
|
||||||
|
delete[] szTemp;
|
||||||
|
}
|
||||||
|
if(szTitle != NULL)
|
||||||
|
{
|
||||||
|
TCHAR *wszTitle = new TCHAR[64];
|
||||||
|
ConvertString(szTitle, wszTitle, 64);
|
||||||
|
_tcsncpy(nidata.szInfoTitle, wszTitle, 64);
|
||||||
|
delete[] wszTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Shell_NotifyIcon(NIM_MODIFY, &nidata);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD WINAPI BlinkThread(LPVOID lpParam)
|
||||||
|
{
|
||||||
|
NOTIFYICONDATA nidata;
|
||||||
|
|
||||||
|
nidata.cbSize = NOTIFYICONDATA_V2_SIZE;
|
||||||
|
nidata.hWnd = tData->hwnd;
|
||||||
|
nidata.uID = tData->id;
|
||||||
|
nidata.uFlags = NIF_ICON;
|
||||||
|
|
||||||
|
for(UINT i = 0; i < tData->num; i++)
|
||||||
|
{
|
||||||
|
nidata.hIcon = tData->hBlink;
|
||||||
|
Shell_NotifyIcon(NIM_MODIFY, &nidata);
|
||||||
|
|
||||||
|
Sleep(tData->time);
|
||||||
|
|
||||||
|
nidata.hIcon = tData->hBase;
|
||||||
|
Shell_NotifyIcon(NIM_MODIFY, &nidata);
|
||||||
|
|
||||||
|
Sleep(tData->time);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete tData;
|
||||||
|
hThread = NULL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BlinkIcon(HWND hwnd, UINT id, HICON hBase, HICON hBlink, UINT time, UINT num)
|
||||||
|
{
|
||||||
|
if(hThread != NULL)
|
||||||
|
{
|
||||||
|
StopBlink(hwnd, id, hBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD dwThreadID;
|
||||||
|
tData = new iBlink;
|
||||||
|
|
||||||
|
tData->hwnd = hwnd;
|
||||||
|
tData->id = id;
|
||||||
|
tData->hBase = hBase;
|
||||||
|
tData->hBlink = hBlink;
|
||||||
|
tData->time = time;
|
||||||
|
tData->num = num;
|
||||||
|
|
||||||
|
hThread = CreateThread(NULL, 0, BlinkThread, tData, 0, &dwThreadID);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StopBlink(HWND hwnd, UINT id, HICON hBase)
|
||||||
|
{
|
||||||
|
if(hThread != NULL)
|
||||||
|
{
|
||||||
|
TerminateThread(hThread, 0);
|
||||||
|
hThread = NULL;
|
||||||
|
|
||||||
|
delete tData;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetIcon(hwnd, id, hBase);
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _H_SDTRAY_H
|
||||||
|
#define _H_SDTRAY_H
|
||||||
|
|
||||||
|
int AddIcon (HWND, UINT, HICON, char *, unsigned short, UINT);
|
||||||
|
int ShowBalloon (HWND, UINT, char *, char *, UINT, UINT);
|
||||||
|
int BlinkIcon (HWND, UINT, HICON, HICON, UINT, UINT);
|
||||||
|
int SetTooltip (HWND, UINT, char *);
|
||||||
|
int SetIcon (HWND, UINT, HICON);
|
||||||
|
void StopBlink (HWND, UINT, HICON);
|
||||||
|
int RemoveIcon (HWND, UINT);
|
||||||
|
|
||||||
|
typedef struct IBLINK
|
||||||
|
{
|
||||||
|
HICON hBase;
|
||||||
|
HICON hBlink;
|
||||||
|
HWND hwnd;
|
||||||
|
UINT id;
|
||||||
|
UINT time;
|
||||||
|
UINT num;
|
||||||
|
}iBlink;
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,410 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include "hexchat-plugin.h"
|
||||||
|
#include "utility.h"
|
||||||
|
#include "hextray.h"
|
||||||
|
#include "callbacks.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
struct HOTKEY g_hHotKey;
|
||||||
|
|
||||||
|
/* we need to convert ALT and SHIFT modifiers
|
||||||
|
// from <winuser.h>
|
||||||
|
#define MOD_ALT 0x0001
|
||||||
|
#define MOD_CONTROL 0x0002
|
||||||
|
#define MOD_SHIFT 0x0004
|
||||||
|
// from <commctrl.h>
|
||||||
|
#define HOTKEYF_SHIFT 0x01
|
||||||
|
#define HOTKEYF_CONTROL 0x02
|
||||||
|
#define HOTKEYF_ALT 0x04
|
||||||
|
*/
|
||||||
|
|
||||||
|
WORD HotkeyfToMod(WORD modifiers)
|
||||||
|
{
|
||||||
|
WORD newmods = 0;
|
||||||
|
|
||||||
|
if (modifiers & HOTKEYF_SHIFT)
|
||||||
|
newmods |= MOD_SHIFT;
|
||||||
|
|
||||||
|
if (modifiers & HOTKEYF_CONTROL)
|
||||||
|
newmods |= MOD_CONTROL;
|
||||||
|
|
||||||
|
if (modifiers & HOTKEYF_ALT)
|
||||||
|
newmods |= MOD_ALT;
|
||||||
|
|
||||||
|
return newmods;
|
||||||
|
}
|
||||||
|
|
||||||
|
WORD ModToHotkeyf(WORD modifiers)
|
||||||
|
{
|
||||||
|
WORD newmods = 0;
|
||||||
|
|
||||||
|
if (modifiers & MOD_SHIFT)
|
||||||
|
newmods |= HOTKEYF_SHIFT;
|
||||||
|
|
||||||
|
if (modifiers & MOD_CONTROL)
|
||||||
|
newmods |= HOTKEYF_CONTROL;
|
||||||
|
|
||||||
|
if (modifiers & MOD_ALT)
|
||||||
|
newmods |= HOTKEYF_ALT;
|
||||||
|
|
||||||
|
return newmods;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavePrefs(int iDlg)
|
||||||
|
{
|
||||||
|
hexchat_pluginpref_set_int (ph, "settings", g_dwPrefs);
|
||||||
|
hexchat_pluginpref_set_int (ph, "aot", g_iTime);
|
||||||
|
hexchat_pluginpref_set_int (ph, "key", g_hHotKey.key);
|
||||||
|
hexchat_pluginpref_set_int (ph, "mod", g_hHotKey.mod);
|
||||||
|
hexchat_pluginpref_set_str (ph, "away", (const char*) g_szAway);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadPrefs()
|
||||||
|
{
|
||||||
|
/**************************************************************************************************/
|
||||||
|
/*********************** Our Settings Section *****************************************************/
|
||||||
|
/**************************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************************************/
|
||||||
|
/*************************** Get the value for each of our preferances ****************************/
|
||||||
|
/**************************************************************************************************/
|
||||||
|
|
||||||
|
g_dwPrefs = hexchat_pluginpref_get_int (ph, "settings");
|
||||||
|
g_iTime = hexchat_pluginpref_get_int (ph, "aot");
|
||||||
|
g_hHotKey.key = hexchat_pluginpref_get_int (ph, "key");
|
||||||
|
g_hHotKey.mod = hexchat_pluginpref_get_int (ph, "mod");
|
||||||
|
hexchat_pluginpref_get_str (ph, "away", (char *) g_szAway);
|
||||||
|
|
||||||
|
/**************************************************************************************************/
|
||||||
|
/******************************** Register our hotkey with windows ********************************/
|
||||||
|
/**************************************************************************************************/
|
||||||
|
if(g_dwPrefs & (1<<PREF_UWIOB))
|
||||||
|
{
|
||||||
|
RegisterHotKey(g_hHotkeyWnd, 1, g_hHotKey.mod, g_hHotKey.key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckPrefs(HWND hwnd, int iDlg)
|
||||||
|
{
|
||||||
|
/**************************************************************************************************/
|
||||||
|
/**************** save the preferances based on the checkmarks/options ****************************/
|
||||||
|
/**************************************************************************************************/
|
||||||
|
switch(iDlg)
|
||||||
|
{
|
||||||
|
case IDD_EVENTS:
|
||||||
|
{
|
||||||
|
SetOption(hwnd, CHAN_HILIGHT, CHAN_HILIGHT);
|
||||||
|
SetOption(hwnd, CHAN_INVITE, CHAN_INVITE);
|
||||||
|
SetOption(hwnd, CHAN_TOPIC_CHANGE, CHAN_TOPIC_CHANGE);
|
||||||
|
SetOption(hwnd, CHAN_BANNED, CHAN_BANNED);
|
||||||
|
SetOption(hwnd, CHAN_KICKED, CHAN_KICKED);
|
||||||
|
SetOption(hwnd, CTCP_GENERIC, CTCP_GENERIC);
|
||||||
|
SetOption(hwnd, PMSG_RECEIVE, PMSG_RECEIVE);
|
||||||
|
SetOption(hwnd, SERV_KILLED, SERV_KILLED);
|
||||||
|
SetOption(hwnd, SERV_NOTICE, SERV_NOTICE);
|
||||||
|
SetOption(hwnd, SERV_DISCONNECT, SERV_DISCONNECT);
|
||||||
|
SetOption(hwnd, CHAN_MESSAGE, CHAN_MESSAGE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDD_ALERTS:
|
||||||
|
{
|
||||||
|
SetOption(hwnd, PREF_AMAE, PREF_AMAE);
|
||||||
|
SetOption(hwnd, PREF_OSBWM, PREF_OSBWM);
|
||||||
|
SetOption(hwnd, PREF_UWIOB, PREF_UWIOB);
|
||||||
|
SetOption(hwnd, PREF_KAOI, PREF_KAOI);
|
||||||
|
SetOption(hwnd, PREF_BLINK, PREF_BLINK);
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
TCHAR tTime[512];
|
||||||
|
|
||||||
|
GetWindowText(GetDlgItem(hwnd, IDC_ALERT_TIME), tTime, 511);
|
||||||
|
|
||||||
|
g_iTime = _tstoi(tTime);
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************** Get our Hotkey and save it **********/
|
||||||
|
/**************** then remove the old hotkey and add the new one **********/
|
||||||
|
/**************************************************************************/
|
||||||
|
DWORD hHotkey;
|
||||||
|
hHotkey = SendDlgItemMessage(hwnd, IDC_ALERT_HOTKEY, HKM_GETHOTKEY, 0, 0);
|
||||||
|
|
||||||
|
g_hHotKey.key = LOBYTE(hHotkey);
|
||||||
|
g_hHotKey.mod = HotkeyfToMod(HIBYTE(hHotkey));
|
||||||
|
|
||||||
|
if(IsDlgButtonChecked(hwnd, PREF_UWIOB) == BST_CHECKED)
|
||||||
|
{
|
||||||
|
UnregisterHotKey(g_hHotkeyWnd, 1);
|
||||||
|
RegisterHotKey(g_hHotkeyWnd, 1, g_hHotKey.mod, g_hHotKey.key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UnregisterHotKey(g_hHotkeyWnd, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*********** Get and save the away msg and alert time ********************/
|
||||||
|
/*************************************************************************/
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDD_SETTINGS:
|
||||||
|
{
|
||||||
|
SetOption(hwnd, PREF_AOM, PREF_AOM);
|
||||||
|
SetOption(hwnd, PREF_TOT, PREF_TOT);
|
||||||
|
SetOption(hwnd, PREF_MIOC, PREF_MIOC);
|
||||||
|
SetOption(hwnd, PREF_DNSIT, PREF_DNSIT);
|
||||||
|
|
||||||
|
GetDlgItemText(hwnd, IDC_AWAY_MSG, g_szAway, 511);
|
||||||
|
|
||||||
|
if(g_dwPrefs & (1<<PREF_DNSIT))
|
||||||
|
{
|
||||||
|
DWORD dwStyle;
|
||||||
|
dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE);
|
||||||
|
dwStyle |= (1<<WS_CHILD);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, (LONG_PTR)g_hHotkeyWnd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DWORD dwStyle;
|
||||||
|
dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE);
|
||||||
|
dwStyle &= ~(1<<WS_CHILD);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle);
|
||||||
|
SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDialog(HWND hwnd, int iDlg)
|
||||||
|
{
|
||||||
|
switch(iDlg)
|
||||||
|
{
|
||||||
|
case IDD_EVENTS:
|
||||||
|
{
|
||||||
|
SetCheck(hwnd, CHAN_HILIGHT, CHAN_HILIGHT);
|
||||||
|
SetCheck(hwnd, CHAN_INVITE, CHAN_INVITE);
|
||||||
|
SetCheck(hwnd, CHAN_TOPIC_CHANGE, CHAN_TOPIC_CHANGE);
|
||||||
|
SetCheck(hwnd, CHAN_BANNED, CHAN_BANNED);
|
||||||
|
SetCheck(hwnd, CHAN_KICKED, CHAN_KICKED);
|
||||||
|
SetCheck(hwnd, CTCP_GENERIC, CTCP_GENERIC);
|
||||||
|
SetCheck(hwnd, PMSG_RECEIVE, PMSG_RECEIVE);
|
||||||
|
SetCheck(hwnd, SERV_KILLED, SERV_KILLED);
|
||||||
|
SetCheck(hwnd, SERV_NOTICE, SERV_NOTICE);
|
||||||
|
SetCheck(hwnd, SERV_DISCONNECT, SERV_DISCONNECT);
|
||||||
|
SetCheck(hwnd, CHAN_MESSAGE, CHAN_MESSAGE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDD_SETTINGS:
|
||||||
|
{
|
||||||
|
SetCheck(hwnd, PREF_TOT, PREF_TOT);
|
||||||
|
SetCheck(hwnd, PREF_MIOC, PREF_MIOC);
|
||||||
|
SetCheck(hwnd, PREF_AOM, PREF_AOM);
|
||||||
|
SetCheck(hwnd, PREF_DNSIT, PREF_DNSIT);
|
||||||
|
|
||||||
|
SetDlgItemText(hwnd, IDC_AWAY_MSG, g_szAway);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDD_ALERTS:
|
||||||
|
{
|
||||||
|
|
||||||
|
SetCheck(hwnd, PREF_BLINK, PREF_BLINK);
|
||||||
|
SetCheck(hwnd, PREF_OSBWM, PREF_OSBWM);
|
||||||
|
SetCheck(hwnd, PREF_UWIOB, PREF_UWIOB);
|
||||||
|
SetCheck(hwnd, PREF_KAOI, PREF_KAOI);
|
||||||
|
|
||||||
|
/**********************************************************/
|
||||||
|
/**********************************************************/
|
||||||
|
/**********************************************************/
|
||||||
|
if(SetCheck(hwnd, PREF_AMAE, PREF_AMAE) == false)
|
||||||
|
{
|
||||||
|
SetToggle(hwnd, PREF_OSBWM, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hwnd, PREF_UWIOB, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hwnd, PREF_KAOI, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hwnd, IDC_ALERT_TIME, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hwnd, IDC_ALERT_TIME_TEXT, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hwnd, IDC_ALERT_HOTKEY, PREF_AMAE, TRUE);
|
||||||
|
SetToggle(hwnd, IDC_ALERT_HOTKEY_TEXT, PREF_AMAE, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
SetToggle(hwnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE);
|
||||||
|
SetToggle(hwnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE);
|
||||||
|
SetToggle(hwnd, IDC_ALERT_TIME, PREF_KAOI, FALSE);
|
||||||
|
SetToggle(hwnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************/
|
||||||
|
/**********************************************************/
|
||||||
|
/**********************************************************/
|
||||||
|
TCHAR tTime[255];
|
||||||
|
SendDlgItemMessage(hwnd, IDC_ALERT_TIME, WM_SETTEXT, 0, (LPARAM)_itot(g_iTime, tTime, 10));
|
||||||
|
SendDlgItemMessage(hwnd, IDC_ALERT_HOTKEY, HKM_SETHOTKEY, MAKEWORD(g_hHotKey.key, ModToHotkeyf(g_hHotKey.mod)), 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int SetCheck(HWND hDialog, unsigned int uiCheckBox, unsigned int uiPref)
|
||||||
|
{
|
||||||
|
if((g_dwPrefs & (1<<uiPref)))
|
||||||
|
{
|
||||||
|
CheckDlgButton(hDialog, uiCheckBox, BST_CHECKED);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CheckDlgButton(hDialog, uiCheckBox, BST_UNCHECKED);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SetToggle(HWND hDialog, unsigned int uiCheckBox, unsigned int uiTestbox, bool offeqoff)
|
||||||
|
{
|
||||||
|
/**************************************************************************************************/
|
||||||
|
/*********************** if(true) then if option is off turn toggle off ***************************/
|
||||||
|
/*********************** if(false) then if option is off turn toggle on ***************************/
|
||||||
|
/**************************************************************************************************/
|
||||||
|
if(offeqoff)
|
||||||
|
{
|
||||||
|
if(IsDlgButtonChecked(hDialog, uiTestbox) == BST_CHECKED)
|
||||||
|
{
|
||||||
|
EnableWindow(GetDlgItem(hDialog, uiCheckBox), TRUE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnableWindow(GetDlgItem(hDialog, uiCheckBox), FALSE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(IsDlgButtonChecked(hDialog, uiTestbox) == BST_CHECKED)
|
||||||
|
{
|
||||||
|
EnableWindow(GetDlgItem(hDialog, uiCheckBox), FALSE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnableWindow(GetDlgItem(hDialog, uiCheckBox), TRUE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SetOption(HWND hDialog, unsigned int uiCheckBox, unsigned int uiPref)
|
||||||
|
{
|
||||||
|
if(IsDlgButtonChecked(hDialog, uiCheckBox) == BST_CHECKED)
|
||||||
|
{
|
||||||
|
g_dwPrefs |= (1<<uiPref);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_dwPrefs &= ~(1<<uiPref);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (g_dwPrefs & (1<<uiPref));
|
||||||
|
}
|
||||||
|
|
||||||
|
// For cleanup ( Closing windows and the such )
|
||||||
|
void HoldClose()
|
||||||
|
{
|
||||||
|
HANDLE hcThread;
|
||||||
|
DWORD dwThreadID;
|
||||||
|
hcThread = CreateThread(NULL, 0, HoldCloseThread, 0, 0, &dwThreadID);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD WINAPI HoldCloseThread(LPVOID lpParam)
|
||||||
|
{
|
||||||
|
Sleep(1000);
|
||||||
|
PostMessage(g_hXchatWnd, WM_CLOSE, 0, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FileExists(TCHAR *file)
|
||||||
|
{
|
||||||
|
HANDLE hTemp = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
int nRet = GetLastError();
|
||||||
|
CloseHandle(hTemp);
|
||||||
|
|
||||||
|
if(nRet == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConvertString(const char *in, wchar_t *out, int size)
|
||||||
|
{
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, in, -1, out, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConvertString(const wchar_t *in, char *out, int size)
|
||||||
|
{
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, in, (size - 1), out, size, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConvertString(const char *in, char *out, int size)
|
||||||
|
{
|
||||||
|
strncpy(out, in, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ErrorDebug(LPTSTR lpszFunction)
|
||||||
|
{
|
||||||
|
TCHAR szBuf[80];
|
||||||
|
LPVOID lpMsgBuf;
|
||||||
|
DWORD dw = GetLastError();
|
||||||
|
|
||||||
|
FormatMessage(
|
||||||
|
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
|
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
|
NULL,
|
||||||
|
dw,
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(LPTSTR) &lpMsgBuf,
|
||||||
|
0, NULL );
|
||||||
|
|
||||||
|
_stprintf(szBuf,
|
||||||
|
_T("%s failed with error %d: %s"),
|
||||||
|
lpszFunction, dw, lpMsgBuf);
|
||||||
|
|
||||||
|
MessageBox(NULL, szBuf, _T("Error"), MB_OK);
|
||||||
|
|
||||||
|
LocalFree(lpMsgBuf);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/* X-Tray
|
||||||
|
* Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
|
||||||
|
*
|
||||||
|
* X-Tray is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* X-Tray is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with X-Tray; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _H_UTILITY_H
|
||||||
|
#define _H_UTILITY_H
|
||||||
|
|
||||||
|
WORD HotkeyfToMod (WORD);
|
||||||
|
WORD ModToHotkeyf (WORD);
|
||||||
|
|
||||||
|
int SetOption (HWND, unsigned int, unsigned int);
|
||||||
|
int SetCheck (HWND, unsigned int, unsigned int);
|
||||||
|
int SetToggle (HWND, unsigned int, unsigned int, bool);
|
||||||
|
void ErrorDebug (LPTSTR lpszFunction);
|
||||||
|
void SetDialog (HWND, int);
|
||||||
|
void CheckPrefs (HWND, int);
|
||||||
|
bool FileExists (TCHAR *);
|
||||||
|
DWORD WINAPI HoldCloseThread (LPVOID);
|
||||||
|
void SavePrefs (int);
|
||||||
|
void LoadPrefs ();
|
||||||
|
void HoldClose ();
|
||||||
|
|
||||||
|
void ConvertString(const char *in, wchar_t *out, int size);
|
||||||
|
void ConvertString(const wchar_t *in, char *out, int size);
|
||||||
|
void ConvertString(const char *in, char *out, int size);
|
||||||
|
|
||||||
|
struct HOTKEY
|
||||||
|
{
|
||||||
|
WORD key;
|
||||||
|
WORD mod;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -10,25 +10,27 @@ use overload
|
|||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
|
my $line = shift;
|
||||||
|
|
||||||
my @autojoins;
|
my @autojoins;
|
||||||
|
|
||||||
return bless \@autojoins, $class;
|
if ( $line ) {
|
||||||
}
|
my ( $channels, $keys ) = split / /, $line, 2;
|
||||||
|
my @channels = split /,/, $channels;
|
||||||
|
my @keys = split /,/, ($keys || '');
|
||||||
|
|
||||||
sub add {
|
for my $channel ( @channels ) {
|
||||||
my $self = shift;
|
my $key = shift @keys;
|
||||||
|
$key = '' unless defined $key;
|
||||||
|
|
||||||
my $line = shift;
|
push @autojoins, {
|
||||||
|
|
||||||
my ( $channel, $key ) = split /,/, $line, 2;
|
|
||||||
$key = $key || '';
|
|
||||||
|
|
||||||
push @$self, {
|
|
||||||
channel => $channel,
|
channel => $channel,
|
||||||
key => $key,
|
key => $key,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return bless \@autojoins, $class;
|
||||||
|
}
|
||||||
|
|
||||||
sub channels {
|
sub channels {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ sub parse {
|
|||||||
my @fields = split /\n/, $data;
|
my @fields = split /\n/, $data;
|
||||||
chomp @fields;
|
chomp @fields;
|
||||||
|
|
||||||
$entry->{ autojoins } = Xchat::List::Network::AutoJoin->new();
|
|
||||||
|
|
||||||
for my $field ( @fields ) {
|
for my $field ( @fields ) {
|
||||||
SWITCH: for ( $field ) {
|
SWITCH: for ( $field ) {
|
||||||
/^($letter_key_re)=(.*)/ && do {
|
/^($letter_key_re)=(.*)/ && do {
|
||||||
@@ -49,7 +47,8 @@ sub parse {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/^J.(.*)/ && do {
|
/^J.(.*)/ && do {
|
||||||
$entry->{ autojoins }->add( $1 );
|
$entry->{ autojoins } =
|
||||||
|
Xchat::List::Network::AutoJoin->new( $1 );
|
||||||
};
|
};
|
||||||
|
|
||||||
/^F.(.*)/ && do {
|
/^F.(.*)/ && do {
|
||||||
|
|||||||
@@ -1520,7 +1520,7 @@ perl_command_unload (char *word[], char *word_eol[], void *userdata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
perl_command_reload (char *word[], char *word_eol[], void *eat)
|
perl_command_reload (char *word[], char *word_eol[], void *userdata)
|
||||||
{
|
{
|
||||||
char *file = get_filename (word, word_eol);
|
char *file = get_filename (word, word_eol);
|
||||||
|
|
||||||
@@ -1529,10 +1529,7 @@ perl_command_reload (char *word[], char *word_eol[], void *eat)
|
|||||||
return HEXCHAT_EAT_HEXCHAT;
|
return HEXCHAT_EAT_HEXCHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eat)
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return HEXCHAT_EAT_HEXCHAT;
|
||||||
else
|
|
||||||
return HEXCHAT_EAT_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1573,7 +1570,7 @@ hexchat_plugin_init (hexchat_plugin * plugin_handle, char **plugin_name,
|
|||||||
hexchat_hook_command (ph, "reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
|
hexchat_hook_command (ph, "reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
|
||||||
0);
|
0);
|
||||||
hexchat_hook_command (ph, "pl_reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
|
hexchat_hook_command (ph, "pl_reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
|
||||||
(int*)1);
|
0);
|
||||||
hexchat_hook_command (ph, "unloadall", HEXCHAT_PRI_NORM,
|
hexchat_hook_command (ph, "unloadall", HEXCHAT_PRI_NORM,
|
||||||
perl_command_unloadall, 0, 0);
|
perl_command_unloadall, 0, 0);
|
||||||
hexchat_hook_command (ph, "reloadall", HEXCHAT_PRI_NORM,
|
hexchat_hook_command (ph, "reloadall", HEXCHAT_PRI_NORM,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PERL518_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PERL518_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -88,6 +89,7 @@ move xchat.pm.h "$(IntDir)"</Command>
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PERL518_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PERL518_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -72,23 +72,15 @@
|
|||||||
#include <structmember.h>
|
#include <structmember.h>
|
||||||
#include <pythread.h>
|
#include <pythread.h>
|
||||||
|
|
||||||
/* Macros to convert version macros into string literals.
|
|
||||||
* The indirect macro is a well-known preprocessor trick to force X to be evaluated before the # operator acts to make it a string literal.
|
|
||||||
* If STRINGIZE were to be directly defined as #X instead, VERSION would be "VERSION_MAJOR" instead of "1".
|
|
||||||
*/
|
|
||||||
#define STRINGIZE2(X) #X
|
|
||||||
#define STRINGIZE(X) STRINGIZE2(X)
|
|
||||||
|
|
||||||
/* Version number macros */
|
|
||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
|
|
||||||
/* Version string macro e.g 1.0/3.3 */
|
|
||||||
#define VERSION STRINGIZE(VERSION_MAJOR) "." STRINGIZE(VERSION_MINOR) "/" \
|
|
||||||
STRINGIZE(PY_MAJOR_VERSION) "." STRINGIZE (PY_MINOR_VERSION)
|
|
||||||
|
|
||||||
/* #define's for Python 2 */
|
|
||||||
#if PY_MAJOR_VERSION == 2
|
#if PY_MAJOR_VERSION == 2
|
||||||
|
#ifdef WIN32
|
||||||
|
#undef WITH_THREAD
|
||||||
|
#define VERSION "1.0/2.7" /* Linked to python27.dll */
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef PyLong_Check
|
#undef PyLong_Check
|
||||||
#define PyLong_Check PyInt_Check
|
#define PyLong_Check PyInt_Check
|
||||||
#define PyLong_AsLong PyInt_AsLong
|
#define PyLong_AsLong PyInt_AsLong
|
||||||
@@ -103,14 +95,15 @@
|
|||||||
#define PyUnicode_FromString PyString_FromString
|
#define PyUnicode_FromString PyString_FromString
|
||||||
#define PyUnicode_AsUTF8 PyString_AsString
|
#define PyUnicode_AsUTF8 PyString_AsString
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define IS_PY3K
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#undef WITH_THREAD
|
#define VERSION "1.0/3.3" /* Linked to python33.dll */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #define for Python 3 */
|
#ifndef VERSION
|
||||||
#if PY_MAJOR_VERSION == 3
|
#define VERSION "1.0"
|
||||||
#define IS_PY3K
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NONE 0
|
#define NONE 0
|
||||||
@@ -218,8 +211,7 @@ static PyThreadState *pTempThread;
|
|||||||
((PluginObject *)(x))->gui = (y);
|
((PluginObject *)(x))->gui = (y);
|
||||||
|
|
||||||
#define HOOK_XCHAT 1
|
#define HOOK_XCHAT 1
|
||||||
#define HOOK_XCHAT_ATTR 2
|
#define HOOK_UNLOAD 2
|
||||||
#define HOOK_UNLOAD 3
|
|
||||||
|
|
||||||
/* ===================================================================== */
|
/* ===================================================================== */
|
||||||
/* Object definitions */
|
/* Object definitions */
|
||||||
@@ -234,24 +226,12 @@ typedef struct {
|
|||||||
hexchat_context *context;
|
hexchat_context *context;
|
||||||
} ContextObject;
|
} ContextObject;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *time;
|
|
||||||
} AttributeObject;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
const char *listname;
|
const char *listname;
|
||||||
PyObject *dict;
|
PyObject *dict;
|
||||||
} ListItemObject;
|
} ListItemObject;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
hexchat_list *list;
|
|
||||||
char *name;
|
|
||||||
} ListObject;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
char *name;
|
char *name;
|
||||||
@@ -281,9 +261,7 @@ static PyObject *Util_BuildList(char *word[]);
|
|||||||
static void Util_Autoload();
|
static void Util_Autoload();
|
||||||
static char *Util_Expand(char *filename);
|
static char *Util_Expand(char *filename);
|
||||||
|
|
||||||
static int Callback_Server(char *word[], char *word_eol[], hexchat_event_attrs *attrs, void *userdata);
|
|
||||||
static int Callback_Command(char *word[], char *word_eol[], void *userdata);
|
static int Callback_Command(char *word[], char *word_eol[], void *userdata);
|
||||||
static int Callback_Print_Attrs(char *word[], hexchat_event_attrs *attrs, void *userdata);
|
|
||||||
static int Callback_Print(char *word[], void *userdata);
|
static int Callback_Print(char *word[], void *userdata);
|
||||||
static int Callback_Timer(void *userdata);
|
static int Callback_Timer(void *userdata);
|
||||||
static int Callback_ThreadTimer(void *userdata);
|
static int Callback_ThreadTimer(void *userdata);
|
||||||
@@ -292,8 +270,6 @@ static PyObject *XChatOut_New();
|
|||||||
static PyObject *XChatOut_write(PyObject *self, PyObject *args);
|
static PyObject *XChatOut_write(PyObject *self, PyObject *args);
|
||||||
static void XChatOut_dealloc(PyObject *self);
|
static void XChatOut_dealloc(PyObject *self);
|
||||||
|
|
||||||
static PyObject *Attribute_New(hexchat_event_attrs *attrs);
|
|
||||||
|
|
||||||
static void Context_dealloc(PyObject *self);
|
static void Context_dealloc(PyObject *self);
|
||||||
static PyObject *Context_set(ContextObject *self, PyObject *args);
|
static PyObject *Context_set(ContextObject *self, PyObject *args);
|
||||||
static PyObject *Context_command(ContextObject *self, PyObject *args);
|
static PyObject *Context_command(ContextObject *self, PyObject *args);
|
||||||
@@ -355,8 +331,6 @@ static PyTypeObject Plugin_Type;
|
|||||||
static PyTypeObject XChatOut_Type;
|
static PyTypeObject XChatOut_Type;
|
||||||
static PyTypeObject Context_Type;
|
static PyTypeObject Context_Type;
|
||||||
static PyTypeObject ListItem_Type;
|
static PyTypeObject ListItem_Type;
|
||||||
static PyTypeObject Attribute_Type;
|
|
||||||
static PyTypeObject List_Type;
|
|
||||||
|
|
||||||
static PyThreadState *main_tstate = NULL;
|
static PyThreadState *main_tstate = NULL;
|
||||||
static void *thread_timer = NULL;
|
static void *thread_timer = NULL;
|
||||||
@@ -381,7 +355,10 @@ Usage: /PY LOAD <filename>\n\
|
|||||||
ABOUT\n\
|
ABOUT\n\
|
||||||
\n";
|
\n";
|
||||||
|
|
||||||
static const char about[] = "HexChat Python interface version " VERSION "\n";
|
/* Remove if/when HexChat supports this command for plugins */
|
||||||
|
static const char reload[] = "Usage: RELOAD <name>, reloads a python script";
|
||||||
|
|
||||||
|
static const char about[] = "HexChat Python " PY_VERSION " Interface Version " VERSION "\n";
|
||||||
|
|
||||||
/* ===================================================================== */
|
/* ===================================================================== */
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
@@ -510,58 +487,6 @@ Util_ReleaseThread(PyThreadState *tstate)
|
|||||||
/* Hookable functions. These are the entry points to python code, besides
|
/* Hookable functions. These are the entry points to python code, besides
|
||||||
* the load function, and the hooks for interactive interpreter. */
|
* the load function, and the hooks for interactive interpreter. */
|
||||||
|
|
||||||
static int
|
|
||||||
Callback_Server(char *word[], char *word_eol[], hexchat_event_attrs *attrs, void *userdata)
|
|
||||||
{
|
|
||||||
Hook *hook = (Hook *) userdata;
|
|
||||||
PyObject *retobj;
|
|
||||||
PyObject *word_list, *word_eol_list;
|
|
||||||
PyObject *attributes;
|
|
||||||
int ret = 0;
|
|
||||||
PyObject *plugin;
|
|
||||||
|
|
||||||
plugin = hook->plugin;
|
|
||||||
BEGIN_PLUGIN(plugin);
|
|
||||||
|
|
||||||
word_list = Util_BuildList(word+1);
|
|
||||||
if (word_list == NULL) {
|
|
||||||
END_PLUGIN(plugin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
word_eol_list = Util_BuildList(word_eol+1);
|
|
||||||
if (word_eol_list == NULL) {
|
|
||||||
Py_DECREF(word_list);
|
|
||||||
END_PLUGIN(plugin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes = Attribute_New(attrs);
|
|
||||||
|
|
||||||
if (hook->type == HOOK_XCHAT_ATTR)
|
|
||||||
retobj = PyObject_CallFunction(hook->callback, "(OOOO)", word_list,
|
|
||||||
word_eol_list, hook->userdata, attributes);
|
|
||||||
else
|
|
||||||
retobj = PyObject_CallFunction(hook->callback, "(OOO)", word_list,
|
|
||||||
word_eol_list, hook->userdata);
|
|
||||||
Py_DECREF(word_list);
|
|
||||||
Py_DECREF(word_eol_list);
|
|
||||||
Py_DECREF(attributes);
|
|
||||||
|
|
||||||
if (retobj == Py_None) {
|
|
||||||
ret = HEXCHAT_EAT_NONE;
|
|
||||||
Py_DECREF(retobj);
|
|
||||||
} else if (retobj) {
|
|
||||||
ret = PyLong_AsLong(retobj);
|
|
||||||
Py_DECREF(retobj);
|
|
||||||
} else {
|
|
||||||
PyErr_Print();
|
|
||||||
}
|
|
||||||
|
|
||||||
END_PLUGIN(plugin);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
Callback_Command(char *word[], char *word_eol[], void *userdata)
|
Callback_Command(char *word[], char *word_eol[], void *userdata)
|
||||||
{
|
{
|
||||||
@@ -606,96 +531,7 @@ Callback_Command(char *word[], char *word_eol[], void *userdata)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
/* No Callback_Server() here. We use Callback_Command() as well. */
|
||||||
Callback_Print_Attrs(char *word[], hexchat_event_attrs *attrs, void *userdata)
|
|
||||||
{
|
|
||||||
Hook *hook = (Hook *) userdata;
|
|
||||||
PyObject *retobj;
|
|
||||||
PyObject *word_list;
|
|
||||||
PyObject *word_eol_list;
|
|
||||||
PyObject *attributes;
|
|
||||||
char **word_eol;
|
|
||||||
char *word_eol_raw;
|
|
||||||
int listsize = 0;
|
|
||||||
int next = 0;
|
|
||||||
int i;
|
|
||||||
int ret = 0;
|
|
||||||
PyObject *plugin;
|
|
||||||
|
|
||||||
/* Cut off the message identifier. */
|
|
||||||
word += 1;
|
|
||||||
|
|
||||||
/* HexChat doesn't provide a word_eol for print events, so we
|
|
||||||
* build our own here. */
|
|
||||||
while (word[listsize] && word[listsize][0])
|
|
||||||
listsize++;
|
|
||||||
word_eol = (char **) g_malloc(sizeof(char*)*(listsize+1));
|
|
||||||
if (word_eol == NULL) {
|
|
||||||
hexchat_print(ph, "Not enough memory to alloc word_eol "
|
|
||||||
"for python plugin callback.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* First build a word clone, but NULL terminated. */
|
|
||||||
memcpy(word_eol, word, listsize*sizeof(char*));
|
|
||||||
word_eol[listsize] = NULL;
|
|
||||||
/* Then join it. */
|
|
||||||
word_eol_raw = g_strjoinv(" ", word_eol);
|
|
||||||
if (word_eol_raw == NULL) {
|
|
||||||
hexchat_print(ph, "Not enough memory to alloc word_eol_raw "
|
|
||||||
"for python plugin callback.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* And rebuild the real word_eol. */
|
|
||||||
for (i = 0; i != listsize; i++) {
|
|
||||||
word_eol[i] = word_eol_raw+next;
|
|
||||||
next += strlen(word[i])+1;
|
|
||||||
}
|
|
||||||
word_eol[i] = "";
|
|
||||||
|
|
||||||
plugin = hook->plugin;
|
|
||||||
BEGIN_PLUGIN(plugin);
|
|
||||||
|
|
||||||
word_list = Util_BuildList(word);
|
|
||||||
if (word_list == NULL) {
|
|
||||||
g_free(word_eol_raw);
|
|
||||||
g_free(word_eol);
|
|
||||||
END_PLUGIN(plugin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
word_eol_list = Util_BuildList(word_eol);
|
|
||||||
if (word_eol_list == NULL) {
|
|
||||||
g_free(word_eol_raw);
|
|
||||||
g_free(word_eol);
|
|
||||||
Py_DECREF(word_list);
|
|
||||||
END_PLUGIN(plugin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes = Attribute_New(attrs);
|
|
||||||
|
|
||||||
retobj = PyObject_CallFunction(hook->callback, "(OOOO)", word_list,
|
|
||||||
word_eol_list, hook->userdata, attributes);
|
|
||||||
|
|
||||||
Py_DECREF(word_list);
|
|
||||||
Py_DECREF(word_eol_list);
|
|
||||||
Py_DECREF(attributes);
|
|
||||||
|
|
||||||
g_free(word_eol_raw);
|
|
||||||
g_free(word_eol);
|
|
||||||
if (retobj == Py_None) {
|
|
||||||
ret = HEXCHAT_EAT_NONE;
|
|
||||||
Py_DECREF(retobj);
|
|
||||||
} else if (retobj) {
|
|
||||||
ret = PyLong_AsLong(retobj);
|
|
||||||
Py_DECREF(retobj);
|
|
||||||
} else {
|
|
||||||
PyErr_Print();
|
|
||||||
}
|
|
||||||
|
|
||||||
END_PLUGIN(plugin);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
Callback_Print(char *word[], void *userdata)
|
Callback_Print(char *word[], void *userdata)
|
||||||
@@ -761,10 +597,8 @@ Callback_Print(char *word[], void *userdata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
retobj = PyObject_CallFunction(hook->callback, "(OOO)", word_list,
|
retobj = PyObject_CallFunction(hook->callback, "(OOO)", word_list,
|
||||||
word_eol_list, hook->userdata);
|
word_eol_list, hook->userdata);
|
||||||
|
|
||||||
Py_DECREF(word_list);
|
Py_DECREF(word_list);
|
||||||
Py_DECREF(word_eol_list);
|
Py_DECREF(word_eol_list);
|
||||||
|
|
||||||
@@ -988,85 +822,6 @@ static PyTypeObject XChatOut_Type = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* ===================================================================== */
|
|
||||||
/* Attribute object */
|
|
||||||
|
|
||||||
#undef OFF
|
|
||||||
#define OFF(x) offsetof(AttributeObject, x)
|
|
||||||
|
|
||||||
static PyMemberDef Attribute_members[] = {
|
|
||||||
{"time", T_OBJECT, OFF(time), 0},
|
|
||||||
{0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
Attribute_dealloc(PyObject *self)
|
|
||||||
{
|
|
||||||
Py_DECREF(((AttributeObject*)self)->time);
|
|
||||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
Attribute_repr(PyObject *self)
|
|
||||||
{
|
|
||||||
return PyUnicode_FromFormat("<Attribute object at %p>", self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyTypeObject Attribute_Type = {
|
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
|
||||||
"hexchat.Attribute", /*tp_name*/
|
|
||||||
sizeof(AttributeObject), /*tp_basicsize*/
|
|
||||||
0, /*tp_itemsize*/
|
|
||||||
Attribute_dealloc, /*tp_dealloc*/
|
|
||||||
0, /*tp_print*/
|
|
||||||
0, /*tp_getattr*/
|
|
||||||
0, /*tp_setattr*/
|
|
||||||
0, /*tp_compare*/
|
|
||||||
Attribute_repr, /*tp_repr*/
|
|
||||||
0, /*tp_as_number*/
|
|
||||||
0, /*tp_as_sequence*/
|
|
||||||
0, /*tp_as_mapping*/
|
|
||||||
0, /*tp_hash*/
|
|
||||||
0, /*tp_call*/
|
|
||||||
0, /*tp_str*/
|
|
||||||
PyObject_GenericGetAttr,/*tp_getattro*/
|
|
||||||
PyObject_GenericSetAttr,/*tp_setattro*/
|
|
||||||
0, /*tp_as_buffer*/
|
|
||||||
Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
|
||||||
0, /*tp_doc*/
|
|
||||||
0, /*tp_traverse*/
|
|
||||||
0, /*tp_clear*/
|
|
||||||
0, /*tp_richcompare*/
|
|
||||||
0, /*tp_weaklistoffset*/
|
|
||||||
0, /*tp_iter*/
|
|
||||||
0, /*tp_iternext*/
|
|
||||||
0, /*tp_methods*/
|
|
||||||
Attribute_members, /*tp_members*/
|
|
||||||
0, /*tp_getset*/
|
|
||||||
0, /*tp_base*/
|
|
||||||
0, /*tp_dict*/
|
|
||||||
0, /*tp_descr_get*/
|
|
||||||
0, /*tp_descr_set*/
|
|
||||||
0, /*tp_dictoffset*/
|
|
||||||
0, /*tp_init*/
|
|
||||||
PyType_GenericAlloc, /*tp_alloc*/
|
|
||||||
PyType_GenericNew, /*tp_new*/
|
|
||||||
PyObject_Del, /*tp_free*/
|
|
||||||
0, /*tp_is_gc*/
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
Attribute_New(hexchat_event_attrs *attrs)
|
|
||||||
{
|
|
||||||
AttributeObject *attr;
|
|
||||||
attr = PyObject_New(AttributeObject, &Attribute_Type);
|
|
||||||
if (attr != NULL) {
|
|
||||||
attr->time = PyLong_FromLong((long)attrs->server_time_utc);
|
|
||||||
}
|
|
||||||
return (PyObject *) attr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ===================================================================== */
|
/* ===================================================================== */
|
||||||
/* Context object */
|
/* Context object */
|
||||||
|
|
||||||
@@ -1114,31 +869,22 @@ Context_prnt(ContextObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
Context_emit_print(ContextObject *self, PyObject *args, PyObject *kwargs)
|
Context_emit_print(ContextObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
char *argv[6];
|
char *argv[10];
|
||||||
char *name;
|
char *name;
|
||||||
int res;
|
int res;
|
||||||
long time = 0;
|
memset(&argv, 0, sizeof(char*)*10);
|
||||||
hexchat_event_attrs *attrs;
|
if (!PyArg_ParseTuple(args, "s|ssssss:print_event", &name,
|
||||||
char *kwlist[] = {"name", "arg1", "arg2", "arg3",
|
|
||||||
"arg4", "arg5", "arg6",
|
|
||||||
"time", NULL};
|
|
||||||
memset(&argv, 0, sizeof(char*)*6);
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ssssssl:print_event", kwlist, &name,
|
|
||||||
&argv[0], &argv[1], &argv[2],
|
&argv[0], &argv[1], &argv[2],
|
||||||
&argv[3], &argv[4], &argv[5],
|
&argv[3], &argv[4], &argv[5],
|
||||||
&time))
|
&argv[6], &argv[7], &argv[8]))
|
||||||
return NULL;
|
return NULL;
|
||||||
BEGIN_XCHAT_CALLS(ALLOW_THREADS);
|
BEGIN_XCHAT_CALLS(ALLOW_THREADS);
|
||||||
hexchat_set_context(ph, self->context);
|
hexchat_set_context(ph, self->context);
|
||||||
attrs = hexchat_event_attrs_create(ph);
|
res = hexchat_emit_print(ph, name, argv[0], argv[1], argv[2],
|
||||||
attrs->server_time_utc = (time_t)time;
|
argv[3], argv[4], argv[5],
|
||||||
|
argv[6], argv[7], argv[8]);
|
||||||
res = hexchat_emit_print_attrs(ph, attrs, name, argv[0], argv[1], argv[2],
|
|
||||||
argv[3], argv[4], argv[5], NULL);
|
|
||||||
|
|
||||||
hexchat_event_attrs_free(ph, attrs);
|
|
||||||
END_XCHAT_CALLS();
|
END_XCHAT_CALLS();
|
||||||
return PyLong_FromLong(res);
|
return PyLong_FromLong(res);
|
||||||
}
|
}
|
||||||
@@ -1199,7 +945,7 @@ static PyMethodDef Context_methods[] = {
|
|||||||
{"set", (PyCFunction) Context_set, METH_NOARGS},
|
{"set", (PyCFunction) Context_set, METH_NOARGS},
|
||||||
{"command", (PyCFunction) Context_command, METH_VARARGS},
|
{"command", (PyCFunction) Context_command, METH_VARARGS},
|
||||||
{"prnt", (PyCFunction) Context_prnt, METH_VARARGS},
|
{"prnt", (PyCFunction) Context_prnt, METH_VARARGS},
|
||||||
{"emit_print", (PyCFunction) Context_emit_print, METH_VARARGS|METH_KEYWORDS},
|
{"emit_print", (PyCFunction) Context_emit_print, METH_VARARGS},
|
||||||
{"get_info", (PyCFunction) Context_get_info, METH_VARARGS},
|
{"get_info", (PyCFunction) Context_get_info, METH_VARARGS},
|
||||||
{"get_list", (PyCFunction) Context_get_list, METH_VARARGS},
|
{"get_list", (PyCFunction) Context_get_list, METH_VARARGS},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
@@ -1358,167 +1104,7 @@ ListItem_New(const char *listname)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (PyObject *) item;
|
return (PyObject *) item;
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ===================================================================== */
|
|
||||||
/* List object */
|
|
||||||
|
|
||||||
#undef OFF
|
|
||||||
#define OFF(x) offsetof(ListObject, x)
|
|
||||||
|
|
||||||
static void
|
|
||||||
List_dealloc(PyObject *self)
|
|
||||||
{
|
|
||||||
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT);
|
|
||||||
hexchat_list_free(ph, ((ListObject*)self)->list);
|
|
||||||
END_XCHAT_CALLS();
|
|
||||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
List_repr(PyObject *self)
|
|
||||||
{
|
|
||||||
return PyUnicode_FromFormat("<%s list at %p>", ((ListObject*)self)->name, self);
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
List_iter(PyObject *self)
|
|
||||||
{
|
|
||||||
Py_INCREF(self);
|
|
||||||
return self;
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
List_iternext(PyObject *self)
|
|
||||||
{
|
|
||||||
hexchat_list *list = ((ListObject *)self)->list;
|
|
||||||
char *name = ((ListObject *)self)->name;
|
|
||||||
PyObject *o = NULL;
|
|
||||||
const char * const *fields;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT);
|
|
||||||
fields = hexchat_list_fields(ph, name);
|
|
||||||
if (hexchat_list_next(ph, list))
|
|
||||||
{
|
|
||||||
o = ListItem_New(name);
|
|
||||||
if (o == NULL)
|
|
||||||
goto error;
|
|
||||||
for (i = 0; fields[i]; i++)
|
|
||||||
{
|
|
||||||
const char *fld = fields[i]+1;
|
|
||||||
PyObject *attr = NULL;
|
|
||||||
const char *sattr;
|
|
||||||
int iattr;
|
|
||||||
time_t tattr;
|
|
||||||
|
|
||||||
switch(fields[i][0])
|
|
||||||
{
|
|
||||||
case 's':
|
|
||||||
sattr = hexchat_list_str(ph, list, (char*)fld);
|
|
||||||
attr = PyUnicode_FromString(sattr?sattr:"");
|
|
||||||
break;
|
|
||||||
case 'i':
|
|
||||||
iattr = hexchat_list_int(ph, list, (char*)fld);
|
|
||||||
attr = PyLong_FromLong((long)iattr);
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
tattr = hexchat_list_time(ph, list, (char*)fld);
|
|
||||||
attr = PyLong_FromLong((long)tattr);
|
|
||||||
break;
|
|
||||||
case 'p':
|
|
||||||
sattr = hexchat_list_str(ph, list, (char*)fld);
|
|
||||||
if (strcmp(fld, "context") == 0)
|
|
||||||
{
|
|
||||||
attr = Context_FromContext((hexchat_context*)sattr);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default: /* ignore unknown (newly added?) types */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (attr == NULL)
|
|
||||||
goto error;
|
|
||||||
PyObject_SetAttrString(o, (char*)fld, attr); /* add reference on attr in o */
|
|
||||||
Py_DECREF(attr); /* make o own attr */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Raising of standard StopIteration exception with empty value. */
|
|
||||||
PyErr_SetNone(PyExc_StopIteration);
|
|
||||||
}
|
|
||||||
|
|
||||||
goto exit;
|
|
||||||
|
|
||||||
error:
|
|
||||||
if (list)
|
|
||||||
hexchat_list_free(ph, list);
|
|
||||||
Py_DECREF(o);
|
|
||||||
o = NULL;
|
|
||||||
|
|
||||||
exit:
|
|
||||||
END_XCHAT_CALLS();
|
|
||||||
if (o)
|
|
||||||
return o;
|
|
||||||
return NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyTypeObject List_Type = {
|
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
|
||||||
"hexchat.List", /*tp_name*/
|
|
||||||
sizeof(ListObject), /*tp_basicsize*/
|
|
||||||
0, /*tp_itemsize*/
|
|
||||||
List_dealloc, /*tp_dealloc*/
|
|
||||||
0, /*tp_print*/
|
|
||||||
0, /*tp_getattr*/
|
|
||||||
0, /*tp_setattr*/
|
|
||||||
0, /*tp_compare*/
|
|
||||||
List_repr, /*tp_repr*/
|
|
||||||
0, /*tp_as_number*/
|
|
||||||
0, /*tp_as_sequence*/
|
|
||||||
0, /*tp_as_mapping*/
|
|
||||||
0, /*tp_hash*/
|
|
||||||
0, /*tp_call*/
|
|
||||||
0, /*tp_str*/
|
|
||||||
PyObject_GenericGetAttr,/*tp_getattro*/
|
|
||||||
PyObject_GenericSetAttr,/*tp_setattro*/
|
|
||||||
0, /*tp_as_buffer*/
|
|
||||||
Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
|
||||||
0, /*tp_doc*/
|
|
||||||
0, /*tp_traverse*/
|
|
||||||
0, /*tp_clear*/
|
|
||||||
0, /*tp_richcompare*/
|
|
||||||
0, /*tp_weaklistoffset*/
|
|
||||||
List_iter, /*tp_iter*/
|
|
||||||
List_iternext, /*tp_iternext*/
|
|
||||||
0, /*tp_methods*/
|
|
||||||
0, /*tp_members*/
|
|
||||||
0, /*tp_getset*/
|
|
||||||
0, /*tp_base*/
|
|
||||||
0, /*tp_dict*/
|
|
||||||
0, /*tp_descr_get*/
|
|
||||||
0, /*tp_descr_set*/
|
|
||||||
0, /*tp_dictoffset*/
|
|
||||||
0, /*tp_init*/
|
|
||||||
PyType_GenericAlloc, /*tp_alloc*/
|
|
||||||
PyType_GenericNew, /*tp_new*/
|
|
||||||
PyObject_Del, /*tp_free*/
|
|
||||||
0, /*tp_is_gc*/
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
List_New(hexchat_list *list, char *name)
|
|
||||||
{
|
|
||||||
ListObject *listobj = PyObject_New(ListObject, &List_Type);
|
|
||||||
if (listobj != NULL) {
|
|
||||||
/* name parameter must be statically allocated. */
|
|
||||||
listobj->name = name;
|
|
||||||
//listobj->ph = ph;
|
|
||||||
listobj->list = list;
|
|
||||||
}
|
|
||||||
return (PyObject *)listobj;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ===================================================================== */
|
/* ===================================================================== */
|
||||||
@@ -1646,7 +1232,7 @@ Plugin_RemoveHook(PyObject *plugin, Hook *hook)
|
|||||||
list = g_slist_find(Plugin_GetHooks(plugin), hook);
|
list = g_slist_find(Plugin_GetHooks(plugin), hook);
|
||||||
if (list) {
|
if (list) {
|
||||||
/* Ok, unhook it. */
|
/* Ok, unhook it. */
|
||||||
if (hook->type != HOOK_UNLOAD) {
|
if (hook->type == HOOK_XCHAT) {
|
||||||
/* This is an xchat hook. Unregister it. */
|
/* This is an xchat hook. Unregister it. */
|
||||||
BEGIN_XCHAT_CALLS(NONE);
|
BEGIN_XCHAT_CALLS(NONE);
|
||||||
hexchat_unhook(ph, (hexchat_hook*)hook->data);
|
hexchat_unhook(ph, (hexchat_hook*)hook->data);
|
||||||
@@ -1669,7 +1255,7 @@ Plugin_RemoveAllHooks(PyObject *plugin)
|
|||||||
GSList *list = Plugin_GetHooks(plugin);
|
GSList *list = Plugin_GetHooks(plugin);
|
||||||
while (list) {
|
while (list) {
|
||||||
Hook *hook = (Hook *) list->data;
|
Hook *hook = (Hook *) list->data;
|
||||||
if (hook->type != HOOK_UNLOAD) {
|
if (hook->type == HOOK_XCHAT) {
|
||||||
/* This is an xchat hook. Unregister it. */
|
/* This is an xchat hook. Unregister it. */
|
||||||
BEGIN_XCHAT_CALLS(NONE);
|
BEGIN_XCHAT_CALLS(NONE);
|
||||||
hexchat_unhook(ph, (hexchat_hook*)hook->data);
|
hexchat_unhook(ph, (hexchat_hook*)hook->data);
|
||||||
@@ -1925,30 +1511,21 @@ Module_xchat_prnt(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
Module_hexchat_emit_print(PyObject *self, PyObject *args, PyObject *kwargs)
|
Module_hexchat_emit_print(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
char *argv[6];
|
char *argv[10];
|
||||||
char *name;
|
char *name;
|
||||||
int res;
|
int res;
|
||||||
long time = 0;
|
memset(&argv, 0, sizeof(char*)*10);
|
||||||
hexchat_event_attrs *attrs;
|
if (!PyArg_ParseTuple(args, "s|ssssss:print_event", &name,
|
||||||
char *kwlist[] = {"name", "arg1", "arg2", "arg3",
|
|
||||||
"arg4", "arg5", "arg6",
|
|
||||||
"time", NULL};
|
|
||||||
memset(&argv, 0, sizeof(char*)*6);
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ssssssl:print_event", kwlist, &name,
|
|
||||||
&argv[0], &argv[1], &argv[2],
|
&argv[0], &argv[1], &argv[2],
|
||||||
&argv[3], &argv[4], &argv[5],
|
&argv[3], &argv[4], &argv[5],
|
||||||
&time))
|
&argv[6], &argv[7], &argv[8]))
|
||||||
return NULL;
|
return NULL;
|
||||||
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT|ALLOW_THREADS);
|
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT|ALLOW_THREADS);
|
||||||
attrs = hexchat_event_attrs_create(ph);
|
res = hexchat_emit_print(ph, name, argv[0], argv[1], argv[2],
|
||||||
attrs->server_time_utc = (time_t)time;
|
argv[3], argv[4], argv[5],
|
||||||
|
argv[6], argv[7], argv[8]);
|
||||||
res = hexchat_emit_print_attrs(ph, attrs, name, argv[0], argv[1], argv[2],
|
|
||||||
argv[3], argv[4], argv[5], NULL);
|
|
||||||
|
|
||||||
hexchat_event_attrs_free(ph, attrs);
|
|
||||||
END_XCHAT_CALLS();
|
END_XCHAT_CALLS();
|
||||||
return PyLong_FromLong(res);
|
return PyLong_FromLong(res);
|
||||||
}
|
}
|
||||||
@@ -2180,7 +1757,7 @@ Module_hexchat_hook_command(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||||||
Callback_Command, help, hook);
|
Callback_Command, help, hook);
|
||||||
END_XCHAT_CALLS();
|
END_XCHAT_CALLS();
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(hook);
|
return PyLong_FromLong((long)hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@@ -2212,47 +1789,11 @@ Module_hexchat_hook_server(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
BEGIN_XCHAT_CALLS(NONE);
|
BEGIN_XCHAT_CALLS(NONE);
|
||||||
hook->data = (void*)hexchat_hook_server_attrs(ph, name, priority,
|
hook->data = (void*)hexchat_hook_server(ph, name, priority,
|
||||||
Callback_Server, hook);
|
Callback_Command, hook);
|
||||||
END_XCHAT_CALLS();
|
END_XCHAT_CALLS();
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(hook);
|
return PyLong_FromLong((long)hook);
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
Module_hexchat_hook_server_attrs(PyObject *self, PyObject *args, PyObject *kwargs)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
PyObject *callback;
|
|
||||||
PyObject *userdata = Py_None;
|
|
||||||
int priority = HEXCHAT_PRI_NORM;
|
|
||||||
PyObject *plugin;
|
|
||||||
Hook *hook;
|
|
||||||
char *kwlist[] = {"name", "callback", "userdata", "priority", 0};
|
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO|Oi:hook_server",
|
|
||||||
kwlist, &name, &callback, &userdata,
|
|
||||||
&priority))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
plugin = Plugin_GetCurrent();
|
|
||||||
if (plugin == NULL)
|
|
||||||
return NULL;
|
|
||||||
if (!PyCallable_Check(callback)) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "callback is not callable");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
hook = Plugin_AddHook(HOOK_XCHAT_ATTR, plugin, callback, userdata, NULL, NULL);
|
|
||||||
if (hook == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
BEGIN_XCHAT_CALLS(NONE);
|
|
||||||
hook->data = (void*)hexchat_hook_server_attrs(ph, name, priority,
|
|
||||||
Callback_Server, hook);
|
|
||||||
END_XCHAT_CALLS();
|
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(hook);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@@ -2288,43 +1829,7 @@ Module_hexchat_hook_print(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||||||
Callback_Print, hook);
|
Callback_Print, hook);
|
||||||
END_XCHAT_CALLS();
|
END_XCHAT_CALLS();
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(hook);
|
return PyLong_FromLong((long)hook);
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
Module_hexchat_hook_print_attrs(PyObject *self, PyObject *args, PyObject *kwargs)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
PyObject *callback;
|
|
||||||
PyObject *userdata = Py_None;
|
|
||||||
int priority = HEXCHAT_PRI_NORM;
|
|
||||||
PyObject *plugin;
|
|
||||||
Hook *hook;
|
|
||||||
char *kwlist[] = {"name", "callback", "userdata", "priority", 0};
|
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO|Oi:hook_print_attrs",
|
|
||||||
kwlist, &name, &callback, &userdata,
|
|
||||||
&priority))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
plugin = Plugin_GetCurrent();
|
|
||||||
if (plugin == NULL)
|
|
||||||
return NULL;
|
|
||||||
if (!PyCallable_Check(callback)) {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "callback is not callable");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
hook = Plugin_AddHook(HOOK_XCHAT_ATTR, plugin, callback, userdata, name, NULL);
|
|
||||||
if (hook == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
BEGIN_XCHAT_CALLS(NONE);
|
|
||||||
hook->data = (void*)hexchat_hook_print_attrs(ph, name, priority,
|
|
||||||
Callback_Print_Attrs, hook);
|
|
||||||
END_XCHAT_CALLS();
|
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(hook);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@@ -2359,7 +1864,7 @@ Module_hexchat_hook_timer(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||||||
Callback_Timer, hook);
|
Callback_Timer, hook);
|
||||||
END_XCHAT_CALLS();
|
END_XCHAT_CALLS();
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(hook);
|
return PyLong_FromLong((long)hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@@ -2387,7 +1892,7 @@ Module_hexchat_hook_unload(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||||||
if (hook == NULL)
|
if (hook == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(hook);
|
return PyLong_FromLong((long)hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@@ -2413,7 +1918,7 @@ Module_hexchat_unhook(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hook = (Hook *)PyLong_AsVoidPtr(obj);
|
hook = (Hook *)PyLong_AsLong(obj);
|
||||||
Plugin_RemoveHook(plugin, hook);
|
Plugin_RemoveHook(plugin, hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2434,7 +1939,6 @@ Module_xchat_get_list(PyObject *self, PyObject *args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
/* This function is thread safe, and returns statically
|
/* This function is thread safe, and returns statically
|
||||||
* allocated data. */
|
* allocated data. */
|
||||||
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT);
|
|
||||||
fields = hexchat_list_fields(ph, "lists");
|
fields = hexchat_list_fields(ph, "lists");
|
||||||
for (i = 0; fields[i]; i++) {
|
for (i = 0; fields[i]; i++) {
|
||||||
if (strcmp(fields[i], name) == 0) {
|
if (strcmp(fields[i], name) == 0) {
|
||||||
@@ -2447,14 +1951,57 @@ Module_xchat_get_list(PyObject *self, PyObject *args)
|
|||||||
PyErr_SetString(PyExc_KeyError, "list not available");
|
PyErr_SetString(PyExc_KeyError, "list not available");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
l = PyList_New(0);
|
||||||
|
if (l == NULL)
|
||||||
|
return NULL;
|
||||||
|
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT);
|
||||||
list = hexchat_list_get(ph, (char*)name);
|
list = hexchat_list_get(ph, (char*)name);
|
||||||
if (list == NULL)
|
if (list == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
fields = hexchat_list_fields(ph, (char*)name);
|
||||||
l = List_New(list, (char*)name);
|
while (hexchat_list_next(ph, list)) {
|
||||||
if (l == NULL)
|
PyObject *o = ListItem_New(name);
|
||||||
|
if (o == NULL || PyList_Append(l, o) == -1) {
|
||||||
|
Py_XDECREF(o);
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
Py_DECREF(o); /* l is holding a reference */
|
||||||
|
for (i = 0; fields[i]; i++) {
|
||||||
|
const char *fld = fields[i]+1;
|
||||||
|
PyObject *attr = NULL;
|
||||||
|
const char *sattr;
|
||||||
|
int iattr;
|
||||||
|
time_t tattr;
|
||||||
|
switch(fields[i][0]) {
|
||||||
|
case 's':
|
||||||
|
sattr = hexchat_list_str(ph, list, (char*)fld);
|
||||||
|
attr = PyUnicode_FromString(sattr?sattr:"");
|
||||||
|
break;
|
||||||
|
case 'i':
|
||||||
|
iattr = hexchat_list_int(ph, list, (char*)fld);
|
||||||
|
attr = PyLong_FromLong((long)iattr);
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
tattr = hexchat_list_time(ph, list, (char*)fld);
|
||||||
|
attr = PyLong_FromLong((long)tattr);
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
sattr = hexchat_list_str(ph, list, (char*)fld);
|
||||||
|
if (strcmp(fld, "context") == 0) {
|
||||||
|
attr = Context_FromContext(
|
||||||
|
(hexchat_context*)sattr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: /* ignore unknown (newly added?) types */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (attr == NULL)
|
||||||
|
goto error;
|
||||||
|
PyObject_SetAttrString(o, (char*)fld, attr); /* add reference on attr in o */
|
||||||
|
Py_DECREF(attr); /* make o own attr */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hexchat_list_free(ph, list);
|
||||||
goto exit;
|
goto exit;
|
||||||
error:
|
error:
|
||||||
if (list)
|
if (list)
|
||||||
@@ -2519,8 +2066,8 @@ static PyMethodDef Module_xchat_methods[] = {
|
|||||||
METH_VARARGS},
|
METH_VARARGS},
|
||||||
{"prnt", Module_xchat_prnt,
|
{"prnt", Module_xchat_prnt,
|
||||||
METH_VARARGS},
|
METH_VARARGS},
|
||||||
{"emit_print", (PyCFunction)Module_hexchat_emit_print,
|
{"emit_print", Module_hexchat_emit_print,
|
||||||
METH_VARARGS|METH_KEYWORDS},
|
METH_VARARGS},
|
||||||
{"get_info", Module_hexchat_get_info,
|
{"get_info", Module_hexchat_get_info,
|
||||||
METH_VARARGS},
|
METH_VARARGS},
|
||||||
{"get_prefs", Module_xchat_get_prefs,
|
{"get_prefs", Module_xchat_get_prefs,
|
||||||
@@ -2541,12 +2088,8 @@ static PyMethodDef Module_xchat_methods[] = {
|
|||||||
METH_VARARGS|METH_KEYWORDS},
|
METH_VARARGS|METH_KEYWORDS},
|
||||||
{"hook_server", (PyCFunction)Module_hexchat_hook_server,
|
{"hook_server", (PyCFunction)Module_hexchat_hook_server,
|
||||||
METH_VARARGS|METH_KEYWORDS},
|
METH_VARARGS|METH_KEYWORDS},
|
||||||
{"hook_server_attrs", (PyCFunction)Module_hexchat_hook_server_attrs,
|
|
||||||
METH_VARARGS|METH_KEYWORDS},
|
|
||||||
{"hook_print", (PyCFunction)Module_hexchat_hook_print,
|
{"hook_print", (PyCFunction)Module_hexchat_hook_print,
|
||||||
METH_VARARGS|METH_KEYWORDS},
|
METH_VARARGS|METH_KEYWORDS},
|
||||||
{"hook_print_attrs", (PyCFunction)Module_hexchat_hook_print_attrs,
|
|
||||||
METH_VARARGS|METH_KEYWORDS},
|
|
||||||
{"hook_timer", (PyCFunction)Module_hexchat_hook_timer,
|
{"hook_timer", (PyCFunction)Module_hexchat_hook_timer,
|
||||||
METH_VARARGS|METH_KEYWORDS},
|
METH_VARARGS|METH_KEYWORDS},
|
||||||
{"hook_unload", (PyCFunction)Module_hexchat_hook_unload,
|
{"hook_unload", (PyCFunction)Module_hexchat_hook_unload,
|
||||||
@@ -2969,7 +2512,7 @@ hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
|||||||
hexchat_hook_command(ph, "PY", HEXCHAT_PRI_NORM, Command_Py, usage, 0);
|
hexchat_hook_command(ph, "PY", HEXCHAT_PRI_NORM, Command_Py, usage, 0);
|
||||||
hexchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, Command_Load, 0, 0);
|
hexchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, Command_Load, 0, 0);
|
||||||
hexchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, Command_Unload, 0, 0);
|
hexchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, Command_Unload, 0, 0);
|
||||||
hexchat_hook_command(ph, "RELOAD", HEXCHAT_PRI_NORM, Command_Reload, 0, 0);
|
hexchat_hook_command(ph, "RELOAD", HEXCHAT_PRI_NORM, Command_Reload, reload, 0);
|
||||||
#ifdef WITH_THREAD
|
#ifdef WITH_THREAD
|
||||||
thread_timer = hexchat_hook_timer(ph, 300, Callback_ThreadTimer, NULL);
|
thread_timer = hexchat_hook_timer(ph, 300, Callback_ThreadTimer, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -65,31 +65,14 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void remove_leading_whitespace(char *buffer)
|
void remove_leading_whitespace(char *buffer)
|
||||||
{
|
{
|
||||||
char *buffer2 = NULL;
|
char *pos;
|
||||||
int i = 0, j = 0, ews = 0;
|
while((pos = memchr(buffer, 0x20, 1)))
|
||||||
|
|
||||||
buffer2 = (char*)malloc(strlen(buffer) * sizeof(char));
|
|
||||||
if (buffer2 == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
memset (buffer2, (char)0, strlen(buffer));
|
|
||||||
while (i < strlen(buffer))
|
|
||||||
{
|
{
|
||||||
/* count tabs, spaces as whitespace. */
|
pos += 1;
|
||||||
if (!(buffer[i] == (char)32 || buffer[i] == (char)9) || ews == 1)
|
strcpy(buffer, pos);
|
||||||
{
|
|
||||||
ews = 1;
|
|
||||||
buffer2[j] = buffer[i];
|
|
||||||
j++;
|
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
|
||||||
memset (buffer, (char)0, strlen(buffer));
|
|
||||||
strcpy (buffer, buffer2);
|
|
||||||
free (buffer2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *decruft_filename(char *buffer)
|
char *decruft_filename(char *buffer)
|
||||||
|
|||||||
@@ -379,8 +379,21 @@ int xs_parse_distro(char *name)
|
|||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char buffer[bsize], *pos = NULL;
|
char buffer[bsize], *pos = NULL;
|
||||||
|
|
||||||
if((fp = fopen("/etc/portage/make.conf", "r")) != NULL ||
|
if((fp = fopen("/etc/lsb-release", "r")) != NULL)
|
||||||
(fp = fopen("/etc/make.conf", "r")) != NULL)
|
{
|
||||||
|
char id[bsize], codename[bsize], release[bsize];
|
||||||
|
strcpy(id, "?");
|
||||||
|
strcpy(codename, "?");
|
||||||
|
strcpy(release, "?");
|
||||||
|
while(fgets(buffer, bsize, fp) != NULL)
|
||||||
|
{
|
||||||
|
find_match_char(buffer, "DISTRIB_ID", id);
|
||||||
|
find_match_char(buffer, "DISTRIB_CODENAME", codename);
|
||||||
|
find_match_char(buffer, "DISTRIB_RELEASE", release);
|
||||||
|
}
|
||||||
|
snprintf(buffer, bsize, "%s \"%s\" %s", id, codename, release);
|
||||||
|
}
|
||||||
|
else if((fp = fopen("/etc/make.conf", "r")) != NULL)
|
||||||
{
|
{
|
||||||
char keywords[bsize];
|
char keywords[bsize];
|
||||||
while(fgets(buffer, bsize, fp) != NULL)
|
while(fgets(buffer, bsize, fp) != NULL)
|
||||||
@@ -411,20 +424,6 @@ int xs_parse_distro(char *name)
|
|||||||
fgets(buffer, bsize, fp);
|
fgets(buffer, bsize, fp);
|
||||||
else if((fp = fopen("/etc/arch-release", "r")) != NULL)
|
else if((fp = fopen("/etc/arch-release", "r")) != NULL)
|
||||||
snprintf(buffer, bsize, "ArchLinux");
|
snprintf(buffer, bsize, "ArchLinux");
|
||||||
else if((fp = fopen("/etc/lsb-release", "r")) != NULL)
|
|
||||||
{
|
|
||||||
char id[bsize], codename[bsize], release[bsize];
|
|
||||||
strcpy(id, "?");
|
|
||||||
strcpy(codename, "?");
|
|
||||||
strcpy(release, "?");
|
|
||||||
while(fgets(buffer, bsize, fp) != NULL)
|
|
||||||
{
|
|
||||||
find_match_char(buffer, "DISTRIB_ID", id);
|
|
||||||
find_match_char(buffer, "DISTRIB_CODENAME", codename);
|
|
||||||
find_match_char(buffer, "DISTRIB_RELEASE", release);
|
|
||||||
}
|
|
||||||
snprintf(buffer, bsize, "%s \"%s\" %s", id, codename, release);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
snprintf(buffer, bsize, "Unknown Distro");
|
snprintf(buffer, bsize, "Unknown Distro");
|
||||||
if(fp != NULL) fclose(fp);
|
if(fp != NULL) fclose(fp);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -80,6 +81,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#define DEFAULT_FORMAT "%B%1:%B %2 **"
|
#define DEFAULT_FORMAT "%B%1:%B %2 **"
|
||||||
#define DEFAULT_PERCENT 1
|
#define DEFAULT_PERCENT 1
|
||||||
#define DEFAULT_ANNOUNCE 1
|
|
||||||
#define DEFAULT_PCIIDS "/usr/share/hwdata/pci.ids"
|
#define DEFAULT_PCIIDS "/usr/share/hwdata/pci.ids"
|
||||||
|
|
||||||
static hexchat_plugin *ph; /* plugin handle */
|
static hexchat_plugin *ph; /* plugin handle */
|
||||||
@@ -44,7 +43,7 @@ static int error_printed = 0; /* semaphore, make sure not to print the same erro
|
|||||||
static char name[] = "SysInfo";
|
static char name[] = "SysInfo";
|
||||||
static char desc[] = "Display info about your hardware and OS";
|
static char desc[] = "Display info about your hardware and OS";
|
||||||
static char version[] = "3.0";
|
static char version[] = "3.0";
|
||||||
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [OS|DISTRO|CPU|RAM|DISK|VGA|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO LIST, print current settings\n /SYSINFO SET <variable>, update given setting\n /SYSINFO RESET, reset settings to defaults\n /NETDATA <iface>, show transmitted data on given interface\n /NETSTREAM <iface>, show current bandwidth on given interface\n";
|
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [OS|DISTRO|CPU|RAM|DISK|VGA|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO LIST, print current settings\n /SYSINFO SET <variable>, update given setting\n /SYSINFO RESET, reset settings to defaults\n /NETDATA <iface>, show transmitted data on given interface\n /NETSTREAM <iface>, show current bandwidth on given interface\n";
|
||||||
|
|
||||||
void
|
void
|
||||||
sysinfo_get_pciids (char* dest)
|
sysinfo_get_pciids (char* dest)
|
||||||
@@ -58,12 +57,6 @@ sysinfo_get_percent ()
|
|||||||
return hexchat_pluginpref_get_int (ph, "percent");
|
return hexchat_pluginpref_get_int (ph, "percent");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
sysinfo_get_announce ()
|
|
||||||
{
|
|
||||||
return hexchat_pluginpref_get_int (ph, "announce");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sysinfo_print_error (const char* msg)
|
sysinfo_print_error (const char* msg)
|
||||||
{
|
{
|
||||||
@@ -712,15 +705,13 @@ reset_settings ()
|
|||||||
hexchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
|
hexchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
|
||||||
hexchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
|
hexchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
|
||||||
hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
|
hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
|
||||||
hexchat_pluginpref_set_int (ph, "announce", DEFAULT_ANNOUNCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
||||||
{
|
{
|
||||||
error_printed = 0;
|
error_printed = 0;
|
||||||
int announce = sysinfo_get_announce ();
|
int announce = 0;
|
||||||
int offset = 0;
|
|
||||||
int buffer;
|
int buffer;
|
||||||
char format[bsize];
|
char format[bsize];
|
||||||
|
|
||||||
@@ -730,49 +721,36 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cannot send to server tab */
|
if (hexchat_list_int (ph, NULL, "type") >= 2)
|
||||||
if (hexchat_list_int (ph, NULL, "type") == 1)
|
|
||||||
{
|
|
||||||
announce = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allow overriding global announce setting */
|
|
||||||
if (!strcmp ("-e", word[2]))
|
|
||||||
{
|
|
||||||
announce = 0;
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
else if (!strcmp ("-o", word[2]))
|
|
||||||
{
|
{
|
||||||
announce = 1;
|
announce = 1;
|
||||||
offset++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_ascii_strcasecmp ("HELP", word[2+offset]))
|
if (!g_ascii_strcasecmp ("HELP", word[2]))
|
||||||
{
|
{
|
||||||
hexchat_printf (ph, sysinfo_help);
|
hexchat_printf (ph, sysinfo_help);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("LIST", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("LIST", word[2]))
|
||||||
{
|
{
|
||||||
list_settings ();
|
list_settings ();
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("SET", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("SET", word[2]))
|
||||||
{
|
{
|
||||||
if (!g_ascii_strcasecmp ("", word_eol[4+offset]))
|
if (!g_ascii_strcasecmp ("", word_eol[4]))
|
||||||
{
|
{
|
||||||
hexchat_printf (ph, "%s\tEnter a value!\n", name);
|
hexchat_printf (ph, "%s\tEnter a value!\n", name);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
if (!g_ascii_strcasecmp ("format", word[3+offset]))
|
if (!g_ascii_strcasecmp ("format", word[3]))
|
||||||
{
|
{
|
||||||
hexchat_pluginpref_set_str (ph, "format", word_eol[4+offset]);
|
hexchat_pluginpref_set_str (ph, "format", word_eol[4]);
|
||||||
hexchat_printf (ph, "%s\tformat is set to: %s\n", name, word_eol[4+offset]);
|
hexchat_printf (ph, "%s\tformat is set to: %s\n", name, word_eol[4]);
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("percent", word[3+offset]))
|
else if (!g_ascii_strcasecmp ("percent", word[3]))
|
||||||
{
|
{
|
||||||
buffer = atoi (word[4+offset]); /* don't use word_eol, numbers must not contain spaces */
|
buffer = atoi (word[4]); /* don't use word_eol, numbers must not contain spaces */
|
||||||
|
|
||||||
if (buffer > 0 && buffer < INT_MAX)
|
if (buffer > 0 && buffer < INT_MAX)
|
||||||
{
|
{
|
||||||
@@ -784,25 +762,10 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
hexchat_printf (ph, "%s\tInvalid input!\n", name);
|
hexchat_printf (ph, "%s\tInvalid input!\n", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("announce", word[3+offset]))
|
else if (!g_ascii_strcasecmp ("pciids", word[3]))
|
||||||
{
|
{
|
||||||
buffer = atoi (word[4+offset]); /* don't use word_eol, numbers must not contain spaces */
|
hexchat_pluginpref_set_str (ph, "pciids", word_eol[4]);
|
||||||
|
hexchat_printf (ph, "%s\tpciids is set to: %s\n", name, word_eol[4]);
|
||||||
if (buffer > 0)
|
|
||||||
{
|
|
||||||
hexchat_pluginpref_set_int (ph, "announce", 1);
|
|
||||||
hexchat_printf (ph, "%s\tannounce is set to: On\n", name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hexchat_pluginpref_set_int (ph, "announce", 0);
|
|
||||||
hexchat_printf (ph, "%s\tannounce is set to: Off\n", name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!g_ascii_strcasecmp ("pciids", word[3+offset]))
|
|
||||||
{
|
|
||||||
hexchat_pluginpref_set_str (ph, "pciids", word_eol[4+offset]);
|
|
||||||
hexchat_printf (ph, "%s\tpciids is set to: %s\n", name, word_eol[4+offset]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -812,58 +775,58 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("RESET", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("RESET", word[2]))
|
||||||
{
|
{
|
||||||
reset_settings ();
|
reset_settings ();
|
||||||
hexchat_printf (ph, "%s\tSettings have been restored to defaults.\n", name);
|
hexchat_printf (ph, "%s\tSettings have been restored to defaults.\n", name);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("OS", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("OS", word[2]))
|
||||||
{
|
{
|
||||||
print_os (announce, format);
|
print_os (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("DISTRO", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("DISTRO", word[2]))
|
||||||
{
|
{
|
||||||
print_distro (announce, format);
|
print_distro (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("CPU", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("CPU", word[2]))
|
||||||
{
|
{
|
||||||
print_cpu (announce, format);
|
print_cpu (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("RAM", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("RAM", word[2]))
|
||||||
{
|
{
|
||||||
print_ram (announce, format);
|
print_ram (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("DISK", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("DISK", word[2]))
|
||||||
{
|
{
|
||||||
print_disk (announce, format);
|
print_disk (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("VGA", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("VGA", word[2]))
|
||||||
{
|
{
|
||||||
print_vga (announce, format);
|
print_vga (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("SOUND", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("SOUND", word[2]))
|
||||||
{
|
{
|
||||||
print_sound (announce, format);
|
print_sound (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("ETHERNET", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("ETHERNET", word[2]))
|
||||||
{
|
{
|
||||||
print_ethernet (announce, format);
|
print_ethernet (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("UPTIME", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("UPTIME", word[2]))
|
||||||
{
|
{
|
||||||
print_uptime (announce, format);
|
print_uptime (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
else if (!g_ascii_strcasecmp ("", word[2+offset]))
|
else if (!g_ascii_strcasecmp ("", word[2]))
|
||||||
{
|
{
|
||||||
print_summary (announce, format);
|
print_summary (announce, format);
|
||||||
return HEXCHAT_EAT_ALL;
|
return HEXCHAT_EAT_ALL;
|
||||||
@@ -904,11 +867,6 @@ hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **p
|
|||||||
hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
|
hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hexchat_pluginpref_get_int (ph, "announce") == -1)
|
|
||||||
{
|
|
||||||
hexchat_pluginpref_set_int (ph, "announce", DEFAULT_ANNOUNCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
hexchat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
hexchat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
||||||
hexchat_printf (ph, "%s plugin loaded\n", name);
|
hexchat_printf (ph, "%s plugin loaded\n", name);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -27,9 +27,8 @@
|
|||||||
|
|
||||||
#include "hexchat-plugin.h"
|
#include "hexchat-plugin.h"
|
||||||
|
|
||||||
#define DEFAULT_DELAY 30 /* 30 seconds */
|
#define DEFAULT_DELAY 10 /* 10 seconds */
|
||||||
#define DEFAULT_FREQ 360 /* 6 hours */
|
#define DEFAULT_FREQ 360 /* 6 hours */
|
||||||
#define DOWNLOAD_URL "http://dl.hexchat.net/hexchat"
|
|
||||||
|
|
||||||
static hexchat_plugin *ph; /* plugin handle */
|
static hexchat_plugin *ph; /* plugin handle */
|
||||||
static char name[] = "Update Checker";
|
static char name[] = "Update Checker";
|
||||||
@@ -40,6 +39,61 @@ static const char upd_help[] = "Update Checker Usage:\n /UPDCHK, check for HexC
|
|||||||
static char*
|
static char*
|
||||||
check_version ()
|
check_version ()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
HINTERNET hINet, hFile;
|
||||||
|
hINet = InternetOpen ("Update Checker", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
|
||||||
|
|
||||||
|
if (!hINet)
|
||||||
|
{
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
hFile = InternetOpenUrl (hINet,
|
||||||
|
"https://raw.github.com/hexchat/hexchat/master/win32/version.txt",
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD,
|
||||||
|
0);
|
||||||
|
if (hFile)
|
||||||
|
{
|
||||||
|
static char buffer[1024];
|
||||||
|
DWORD dwRead;
|
||||||
|
while (InternetReadFile (hFile, buffer, 1023, &dwRead))
|
||||||
|
{
|
||||||
|
if (dwRead == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
buffer[dwRead] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
InternetCloseHandle (hFile);
|
||||||
|
InternetCloseHandle (hINet);
|
||||||
|
if (strlen (buffer) == 5)
|
||||||
|
return buffer;
|
||||||
|
else
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
InternetCloseHandle (hINet);
|
||||||
|
return "Unknown";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Google Code's messing up with requests, use HTTP/1.0 as suggested. More info:
|
||||||
|
|
||||||
|
http://code.google.com/p/support/issues/detail?id=6095
|
||||||
|
|
||||||
|
Of course it would be still too simple, coz IE will override settings, so
|
||||||
|
you have to disable HTTP/1.1 manually and globally. More info:
|
||||||
|
|
||||||
|
http://support.microsoft.com/kb/258425
|
||||||
|
|
||||||
|
So this code's basically useless since disabling HTTP/1.1 will work with the
|
||||||
|
above code too.
|
||||||
|
|
||||||
|
Update: a Connection: close header seems to disable chunked encoding.
|
||||||
|
*/
|
||||||
|
|
||||||
HINTERNET hOpen, hConnect, hResource;
|
HINTERNET hOpen, hConnect, hResource;
|
||||||
|
|
||||||
hOpen = InternetOpen (TEXT ("Update Checker"),
|
hOpen = InternetOpen (TEXT ("Update Checker"),
|
||||||
@@ -83,11 +137,7 @@ check_version ()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
static char buffer[1024];
|
static char buffer[1024];
|
||||||
char infobuffer[32];
|
|
||||||
int statuscode;
|
|
||||||
|
|
||||||
DWORD dwRead;
|
DWORD dwRead;
|
||||||
DWORD infolen = sizeof(infobuffer);
|
|
||||||
|
|
||||||
HttpAddRequestHeaders (hResource, TEXT ("Connection: close\r\n"), -1L, HTTP_ADDREQ_FLAG_ADD); /* workaround for GC bug */
|
HttpAddRequestHeaders (hResource, TEXT ("Connection: close\r\n"), -1L, HTTP_ADDREQ_FLAG_ADD); /* workaround for GC bug */
|
||||||
HttpSendRequest (hResource, NULL, 0, NULL, 0);
|
HttpSendRequest (hResource, NULL, 0, NULL, 0);
|
||||||
@@ -101,18 +151,10 @@ check_version ()
|
|||||||
buffer[dwRead] = 0;
|
buffer[dwRead] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpQueryInfo(hResource,
|
|
||||||
HTTP_QUERY_STATUS_CODE,
|
|
||||||
&infobuffer,
|
|
||||||
&infolen,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
InternetCloseHandle (hResource);
|
InternetCloseHandle (hResource);
|
||||||
InternetCloseHandle (hConnect);
|
InternetCloseHandle (hConnect);
|
||||||
InternetCloseHandle (hOpen);
|
InternetCloseHandle (hOpen);
|
||||||
|
if (strlen (buffer) == 5)
|
||||||
statuscode = atoi(infobuffer);
|
|
||||||
if (statuscode == 200)
|
|
||||||
return buffer;
|
return buffer;
|
||||||
else
|
else
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
@@ -191,9 +233,9 @@ print_version (char *word[], char *word_eol[], void *userdata)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for some reason */
|
#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for some reason */
|
||||||
hexchat_printf (ph, "%s:\tA HexChat update is available! You can download it from here:\n%s/HexChat%%20%s%%20x64.exe\n", name, DOWNLOAD_URL, version);
|
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttp://dl.hexchat.org/hexchat/HexChat%%20%s%%20x64.exe\n", name, version);
|
||||||
#else
|
#else
|
||||||
hexchat_printf (ph, "%s:\tA HexChat update is available! You can download it from here:\n%s/HexChat%%20%s%%20x86.exe\n", name, DOWNLOAD_URL, version);
|
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttp://dl.hexchat.org/hexchat/HexChat%%20%s%%20x86.exe\n", name, version);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return HEXCHAT_EAT_HEXCHAT;
|
||||||
@@ -214,9 +256,9 @@ print_version_quiet (void *userdata)
|
|||||||
if (!(strcmp (version, hexchat_get_info (ph, "version")) == 0) && !(strcmp (version, "Unknown") == 0))
|
if (!(strcmp (version, hexchat_get_info (ph, "version")) == 0) && !(strcmp (version, "Unknown") == 0))
|
||||||
{
|
{
|
||||||
#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for plugins for some reason */
|
#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for plugins for some reason */
|
||||||
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\n%s/HexChat%%20%s%%20x64.exe\n", name, DOWNLOAD_URL, version);
|
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x64.exe\n", name, version);
|
||||||
#else
|
#else
|
||||||
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\n%s/HexChat%%20%s%%20x86.exe\n", name, DOWNLOAD_URL, version);
|
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x86.exe\n", name, version);
|
||||||
#endif
|
#endif
|
||||||
/* print update url once, then stop the timer */
|
/* print update url once, then stop the timer */
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UPD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UPD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;UPD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;UPD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ src/common/text.c
|
|||||||
src/common/util.c
|
src/common/util.c
|
||||||
src/common/dbus/dbus-client.c
|
src/common/dbus/dbus-client.c
|
||||||
src/common/dbus/dbus-plugin.c
|
src/common/dbus/dbus-plugin.c
|
||||||
|
src/fe-gtk/about.c
|
||||||
src/fe-gtk/ascii.c
|
src/fe-gtk/ascii.c
|
||||||
src/fe-gtk/banlist.c
|
src/fe-gtk/banlist.c
|
||||||
src/fe-gtk/chanlist.c
|
src/fe-gtk/chanlist.c
|
||||||
@@ -28,6 +29,7 @@ src/fe-gtk/notifygui.c
|
|||||||
src/fe-gtk/plugin-tray.c
|
src/fe-gtk/plugin-tray.c
|
||||||
src/fe-gtk/plugingui.c
|
src/fe-gtk/plugingui.c
|
||||||
src/fe-gtk/rawlog.c
|
src/fe-gtk/rawlog.c
|
||||||
|
src/fe-gtk/search.c
|
||||||
src/fe-gtk/servlistgui.c
|
src/fe-gtk/servlistgui.c
|
||||||
src/fe-gtk/setup.c
|
src/fe-gtk/setup.c
|
||||||
src/fe-gtk/sexy-spell-entry.c
|
src/fe-gtk/sexy-spell-entry.c
|
||||||
|
|||||||