Compare commits
160 Commits
wip/connec
...
wip/file-h
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eafc1e2b70 | ||
|
|
06d323025d | ||
|
|
c0c2668c10 | ||
|
|
7cf631f93c | ||
|
|
f5142c6724 | ||
|
|
3ba5581c6b | ||
|
|
d825b3514b | ||
|
|
650bddcfd1 | ||
|
|
089fe95a42 | ||
|
|
4362085847 | ||
|
|
6b62c4738d | ||
|
|
8da205b0a8 | ||
|
|
981d55e84c | ||
|
|
35d238ad3a | ||
|
|
2c8729becd | ||
|
|
35f97b65c1 | ||
|
|
a2c2abd60a | ||
|
|
7a85c9160d | ||
|
|
4e061a43b3 | ||
|
|
5c534ac344 | ||
|
|
ea9e8d353b | ||
|
|
f14ad5e9dd | ||
|
|
2226363fd0 | ||
|
|
5dafa60433 | ||
|
|
971e5cf4fe | ||
|
|
edd57fdc86 | ||
|
|
eab580408c | ||
|
|
26d3461f46 | ||
|
|
295061f461 | ||
|
|
0bd15d435a | ||
|
|
c8539b93fe | ||
|
|
1e914347d7 | ||
|
|
66eebea2c3 | ||
|
|
9e2d5dae5e | ||
|
|
b8e7dfa4ba | ||
|
|
1d8dd50455 | ||
|
|
7f1ee9dad0 | ||
|
|
be5e2b9566 | ||
|
|
e40fbee772 | ||
|
|
7247c24e98 | ||
|
|
f7e3d3f32c | ||
|
|
671a838b52 | ||
|
|
6ca29b2eb4 | ||
|
|
15efdd5f2b | ||
|
|
599f5c7b29 | ||
|
|
fad8f93ad8 | ||
|
|
78486b49d5 | ||
|
|
9c5f577002 | ||
|
|
dbad9285b8 | ||
|
|
73636a00b5 | ||
|
|
e7003ef9c6 | ||
|
|
9664b1b7e3 | ||
|
|
422cce6f70 | ||
|
|
afd2135393 | ||
|
|
94ef0fd294 | ||
|
|
ebe1f824a7 | ||
|
|
f7bea16e37 | ||
|
|
ff9c0dbd5e | ||
|
|
29321c8660 | ||
|
|
0b40146b85 | ||
|
|
9b2c560519 | ||
|
|
3675302930 | ||
|
|
925570aab1 | ||
|
|
498f53b96a | ||
|
|
5263887ac3 | ||
|
|
73d865b243 | ||
|
|
a3c257bdb4 | ||
|
|
6ad9419693 | ||
|
|
c5aa91a836 | ||
|
|
b10f94d5f6 | ||
|
|
9a98de1f65 | ||
|
|
7363bc03f2 | ||
|
|
78e51a4f3f | ||
|
|
174db0eb7f | ||
|
|
f64b61a1b9 | ||
|
|
a8392c7f95 | ||
|
|
72d7f64f8b | ||
|
|
c86389f99b | ||
|
|
66f2f3a84a | ||
|
|
f8c7ea3672 | ||
|
|
e313a82ab4 | ||
|
|
9024a5c71b | ||
|
|
f03b6314b4 | ||
|
|
ae2e5ab092 | ||
|
|
167eb11ea7 | ||
|
|
1cc06f9301 | ||
|
|
455fa24d63 | ||
|
|
dc69f24ae5 | ||
|
|
b4906f3d23 | ||
|
|
4e338a2b70 | ||
|
|
98fefcd162 | ||
|
|
fb422732f2 | ||
|
|
36a8ba126c | ||
|
|
658f30ec43 | ||
|
|
749e5b20da | ||
|
|
d78db5070a | ||
|
|
a5584c6b57 | ||
|
|
97bf0de016 | ||
|
|
b6c4cfa2a3 | ||
|
|
ec12871e60 | ||
|
|
0a29313fff | ||
|
|
b009084a52 | ||
|
|
7e7e87600e | ||
|
|
c36d4859d7 | ||
|
|
c1d06c7d63 | ||
|
|
5e3355a6c3 | ||
|
|
363321dc33 | ||
|
|
4d44c17939 | ||
|
|
5b24c60def | ||
|
|
96026b82c7 | ||
|
|
e42da22716 | ||
|
|
0a8248578f | ||
|
|
c87f559334 | ||
|
|
8ca96d7ea3 | ||
|
|
bbb81af550 | ||
|
|
a22816fbbd | ||
|
|
b6877ccf5c | ||
|
|
7063406d6c | ||
|
|
9858784eb6 | ||
|
|
7e4a585611 | ||
|
|
5a87d814cf | ||
|
|
ac54a2ed45 | ||
|
|
296fbaf94f | ||
|
|
75c022c49f | ||
|
|
f4f27e438b | ||
|
|
a216ed1df9 | ||
|
|
afee9fd42b | ||
|
|
60fa7efbc8 | ||
|
|
dc9a7d3a59 | ||
|
|
1d83610341 | ||
|
|
5dde0d7c6d | ||
|
|
9968bb31a4 | ||
|
|
5fe2dda146 | ||
|
|
85fd6f525e | ||
|
|
e5b65bbd69 | ||
|
|
a838cd9c07 | ||
|
|
02470dffa5 | ||
|
|
c5bbf75f5e | ||
|
|
b783c827c8 | ||
|
|
d1897c1602 | ||
|
|
6f8a6e66cc | ||
|
|
5749c53484 | ||
|
|
5569205d15 | ||
|
|
2e76a4e477 | ||
|
|
ee17ec6b4f | ||
|
|
5a56f9ea01 | ||
|
|
e400ed2855 | ||
|
|
1d316710ed | ||
|
|
aab243592f | ||
|
|
13db2011e3 | ||
|
|
7739c99f3f | ||
|
|
99f74e8d94 | ||
|
|
5ca87b3c8d | ||
|
|
62df565190 | ||
|
|
4f08b0b386 | ||
|
|
5b8cc683f3 | ||
|
|
e758da5d28 | ||
|
|
16d1fccf61 | ||
|
|
9e9ed54bfa | ||
|
|
aece18dfd5 |
5
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
# Unix generated files
|
||||
.deps/
|
||||
.libs/
|
||||
.dirstamp
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
@@ -53,6 +54,8 @@ src/common/textenums.h
|
||||
src/common/textevents.h
|
||||
src/fe-gtk/hexchat
|
||||
src/fe-gtk/hexchat.rc
|
||||
src/fe-gtk/resources.c
|
||||
src/fe-gtk/resources.h
|
||||
src/fe-text/hexchat-text
|
||||
src/htm/Main.resources
|
||||
src/htm/thememan.exe
|
||||
@@ -69,11 +72,11 @@ stamp-h1
|
||||
*.po~
|
||||
*.pot
|
||||
*.patch
|
||||
tags
|
||||
src/**/*.plist
|
||||
# Win32 generated files
|
||||
plugins/wmpa/wmpa_h.h
|
||||
plugins/wmpa/wmpa_i.c
|
||||
src/fe-gtk/resources.c
|
||||
src/htm/obj/*
|
||||
win32/ipch/*
|
||||
win32/ext/perl/perl-x86-cache
|
||||
|
||||
31
.travis.yml
@@ -1,12 +1,9 @@
|
||||
sudo: false
|
||||
language: c
|
||||
cache: apt
|
||||
compiler: clang
|
||||
before_script:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get build-dep -qq xchat
|
||||
- sudo apt-get install -qq libnotify-dev libproxy-dev libpci-dev libcanberra-dev monodevelop gnome-common
|
||||
script:
|
||||
- ./autogen.sh
|
||||
- ./configure --enable-textfe --with-theme-manager --enable-static-analysis
|
||||
script:
|
||||
- ./autogen.sh --enable-textfe --with-theme-manager --enable-static-analysis
|
||||
- make V=1 -j$(nproc)
|
||||
notifications:
|
||||
irc:
|
||||
@@ -15,3 +12,23 @@ notifications:
|
||||
on_success: change
|
||||
matrix:
|
||||
fast_finish: true
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- automake
|
||||
- autoconf
|
||||
- imagemagick
|
||||
- intltool
|
||||
- libcanberra-dev
|
||||
- libdbus-glib-1-dev
|
||||
- libglib2.0-dev
|
||||
- libgtk2.0-dev
|
||||
- libnotify-dev
|
||||
- libpci-dev
|
||||
- libperl-dev
|
||||
- libproxy-dev
|
||||
- libssl-dev
|
||||
- libtool
|
||||
- monodevelop
|
||||
- mono-devel
|
||||
- python-dev
|
||||
|
||||
@@ -4,5 +4,4 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = po src plugins data
|
||||
|
||||
EXTRA_DIST = autogen.sh data
|
||||
|
||||
EXTRA_DIST = autogen.sh Doxyfile readme.md
|
||||
|
||||
25
autogen.sh
@@ -4,19 +4,24 @@
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
NOCONFIGURE=1
|
||||
PKG_NAME="hexchat"
|
||||
|
||||
(test -f $srcdir/src/common/hexchat.c) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the top-level directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
which gnome-autogen.sh || {
|
||||
echo "You need to install gnome-common"
|
||||
exit 1
|
||||
}
|
||||
aclocal --install -I m4 || exit 1
|
||||
glib-gettextize --force --copy || exit 1
|
||||
intltoolize --force --copy --automake || exit 1
|
||||
autoreconf --force --install -Wno-portability || exit 1
|
||||
|
||||
. gnome-autogen.sh
|
||||
if [ "$NOCONFIGURE" = "" ]; then
|
||||
$srcdir/configure "$@" || exit 1
|
||||
|
||||
if [ "$1" = "--help" ]; then exit 0 else
|
||||
echo "Now type \`make\' to compile" || exit 1
|
||||
fi
|
||||
else
|
||||
echo "Skipping configure process."
|
||||
fi
|
||||
|
||||
set +x
|
||||
|
||||
572
configure.ac
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT([HexChat],[2.11.0])
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
AC_PREREQ([2.64])
|
||||
AC_COPYRIGHT([Copyright (C) 1998-2010 Peter Zelezny])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -10,19 +10,25 @@ 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.1 dist-xz no-dist-gzip subdir-objects no-define foreign])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
AX_IS_RELEASE([minor-version])
|
||||
AX_CHECK_ENABLE_DEBUG([yes])
|
||||
AX_REQUIRE_DEFINED([PKG_PROG_PKG_CONFIG])
|
||||
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AM_MAINTAINER_MODE
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CPP
|
||||
AC_PROG_OBJC
|
||||
AM_PROG_AS
|
||||
AM_PROG_AR
|
||||
AM_DISABLE_STATIC
|
||||
AC_PROG_LIBTOOL
|
||||
LT_PREREQ([2.2.6])
|
||||
LT_INIT([disable-static])
|
||||
AC_PATH_PROG(MDTOOL, mdtool, no)
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
dnl -----------------------------------------------------------
|
||||
dnl Language Support
|
||||
@@ -38,6 +44,8 @@ AH_VERBATIM([OLD_PERL],[#undef OLD_PERL])
|
||||
AH_VERBATIM([PREFIX],[#undef PREFIX])
|
||||
AH_VERBATIM([HEXCHATLIBDIR],[#undef HEXCHATLIBDIR])
|
||||
AH_VERBATIM([HEXCHATSHAREDIR],[#undef HEXCHATSHAREDIR])
|
||||
AH_VERBATIM([USE_LIBPROXY],[#undef USE_LIBPROXY])
|
||||
AH_VERBATIM([HAVE_LIBPCI],[#undef HAVE_LIBPCI])
|
||||
AH_VERBATIM([HAVE_ISO_CODES],[#undef HAVE_ISO_CODES])
|
||||
AH_VERBATIM([HAVE_GTK_MAC],[#undef HAVE_GTK_MAC])
|
||||
AH_VERBATIM([USE_LIBNOTIFY],[#undef USE_LIBNOTIFY])
|
||||
@@ -51,31 +59,34 @@ AH_VERBATIM([socklen_t],[#undef socklen_t])
|
||||
AH_VERBATIM([USE_DBUS],[#undef USE_DBUS])
|
||||
|
||||
AC_PATH_PROG(sedpath, sed)
|
||||
if test "_$sedpath" = _; then
|
||||
AS_IF([test "_$sedpath" = _], [
|
||||
AC_MSG_ERROR(Cannot find sed: I need it!)
|
||||
fi
|
||||
])
|
||||
|
||||
AC_PATH_PROG(unamepath, uname)
|
||||
if test "_$unamepath" = _; then
|
||||
AS_IF([test "_$unamepath" = _], [
|
||||
system="unknown"
|
||||
else
|
||||
], [
|
||||
AC_MSG_CHECKING(system type)
|
||||
system=`$unamepath -s`
|
||||
AC_MSG_RESULT($system)
|
||||
if test "$system" = "Linux"; then
|
||||
AS_IF([test "$system" = "Linux"], [
|
||||
AC_DEFINE(USING_LINUX)
|
||||
fi
|
||||
if test "$system" = "FreeBSD"; then
|
||||
], [test "$system" = "FreeBSD"], [
|
||||
AC_DEFINE(USING_FREEBSD)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
platform_win32=no
|
||||
case $host_os in
|
||||
*mingw*|*cygwin*|*msys*)
|
||||
platform_win32=yes;;
|
||||
*);;
|
||||
esac
|
||||
platform_osx=no
|
||||
AS_CASE([$host_os],
|
||||
[*mingw*|*cygwin*|*msys*], [
|
||||
platform_win32=yes
|
||||
],
|
||||
[darwin*], [
|
||||
platform_osx=yes
|
||||
]
|
||||
)
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** configure switches ***********************************************
|
||||
@@ -138,14 +149,14 @@ AC_ARG_ENABLE(libcanberra,
|
||||
[AS_HELP_STRING([--disable-libcanberra],[disable libcanberra support])],
|
||||
libcanberra=$enableval, libcanberra=yes)
|
||||
|
||||
AC_ARG_ENABLE(libproxy,
|
||||
[AS_HELP_STRING([--disable-libproxy],[disable libproxy support (default: auto)])],
|
||||
libproxy=$enableval, libproxy=auto)
|
||||
|
||||
AC_ARG_ENABLE(isocodes,
|
||||
[AS_HELP_STRING([--disable-isocodes],[disable iso-codes with spell-check])],
|
||||
isocodes=$enableval, isocodes=yes)
|
||||
|
||||
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_ENABLE(static-analysis,
|
||||
[AS_HELP_STRING([--enable-static-analysis],[if using clang run static analysis during build (default: no)])],
|
||||
analyze=$enableval, analyze=no)
|
||||
@@ -159,171 +170,133 @@ AC_ARG_WITH(theme-manager,
|
||||
dnl *********************************************************************
|
||||
dnl ** THEME-MANAGER ****************************************************
|
||||
dnl *********************************************************************
|
||||
if test "x$theme_manager" != "xno" ; then
|
||||
if test "x$MDTOOL" = "xno"; then
|
||||
AS_IF([test "x$theme_manager" != "xno"], [
|
||||
AS_IF([test "x$MDTOOL" = "xno"], [
|
||||
AC_MSG_ERROR([No "mdtool" found, you need to install monodevelop!])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** GLIB *************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
AM_PATH_GLIB_2_0([2.36.0], [], [AC_MSG_ERROR([Glib not found!])], [gmodule gobject gio])
|
||||
AM_PATH_GLIB_2_0([2.32.0], [], [AC_MSG_ERROR([Glib not found!])], [gmodule gobject gio])
|
||||
COMMON_CFLAGS="$GLIB_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
|
||||
COMMON_LIBS="$GLIB_LIBS"
|
||||
AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_36], [Dont warn using older APIs])
|
||||
AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_36], [Prevents using newer APIs])
|
||||
AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_32], [Dont warn using older APIs])
|
||||
AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_32], [Prevents using newer APIs])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** GTK **************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
# we might get undefined macro without this test
|
||||
if test "$gtkfe" = yes ; then
|
||||
AM_PATH_GTK_2_0(2.24.0, havegtk=yes, havegtk=no)
|
||||
|
||||
if test "$havegtk" = no; then
|
||||
AS_IF([test "$gtkfe" = yes], [
|
||||
PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.24.0], [
|
||||
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
|
||||
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED"
|
||||
], [
|
||||
gtkfe=no
|
||||
echo
|
||||
echo Cannot find GTK\! Not building GTK FrontEnd.
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
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 -DGTK_DISABLE_DEPRECATED"
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** MAC_INTEGRATION **************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
_gdk_tgt=`$PKG_CONFIG --variable=target gdk-2.0`
|
||||
if test "x$_gdk_tgt" = xquartz; then
|
||||
PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration-gtk2, [
|
||||
GUI_LIBS="$GUI_LIBS $GTK_MAC_LIBS"
|
||||
GUI_CFLAGS="$GUI_CFLAGS $GTK_MAC_CFLAGS"
|
||||
AC_DEFINE(HAVE_GTK_MAC)
|
||||
])
|
||||
fi
|
||||
AS_IF([test "x$_gdk_tgt" = xquartz], [
|
||||
PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration-gtk2, [
|
||||
GUI_LIBS="$GUI_LIBS $GTK_MAC_LIBS"
|
||||
GUI_CFLAGS="$GUI_CFLAGS $GTK_MAC_CFLAGS"
|
||||
AC_DEFINE(HAVE_GTK_MAC)
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** PERL *************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$perl" = yes; then
|
||||
AS_IF([test "$perl" = yes], [
|
||||
AC_MSG_CHECKING(for plugin interface used by Perl)
|
||||
if test "$plugin" = yes; then
|
||||
AS_IF([test "$plugin" = yes], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_PATH_PROG(perlpath, perl)
|
||||
AC_MSG_CHECKING(for Perl compile flags)
|
||||
PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
|
||||
if test "_$PERL_CFLAGS" = _ ; then
|
||||
AC_MSG_RESULT([not found, building without perl.])
|
||||
perl=no
|
||||
else
|
||||
PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts |$sedpath 's/-lgdbm //'`
|
||||
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-ldb //'`
|
||||
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lndbm //'`
|
||||
if test "$system" = "Linux"; then
|
||||
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lnsl //'`
|
||||
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lposix //'`
|
||||
fi
|
||||
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lc //'`
|
||||
AC_MSG_RESULT(ok)
|
||||
|
||||
AC_MSG_CHECKING(for perl >= 5.8.0)
|
||||
PERL_VER=`$perlpath -e 'print $]>= 5.008?"yes":"no"'`
|
||||
if test "$PERL_VER" = "yes"; then
|
||||
original_cflags="$CFLAGS"
|
||||
original_ldflags="$LDFLAGS"
|
||||
CFLAGS="$PERL_CFLAGS"
|
||||
LDFLAGS="$PERL_LDFLAGS"
|
||||
AC_TRY_LINK([
|
||||
#define PERL_NO_INLINE_FUNCTIONS
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
], [], perl_is_usable=yes, perl_is_usable=no)
|
||||
CFLAGS="$original_cflags"
|
||||
LDFLAGS="$original_ldflags"
|
||||
if test x$perl_is_usable = xno ; then
|
||||
AC_MSG_RESULT(no)
|
||||
perl=no
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_MSG_CHECKING(if perl plugin will be backward compatible)
|
||||
if test "$perl_old" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(OLD_PERL)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
echo "perl version too old, building without perl."
|
||||
perl=no
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AX_PERL_EXT_FLAGS([PERL_CFLAGS], [PERL_LDFLAGS])
|
||||
original_cflags="$CFLAGS"
|
||||
original_ldflags="$LDFLAGS"
|
||||
CFLAGS="$PERL_CFLAGS"
|
||||
LDFLAGS="$PERL_LDFLAGS"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#define PERL_NO_INLINE_FUNCTIONS
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
]], [[]])],[perl_is_usable=yes],[perl_is_usable=no])
|
||||
CFLAGS="$original_cflags"
|
||||
LDFLAGS="$original_ldflags"
|
||||
AS_IF([test "$perl_is_usable" = "no"], [
|
||||
AC_MSG_WARN([perl test failed to compile, disabling])
|
||||
perl=no
|
||||
], [
|
||||
AC_MSG_CHECKING([if perl plugin will be backward compatible])
|
||||
AS_IF([test "$perl_old" = "yes"], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(OLD_PERL)
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for Perl])
|
||||
perl=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** PYTHON ***********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "x$python" != xno ; then
|
||||
AS_IF([test "x$python" != xno], [
|
||||
AC_MSG_CHECKING(for plugin interface used by Python)
|
||||
if test "$plugin" = yes; then
|
||||
AS_IF([test "$plugin" = yes], [
|
||||
AC_MSG_RESULT([yes])
|
||||
case $python in
|
||||
AS_CASE([$python],
|
||||
dnl set python2 default here
|
||||
python2)
|
||||
PKG_CHECK_MODULES([PY], [python-2.7],
|
||||
[PY_VER="`$PKG_CONFIG --modversion python-2.7`"],
|
||||
[true])
|
||||
;;
|
||||
[python2], [
|
||||
PYTHON_VERSION=2
|
||||
AX_PYTHON_DEVEL([>= '2.7'])
|
||||
],
|
||||
dnl set python3 default here
|
||||
python3)
|
||||
PKG_CHECK_MODULES([PY], [python-3.4],
|
||||
[PY_VER="`$PKG_CONFIG --modversion python-3.4`"],
|
||||
[true])
|
||||
if test "$PY_VER" = "" ; then
|
||||
PKG_CHECK_MODULES([PY], [python-3.3],
|
||||
[PY_VER="`$PKG_CONFIG --modversion python-3.3`"],
|
||||
[true])
|
||||
fi
|
||||
;;
|
||||
[python3], [
|
||||
PYTHON_VERSION=3
|
||||
AX_PYTHON_DEVEL([>= '3.3'])
|
||||
],
|
||||
dnl add broken versions here
|
||||
python2.5|python2.6|python3.1|python3.2)
|
||||
AC_MSG_WARN(Unsupported Python version ${python}!);;
|
||||
python*)
|
||||
python="python-${python#python}" # stay posix compliant
|
||||
PKG_CHECK_MODULES([PY], [${python}],
|
||||
[PY_VER="`$PKG_CONFIG --modversion ${python}`"],
|
||||
[AC_MSG_WARN(Cannot find "${python}.pc"!)])
|
||||
;;
|
||||
*)
|
||||
[python2.5|python2.6|python3.1|python3.2], [
|
||||
AC_MSG_WARN(Unsupported Python version ${python}!)
|
||||
],
|
||||
dnl user supplied version
|
||||
[python*], [
|
||||
PYTHON_VERSION="${python#python}"
|
||||
AX_PYTHON_DEVEL()
|
||||
],[
|
||||
AC_MSG_WARN(Unsupported Python ${python}!)
|
||||
esac
|
||||
]
|
||||
)
|
||||
AC_MSG_CHECKING(Python version)
|
||||
|
||||
if test "$PY_VER"; then
|
||||
AC_MSG_RESULT($PY_VER)
|
||||
python="python-${PY_VER}"
|
||||
else
|
||||
AS_IF([test "$ac_python_version" != ""], [
|
||||
AC_MSG_RESULT($ac_python_version)
|
||||
python="python-${ac_python_version}"
|
||||
], [
|
||||
AC_MSG_RESULT(Not found)
|
||||
python=no
|
||||
fi
|
||||
else
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for Python])
|
||||
python=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** IPv6 *************************************************************
|
||||
@@ -341,150 +314,173 @@ AC_CHECK_LIB(socket, select)
|
||||
|
||||
AC_CHECK_FUNCS(getaddrinfo, have_getaddrinfo=yes)
|
||||
AC_MSG_CHECKING(whether IPv6 is supported)
|
||||
if test "$have_getaddrinfo" = yes; then
|
||||
AS_IF([test "$have_getaddrinfo" = yes], [
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(ipv6 support not found!)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** OPENSSL **********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
retry=no
|
||||
if test "$openssl" != no; then
|
||||
|
||||
AS_IF([test "$openssl" != no], [
|
||||
PKG_CHECK_MODULES(OPENSSL, [openssl], [
|
||||
AC_DEFINE(USE_OPENSSL)
|
||||
openssl=yes
|
||||
COMMON_LIBS="$COMMON_LIBS $OPENSSL_LIBS"
|
||||
COMMON_CFLAGS="$COMMON_CFLAGS $OPENSSL_CFLAGS"
|
||||
], [
|
||||
retry=yes
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$retry" = "yes"; then
|
||||
unset openssl_path ac_cv_lib_ssl_SSL_new ac_cv_header_openssl_ssl_h
|
||||
if test "$openssl" != yes; then
|
||||
openssl_path=$openssl
|
||||
fi
|
||||
openssl=no
|
||||
OPENSSL_LIBS="-lcrypto"
|
||||
if test -n "$openssl_path"; then
|
||||
OPENSSL_LIBS="-L$openssl_path/lib $OPENSSL_LIBS"
|
||||
fi
|
||||
SAVED_LIBS=$LIBS
|
||||
LIBS="$LIBS $OPENSSL_LIBS"
|
||||
AC_CHECK_LIB(ssl, SSL_new, [
|
||||
if test -n "$openssl_path"; then
|
||||
OPENSSL_CFLAGS="-I$openssl_path/include"
|
||||
fi
|
||||
SAVED_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
|
||||
AC_CHECK_HEADERS(openssl/ssl.h, [
|
||||
openssl=yes
|
||||
AC_DEFINE(USE_OPENSSL)
|
||||
OPENSSL_LIBS="$OPENSSL_LIBS -lssl"
|
||||
|
||||
COMMON_LIBS="$COMMON_LIBS $OPENSSL_LIBS"
|
||||
COMMON_CFLAGS="$COMMON_CFLAGS $OPENSSL_CFLAGS"
|
||||
unset openssl_path ac_cv_lib_ssl_SSL_new ac_cv_header_openssl_ssl_h
|
||||
AS_IF([test "$openssl" != yes], [
|
||||
openssl_path=$openssl
|
||||
])
|
||||
CFLAGS=$SAVED_CFLAGS
|
||||
openssl=no
|
||||
OPENSSL_LIBS="-lcrypto"
|
||||
AS_IF([test -n "$openssl_path"], [
|
||||
OPENSSL_LIBS="-L$openssl_path/lib $OPENSSL_LIBS"
|
||||
])
|
||||
SAVED_LIBS=$LIBS
|
||||
LIBS="$LIBS $OPENSSL_LIBS"
|
||||
AC_CHECK_LIB(ssl, SSL_new, [
|
||||
AS_IF([test -n "$openssl_path"], [
|
||||
OPENSSL_CFLAGS="-I$openssl_path/include"
|
||||
])
|
||||
SAVED_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
|
||||
AC_CHECK_HEADERS(openssl/ssl.h, [
|
||||
openssl=yes
|
||||
AC_DEFINE(USE_OPENSSL)
|
||||
OPENSSL_LIBS="$OPENSSL_LIBS -lssl"
|
||||
|
||||
COMMON_LIBS="$COMMON_LIBS $OPENSSL_LIBS"
|
||||
COMMON_CFLAGS="$COMMON_CFLAGS $OPENSSL_CFLAGS"
|
||||
])
|
||||
CFLAGS=$SAVED_CFLAGS
|
||||
])
|
||||
LIBS=$SAVED_LIBS
|
||||
])
|
||||
LIBS=$SAVED_LIBS
|
||||
fi
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** LIBPROXY *********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
AS_IF([test "x$libproxy" = "xyes" -o "x$libproxy" = "xauto"], [
|
||||
PKG_CHECK_MODULES([LIBPROXY], [libproxy-1.0], [
|
||||
COMMON_LIBS="$COMMON_LIBS $LIBPROXY_LIBS"
|
||||
COMMON_CFLAGS="$COMMON_CFLAGS $LIBPROXY_CFLAGS"
|
||||
AC_DEFINE(USE_LIBPROXY)
|
||||
libproxy=yes
|
||||
], [
|
||||
AS_IF([test "x$libproxy" = "xyes"], [
|
||||
AC_MSG_ERROR(Cannot find libproxy!)
|
||||
])
|
||||
libproxy=no
|
||||
])
|
||||
], [
|
||||
libproxy=no
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** PLUGIN ***********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$plugin" = yes; then
|
||||
AS_IF([test "$plugin" = yes], [
|
||||
AC_DEFINE(USE_PLUGIN)
|
||||
PLUGIN_LDFLAGS="-avoid-version"
|
||||
if test "$platform_win32" = yes; then
|
||||
AS_IF([test "$platform_win32" = yes], [
|
||||
PLUGIN_LDFLAGS="$PLUGIN_LDFLAGS -no-undefined"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** Checksum *********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$checksum" != "no"; then
|
||||
AS_IF([test "$checksum" != "no"], [
|
||||
checksum=no
|
||||
AC_MSG_CHECKING(for plugin interface used by Checksum)
|
||||
if test "$plugin" = yes; then
|
||||
AS_IF([test "$plugin" = yes], [
|
||||
checksum=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
], [
|
||||
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** DO AT ************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$doat" != "no"; then
|
||||
AS_IF([test "$doat" != "no"], [
|
||||
AC_MSG_CHECKING(for plugin interface used by Do At)
|
||||
doat=no
|
||||
if test "$plugin" = yes; then
|
||||
AS_IF([test "$plugin" = yes], [
|
||||
doat=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
], [
|
||||
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for Do At])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** FiSHLiM **********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$fishlim" != "no"; then
|
||||
AS_IF([test "$fishlim" != "no"], [
|
||||
fishlim=no
|
||||
AC_MSG_CHECKING(for plugin interface used by FiSHLiM)
|
||||
if test "$plugin" = yes; then
|
||||
AS_IF([test "$plugin" = yes], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_CHECKING(for OpenSSL used by FiSHLiM)
|
||||
if test "$openssl" = yes; then
|
||||
AS_IF([test "$openssl" = yes], [
|
||||
fishlim=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
], [
|
||||
AC_MSG_RESULT([OpenSSL cannot be found, use the --enable-openssl option])
|
||||
fi
|
||||
else
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** SYSINFO **********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$sysinfo" != "no"; then
|
||||
AS_IF([test "$sysinfo" != "no"], [
|
||||
AC_MSG_CHECKING(for plugin interface used by SysInfo)
|
||||
if test "$plugin" = yes; then
|
||||
AS_IF([test "$plugin" = yes], [
|
||||
AC_MSG_RESULT([yes])
|
||||
PKG_CHECK_MODULES(LIBPCI, libpci >= 3.0.0, [sysinfo=yes], [sysinfo=no])
|
||||
else
|
||||
AS_IF([test "$platform_osx" = yes], [
|
||||
sysinfo=yes
|
||||
], [
|
||||
PKG_CHECK_MODULES(LIBPCI, libpci >= 3.0.0, [
|
||||
sysinfo=yes
|
||||
AC_DEFINE(HAVE_LIBPCI)
|
||||
], [sysinfo=no])
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for SysInfo])
|
||||
sysinfo=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # Check for DBUS libraries
|
||||
dnl #######################################################################
|
||||
|
||||
if test "x$dbus" = "xyes" ; then
|
||||
AS_IF([test "x$dbus" = "xyes"], [
|
||||
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60 dbus-glib-1 >= 0.60 gthread-2.0], dbus=yes, [
|
||||
dbus=no
|
||||
])
|
||||
AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
|
||||
if test "x$DBUS_BINDING_TOOL" = "xno" || test "x$dbus" = "xno" ; then
|
||||
AS_IF([test "x$DBUS_BINDING_TOOL" = "xno" || test "x$dbus" = "xno"], [
|
||||
dbus="no"
|
||||
else
|
||||
], [
|
||||
COMMON_LIBS="$COMMON_LIBS $DBUS_LIBS"
|
||||
COMMON_CFLAGS="$COMMON_CFLAGS $DBUS_CFLAGS"
|
||||
AC_DEFINE(USE_DBUS)
|
||||
@@ -492,44 +488,44 @@ if test "x$dbus" = "xyes" ; then
|
||||
AS_AC_EXPAND(DBUS_SERVICES_DIR, "$datadir/dbus-1/services")
|
||||
AC_SUBST(DBUS_SERVICES_DIR)
|
||||
AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for DBUS is])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** LIBNOTIFY ********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "x$libnotify" = "xyes" ; then
|
||||
AS_IF([test "x$libnotify" = "xyes"], [
|
||||
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= 0.4, [], [
|
||||
libnotify=no
|
||||
])
|
||||
if test "$libnotify" != "no" ; then
|
||||
AS_IF([test "$libnotify" != "no"], [
|
||||
GUI_LIBS="$GUI_LIBS $LIBNOTIFY_LIBS"
|
||||
GUI_CFLAGS="$GUI_CFLAGS $LIBNOTIFY_CFLAGS"
|
||||
AC_DEFINE(USE_LIBNOTIFY)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** LIBCANBERRA ******************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "x$libcanberra" = "xyes" ; then
|
||||
AS_IF([test "x$libcanberra" = "xyes"], [
|
||||
PKG_CHECK_MODULES(LIBCANBERRA, libcanberra >= 0.22, [], [
|
||||
libcanberra=no
|
||||
])
|
||||
if test "$libcanberra" != "no" ; then
|
||||
AS_IF([test "$libcanberra" != "no"], [
|
||||
COMMON_LIBS="$COMMON_LIBS $LIBCANBERRA_LIBS"
|
||||
COMMON_CFLAGS="$COMMON_CFLAGS $LIBCANBERRA_CFLAGS"
|
||||
AC_DEFINE(USE_LIBCANBERRA)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** SPELL ************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "x$isocodes" = "xyes" ; then
|
||||
AS_IF([test "x$isocodes" = "xyes"], [
|
||||
PKG_CHECK_MODULES(ISOCODES, "iso-codes", [
|
||||
iso_codes_prefix=`$PKG_CONFIG --variable=prefix iso-codes 2>/dev/null || echo /usr`
|
||||
AC_MSG_NOTICE([iso-codes prefix: $iso_codes_prefix])
|
||||
@@ -540,18 +536,18 @@ if test "x$isocodes" = "xyes" ; then
|
||||
isocodes=no
|
||||
AC_MSG_WARN(iso-codes not found!)
|
||||
])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** Static Analysis **************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "x$analyze" = "xyes"; then
|
||||
if test "$CC" != "clang"; then
|
||||
AS_IF([test "x$analyze" = "xyes"], [
|
||||
AS_IF([test "$CC" != "clang"], [
|
||||
AC_MSG_WARN(CC is not clang for static analysis)
|
||||
analyze=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** CONDITIONALS *****************************************************
|
||||
@@ -572,95 +568,27 @@ AM_CONDITIONAL(DO_SYSINFO, test "x$sysinfo" = "xyes")
|
||||
AM_CONDITIONAL(DO_STATIC_ANALYSIS, test "x$analyze" = "xyes")
|
||||
AM_CONDITIONAL(USE_DBUS, test "x$dbus" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_ISO_CODES, test "x$isocodes" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_GTK_MAC, test "x$_gdk_tgt" = xquartz)
|
||||
AM_CONDITIONAL(WITH_TM, test "x$theme_manager" != "xno")
|
||||
AM_CONDITIONAL(PLATFORM_OSX, test "x$platform_osx" == "xyes")
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** GCC FLAGS ********************************************************
|
||||
dnl ** CFLAGS ***********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
dnl Only use -Wall and -pipe if we have gcc
|
||||
if test "x$GCC" = "xyes"; then
|
||||
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
dnl these flags might be unwanted
|
||||
if test x$minimalflags != xyes; then
|
||||
if test "$system" = "Linux" -o "$system" = "FreeBSD"; then
|
||||
if test -z "`echo "$CFLAGS" | grep "\-pipe" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
fi
|
||||
fi
|
||||
if test -z "`echo "$CFLAGS" | grep "\-g " 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -g"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl does this compiler support -Wno-pointer-sign ?
|
||||
AC_MSG_CHECKING([if $CC accepts -Wno-pointer-sign ])
|
||||
|
||||
safe_CFLAGS=$CFLAGS
|
||||
CFLAGS="-Wno-pointer-sign"
|
||||
|
||||
AC_TRY_COMPILE(, [
|
||||
return 0;
|
||||
],
|
||||
[
|
||||
no_pointer_sign=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
no_pointer_sign=no
|
||||
AC_MSG_RESULT([no])
|
||||
CC_CHECK_FLAGS_APPEND([CFLAGS], [CFLAGS], [ \
|
||||
-pipe \
|
||||
-funsigned-char \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-sign-compare \
|
||||
-Wno-pointer-sign \
|
||||
-Wno-missing-field-initializers \
|
||||
-Wno-unused-result \
|
||||
-Werror=format-security \
|
||||
-Werror=declaration-after-statement \
|
||||
])
|
||||
CFLAGS=$safe_CFLAGS
|
||||
|
||||
if test x$no_pointer_sign = xyes; then
|
||||
CFLAGS="$CFLAGS -Wno-pointer-sign"
|
||||
fi
|
||||
|
||||
dnl does this compiler support -funsigned-char ?
|
||||
AC_MSG_CHECKING([if $CC accepts -funsigned-char ])
|
||||
|
||||
safe_CFLAGS=$CFLAGS
|
||||
CFLAGS="-funsigned-char"
|
||||
|
||||
AC_TRY_COMPILE(, [
|
||||
return 0;
|
||||
],
|
||||
[
|
||||
unsigned_char=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
unsigned_char=no
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
CFLAGS=$safe_CFLAGS
|
||||
|
||||
if test x$unsigned_char = xyes; then
|
||||
CFLAGS="$CFLAGS -funsigned-char"
|
||||
fi
|
||||
|
||||
dnl does this compiler support -Wno-unused-result ?
|
||||
AC_MSG_CHECKING([if $CC accepts -Wno-unused-result ])
|
||||
|
||||
safe_CFLAGS=$CFLAGS
|
||||
CFLAGS="-Wno-unused-result"
|
||||
|
||||
AC_TRY_COMPILE(, [
|
||||
return 0;
|
||||
],
|
||||
[
|
||||
no_unused_result=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
no_unused_result=no
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
CFLAGS=$safe_CFLAGS
|
||||
|
||||
if test x$no_unused_result = xyes; then
|
||||
CFLAGS="$CFLAGS -Wno-unused-result"
|
||||
fi
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** FUNCTIONS/LIBS/CFLAGS ********************************************
|
||||
@@ -669,16 +597,12 @@ dnl *********************************************************************
|
||||
AC_MSG_CHECKING(for modern sigaction)
|
||||
dnl libc5 on linux and FreeBSD 3.x doesn\'t have siginfo_t
|
||||
dnl and the sa_sigation field.
|
||||
AC_TRY_COMPILE(
|
||||
[#include <signal.h>],
|
||||
[struct sigaction act;
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[struct sigaction act;
|
||||
siginfo_t *si;
|
||||
act.sa_sigaction = 0;],
|
||||
[
|
||||
act.sa_sigaction = 0;]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SIGACTION)
|
||||
],
|
||||
AC_MSG_RESULT(no))
|
||||
],[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_CHECK_FUNCS(memrchr)
|
||||
|
||||
@@ -702,9 +626,9 @@ AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
|
||||
ac_cv_type_socklen_t=yes,
|
||||
ac_cv_type_socklen_t=no)
|
||||
])
|
||||
if test $ac_cv_type_socklen_t = no; then
|
||||
AS_IF([test $ac_cv_type_socklen_t = no], [
|
||||
AC_DEFINE(socklen_t, int)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Mac OS X and Darwin use lookupd, which caches DNS queries by default
|
||||
AC_EGREP_CPP(lookupd, dnl
|
||||
@@ -714,7 +638,6 @@ AC_EGREP_CPP(lookupd, dnl
|
||||
|
||||
dnl freebsd needs this
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
CFLAGS="$CFLAGS $CPPFLAGS"
|
||||
|
||||
GUI_LIBS="$GUI_LIBS $COMMON_LIBS"
|
||||
|
||||
@@ -725,8 +648,8 @@ AC_SUBST(COMMON_LIBS)
|
||||
AC_SUBST(COMMON_CFLAGS)
|
||||
AC_SUBST(PERL_CFLAGS)
|
||||
AC_SUBST(PERL_LDFLAGS)
|
||||
AC_SUBST(PY_CFLAGS)
|
||||
AC_SUBST(PY_LIBS)
|
||||
AC_SUBST(PYTHON_CPPFLAGS)
|
||||
AC_SUBST(PYTHON_LIBS)
|
||||
AC_SUBST(DBUS_CFLAGS)
|
||||
AC_SUBST(DBUS_LIBS)
|
||||
AC_SUBST(OPENSSL_LIBS)
|
||||
@@ -736,8 +659,12 @@ AC_SUBST(PLUGIN_LDFLAGS)
|
||||
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/pkgconfig))
|
||||
|
||||
dnl for plugin.c and pixmaps.c
|
||||
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
|
||||
AS_IF([test "x$prefix" = xNONE], [
|
||||
prefix="$ac_default_prefix"
|
||||
])
|
||||
AS_IF([test "x$exec_prefix" = xNONE], [
|
||||
exec_prefix="$prefix"
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
|
||||
|
||||
@@ -792,6 +719,7 @@ echo D-Bus support ......... : $dbus
|
||||
echo libnotify support ..... : $libnotify
|
||||
echo libcanberra support ... : $libcanberra
|
||||
echo Plugin interface ...... : $plugin
|
||||
echo libproxy support ...... : $libproxy
|
||||
echo
|
||||
echo Perl .................. : $perl
|
||||
echo Python ................ : $python
|
||||
@@ -801,6 +729,8 @@ echo Do At ................. : $doat
|
||||
echo FiSHLiM ............... : $fishlim
|
||||
echo SysInfo ............... : $sysinfo
|
||||
echo
|
||||
echo Debug mode ............ : $enable_debug
|
||||
echo
|
||||
echo The binary will be installed in $prefix/bin
|
||||
echo
|
||||
|
||||
|
||||
@@ -3,3 +3,6 @@ SUBDIRS = pkgconfig man
|
||||
if DO_GTK
|
||||
SUBDIRS += icons misc
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
hexchat.gresource.xml
|
||||
|
||||
@@ -11,3 +11,5 @@ install-data-hook:
|
||||
|
||||
uninstall-hook:
|
||||
$(UPDATE_ICON_CACHE);
|
||||
|
||||
EXTRA_DIST = $(icon_DATA) $(hicolor_DATA)
|
||||
|
||||
@@ -1,745 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="hexchat.svg"
|
||||
version="1.0"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:version="0.32"
|
||||
id="svg2"
|
||||
height="64"
|
||||
width="64">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient2289">
|
||||
<stop
|
||||
style="stop-color:#ff2600;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2291" />
|
||||
<stop
|
||||
style="stop-color:#ffd600;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop2293" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1335"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1337"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="16.88862"
|
||||
y2="19.001091" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1317"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1319"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="16.88862"
|
||||
y2="19.001091" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1320"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1322"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="16.88862"
|
||||
y2="19.001091" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient2997"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-160.10656,-7.1914058)"
|
||||
x1="130.2673"
|
||||
y1="78.743134"
|
||||
x2="129.2081"
|
||||
y2="25.771122" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient3011"
|
||||
x1="34.62241"
|
||||
y1="53.508884"
|
||||
x2="34.466503"
|
||||
y2="5.4893961"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient3030"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="34.62241"
|
||||
y1="53.508884"
|
||||
x2="34.466503"
|
||||
y2="5.4893961" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient3070"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="34.62241"
|
||||
y1="53.508884"
|
||||
x2="34.466503"
|
||||
y2="5.4893961"
|
||||
gradientTransform="matrix(0.99894925,0,0,0.97549134,-3.1829063,4.465557)" />
|
||||
<filter
|
||||
id="filter3281"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3283"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3285"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3287"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3289"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3291"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3293"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3295"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3297"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3299"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3301"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3303"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4089"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4093"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4096"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4098"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438"
|
||||
gradientTransform="translate(-70.003571,-2.298097)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
id="linearGradient4101"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.94969205,0,0,0.89326813,1.6716955,2.7025635)"
|
||||
x1="31.372862"
|
||||
y1="60.111893"
|
||||
x2="31.559002"
|
||||
y2="5.6897221" />
|
||||
<filter
|
||||
id="filter4111"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood4113"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite4115"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur4117"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset4119"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite4121"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter4123"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood4125"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite4127"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur4129"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset4131"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite4133"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1330"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1328"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1322-5"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1320-4"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1319-2"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1317-8"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1337-8"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1335-4"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient2289-4">
|
||||
<stop
|
||||
id="stop2291-0"
|
||||
offset="0"
|
||||
style="stop-color:#ff2600;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop2293-9"
|
||||
offset="1"
|
||||
style="stop-color:#ffd600;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
id="linearGradient3133"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.51445624,0,0,0.53856587,7.3477348,6.9450134)"
|
||||
x1="46.881573"
|
||||
y1="91.824585"
|
||||
x2="47.225189"
|
||||
y2="1.5596932" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
id="linearGradient3136"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.51445624,0,0,0.53856587,-120.3871,-29.360443)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<filter
|
||||
id="filter3138"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3140"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3142"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3144"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3146"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3148"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3670"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3672"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3674"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3676"
|
||||
in="composite"
|
||||
stdDeviation="1.5"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3678"
|
||||
dx="0"
|
||||
dy="4"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3680"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix3682" />
|
||||
<feFlood
|
||||
id="feFlood3684"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
in="fbSourceGraphic" />
|
||||
<feComposite
|
||||
id="feComposite3686"
|
||||
in2="fbSourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3688"
|
||||
in="composite"
|
||||
stdDeviation="1.5"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3690"
|
||||
dx="0"
|
||||
dy="2"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3692"
|
||||
in2="offset"
|
||||
in="fbSourceGraphic"
|
||||
operator="over"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix3706" />
|
||||
<feFlood
|
||||
id="feFlood3708"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(255,255,255)"
|
||||
result="flood"
|
||||
in="fbSourceGraphic" />
|
||||
<feComposite
|
||||
id="feComposite3710"
|
||||
in2="fbSourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3712"
|
||||
in="composite"
|
||||
stdDeviation="1"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3714"
|
||||
dx="0"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3716"
|
||||
in2="offset"
|
||||
in="fbSourceGraphic"
|
||||
operator="over"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix3123" />
|
||||
<feFlood
|
||||
id="feFlood3125"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
in="fbSourceGraphic" />
|
||||
<feComposite
|
||||
id="feComposite3127"
|
||||
in2="fbSourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3129"
|
||||
in="composite"
|
||||
stdDeviation="1"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3131"
|
||||
dx="0"
|
||||
dy="2"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3133"
|
||||
in2="offset"
|
||||
in="fbSourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3135"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3137"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3139"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3141"
|
||||
in="composite"
|
||||
stdDeviation="1"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3143"
|
||||
dx="0"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3145"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3183"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3185"
|
||||
flood-opacity="0.3"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3187"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3189"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3191"
|
||||
dx="0"
|
||||
dy="2"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3193"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="7.9999999"
|
||||
inkscape:cx="61.011203"
|
||||
inkscape:cy="36.086679"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1270"
|
||||
inkscape:window-height="837"
|
||||
inkscape:window-x="287"
|
||||
inkscape:window-y="27"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-maximized="0">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3001" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
height="64"
|
||||
width="64">
|
||||
<metadata>
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<cc:Work>
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Guglielmi David</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
|
||||
<cc:license rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>Peter Zelezny</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>Samuel Messner</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/SourceCode" />
|
||||
<cc:License rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
|
||||
<cc:requires rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
<cc:requires rdf:resource="http://web.resource.org/cc/SourceCode" />
|
||||
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g3663">
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:1;"
|
||||
d="m 31.404792,8.7464684 c -6.271873,0.05843 -12.553,0.431777 -13.735377,1.075609 C 15.304661,11.109737 4.1505773,29.32852 4.1783444,31.859522 c 0.02777,2.531005 11.5871596,20.543967 13.9796816,21.787309 2.392519,1.243342 25.106,1.037521 27.470753,-0.250141 C 47.993531,52.109028 59.147618,33.890246 59.119851,31.359242 59.092081,28.828238 47.532689,10.790262 45.140167,9.5469214 43.943907,8.9252504 37.676665,8.6880384 31.404792,8.7464684 z m 0.05429,4.5275596 c 4.90437,-0.047 9.786849,0.175368 10.722281,0.67538 1.870861,1.000021 10.917726,15.499216 10.939439,17.534904 C 53.142512,33.52 44.410541,48.158649 42.561393,49.194315 40.712245,50.229983 22.960549,50.419464 21.089689,49.419444 19.218826,48.419423 10.199106,33.920226 10.177392,31.884537 10.155682,29.84885 18.860508,15.185189 20.709656,14.14952 c 0.924575,-0.517833 5.845056,-0.828498 10.749425,-0.875492 z"
|
||||
id="path4107"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
transform="matrix(0.97890109,0,0,0.98965389,0.52623659,-1.3159842)"
|
||||
style="fill:#000000;fill-opacity:1;"
|
||||
d="M 31.801142,5.3887159 C 24.358829,5.4607629 16.905535,5.9211193 15.502506,6.7149966 12.696449,8.3027513 -0.53918189,30.767467 -0.50623228,33.888328 -0.47328049,37.00919 13.243292,59.220118 16.0823,60.753225 18.921305,62.286332 45.873514,62.032541 48.67957,60.444787 51.485627,58.857032 64.721258,36.392315 64.688309,33.271454 64.655357,30.150593 50.938784,7.9088218 48.099776,6.3757155 46.680274,5.6091623 39.243454,5.3166688 31.801142,5.3887159 z m 0.06442,5.5827171 c 5.81961,-0.05795 11.613244,0.216241 12.723243,0.83278 2.219996,1.233079 12.955163,19.111349 12.980929,21.621461 0.02577,2.51011 -10.335747,20.560333 -12.529979,21.837366 -2.19423,1.277031 -23.2587,1.510671 -25.478697,0.277592 C 17.341063,54.307554 6.638107,36.429283 6.6123418,33.919173 6.5865755,31.409062 16.915878,13.327995 19.110109,12.050964 20.207224,11.412447 26.045952,11.02938 31.865563,10.971433 z"
|
||||
id="path4103"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
inkscape:transform-center-y="2.25"
|
||||
inkscape:transform-center-x="2.25"
|
||||
style="fill:url(#linearGradient3133);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.31593215000000008;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;"
|
||||
d="m 10.723737,18.285684 7.623916,-7.935243 13.238019,13.886676 12.492701,-13.886676 8.576909,7.935243 -14.294847,14.878584 13.341856,11.902864 -6.670928,6.94334 L 31.585672,39.351071 18.573785,52.010472 11.676724,45.086347 24.065591,33.164268 10.723737,18.285684 z"
|
||||
id="path2297"
|
||||
sodipodi:nodetypes="ccccccccccccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3305"
|
||||
d="M 31.293607,6.0952825 C 24.436514,6.1604875 17.569304,6.5771256 16.276601,7.2956116 13.691196,8.7325834 1.4963386,29.063913 1.5266972,31.888398 1.5570579,34.712884 14.195039,54.814527 16.810803,56.20204 19.426566,57.589553 44.25941,57.359866 46.844814,55.922894 49.430219,54.485922 61.625078,34.154591 61.594719,31.330106 61.564358,28.505621 48.926376,8.3760634 46.310612,6.9885506 45.002731,6.294794 38.150699,6.0300774 31.293607,6.0952825 z m 0.05936,5.0525485 c 5.36199,-0.05245 10.700046,0.195704 11.722761,0.753694 2.045429,1.115978 11.936445,17.296419 11.960184,19.568154 0.02374,2.271736 -9.523004,18.6078 -11.544693,19.763557 -2.02169,1.155758 -21.429773,1.36721 -23.475201,0.251232 C 17.970585,50.368491 8.1092472,34.188049 8.085508,31.916313 8.061768,29.644577 17.578834,13.2806 19.600523,12.124842 c 1.010846,-0.577879 6.39045,-0.924567 11.75244,-0.977011 z"
|
||||
style="fill:url(#linearGradient4101);fill-opacity:1;" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3077"
|
||||
d="M 14.640198,55.682743 C 9.6971439,47.360612 2.8950957,35.733851 2.9419881,35.686959 c 0.031272,-0.03127 0.5023581,0.289334 1.0468575,0.712459 0.5444994,0.423125 1.0414462,0.769317 1.1043264,0.769317 0.06288,0 2.6329414,4.276521 5.711247,9.50338 l 5.59692,9.503379 2.159128,0.007 2.159126,0.007 -0.34365,-0.584653 C 20.186937,55.28323 17.303514,50.518786 13.968339,45.017137 10.633164,39.515488 7.9043842,34.929294 7.9043842,34.825595 c 0,-0.103699 0.2455542,-0.59277 0.545676,-1.086823 0.3001218,-0.494053 0.545676,-0.941721 0.545676,-0.994816 0,-0.05309 -0.2788317,-0.09654 -0.619626,-0.09654 -0.8505388,0 -1.0953557,-0.488405 -1.0953557,-2.185211 0,-1.90734 -0.048411,-1.868066 2.30512,-1.870072 l 1.9823345,-0.0017 1.052375,-1.721616 c 0.578806,-0.94689 1.052375,-1.785869 1.052375,-1.8644 0,-0.07853 -0.829918,-0.162484 -1.844262,-0.186561 l -1.8442631,-0.04378 4.4809551,-7.327649 4.480953,-7.32765 12.466741,-0.0399 12.466738,-0.0399 0.517892,0.854518 0.517892,0.854518 2.335995,0.04287 2.335994,0.04287 2.742626,4.521316 c 1.508447,2.486723 4.136212,6.819001 5.839482,9.627283 1.703268,2.808283 3.157599,5.105969 3.231846,5.105969 0.256907,0 0.13186,-0.393635 -0.411085,-1.294044 -0.299901,-0.497351 -0.545275,-0.935841 -0.545275,-0.974422 0,-0.03858 0.310833,-0.07015 0.69074,-0.07015 0.575204,0 0.699074,-0.05324 0.740561,-0.318272 0.03599,-0.229934 0.273254,0.06215 0.854835,1.052375 0.702767,1.196557 0.780303,1.410253 0.610448,1.682462 -0.107012,0.171499 -0.377881,0.627528 -0.601929,1.013399 l -0.407361,0.701583 0.533953,0.857491 c 0.293674,0.47162 0.535536,0.950306 0.537472,1.063747 0.0019,0.113441 -3.098537,5.322698 -6.889942,11.576127 l -6.893462,11.36987 -16.876654,0 -16.876655,0 -1.226996,-2.065773 z"
|
||||
style="fill:none;" />
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient id="hexchatGradient" x1="0" y1="1" x2="0" y2="0">
|
||||
<stop id="hgRedStop" offset="0" style="stop-color: #FF2600; stop-opacity: 1;" />
|
||||
<stop id="hgYellowStop" offset="1" style="stop-color: #FFD600; stop-opacity: 1;" />
|
||||
</linearGradient>
|
||||
<filter inkscape:collect="always" id="dropshadow">
|
||||
<feGaussianBlur inkscape:collect="always" stdDeviation="1.9736701" id="dropshadowGaussian" />
|
||||
</filter>
|
||||
</defs>
|
||||
<path
|
||||
style="fill: #000000; fill-opacity: 1;"
|
||||
d="m 31.62506,4.4248023 c -7.285288,0.0713 -14.595323,0.526836 -15.96875,1.3125 C 12.909458,7.3086297 -0.0321942,29.523731 6.0185229e-5,32.612303 0.0323162,35.700876 13.470952,57.688808 16.25006,59.206053 c 2.779105,1.517245 29.159399,1.258827 31.90625,-0.3125 2.746852,-1.571328 15.688504,-23.786428 15.65625,-26.875 C 63.7803,28.929981 50.372918,6.9107967 47.59381,5.3935523 46.204258,4.6349293 38.910347,4.3535003 31.62506,4.4248023 z m -0.1875,9.2500007 c 3.386631,-0.03246 6.676687,0.05409 8.75,0.28125 l -8.71875,9.71875 -9.0625,-9.5 c 2.055746,-0.283043 5.521157,-0.466366 9.03125,-0.5 z m 17.34375,9.84375 c 2.298293,3.744897 4.302354,7.392556 4.3125,8.34375 0.01126,1.055883 -2.358157,5.507241 -4.875,9.6875 l -9.03125,-8.03125 z m -34.46875,0.25 8.75,9.75 -8.1875,7.875 c -2.482342,-3.992634 -4.707927,-8.110307 -4.71875,-9.125 -0.01021,-0.95736 1.927117,-4.687748 4.15625,-8.5 z m 17.15625,16.90625 9.8125,9.21875 c -4.111037,0.67314 -16.108253,0.781873 -19.46875,0.125 z"
|
||||
id="outline"
|
||||
sodipodi:nodetypes="ssssssssscccscsccccccsccccc" />
|
||||
<path
|
||||
style="fill: url(#hexchatGradient); fill-opacity: 1;"
|
||||
d="m 31.25006,6.4873027 c -6.857093,0.06521 -13.707297,0.469014 -15,1.1875 -2.585405,1.4369712 -14.780358,21.7692653 -14.75,24.5937503 0.03036,2.824486 12.665486,22.924987 15.28125,24.3125 2.615763,1.387513 27.445846,1.186972 30.03125,-0.25 2.585405,-1.436972 14.780359,-21.769265 14.75,-24.59375 C 61.5322,28.912818 48.897074,8.7810649 46.28131,7.3935527 44.973429,6.6997957 38.107152,6.4220967 31.25006,6.4873027 z m 0.0625,5.0625003 c 5.36199,-0.05245 10.696035,0.19201 11.71875,0.75 0.06132,0.03346 0.143803,0.127745 0.21875,0.1875 l -11.28125,12.59375 -0.5,0.53125 -0.46875,-0.53125 -11.75,-12.3125 c 0.10903,-0.09884 0.228263,-0.201843 0.3125,-0.25 1.010846,-0.577879 6.38801,-0.916306 11.75,-0.96875 z m 18.0625,9.46875 c 2.883844,4.661341 5.612556,9.652893 5.625,10.84375 0.01348,1.290331 -3.064699,7.087557 -6.09375,12.09375 l -11.09375,-9.90625 -0.53125,-0.46875 0.5,-0.46875 11.59375,-12.09375 z m -35.78125,0.03125 10.84375,12.0625 0.4375,0.46875 -0.46875,0.4375 -10.28125,9.90625 c -3.04689,-4.86606 -6.049362,-10.36778 -6.0625,-11.625 -0.01271,-1.216102 2.689239,-6.451996 5.53125,-11.25 z m 17.875,17.78125 0.4375,0.4375 12.34375,11.59375 c -0.318014,0.365376 -0.587006,0.638955 -0.78125,0.75 -2.02169,1.155758 -21.423322,1.397228 -23.46875,0.28125 -0.228202,-0.124506 -0.601742,-0.47821 -1,-0.9375 l 12,-11.6875 0.46875,-0.4375 z"
|
||||
id="coloredX" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -1,746 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="hexchat.svg"
|
||||
version="1.0"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:version="0.32"
|
||||
id="svg2"
|
||||
height="64"
|
||||
width="64">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient2289">
|
||||
<stop
|
||||
style="stop-color:#ff2600;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2291" />
|
||||
<stop
|
||||
style="stop-color:#ffd600;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop2293" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1335"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1337"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="16.88862"
|
||||
y2="19.001091" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1317"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1319"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="16.88862"
|
||||
y2="19.001091" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1320"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient1322"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="16.88862"
|
||||
y2="19.001091" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient2997"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-160.10656,-7.1914058)"
|
||||
x1="130.2673"
|
||||
y1="78.743134"
|
||||
x2="129.2081"
|
||||
y2="25.771122" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient3011"
|
||||
x1="34.62241"
|
||||
y1="53.508884"
|
||||
x2="34.466503"
|
||||
y2="5.4893961"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient3030"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="34.62241"
|
||||
y1="53.508884"
|
||||
x2="34.466503"
|
||||
y2="5.4893961" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient3070"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="34.62241"
|
||||
y1="53.508884"
|
||||
x2="34.466503"
|
||||
y2="5.4893961"
|
||||
gradientTransform="matrix(0.99894925,0,0,0.97549134,-3.1829063,4.465557)" />
|
||||
<filter
|
||||
id="filter3281"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3283"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3285"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3287"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3289"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3291"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3293"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3295"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3297"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3299"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3301"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3303"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4089"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4093"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4096"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289"
|
||||
id="linearGradient4098"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="99.348503"
|
||||
y1="59.934135"
|
||||
x2="100.40916"
|
||||
y2="10.613438"
|
||||
gradientTransform="translate(-70.003571,-2.298097)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
id="linearGradient4101"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.94969205,0,0,0.89326813,1.6716955,2.7025635)"
|
||||
x1="31.372862"
|
||||
y1="60.111893"
|
||||
x2="31.559002"
|
||||
y2="5.6897221" />
|
||||
<filter
|
||||
id="filter4111"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood4113"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite4115"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur4117"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset4119"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite4121"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter4123"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood4125"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite4127"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur4129"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset4131"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite4133"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1330"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1328"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1322-5"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.172329,-1.111016)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1320-4"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1319-2"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.735969,0,0,0.735801,-2.052758,-16.66733)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1317-8"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="19.001091"
|
||||
x2="16.88862"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1337-8"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
y2="20.59322"
|
||||
x2="72.348671"
|
||||
y1="77.796608"
|
||||
x1="16.88862"
|
||||
gradientTransform="matrix(0.545166,0,0,0.544959,0.186963,35.29511)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient1335-4"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient2289-4">
|
||||
<stop
|
||||
id="stop2291-0"
|
||||
offset="0"
|
||||
style="stop-color:#ff2600;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop2293-9"
|
||||
offset="1"
|
||||
style="stop-color:#ffd600;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
id="linearGradient3133"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.51445624,0,0,0.53856587,7.3477348,6.9450134)"
|
||||
x1="46.881573"
|
||||
y1="91.824585"
|
||||
x2="47.225189"
|
||||
y2="1.5596932" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2289-4"
|
||||
id="linearGradient3136"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.51445624,0,0,0.53856587,-120.3871,-29.360443)"
|
||||
x1="16.88862"
|
||||
y1="77.796608"
|
||||
x2="72.348671"
|
||||
y2="20.59322" />
|
||||
<filter
|
||||
id="filter3138"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3140"
|
||||
flood-opacity="0.33"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3142"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3144"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3146"
|
||||
dx="4"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3148"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3670"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3672"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3674"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3676"
|
||||
in="composite"
|
||||
stdDeviation="1.5"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3678"
|
||||
dx="0"
|
||||
dy="4"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3680"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix3682" />
|
||||
<feFlood
|
||||
id="feFlood3684"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
in="fbSourceGraphic" />
|
||||
<feComposite
|
||||
id="feComposite3686"
|
||||
in2="fbSourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3688"
|
||||
in="composite"
|
||||
stdDeviation="1.5"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3690"
|
||||
dx="0"
|
||||
dy="2"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3692"
|
||||
in2="offset"
|
||||
in="fbSourceGraphic"
|
||||
operator="over"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix3706" />
|
||||
<feFlood
|
||||
id="feFlood3708"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(255,255,255)"
|
||||
result="flood"
|
||||
in="fbSourceGraphic" />
|
||||
<feComposite
|
||||
id="feComposite3710"
|
||||
in2="fbSourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3712"
|
||||
in="composite"
|
||||
stdDeviation="1"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3714"
|
||||
dx="0"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3716"
|
||||
in2="offset"
|
||||
in="fbSourceGraphic"
|
||||
operator="over"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix3123" />
|
||||
<feFlood
|
||||
id="feFlood3125"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
in="fbSourceGraphic" />
|
||||
<feComposite
|
||||
id="feComposite3127"
|
||||
in2="fbSourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3129"
|
||||
in="composite"
|
||||
stdDeviation="1"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3131"
|
||||
dx="0"
|
||||
dy="2"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3133"
|
||||
in2="offset"
|
||||
in="fbSourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3135"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3137"
|
||||
flood-opacity="0.2"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3139"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3141"
|
||||
in="composite"
|
||||
stdDeviation="1"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3143"
|
||||
dx="0"
|
||||
dy="1"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3145"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
<filter
|
||||
id="filter3183"
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow">
|
||||
<feFlood
|
||||
id="feFlood3185"
|
||||
flood-opacity="0.3"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood" />
|
||||
<feComposite
|
||||
id="feComposite3187"
|
||||
in2="SourceGraphic"
|
||||
in="flood"
|
||||
operator="in"
|
||||
result="composite1" />
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3189"
|
||||
in="composite"
|
||||
stdDeviation="2"
|
||||
result="blur" />
|
||||
<feOffset
|
||||
id="feOffset3191"
|
||||
dx="0"
|
||||
dy="2"
|
||||
result="offset" />
|
||||
<feComposite
|
||||
id="feComposite3193"
|
||||
in2="offset"
|
||||
in="SourceGraphic"
|
||||
operator="over"
|
||||
result="composite2" />
|
||||
</filter>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="7.9999999"
|
||||
inkscape:cx="60.761203"
|
||||
inkscape:cy="36.086679"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1270"
|
||||
inkscape:window-height="837"
|
||||
inkscape:window-x="287"
|
||||
inkscape:window-y="27"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-maximized="0">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3001" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
height="64"
|
||||
width="64">
|
||||
<metadata>
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<cc:Work>
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Guglielmi David</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
|
||||
<cc:license rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>Peter Zelezny</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>Samuel Messner</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/SourceCode" />
|
||||
<cc:License rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
|
||||
<cc:requires rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
<cc:requires rdf:resource="http://web.resource.org/cc/SourceCode" />
|
||||
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g3663"
|
||||
style="filter:url(#filter3183)">
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:1;"
|
||||
d="m 31.404792,8.7464684 c -6.271873,0.05843 -12.553,0.431777 -13.735377,1.075609 C 15.304661,11.109737 4.1505773,29.32852 4.1783444,31.859522 c 0.02777,2.531005 11.5871596,20.543967 13.9796816,21.787309 2.392519,1.243342 25.106,1.037521 27.470753,-0.250141 C 47.993531,52.109028 59.147618,33.890246 59.119851,31.359242 59.092081,28.828238 47.532689,10.790262 45.140167,9.5469214 43.943907,8.9252504 37.676665,8.6880384 31.404792,8.7464684 z m 0.05429,4.5275596 c 4.90437,-0.047 9.786849,0.175368 10.722281,0.67538 1.870861,1.000021 10.917726,15.499216 10.939439,17.534904 C 53.142512,33.52 44.410541,48.158649 42.561393,49.194315 40.712245,50.229983 22.960549,50.419464 21.089689,49.419444 19.218826,48.419423 10.199106,33.920226 10.177392,31.884537 10.155682,29.84885 18.860508,15.185189 20.709656,14.14952 c 0.924575,-0.517833 5.845056,-0.828498 10.749425,-0.875492 z"
|
||||
id="path4107"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
transform="matrix(0.97890109,0,0,0.98965389,0.52623659,-1.3159842)"
|
||||
style="fill:#000000;fill-opacity:1;"
|
||||
d="M 31.801142,5.3887159 C 24.358829,5.4607629 16.905535,5.9211193 15.502506,6.7149966 12.696449,8.3027513 -0.53918189,30.767467 -0.50623228,33.888328 -0.47328049,37.00919 13.243292,59.220118 16.0823,60.753225 18.921305,62.286332 45.873514,62.032541 48.67957,60.444787 51.485627,58.857032 64.721258,36.392315 64.688309,33.271454 64.655357,30.150593 50.938784,7.9088218 48.099776,6.3757155 46.680274,5.6091623 39.243454,5.3166688 31.801142,5.3887159 z m 0.06442,5.5827171 c 5.81961,-0.05795 11.613244,0.216241 12.723243,0.83278 2.219996,1.233079 12.955163,19.111349 12.980929,21.621461 0.02577,2.51011 -10.335747,20.560333 -12.529979,21.837366 -2.19423,1.277031 -23.2587,1.510671 -25.478697,0.277592 C 17.341063,54.307554 6.638107,36.429283 6.6123418,33.919173 6.5865755,31.409062 16.915878,13.327995 19.110109,12.050964 20.207224,11.412447 26.045952,11.02938 31.865563,10.971433 z"
|
||||
id="path4103"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
inkscape:transform-center-y="2.25"
|
||||
inkscape:transform-center-x="2.25"
|
||||
style="fill:url(#linearGradient3133);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.31593215000000008;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;"
|
||||
d="m 10.723737,18.285684 7.623916,-7.935243 13.238019,13.886676 12.492701,-13.886676 8.576909,7.935243 -14.294847,14.878584 13.341856,11.902864 -6.670928,6.94334 L 31.585672,39.351071 18.573785,52.010472 11.676724,45.086347 24.065591,33.164268 10.723737,18.285684 z"
|
||||
id="path2297"
|
||||
sodipodi:nodetypes="ccccccccccccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3305"
|
||||
d="M 31.293607,6.0952825 C 24.436514,6.1604875 17.569304,6.5771256 16.276601,7.2956116 13.691196,8.7325834 1.4963386,29.063913 1.5266972,31.888398 1.5570579,34.712884 14.195039,54.814527 16.810803,56.20204 19.426566,57.589553 44.25941,57.359866 46.844814,55.922894 49.430219,54.485922 61.625078,34.154591 61.594719,31.330106 61.564358,28.505621 48.926376,8.3760634 46.310612,6.9885506 45.002731,6.294794 38.150699,6.0300774 31.293607,6.0952825 z m 0.05936,5.0525485 c 5.36199,-0.05245 10.700046,0.195704 11.722761,0.753694 2.045429,1.115978 11.936445,17.296419 11.960184,19.568154 0.02374,2.271736 -9.523004,18.6078 -11.544693,19.763557 -2.02169,1.155758 -21.429773,1.36721 -23.475201,0.251232 C 17.970585,50.368491 8.1092472,34.188049 8.085508,31.916313 8.061768,29.644577 17.578834,13.2806 19.600523,12.124842 c 1.010846,-0.577879 6.39045,-0.924567 11.75244,-0.977011 z"
|
||||
style="fill:url(#linearGradient4101);fill-opacity:1;" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3077"
|
||||
d="M 14.640198,55.682743 C 9.6971439,47.360612 2.8950957,35.733851 2.9419881,35.686959 c 0.031272,-0.03127 0.5023581,0.289334 1.0468575,0.712459 0.5444994,0.423125 1.0414462,0.769317 1.1043264,0.769317 0.06288,0 2.6329414,4.276521 5.711247,9.50338 l 5.59692,9.503379 2.159128,0.007 2.159126,0.007 -0.34365,-0.584653 C 20.186937,55.28323 17.303514,50.518786 13.968339,45.017137 10.633164,39.515488 7.9043842,34.929294 7.9043842,34.825595 c 0,-0.103699 0.2455542,-0.59277 0.545676,-1.086823 0.3001218,-0.494053 0.545676,-0.941721 0.545676,-0.994816 0,-0.05309 -0.2788317,-0.09654 -0.619626,-0.09654 -0.8505388,0 -1.0953557,-0.488405 -1.0953557,-2.185211 0,-1.90734 -0.048411,-1.868066 2.30512,-1.870072 l 1.9823345,-0.0017 1.052375,-1.721616 c 0.578806,-0.94689 1.052375,-1.785869 1.052375,-1.8644 0,-0.07853 -0.829918,-0.162484 -1.844262,-0.186561 l -1.8442631,-0.04378 4.4809551,-7.327649 4.480953,-7.32765 12.466741,-0.0399 12.466738,-0.0399 0.517892,0.854518 0.517892,0.854518 2.335995,0.04287 2.335994,0.04287 2.742626,4.521316 c 1.508447,2.486723 4.136212,6.819001 5.839482,9.627283 1.703268,2.808283 3.157599,5.105969 3.231846,5.105969 0.256907,0 0.13186,-0.393635 -0.411085,-1.294044 -0.299901,-0.497351 -0.545275,-0.935841 -0.545275,-0.974422 0,-0.03858 0.310833,-0.07015 0.69074,-0.07015 0.575204,0 0.699074,-0.05324 0.740561,-0.318272 0.03599,-0.229934 0.273254,0.06215 0.854835,1.052375 0.702767,1.196557 0.780303,1.410253 0.610448,1.682462 -0.107012,0.171499 -0.377881,0.627528 -0.601929,1.013399 l -0.407361,0.701583 0.533953,0.857491 c 0.293674,0.47162 0.535536,0.950306 0.537472,1.063747 0.0019,0.113441 -3.098537,5.322698 -6.889942,11.576127 l -6.893462,11.36987 -16.876654,0 -16.876655,0 -1.226996,-2.065773 z"
|
||||
style="fill:none;" />
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient id="hexchatGradient" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop id="hgYellowStop" offset="0" style="stop-color: #FFD600" />
|
||||
<stop id="hgRedStop" offset="1" style="stop-color: #FF2600" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<use xlink:href="#outline" style="opacity:0.15" transform="translate(0,2)" id="shadow" />
|
||||
<path
|
||||
style="fill:#000000; fill-opacity: 1;"
|
||||
d="M 31.71875,4.1088109 C 24.433462,4.1801109 17.123427,4.6356469 15.75,5.4213109 13.003148,6.9926379 0.06149557,29.207739 0.09374996,32.296311 0.12600597,35.384884 13.564642,57.372816 16.34375,58.890061 19.122855,60.407306 45.503149,60.148888 48.25,58.577561 50.996852,57.006233 63.938504,34.791133 63.90625,31.702561 63.87399,28.613989 50.466608,6.5948049 47.6875,5.0775609 46.297948,4.3189379 39.004037,4.0375089 31.71875,4.1088109 Z m -0.1875,9.2500001 c 3.386631,-0.03246 6.676687,0.05409 8.75,0.28125 l -8.71875,9.71875 -9.0625,-9.5 c 2.055746,-0.283043 5.521157,-0.466366 9.03125,-0.5 z m 17.34375,9.84375 c 2.298293,3.744897 4.302354,7.392556 4.3125,8.34375 0.01126,1.055883 -2.358157,5.507241 -4.875,9.6875 l -9.03125,-8.03125 z m -34.46875,0.25 8.75,9.75 -8.1875,7.875 c -2.482342,-3.992634 -4.707927,-8.110307 -4.71875,-9.125 -0.01021,-0.95736 1.927117,-4.687748 4.15625,-8.5 z m 17.15625,16.90625 9.8125,9.21875 c -4.111037,0.67314 -16.108253,0.781873 -19.46875,0.125 z"
|
||||
id="outline" />
|
||||
<path
|
||||
style="fill:url(#hexchatGradient); fill-opacity: 1;"
|
||||
d="m 31.34375,6.1713109 c -6.857093,0.06521 -13.707297,0.469014 -15,1.1875 C 13.758345,8.7957819 1.5633917,29.128076 1.5937497,31.952561 c 0.03036,2.824486 12.6654863,22.924987 15.2812503,24.3125 2.615763,1.387513 27.445846,1.186972 30.03125,-0.25 2.585405,-1.436972 14.780359,-21.769265 14.75,-24.59375 C 61.62589,28.596826 48.990764,8.4650729 46.375,7.0775609 45.067119,6.3838039 38.200842,6.1061049 31.34375,6.1713109 Z m 0.0625,5.0625001 c 5.36199,-0.05245 10.696035,0.19201 11.71875,0.75 0.06132,0.03346 0.143803,0.127745 0.21875,0.1875 l -11.28125,12.59375 -0.5,0.53125 -0.46875,-0.53125 -11.75,-12.3125 c 0.10903,-0.09884 0.228263,-0.201843 0.3125,-0.25 1.010846,-0.577879 6.38801,-0.916306 11.75,-0.96875 z m 18.0625,9.46875 c 2.883844,4.661341 5.612556,9.652893 5.625,10.84375 0.01348,1.290331 -3.064699,7.087557 -6.09375,12.09375 l -11.09375,-9.90625 -0.53125,-0.46875 0.5,-0.46875 11.59375,-12.09375 z m -35.78125,0.03125 10.84375,12.0625 0.4375,0.46875 -0.46875,0.4375 -10.28125,9.90625 c -3.04689,-4.86606 -6.0493623,-10.36778 -6.0625003,-11.625 -0.01271,-1.216102 2.6892393,-6.451996 5.5312503,-11.25 z m 17.875,17.78125 0.4375,0.4375 12.34375,11.59375 c -0.318014,0.365376 -0.587006,0.638955 -0.78125,0.75 -2.02169,1.155758 -21.423322,1.397228 -23.46875,0.28125 -0.228202,-0.124506 -0.601742,-0.47821 -1,-0.9375 l 12,-11.6875 0.46875,-0.4375 z"
|
||||
id="coloredX" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -26,4 +26,6 @@ uninstall-hook:
|
||||
$(UPDATE_MIME_DATABASE);
|
||||
$(UPDATE_DESKTOP_DATABASE);
|
||||
|
||||
EXTRA_DIST = hexchat.appdata.xml.in hexchat.desktop.in htm.desktop.in htm-mime.xml
|
||||
|
||||
CLEANFILES = $(appdata_DATA) $(data_desktop_DATA)
|
||||
|
||||
60
m4/ac-check-cflags.m4
Normal file
@@ -0,0 +1,60 @@
|
||||
dnl Macros to check the presence of generic (non-typed) symbols.
|
||||
dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
|
||||
dnl Copyright (c) 2006-2008 xine project
|
||||
dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
dnl 02110-1301, USA.
|
||||
dnl
|
||||
dnl As a special exception, the copyright owners of the
|
||||
dnl macro gives unlimited permission to copy, distribute and modify the
|
||||
dnl configure scripts that are the output of Autoconf when processing the
|
||||
dnl Macro. You need not follow the terms of the GNU General Public
|
||||
dnl License when using or distributing such scripts, even though portions
|
||||
dnl of the text of the Macro appear in them. The GNU General Public
|
||||
dnl License (GPL) does govern all other use of the material that
|
||||
dnl constitutes the Autoconf Macro.
|
||||
dnl
|
||||
dnl This special exception to the GPL applies to versions of the
|
||||
dnl Autoconf Macro released by this project. When you make and
|
||||
dnl distribute a modified version of the Autoconf Macro, you may extend
|
||||
dnl this special exception to the GPL to apply to your modified version as
|
||||
dnl well.
|
||||
|
||||
dnl Check if FLAG in ENV-VAR is supported by compiler and append it
|
||||
dnl to WHERE-TO-APPEND variable
|
||||
dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG])
|
||||
|
||||
AC_DEFUN([CC_CHECK_FLAG_APPEND], [
|
||||
AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
|
||||
AS_TR_SH([cc_cv_$2_$3]),
|
||||
[eval "AS_TR_SH([cc_save_$2])='${$2}'"
|
||||
eval "AS_TR_SH([$2])='$3'"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])],
|
||||
[eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
|
||||
[eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
|
||||
eval "AS_TR_SH([$2])='$cc_save_$2'"])
|
||||
|
||||
AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
|
||||
[eval "$1='${$1} $3'"])
|
||||
])
|
||||
|
||||
dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
|
||||
AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
|
||||
for flag in $3; do
|
||||
CC_CHECK_FLAG_APPEND($1, $2, $flag)
|
||||
done
|
||||
])
|
||||
|
||||
124
m4/ax_check_enable_debug.m4
Normal file
@@ -0,0 +1,124 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for the presence of an --enable-debug option to configure, with
|
||||
# the specified default value used when the option is not present. Return
|
||||
# the value in the variable $ax_enable_debug.
|
||||
#
|
||||
# Specifying 'yes' adds '-g -O0' to the compilation flags for all
|
||||
# languages. Specifying 'info' adds '-g' to the compilation flags.
|
||||
# Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to
|
||||
# the linking flags. Otherwise, nothing is added.
|
||||
#
|
||||
# Define the variables listed in the second argument if debug is enabled,
|
||||
# defaulting to no variables. Defines the variables listed in the third
|
||||
# argument if debug is disabled, defaulting to NDEBUG. All lists of
|
||||
# variables should be space-separated.
|
||||
#
|
||||
# If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
|
||||
# Should be invoked prior to any AC_PROG_* compiler checks.
|
||||
#
|
||||
# IS-RELEASE can be used to change the default to 'no' when making a
|
||||
# release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it
|
||||
# uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE
|
||||
# macro, there is no need to pass this parameter.
|
||||
#
|
||||
# AX_IS_RELEASE([git-directory])
|
||||
# AX_CHECK_ENABLE_DEBUG()
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Rhys Ulerich <rhys.ulerich@gmail.com>
|
||||
# Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved.
|
||||
|
||||
#serial 5
|
||||
|
||||
AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
|
||||
AC_BEFORE([$0],[AC_PROG_CC])dnl
|
||||
AC_BEFORE([$0],[AC_PROG_CXX])dnl
|
||||
AC_BEFORE([$0],[AC_PROG_F77])dnl
|
||||
AC_BEFORE([$0],[AC_PROG_FC])dnl
|
||||
|
||||
AC_MSG_CHECKING(whether to enable debugging)
|
||||
|
||||
ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))
|
||||
ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],,
|
||||
[$ax_is_release],
|
||||
[$4])))
|
||||
|
||||
# If this is a release, override the default.
|
||||
AS_IF([test "$ax_enable_debug_is_release" = "yes"],
|
||||
[ax_enable_debug_default="no"])
|
||||
|
||||
m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
|
||||
m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])],
|
||||
[],enable_debug=$ax_enable_debug_default)
|
||||
|
||||
# empty mean debug yes
|
||||
AS_IF([test "x$enable_debug" = "x"],
|
||||
[enable_debug="yes"])
|
||||
|
||||
# case of debug
|
||||
AS_CASE([$enable_debug],
|
||||
[yes],[
|
||||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="${CFLAGS} -g -O0"
|
||||
CXXFLAGS="${CXXFLAGS} -g -O0"
|
||||
FFLAGS="${FFLAGS} -g -O0"
|
||||
FCFLAGS="${FCFLAGS} -g -O0"
|
||||
OBJCFLAGS="${OBJCFLAGS} -g -O0"
|
||||
],
|
||||
[info],[
|
||||
AC_MSG_RESULT(info)
|
||||
CFLAGS="${CFLAGS} -g"
|
||||
CXXFLAGS="${CXXFLAGS} -g"
|
||||
FFLAGS="${FFLAGS} -g"
|
||||
FCFLAGS="${FCFLAGS} -g"
|
||||
OBJCFLAGS="${OBJCFLAGS} -g"
|
||||
],
|
||||
[profile],[
|
||||
AC_MSG_RESULT(profile)
|
||||
CFLAGS="${CFLAGS} -g -pg"
|
||||
CXXFLAGS="${CXXFLAGS} -g -pg"
|
||||
FFLAGS="${FFLAGS} -g -pg"
|
||||
FCFLAGS="${FCFLAGS} -g -pg"
|
||||
OBJCFLAGS="${OBJCFLAGS} -g -pg"
|
||||
LDFLAGS="${LDFLAGS} -pg"
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
|
||||
dnl by setting any unset environment flag variables
|
||||
AS_IF([test "x${CFLAGS+set}" != "xset"],
|
||||
[CFLAGS=""])
|
||||
AS_IF([test "x${CXXFLAGS+set}" != "xset"],
|
||||
[CXXFLAGS=""])
|
||||
AS_IF([test "x${FFLAGS+set}" != "xset"],
|
||||
[FFLAGS=""])
|
||||
AS_IF([test "x${FCFLAGS+set}" != "xset"],
|
||||
[FCFLAGS=""])
|
||||
AS_IF([test "x${OBJCFLAGS+set}" != "xset"],
|
||||
[OBJCFLAGS=""])
|
||||
])
|
||||
|
||||
dnl Define various variables if debugging is disabled.
|
||||
dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
|
||||
AS_IF([test "x$enable_debug" = "xyes"],
|
||||
[m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])],
|
||||
[m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])])
|
||||
ax_enable_debug=$enable_debug
|
||||
])
|
||||
69
m4/ax_is_release.m4
Normal file
@@ -0,0 +1,69 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_is_release.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_IS_RELEASE(POLICY)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Determine whether the code is being configured as a release, or from
|
||||
# git. Set the ax_is_release variable to 'yes' or 'no'.
|
||||
#
|
||||
# If building a release version, it is recommended that the configure
|
||||
# script disable compiler errors and debug features, by conditionalising
|
||||
# them on the ax_is_release variable. If building from git, these
|
||||
# features should be enabled.
|
||||
#
|
||||
# The POLICY parameter specifies how ax_is_release is determined. It can
|
||||
# take the following values:
|
||||
#
|
||||
# * git-directory: ax_is_release will be 'no' if a '.git' directory exists
|
||||
# * minor-version: ax_is_release will be 'no' if the minor version number
|
||||
# in $PACKAGE_VERSION is odd; this assumes
|
||||
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
|
||||
# * micro-version: ax_is_release will be 'no' if the micro version number
|
||||
# in $PACKAGE_VERSION is odd; this assumes
|
||||
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
|
||||
# * always: ax_is_release will always be 'yes'
|
||||
# * never: ax_is_release will always be 'no'
|
||||
#
|
||||
# Other policies may be added in future.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved.
|
||||
|
||||
#serial 3
|
||||
|
||||
AC_DEFUN([AX_IS_RELEASE],[
|
||||
AC_BEFORE([AC_INIT],[$0])
|
||||
|
||||
m4_case([$1],
|
||||
[git-directory],[
|
||||
# $is_release = (.git directory does not exist)
|
||||
AS_IF([test -d .git],[ax_is_release=no],[ax_is_release=yes])
|
||||
],
|
||||
[minor-version],[
|
||||
# $is_release = ($minor_version is even)
|
||||
minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
|
||||
AS_IF([test "$(( $minor_version % 2 ))" -ne 0],
|
||||
[ax_is_release=no],[ax_is_release=yes])
|
||||
],
|
||||
[micro-version],[
|
||||
# $is_release = ($micro_version is even)
|
||||
micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'`
|
||||
AS_IF([test "$(( $micro_version % 2 ))" -ne 0],
|
||||
[ax_is_release=no],[ax_is_release=yes])
|
||||
],
|
||||
[always],[ax_is_release=yes],
|
||||
[never],[ax_is_release=no],
|
||||
[
|
||||
AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version.])
|
||||
])
|
||||
])
|
||||
116
m4/ax_perl_ext_flags.m4
Normal file
@@ -0,0 +1,116 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_perl_ext_flags.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PERL_EXT_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [EXTRA-MODULES])
|
||||
# AX_PERL_EXT_CFLAGS([CFLAGS-VARIABLE])
|
||||
# AX_PERL_EXT_LDFLAGS([LDFLAGS-VARIABLE], [EXTRA-MODULES])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Fetches the linker flags and C compiler flags for compiling and linking
|
||||
# programs that embed a Perl interpreter. If the EXTRA-MODULES argument is
|
||||
# submitted, it is a space separated list of extra modules to link. The
|
||||
# flags will be stored in the provided variables.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# AX_PERL_EXT_FLAGS([PERLXS_CFLAGS], [PERLXS_LDFLAGS])
|
||||
# AC_SUBST([PERLXS_CFLAGS])
|
||||
# AC_SUBST([PERLXS_LDFLAGS])
|
||||
#
|
||||
# AX_PERL_EXT_CFLAGS([PERLXS_CFLAGS])
|
||||
# AC_SUBST([PERLXS_CFLAGS])
|
||||
#
|
||||
# AX_PERL_EXT_LDFLAGS([PERLXS_LDFLAGS], [-std Socket])
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Mats Kindahl of Sun Microsystems <mats@sun.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#serial 5
|
||||
|
||||
AC_DEFUN([AX_PERL_EXT_CFLAGS],
|
||||
[AC_CHECK_PROG(PERL,perl,perl)
|
||||
_AX_PERL_EXT_MODULE_CHECK([ExtUtils::Embed], [have_embed=yes],
|
||||
[have_embed=no])
|
||||
AS_IF([test $have_embed = no],
|
||||
AC_MSG_ERROR([Require ExtUtils::Embed to proceed]))
|
||||
_AX_PERL_EXT_EMBED_CHECK([$1],[ccopts])
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_PERL_EXT_LDFLAGS],
|
||||
[AC_CHECK_PROG(PERL,perl,perl)
|
||||
_AX_PERL_EXT_MODULE_CHECK([ExtUtils::Embed], [have_embed=yes],
|
||||
[have_embed=no])
|
||||
AS_IF([test $have_embed = no],
|
||||
AC_MSG_ERROR([Require ExtUtils::Embed to proceed]))
|
||||
_AX_PERL_EXT_EMBED_CHECK([$1],[ldopts],[$2])
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_PERL_EXT_FLAGS],
|
||||
[AC_CHECK_PROG(PERL,perl,perl)
|
||||
_AX_PERL_EXT_MODULE_CHECK([ExtUtils::Embed], [have_embed=yes],
|
||||
[have_embed=no])
|
||||
AS_IF([test $have_embed = no],
|
||||
AC_MSG_ERROR([Require ExtUtils::Embed to proceed]))
|
||||
_AX_PERL_EXT_EMBED_CHECK([$1],[ccopts])
|
||||
_AX_PERL_EXT_EMBED_CHECK([$2],[ldopts],[$3])
|
||||
])
|
||||
|
||||
|
||||
dnl _AX_PERL_EXT_MODULE_CHECK(MODULE-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
||||
dnl
|
||||
dnl Check for the existance of the perl module given by MODULE-NAME.
|
||||
dnl
|
||||
AC_DEFUN([_AX_PERL_EXT_MODULE_CHECK],
|
||||
[AC_MSG_CHECKING([for perl module $1])
|
||||
$PERL "-M$1" -e exit > /dev/null 2>&1
|
||||
AS_IF([test $? -eq 0],
|
||||
[AC_MSG_RESULT(yes)
|
||||
$2],
|
||||
[AC_MSG_RESULT(no)
|
||||
$3])
|
||||
])
|
||||
|
||||
dnl _AX_PERL_EXT_EMBED_CHECK(VARIABLE, COMMAND, [EXTRA-FLAGS]) Use
|
||||
dnl
|
||||
dnl ExtUtils::Embed fetch flags for embedding Perl in a C/C++
|
||||
dnl application
|
||||
dnl
|
||||
AC_DEFUN([_AX_PERL_EXT_EMBED_CHECK],
|
||||
[AC_MSG_CHECKING([for perl $2 embed flags])
|
||||
ax_c_perlxs_extras="$3"
|
||||
$1=`$PERL -MExtUtils::Embed -e $2 ${ax_c_perlxs_extras:+"-- $3"}`
|
||||
AC_MSG_RESULT($$1)
|
||||
])
|
||||
327
m4/ax_python_devel.m4
Normal file
@@ -0,0 +1,327 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PYTHON_DEVEL([version])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
|
||||
# in your configure.ac.
|
||||
#
|
||||
# This macro checks for Python and tries to get the include path to
|
||||
# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output
|
||||
# variables. It also exports $(PYTHON_EXTRA_LIBS) and
|
||||
# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
|
||||
#
|
||||
# You can search for some particular version of Python by passing a
|
||||
# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
|
||||
# note that you *have* to pass also an operator along with the version to
|
||||
# match, and pay special attention to the single quotes surrounding the
|
||||
# version number. Don't use "PYTHON_VERSION" for this: that environment
|
||||
# variable is declared as precious and thus reserved for the end-user.
|
||||
#
|
||||
# This macro should work for all versions of Python >= 2.1.0. As an end
|
||||
# user, you can disable the check for the python version by setting the
|
||||
# PYTHON_NOVERSIONCHECK environment variable to something else than the
|
||||
# empty string.
|
||||
#
|
||||
# If you need to use this macro for an older Python version, please
|
||||
# contact the authors. We're always open for feedback.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
|
||||
# Copyright (c) 2009 Alan W. Irwin
|
||||
# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
|
||||
# Copyright (c) 2009 Andrew Collier
|
||||
# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
|
||||
# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
|
||||
# Copyright (c) 2013 Daniel Mullner <muellner@math.stanford.edu>
|
||||
#
|
||||
# This program 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 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 18
|
||||
|
||||
AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
|
||||
AC_DEFUN([AX_PYTHON_DEVEL],[
|
||||
#
|
||||
# Allow the use of a (user set) custom python version
|
||||
#
|
||||
AC_ARG_VAR([PYTHON_VERSION],[The installed Python
|
||||
version to use, for example '2.3'. This string
|
||||
will be appended to the Python interpreter
|
||||
canonical name.])
|
||||
|
||||
AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
|
||||
if test -z "$PYTHON"; then
|
||||
AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
|
||||
PYTHON_VERSION=""
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for a version of Python >= 2.1.0
|
||||
#
|
||||
AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
|
||||
ac_supports_python_ver=`$PYTHON -c "import sys; \
|
||||
ver = sys.version.split ()[[0]]; \
|
||||
print (ver >= '2.1.0')"`
|
||||
if test "$ac_supports_python_ver" != "True"; then
|
||||
if test -z "$PYTHON_NOVERSIONCHECK"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_FAILURE([
|
||||
This version of the AC@&t@_PYTHON_DEVEL macro
|
||||
doesn't work properly with versions of Python before
|
||||
2.1.0. You may need to re-run configure, setting the
|
||||
variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
|
||||
PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
|
||||
Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
|
||||
to something else than an empty string.
|
||||
])
|
||||
else
|
||||
AC_MSG_RESULT([skip at user request])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
#
|
||||
# if the macro parameter ``version'' is set, honour it
|
||||
#
|
||||
if test -n "$1"; then
|
||||
AC_MSG_CHECKING([for a version of Python $1])
|
||||
ac_supports_python_ver=`$PYTHON -c "import sys; \
|
||||
ver = sys.version.split ()[[0]]; \
|
||||
print (ver $1)"`
|
||||
if test "$ac_supports_python_ver" = "True"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([this package requires Python $1.
|
||||
If you have it installed, but it isn't the default Python
|
||||
interpreter in your system path, please pass the PYTHON_VERSION
|
||||
variable to configure. See ``configure --help'' for reference.
|
||||
])
|
||||
PYTHON_VERSION=""
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Check if you have distutils, else fail
|
||||
#
|
||||
AC_MSG_CHECKING([for the distutils Python package])
|
||||
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
|
||||
if test -z "$ac_distutils_result"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([cannot import Python module "distutils".
|
||||
Please check your Python installation. The error was:
|
||||
$ac_distutils_result])
|
||||
PYTHON_VERSION=""
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for Python include path
|
||||
#
|
||||
AC_MSG_CHECKING([for Python include path])
|
||||
if test -z "$PYTHON_CPPFLAGS"; then
|
||||
python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
print (distutils.sysconfig.get_python_inc ());"`
|
||||
plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
|
||||
if test -n "${python_path}"; then
|
||||
if test "${plat_python_path}" != "${python_path}"; then
|
||||
python_path="-I$python_path -I$plat_python_path"
|
||||
else
|
||||
python_path="-I$python_path"
|
||||
fi
|
||||
fi
|
||||
PYTHON_CPPFLAGS=$python_path
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_CPPFLAGS])
|
||||
AC_SUBST([PYTHON_CPPFLAGS])
|
||||
|
||||
#
|
||||
# Check for Python library path
|
||||
#
|
||||
AC_MSG_CHECKING([for Python library path])
|
||||
if test -z "$PYTHON_LIBS"; then
|
||||
# (makes two attempts to ensure we've got a version number
|
||||
# from the interpreter)
|
||||
ac_python_version=`cat<<EOD | $PYTHON -
|
||||
|
||||
# join all versioning strings, on some systems
|
||||
# major/minor numbers could be in different list elements
|
||||
from distutils.sysconfig import *
|
||||
e = get_config_var('VERSION')
|
||||
if e is not None:
|
||||
print(e)
|
||||
EOD`
|
||||
|
||||
if test -z "$ac_python_version"; then
|
||||
if test -n "$PYTHON_VERSION"; then
|
||||
ac_python_version=$PYTHON_VERSION
|
||||
else
|
||||
ac_python_version=`$PYTHON -c "import sys; \
|
||||
print (sys.version[[:3]])"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make the versioning information available to the compiler
|
||||
AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
|
||||
[If available, contains the Python version number currently in use.])
|
||||
|
||||
# First, the library directory:
|
||||
ac_python_libdir=`cat<<EOD | $PYTHON -
|
||||
|
||||
# There should be only one
|
||||
import distutils.sysconfig
|
||||
e = distutils.sysconfig.get_config_var('LIBDIR')
|
||||
if e is not None:
|
||||
print (e)
|
||||
EOD`
|
||||
|
||||
# Now, for the library:
|
||||
ac_python_library=`cat<<EOD | $PYTHON -
|
||||
|
||||
import distutils.sysconfig
|
||||
c = distutils.sysconfig.get_config_vars()
|
||||
if 'LDVERSION' in c:
|
||||
print ('python'+c[['LDVERSION']])
|
||||
else:
|
||||
print ('python'+c[['VERSION']])
|
||||
EOD`
|
||||
|
||||
# This small piece shamelessly adapted from PostgreSQL python macro;
|
||||
# credits goes to momjian, I think. I'd like to put the right name
|
||||
# in the credits, if someone can point me in the right direction... ?
|
||||
#
|
||||
if test -n "$ac_python_libdir" -a -n "$ac_python_library"
|
||||
then
|
||||
# use the official shared library
|
||||
ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
|
||||
PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library"
|
||||
else
|
||||
# old way: use libpython from python_configdir
|
||||
ac_python_libdir=`$PYTHON -c \
|
||||
"from distutils.sysconfig import get_python_lib as f; \
|
||||
import os; \
|
||||
print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
|
||||
PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version"
|
||||
fi
|
||||
|
||||
if test -z "PYTHON_LIBS"; then
|
||||
AC_MSG_ERROR([
|
||||
Cannot determine location of your Python DSO. Please check it was installed with
|
||||
dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
|
||||
])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_LIBS])
|
||||
AC_SUBST([PYTHON_LIBS])
|
||||
|
||||
#
|
||||
# Check for site packages
|
||||
#
|
||||
AC_MSG_CHECKING([for Python site-packages path])
|
||||
if test -z "$PYTHON_SITE_PKG"; then
|
||||
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
|
||||
print (distutils.sysconfig.get_python_lib(0,0));"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_SITE_PKG])
|
||||
AC_SUBST([PYTHON_SITE_PKG])
|
||||
|
||||
#
|
||||
# libraries which must be linked in when embedding
|
||||
#
|
||||
AC_MSG_CHECKING(python extra libraries)
|
||||
if test -z "$PYTHON_EXTRA_LDFLAGS"; then
|
||||
PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
conf = distutils.sysconfig.get_config_var; \
|
||||
print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
|
||||
AC_SUBST(PYTHON_EXTRA_LDFLAGS)
|
||||
|
||||
#
|
||||
# linking flags needed when embedding
|
||||
#
|
||||
AC_MSG_CHECKING(python extra linking flags)
|
||||
if test -z "$PYTHON_EXTRA_LIBS"; then
|
||||
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
conf = distutils.sysconfig.get_config_var; \
|
||||
print (conf('LINKFORSHARED'))"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
|
||||
AC_SUBST(PYTHON_EXTRA_LIBS)
|
||||
|
||||
#
|
||||
# final check to see if everything compiles alright
|
||||
#
|
||||
AC_MSG_CHECKING([consistency of all components of python development environment])
|
||||
# save current global flags
|
||||
ac_save_LIBS="$LIBS"
|
||||
ac_save_LDFLAGS="$LDFLAGS"
|
||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||
LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS $PYTHON_EXTRA_LIBS"
|
||||
LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
|
||||
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
|
||||
AC_LANG_PUSH([C])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[#include <Python.h>]],
|
||||
[[Py_Initialize();]])
|
||||
],[pythonexists=yes],[pythonexists=no])
|
||||
AC_LANG_POP([C])
|
||||
# turn back to default flags
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
LDFLAGS="$ac_save_LDFLAGS"
|
||||
|
||||
AC_MSG_RESULT([$pythonexists])
|
||||
|
||||
if test ! "x$pythonexists" = "xyes"; then
|
||||
AC_MSG_FAILURE([
|
||||
Could not link test program to Python. Maybe the main Python library has been
|
||||
installed in some non-standard library path. If so, pass it to configure,
|
||||
via the LIBS environment variable.
|
||||
Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
|
||||
============================================================================
|
||||
ERROR!
|
||||
You probably have to install the development version of the Python package
|
||||
for your distribution. The exact name of this package varies among them.
|
||||
============================================================================
|
||||
])
|
||||
PYTHON_VERSION=""
|
||||
fi
|
||||
|
||||
#
|
||||
# all done!
|
||||
#
|
||||
])
|
||||
37
m4/ax_require_defined.m4
Normal file
@@ -0,0 +1,37 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_REQUIRE_DEFINED(MACRO)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
|
||||
# been defined and thus are available for use. This avoids random issues
|
||||
# where a macro isn't expanded. Instead the configure script emits a
|
||||
# non-fatal:
|
||||
#
|
||||
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
|
||||
#
|
||||
# It's like AC_REQUIRE except it doesn't expand the required macro.
|
||||
#
|
||||
# Here's an example:
|
||||
#
|
||||
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 1
|
||||
|
||||
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
|
||||
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
|
||||
])dnl AX_REQUIRE_DEFINED
|
||||
@@ -1,38 +0,0 @@
|
||||
# Makefile stub for creating standalone plugin distributions.
|
||||
|
||||
plugin_dist: pg_dist pg_dist/config.status
|
||||
pgi=`cd $(srcdir)/.. && pwd`; cd pg_dist; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) PLUGIN_INCLUDES=-I$$pgi distcheck dist
|
||||
|
||||
pg_dist: pg_distdir pg_dist/configure.in pg_dist/install-sh
|
||||
cd pg_dist \
|
||||
&& libtoolize --copy --force --automake \
|
||||
&& automake --copy --add-missing --foreign \
|
||||
&& autoconf -l ../$(top_srcdir)
|
||||
|
||||
pg_distdir: $(DISTFILES)
|
||||
test -d pg_dist || mkdir pg_dist
|
||||
for dfile in $(DISTFILES); do \
|
||||
test -f $$dfile && cp $$dfile pg_dist \
|
||||
|| test -f $(srcdir)/$$dfile && cp $(srcdir)/$$dfile pg_dist; done
|
||||
sed '/Make.plugin/d' < $(srcdir)/Makefile.am > pg_dist/Makefile.am
|
||||
|
||||
pg_dist/configure.in: $(srcdir)/../plugin-conf.in
|
||||
rm -f pg_dist/configure.in
|
||||
test -f $(srcdir)/config.stub \
|
||||
&& cat $(srcdir)/config.stub > pg_dist/configure.in || true
|
||||
cat $(srcdir)/../plugin-conf.in | \
|
||||
sed 's%@PLUGIN_VERSION@%$(PLUGIN_VERSION)%; \
|
||||
s%@PLUGIN@%$(PLUGIN)%' >> pg_dist/configure.in
|
||||
|
||||
pg_dist/install-sh: pg_distdir
|
||||
cp $(top_srcdir)/install-sh pg_dist
|
||||
|
||||
pg_dist/config.status: pg_dist/configure
|
||||
cd pg_dist \
|
||||
&& test -f config.status && $(SHELL) ./config.status --recheck \
|
||||
|| $(SHELL) ./configure --enable-maintainer-mode
|
||||
|
||||
DISTCLEANFILES = pg_dist/* pg_dist
|
||||
|
||||
#
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,57 +20,19 @@
|
||||
<RootNamespace>checksum</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcchecksum</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcchecksum</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>checksum.def</ModuleDefinitionFile>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@@ -77,19 +40,10 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>checksum.def</ModuleDefinitionFile>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@@ -102,6 +56,4 @@
|
||||
<None Include="checksum.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,57 +20,19 @@
|
||||
<RootNamespace>doat</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcdoat</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcdoat</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(HexChatLib);$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>doat.def</ModuleDefinitionFile>
|
||||
@@ -77,19 +40,10 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(HexChatLib);$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>doat.def</ModuleDefinitionFile>
|
||||
@@ -102,6 +56,4 @@
|
||||
<None Include="doat.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,75 +20,28 @@
|
||||
<RootNamespace>exec</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcexec</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcexec</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;EXEC_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>exec.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;EXEC_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>exec.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -98,6 +52,4 @@
|
||||
<ClCompile Include="exec.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EXTRA_DIST = INSTALL LICENSE
|
||||
EXTRA_DIST = INSTALL LICENSE fish.h irc.h keystore.h plugin_hexchat.h
|
||||
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,57 +20,19 @@
|
||||
<RootNamespace>fishlim</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcfishlim</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcfishlim</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>fishlim.def</ModuleDefinitionFile>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@@ -77,19 +40,10 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>fishlim.def</ModuleDefinitionFile>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@@ -112,6 +66,4 @@
|
||||
<ClCompile Include="plugin_hexchat.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 Samuel Lidén Borell <samuel@kodafritt.se>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "fish.h"
|
||||
|
||||
// We can't use the HexChat plugin API from here...
|
||||
gchar *get_config_filename() {
|
||||
const gchar *homedir = g_get_home_dir();
|
||||
return g_build_filename(homedir, ".config", "hexchat", "blow.ini", NULL);
|
||||
}
|
||||
|
||||
|
||||
static int decrypt(int nick_count, char *nicks[]) {
|
||||
char encrypted[8192];
|
||||
while (fgets(encrypted, sizeof(encrypted), stdin)) {
|
||||
char *msg;
|
||||
for (int i = 0; i < nick_count; i++) {
|
||||
msg = fish_decrypt_from_nick(nicks[i], encrypted);
|
||||
if (msg) goto success;
|
||||
}
|
||||
fprintf(stderr, "None of the recipients were found in the key store!\n");
|
||||
return 1;
|
||||
success:
|
||||
fprintf(stderr, "Decrypted text >>>%s<<<\n", msg);
|
||||
g_free(msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int encrypt(int nick_count, char *nicks[]) {
|
||||
char message[8192];
|
||||
while (fgets(message, sizeof(message), stdin)) {
|
||||
// Remove newline character
|
||||
char *newline = strchr(message, '\n');
|
||||
if (newline) *newline = '\0';
|
||||
|
||||
bool error = false;
|
||||
for (int i = 0; i < nick_count; i++) {
|
||||
char *encrypted = fish_encrypt_for_nick(nicks[i], message);
|
||||
if (encrypted) {
|
||||
fprintf(stderr, "Encrypted [%s]: >>>%s<<<\n", nicks[i], encrypted);
|
||||
g_free(encrypted);
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "Some of the recipients were't found in the key store!\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "usage: %s [-e] nick...\n", argv[0]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "-e") == 0) {
|
||||
return encrypt(argc-2, &argv[2]);
|
||||
} else {
|
||||
return decrypt(argc-1, &argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,57 +20,19 @@
|
||||
<RootNamespace>mpcinfo</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcmpcinfo</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcmpcinfo</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>mpcinfo.def</ModuleDefinitionFile>
|
||||
@@ -77,19 +40,10 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>mpcinfo.def</ModuleDefinitionFile>
|
||||
@@ -102,6 +56,4 @@
|
||||
<ClCompile Include="mpcInfo.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -7,7 +7,7 @@ libdir = $(hexchatlibdir)
|
||||
lib_LTLIBRARIES = perl.la
|
||||
perl_la_SOURCES = perl.c
|
||||
perl_la_LDFLAGS = $(PERL_LDFLAGS) $(PLUGIN_LDFLAGS) -module
|
||||
perl_la_LIBADD = $(PERL_LIBS) $(GLIB_LIBS)
|
||||
perl_la_LIBADD = $(GLIB_LIBS)
|
||||
perl_la_CFLAGS = $(PERL_CFLAGS) $(GLIB_CFLAGS) -I$(top_srcdir)/src/common
|
||||
|
||||
BUILT_SOURCES = hexchat.pm.h irc.pm.h
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,58 +20,20 @@
|
||||
<RootNamespace>perl520</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>
|
||||
<TargetName>$(PerlOutput)</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>$(PerlOutput)</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcperl</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PERL520_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(PerlPath)\lib\CORE;$(IntDir);..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PERL520_EXPORTS;HAS_BOOL;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);..\..\src\common;$(HexChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(IntDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(PerlLib).lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>perl.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>$(PerlLib).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
@@ -78,7 +41,7 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(GendefPath)\gendef" "$(PerlPath)\bin\$(PerlLib).dll"
|
||||
move $(PerlLib).def "$(IntDir)"
|
||||
lib /nologo /machine:x86 "/def:$(IntDir)$(PerlLib).def" "/out:$(OutDir)\$(PerlLib).lib"
|
||||
lib /nologo /machine:x86 "/def:$(IntDir)$(PerlLib).def" "/out:$(IntDir)\$(PerlLib).lib"
|
||||
"$(PerlPath)\bin\perl.exe" generate_header
|
||||
move irc.pm.h "$(IntDir)"
|
||||
move hexchat.pm.h "$(IntDir)"</Command>
|
||||
@@ -86,20 +49,11 @@ move hexchat.pm.h "$(IntDir)"</Command>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PERL520_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(PerlPath)\lib\CORE;$(IntDir);..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PERL520_EXPORTS;HAS_BOOL;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);..\..\src\common;$(HexChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(IntDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(PerlLib).lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>perl.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>$(PerlLib).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
@@ -107,7 +61,7 @@ move hexchat.pm.h "$(IntDir)"</Command>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(GendefPath)\gendef" "$(PerlPath)\bin\$(PerlLib).dll"
|
||||
move $(PerlLib).def "$(IntDir)"
|
||||
lib /nologo /machine:x64 "/def:$(IntDir)$(PerlLib).def" "/out:$(OutDir)\$(PerlLib).lib"
|
||||
lib /nologo /machine:x64 "/def:$(IntDir)$(PerlLib).def" "/out:$(IntDir)\$(PerlLib).lib"
|
||||
"$(PerlPath)\bin\perl.exe" generate_header
|
||||
move irc.pm.h "$(IntDir)"
|
||||
move hexchat.pm.h "$(IntDir)"</Command>
|
||||
@@ -120,6 +74,4 @@ move hexchat.pm.h "$(IntDir)"</Command>
|
||||
<ClCompile Include="perl.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
AC_INIT(@PLUGIN@-config.h.in)
|
||||
AM_CONFIG_HEADER(@PLUGIN@-config.h)
|
||||
AM_INIT_AUTOMAKE(hexchat-@PLUGIN@, @PLUGIN_VERSION@)
|
||||
AM_MAINTAINER_MODE
|
||||
AM_DISABLE_STATIC
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_ARG_WITH(plugin-includes,
|
||||
[ --with-plugin-includes directory containing hexchat-plugin.h],
|
||||
PLUGIN_INCLUDES=$enableval)
|
||||
|
||||
AC_SUBST(PLUGIN_INCLUDES)
|
||||
|
||||
hexchatlibdir=${libdir}/hexchat
|
||||
AC_SUBST(hexchatlibdir)
|
||||
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
)
|
||||
@@ -3,6 +3,7 @@ libdir = $(hexchatlibdir)
|
||||
lib_LTLIBRARIES = python.la
|
||||
python_la_SOURCES = python.c
|
||||
python_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
python_la_LIBADD = $(PY_LIBS) $(GLIB_LIBS)
|
||||
python_la_CFLAGS = $(PY_CFLAGS) $(GLIB_CFLAGS) -I$(top_srcdir)/src/common
|
||||
python_la_LIBADD = $(PYTHON_LIBS) $(GLIB_LIBS)
|
||||
python_la_CPPFLAGS = $(PYTHON_CPPFLAGS)
|
||||
python_la_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)/src/common
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,80 +20,33 @@
|
||||
<RootNamespace>python2</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>$(Python2Output)</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>$(Python2Output)</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python2Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python2Path)\include;..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>python.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>"$(Python2Lib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(Python2Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(Python2Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python2Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python2Path)\include;..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>python.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>"$(Python2Lib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(Python2Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(Python2Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -102,6 +56,4 @@
|
||||
<ClCompile Include="python.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,80 +20,33 @@
|
||||
<RootNamespace>python3</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>$(Python3Output)</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>$(Python3Output)</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>python.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>"$(Python3Lib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>python.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>"$(Python3Lib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -102,6 +56,4 @@
|
||||
<ClCompile Include="python.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
sources = sysinfo.c format.c shared/df.c
|
||||
|
||||
if PLATFORM_OSX
|
||||
sources += osx/backend.m
|
||||
else
|
||||
sources += unix/backend.c unix/match.c unix/parse.c unix/pci.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST = osx unix win32 shared format.h sysinfo.h sysinfo-backend.h
|
||||
|
||||
lib_LTLIBRARIES = sysinfo.la
|
||||
sysinfo_la_SOURCES = match.c parse.c pci.c xsys.c
|
||||
sysinfo_la_SOURCES = $(sources)
|
||||
sysinfo_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
sysinfo_la_LIBADD = $(LIBPCI_LIBS) $(GLIB_LIBS)
|
||||
sysinfo_la_CFLAGS = $(LIBPCI_CFLAGS) $(GLIB_CFLAGS) -I$(srcdir)/../../src/common
|
||||
AM_CPPFLAGS = $(LIBPCI_CFLAGS) $(GLIB_CFLAGS) -I$(top_srcdir)/src/common -I$(srcdir)/shared
|
||||
|
||||
90
plugins/sysinfo/format.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
char *
|
||||
sysinfo_format_uptime (gint64 uptime)
|
||||
{
|
||||
char buffer[128];
|
||||
|
||||
gint64 weeks = uptime / 604800;
|
||||
int days = (uptime / 86400) % 7;
|
||||
int hours = (uptime / 3600) % 24;
|
||||
int minutes = (uptime / 60) % 60;
|
||||
int seconds = uptime % 60;
|
||||
|
||||
if (weeks != 0)
|
||||
{
|
||||
g_snprintf (buffer, sizeof(buffer), "%" G_GINT64_FORMAT "w %dd %dh %dm %ds", weeks, days, hours, minutes, seconds);
|
||||
}
|
||||
else if (days != 0)
|
||||
{
|
||||
g_snprintf (buffer, sizeof(buffer), "%dd %dh %dm %ds", days, hours, minutes, seconds);
|
||||
}
|
||||
else if (hours != 0)
|
||||
{
|
||||
g_snprintf (buffer, sizeof(buffer), "%dh %dm %ds", hours, minutes, seconds);
|
||||
}
|
||||
else if (minutes != 0)
|
||||
{
|
||||
g_snprintf (buffer, sizeof(buffer), "%dm %ds", minutes, seconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, sizeof(buffer), "%ds", seconds);
|
||||
}
|
||||
|
||||
return g_strdup (buffer);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_format_memory (guint64 totalmem, guint64 freemem)
|
||||
{
|
||||
char *total_fmt, *free_fmt, *ret;
|
||||
|
||||
total_fmt = g_format_size_full (totalmem, G_FORMAT_SIZE_IEC_UNITS);
|
||||
free_fmt = g_format_size_full (freemem, G_FORMAT_SIZE_IEC_UNITS);
|
||||
ret = g_strdup_printf ("%s Total (%s Free)", total_fmt, free_fmt);
|
||||
|
||||
g_free (total_fmt);
|
||||
g_free (free_fmt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_format_disk (guint64 total, guint64 free)
|
||||
{
|
||||
char *total_fmt, *free_fmt, *used_fmt, *ret;
|
||||
GFormatSizeFlags format_flags = G_FORMAT_SIZE_DEFAULT;
|
||||
|
||||
#ifdef WIN32 /* Windows uses IEC size (with SI format) */
|
||||
format_flags = G_FORMAT_SIZE_IEC_UNITS;
|
||||
#endif
|
||||
|
||||
total_fmt = g_format_size_full (total, format_flags);
|
||||
free_fmt = g_format_size_full (free, format_flags);
|
||||
used_fmt = g_format_size_full (total - free, format_flags);
|
||||
ret = g_strdup_printf ("%s / %s (%s Free)", used_fmt, total_fmt, free_fmt);
|
||||
|
||||
g_free (total_fmt);
|
||||
g_free (free_fmt);
|
||||
g_free (used_fmt);
|
||||
return ret;
|
||||
}
|
||||
28
plugins/sysinfo/format.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FORMAT_H
|
||||
#define FORMAT_H
|
||||
|
||||
char *sysinfo_format_uptime(gint64 uptime);
|
||||
char *sysinfo_format_memory(guint64 totalmem, guint64 freemem);
|
||||
char *sysinfo_format_disk(guint64 total, guint64 free);
|
||||
|
||||
#endif
|
||||
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
* match.c - matching functions for X-Sys
|
||||
* Copyright (C) 2005, 2006, 2007 Tony Vroon
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <glib.h>
|
||||
#include "xsys.h"
|
||||
|
||||
float percentage(unsigned long long *free, unsigned long long *total)
|
||||
{
|
||||
unsigned long long result = (*free) * (unsigned long long)1000 / (*total);
|
||||
return result / 10.0;
|
||||
}
|
||||
|
||||
char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned long long *total_k)
|
||||
{
|
||||
char *quantities[] = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", 0 };
|
||||
char *result, **quantity;
|
||||
double free_space, total_space;
|
||||
free_space = *free_k;
|
||||
total_space = *total_k;
|
||||
result = g_new(char, bsize);
|
||||
if (total_space == 0)
|
||||
{
|
||||
g_snprintf(result, bsize, "%s: none", desc);
|
||||
return result;
|
||||
}
|
||||
quantity = quantities;
|
||||
while (total_space > 1023 && *(quantity + 1))
|
||||
{
|
||||
quantity++;
|
||||
free_space = free_space / 1024;
|
||||
total_space = total_space / 1024;
|
||||
}
|
||||
if (sysinfo_get_percent () != 0)
|
||||
g_snprintf(result, bsize, "%s: %.1f%s, %.1f%% free",
|
||||
desc, total_space, *quantity,
|
||||
percentage(free_k, total_k));
|
||||
else
|
||||
g_snprintf(result, bsize, "%s: %.1f%s/%.1f%s free",
|
||||
desc, free_space, *quantity, total_space, *quantity);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void remove_leading_whitespace(char *buffer)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (buffer == NULL)
|
||||
return;
|
||||
|
||||
for (p = buffer; *p && isspace (*p); p++)
|
||||
;
|
||||
|
||||
memmove (buffer, p, strlen (p) + 1);
|
||||
}
|
||||
|
||||
char *decruft_filename(char *buffer)
|
||||
{
|
||||
char *match, *match_end;
|
||||
|
||||
while ((match = strstr(buffer, "%20")))
|
||||
{
|
||||
match_end = match + 3;
|
||||
*match++ = ' ';
|
||||
while (*match_end)
|
||||
*match++ = *match_end++;
|
||||
*match = 0;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void find_match_char(char *buffer, char *match, char *result)
|
||||
{
|
||||
char *position;
|
||||
remove_leading_whitespace(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL) {
|
||||
position += 1;
|
||||
strcpy(result, position);
|
||||
position = strstr(result, "\n");
|
||||
*(position) = '\0';
|
||||
remove_leading_whitespace(result);
|
||||
}
|
||||
else
|
||||
strcpy(result, "\0");
|
||||
}
|
||||
}
|
||||
|
||||
void find_match_double(char *buffer, char *match, double *result)
|
||||
{
|
||||
char *position;
|
||||
remove_leading_whitespace(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL) {
|
||||
position += 1;
|
||||
*result = strtod(position, NULL);
|
||||
}
|
||||
else
|
||||
*result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void find_match_double_hex(char *buffer, char *match, double *result)
|
||||
{
|
||||
char *position;
|
||||
remove_leading_whitespace(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL) {
|
||||
memcpy(position,"0x",2);
|
||||
*result = strtod(position,NULL);
|
||||
}
|
||||
else
|
||||
*result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void find_match_int(char *buffer, char *match, unsigned int *result)
|
||||
{
|
||||
char *position;
|
||||
remove_leading_whitespace(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL) {
|
||||
position += 1;
|
||||
*result = atoi(position);
|
||||
}
|
||||
else
|
||||
*result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void find_match_ll(char *buffer, char *match, unsigned long long *result)
|
||||
{
|
||||
char *position;
|
||||
remove_leading_whitespace(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL) {
|
||||
position += 1;
|
||||
*result = strtoll(position, NULL, 10);
|
||||
}
|
||||
else
|
||||
*result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void format_output(const char *arg, char *string, char *format)
|
||||
{
|
||||
char *pos1, *pos2, buffer[bsize];
|
||||
pos1 = &format[0];
|
||||
strncpy(buffer, string, bsize);
|
||||
string[0] = '\0';
|
||||
|
||||
while((pos2 = strstr(pos1, "%")) != NULL)
|
||||
{
|
||||
strncat(string, pos1, (size_t)(pos2-pos1));
|
||||
if(*(pos2+1) == '1')
|
||||
strcat(string, arg);
|
||||
else if(*(pos2+1) == '2')
|
||||
strcat(string, buffer);
|
||||
else if(*(pos2+1) == 'C' || *(pos2+1) == 'c')
|
||||
strcat(string, "\003");
|
||||
else if(*(pos2+1) == 'B' || *(pos2+1) == 'b')
|
||||
strcat(string, "\002");
|
||||
else if(*(pos2+1) == 'R' || *(pos2+1) == 'r')
|
||||
strcat(string, "\026");
|
||||
else if(*(pos2+1) == 'O' || *(pos2+1) == 'o')
|
||||
strcat(string, "\017");
|
||||
else if(*(pos2+1) == 'U' || *(pos2+1) == 'u')
|
||||
strcat(string, "\037");
|
||||
else if(*(pos2+1) == '%')
|
||||
strcat(string, "%");
|
||||
pos1=pos2+2;
|
||||
}
|
||||
|
||||
strcat(string, pos1);
|
||||
}
|
||||
|
||||
void flat_format_output(const char *arg, char *string, char *format)
|
||||
{
|
||||
char *pos1, *pos2, buffer[bsize];
|
||||
pos1 = &format[0];
|
||||
strncpy(buffer, string, bsize);
|
||||
string[0] = '\0';
|
||||
|
||||
while((pos2 = strstr(pos1, "%")) != NULL)
|
||||
{
|
||||
strncat(string, pos1, (size_t)(pos2-pos1));
|
||||
if(*(pos2+1) == '1')
|
||||
strcat(string, arg);
|
||||
else if(*(pos2+1) == '2')
|
||||
strcat(string, buffer);
|
||||
else if(*(pos2+1) == '%')
|
||||
strcat(string, "%");
|
||||
pos1=pos2+2;
|
||||
}
|
||||
|
||||
strcat(string, pos1);
|
||||
}
|
||||
263
plugins/sysinfo/osx/backend.m
Normal file
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Some snippets based upon Textual's System Profiler plugin.
|
||||
* https://github.com/Codeux-Software/Textual
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/host_info.h>
|
||||
#include <mach/mach_vm.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "format.h"
|
||||
#include "df.h"
|
||||
|
||||
static char *
|
||||
get_os (void)
|
||||
{
|
||||
NSDictionary *systemversion = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
|
||||
NSString *build = [systemversion objectForKey:@"ProductBuildVersion"];
|
||||
if (!build)
|
||||
return NULL;
|
||||
NSString *version = [systemversion objectForKey:@"ProductUserVisibleVersion"];
|
||||
if (!version)
|
||||
{
|
||||
[build release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSDictionary *profiler = [NSDictionary dictionaryWithContentsOfFile:[@"~/Library/Preferences/com.apple.SystemProfiler.plist" stringByExpandingTildeInPath]];
|
||||
NSDictionary *names = [profiler objectForKey:@"OS Names"];
|
||||
NSString *os_name = nil;
|
||||
|
||||
for (NSString *name in names)
|
||||
{
|
||||
if ([name hasPrefix:build])
|
||||
{
|
||||
os_name = [names objectForKey:name];
|
||||
break;
|
||||
}
|
||||
}
|
||||
[build release];
|
||||
|
||||
if (!os_name)
|
||||
{
|
||||
[version release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *ret = g_strdup_printf ("%s %s", [os_name UTF8String], [version UTF8String]);
|
||||
[version release];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
get_os_fallback (void)
|
||||
{
|
||||
NSProcessInfo *info = [NSProcessInfo processInfo];
|
||||
NSOperatingSystemVersion version = [info operatingSystemVersion];
|
||||
|
||||
return g_strdup_printf ("OS X %ld.%ld.%ld", version.majorVersion, version.minorVersion, version.patchVersion);
|
||||
}
|
||||
char *
|
||||
sysinfo_backend_get_os(void)
|
||||
{
|
||||
static char *os_str = NULL;
|
||||
if (!os_str)
|
||||
{
|
||||
os_str = get_os();
|
||||
if (!os_str)
|
||||
os_str = get_os_fallback();
|
||||
}
|
||||
return g_strdup (os_str);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_disk(void)
|
||||
{
|
||||
gint64 total, free_space;
|
||||
|
||||
if (xs_parse_df (&total, &free_space))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sysinfo_format_disk (total, free_space);
|
||||
}
|
||||
|
||||
static guint64
|
||||
get_free_memory (void)
|
||||
{
|
||||
mach_msg_type_number_t infoCount = (sizeof(vm_statistics_data_t) / sizeof(natural_t));
|
||||
|
||||
vm_size_t pagesize;
|
||||
vm_statistics_data_t vm_stat;
|
||||
|
||||
host_page_size(mach_host_self(), &pagesize);
|
||||
|
||||
if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vm_stat, &infoCount) == KERN_SUCCESS)
|
||||
return ((vm_stat.inactive_count + vm_stat.free_count) * pagesize);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_memory(void)
|
||||
{
|
||||
NSProcessInfo *info = [NSProcessInfo processInfo];
|
||||
guint64 totalmem, freemem;
|
||||
|
||||
totalmem = [info physicalMemory];
|
||||
|
||||
if ((freemem = get_free_memory()) == 0)
|
||||
return NULL;
|
||||
|
||||
return sysinfo_format_memory (totalmem, freemem);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_cpu(void)
|
||||
{
|
||||
guint64 cpu_clock_uint = 0;
|
||||
double cpu_clock;
|
||||
char cpu_string[256];
|
||||
gsize len;
|
||||
gboolean giga = FALSE;
|
||||
|
||||
len = sizeof(cpu_string);
|
||||
if (sysctlbyname ("machdep.cpu.brand_string", cpu_string, &len, NULL, 0) != 0)
|
||||
return NULL;
|
||||
cpu_string[sizeof(cpu_string) - 1] = '\0';
|
||||
|
||||
len = sizeof(cpu_clock_uint);
|
||||
if (sysctlbyname("hw.cpufrequency", &cpu_clock_uint, &len, NULL, 0) < 0)
|
||||
return NULL;
|
||||
|
||||
cpu_clock = cpu_clock_uint / 1000000;
|
||||
if (cpu_clock > 1000)
|
||||
{
|
||||
cpu_clock /= 1000;
|
||||
giga = TRUE;
|
||||
}
|
||||
|
||||
if (giga)
|
||||
return g_strdup_printf ("%s (%.2fGHz)", cpu_string, cpu_clock);
|
||||
else
|
||||
return g_strdup_printf ("%s (%.0fMHz)", cpu_string, cpu_clock);
|
||||
}
|
||||
|
||||
static char *
|
||||
get_gpu(void)
|
||||
{
|
||||
CFMutableDictionaryRef pciDevices = IOServiceMatching("IOPCIDevice");
|
||||
io_iterator_t entry_iterator, serviceObject;
|
||||
|
||||
if (IOServiceGetMatchingServices(kIOMasterPortDefault, pciDevices, &entry_iterator) != kIOReturnSuccess)
|
||||
return NULL;
|
||||
|
||||
GString *gpu_list = g_string_new(NULL);
|
||||
while ((serviceObject = IOIteratorNext(entry_iterator)))
|
||||
{
|
||||
CFMutableDictionaryRef serviceDictionary;
|
||||
|
||||
kern_return_t status = IORegistryEntryCreateCFProperties(serviceObject, &serviceDictionary,
|
||||
kCFAllocatorDefault, kNilOptions);
|
||||
|
||||
if (status != kIOReturnSuccess)
|
||||
{
|
||||
IOObjectRelease(serviceObject);
|
||||
continue;
|
||||
}
|
||||
|
||||
const void *class = CFDictionaryGetValue(serviceDictionary, @"class-code");
|
||||
if (!class || *(guint32*)CFDataGetBytePtr(class) != 0x30000) /* DISPLAY_VGA */
|
||||
{
|
||||
CFRelease(serviceDictionary);
|
||||
continue;
|
||||
}
|
||||
|
||||
const void *model = CFDictionaryGetValue(serviceDictionary, @"model");
|
||||
if (model)
|
||||
{
|
||||
if (CFGetTypeID(model) == CFDataGetTypeID() && CFDataGetLength(model) > 1)
|
||||
{
|
||||
if (gpu_list->len != 0)
|
||||
g_string_append (gpu_list, ", ");
|
||||
g_string_append_len (gpu_list, (const char*)CFDataGetBytePtr(model), CFDataGetLength(model) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(serviceDictionary);
|
||||
}
|
||||
|
||||
if (gpu_list->len == 0)
|
||||
{
|
||||
g_string_free (gpu_list, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The string may contain nul-chars we must replace */
|
||||
int i;
|
||||
for (i = 0; i < gpu_list->len; i++)
|
||||
{
|
||||
if (gpu_list->str[i] == '\0')
|
||||
gpu_list->str[i] = ' ';
|
||||
}
|
||||
|
||||
return g_string_free (gpu_list, FALSE);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_gpu(void)
|
||||
{
|
||||
static char *gpu_str = NULL;
|
||||
if (!gpu_str)
|
||||
gpu_str = get_gpu();
|
||||
|
||||
return g_strdup (gpu_str);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_sound(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_uptime(void)
|
||||
{
|
||||
NSProcessInfo *info = [NSProcessInfo processInfo];
|
||||
double uptime = [info systemUptime];
|
||||
|
||||
return sysinfo_format_uptime ((gint64)uptime);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_network(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
53
plugins/sysinfo/shared/df.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "sysinfo.h"
|
||||
|
||||
int xs_parse_df(gint64 *out_total, gint64 *out_free)
|
||||
{
|
||||
FILE *pipe;
|
||||
char buffer[bsize];
|
||||
|
||||
pipe = popen("df -k -l -P", "r");
|
||||
if(pipe==NULL)
|
||||
return 1;
|
||||
|
||||
*out_total = *out_free = 0;
|
||||
|
||||
while(fgets(buffer, bsize, pipe) != NULL)
|
||||
{
|
||||
long long int avail, total;
|
||||
|
||||
/* Filesystem 1024-blocks Used Available Capacity Mounted-on */
|
||||
if (sscanf (buffer, "%*s %lld %*s %lld %*s %*s", &total, &avail) == 2)
|
||||
{
|
||||
*out_total += total;
|
||||
*out_free += avail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert to bytes */
|
||||
*out_total *= 1000;
|
||||
*out_free *= 1000;
|
||||
|
||||
pclose(pipe);
|
||||
return 0;
|
||||
}
|
||||
23
plugins/sysinfo/shared/df.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SYSINFO_SHARED_H
|
||||
#define SYSINFO_SHARED_H
|
||||
|
||||
int xs_parse_df(gint64 *total_bytes, gint64 *free_bytes);
|
||||
|
||||
#endif
|
||||
33
plugins/sysinfo/sysinfo-backend.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SYSINFO_BACKEND_H
|
||||
#define SYSINFO_BACKEND_H
|
||||
|
||||
char *sysinfo_backend_get_os(void);
|
||||
char *sysinfo_backend_get_disk(void);
|
||||
char *sysinfo_backend_get_memory(void);
|
||||
char *sysinfo_backend_get_cpu(void);
|
||||
char *sysinfo_backend_get_gpu(void);
|
||||
char *sysinfo_backend_get_sound(void);
|
||||
char *sysinfo_backend_get_uptime(void);
|
||||
char *sysinfo_backend_get_network(void);
|
||||
|
||||
#endif
|
||||
277
plugins/sysinfo/sysinfo.c
Normal file
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2012 Berke Viktor.
|
||||
*
|
||||
* xsys.c - main functions for X-Sys 2
|
||||
* by mikeshoup
|
||||
* Copyright (C) 2003, 2004, 2005 Michael Shoup
|
||||
* Copyright (C) 2005, 2006, 2007 Tony Vroon
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
#include "sysinfo-backend.h"
|
||||
#include "sysinfo.h"
|
||||
|
||||
#define _(x) hexchat_gettext(ph,x)
|
||||
#define DEFAULT_ANNOUNCE TRUE
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
|
||||
static char name[] = "Sysinfo";
|
||||
static char desc[] = "Display info about your hardware and OS";
|
||||
static char version[] = "1.0";
|
||||
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|OS|CPU|RAM|DISK|VGA|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name; /* Lower case name used for prefs */
|
||||
const char *title; /* Used for the end formatting */
|
||||
char *(*callback) (void);
|
||||
gboolean def; /* Hide by default? */
|
||||
} hwinfo;
|
||||
|
||||
static char *
|
||||
get_client (void)
|
||||
{
|
||||
return g_strdup_printf ("HexChat %s", hexchat_get_info(ph, "version"));
|
||||
}
|
||||
|
||||
static hwinfo hwinfos[] = {
|
||||
{"client", "Client", get_client},
|
||||
{"os", "OS", sysinfo_backend_get_os},
|
||||
{"cpu", "CPU", sysinfo_backend_get_cpu},
|
||||
{"memory", "Memory", sysinfo_backend_get_memory},
|
||||
{"storage", "Storage", sysinfo_backend_get_disk},
|
||||
{"vga", "VGA", sysinfo_backend_get_gpu},
|
||||
{"sound", "Sound", sysinfo_backend_get_sound, TRUE},
|
||||
{"ethernet", "Ethernet", sysinfo_backend_get_network, TRUE},
|
||||
{"uptime", "Uptime", sysinfo_backend_get_uptime},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
static gboolean sysinfo_get_bool_pref (const char *pref, gboolean def);
|
||||
|
||||
static gboolean
|
||||
should_show_info (hwinfo info)
|
||||
{
|
||||
char hide_pref[32];
|
||||
|
||||
g_snprintf (hide_pref, sizeof(hide_pref), "hide_%s", info.name);
|
||||
return !sysinfo_get_bool_pref (hide_pref, info.def);
|
||||
}
|
||||
|
||||
static void
|
||||
print_summary (gboolean announce)
|
||||
{
|
||||
char **strings = g_new0 (char*, G_N_ELEMENTS(hwinfos));
|
||||
int i, x;
|
||||
char *output;
|
||||
|
||||
for (i = 0, x = 0; hwinfos[i].name != NULL; i++)
|
||||
{
|
||||
if (should_show_info (hwinfos[i]))
|
||||
{
|
||||
char *str = hwinfos[i].callback();
|
||||
if (str)
|
||||
{
|
||||
strings[x++] = g_strdup_printf ("\002%s\002: %s", hwinfos[i].title, str);
|
||||
g_free (str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output = g_strjoinv (" \002\342\200\242\002 ", strings);
|
||||
hexchat_commandf (ph, "%s %s", announce ? "SAY" : "ECHO", output);
|
||||
|
||||
g_strfreev (strings);
|
||||
g_free (output);
|
||||
}
|
||||
|
||||
static void
|
||||
print_info (char *info, gboolean announce)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; hwinfos[i].name != NULL; i++)
|
||||
{
|
||||
if (!g_ascii_strcasecmp (info, hwinfos[i].name))
|
||||
{
|
||||
char *str = hwinfos[i].callback();
|
||||
if (str)
|
||||
{
|
||||
hexchat_commandf (ph, "%s \002%s\002: %s", announce ? "SAY" : "ECHO",
|
||||
hwinfos[i].title, str);
|
||||
g_free (str);
|
||||
}
|
||||
else
|
||||
hexchat_print (ph, _("Sysinfo: Failed to get info. Either not supported or error."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hexchat_print (ph, _("Sysinfo: No info by that name\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple wrapper for backend specific options.
|
||||
* Ensure dest >= 512.
|
||||
*/
|
||||
int
|
||||
sysinfo_get_str_pref (const char *pref, char *dest)
|
||||
{
|
||||
return hexchat_pluginpref_get_str (ph, pref, dest);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sysinfo_get_bool_pref (const char *pref, gboolean def)
|
||||
{
|
||||
int value = hexchat_pluginpref_get_int (ph, pref);
|
||||
|
||||
if (value != -1)
|
||||
return value;
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
static void
|
||||
sysinfo_set_pref_real (const char *pref, char *value, gboolean def)
|
||||
{
|
||||
if (value && value[0])
|
||||
{
|
||||
guint64 i = g_ascii_strtoull (value, NULL, 0);
|
||||
hexchat_pluginpref_set_int (ph, pref, i != 0);
|
||||
hexchat_printf (ph, _("Sysinfo: %s is set to: %d\n"), pref, i != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, _("Sysinfo: %s is set to: %d\n"), pref,
|
||||
sysinfo_get_bool_pref(pref, def));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sysinfo_set_pref (char *key, char *value)
|
||||
{
|
||||
if (!key || !key[0])
|
||||
{
|
||||
hexchat_print (ph, _("Sysinfo: Valid settings are: announce and hide_* for each piece of information. e.g. hide_os. Without a value it will show current (or default) setting.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp (key, "announce"))
|
||||
{
|
||||
sysinfo_set_pref_real (key, value, DEFAULT_ANNOUNCE);
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_LIBPCI
|
||||
else if (!strcmp (key, "pciids"))
|
||||
{
|
||||
if (value && value[0])
|
||||
{
|
||||
hexchat_pluginpref_set_str (ph, "pciids", value);
|
||||
hexchat_printf (ph, _("Sysinfo: pciids is set to: %s\n"), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[512];
|
||||
if (hexchat_pluginpref_get_str (ph, "pciids", buf) == 0)
|
||||
strcpy (buf, DEFAULT_PCIIDS);
|
||||
hexchat_printf (ph, _("Sysinfo: pciids is set to: %s\n"), buf);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else if (g_str_has_prefix (key, "hide_"))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; hwinfos[i].name != NULL; i++)
|
||||
{
|
||||
if (!strcmp (key + 5, hwinfos[i].name))
|
||||
{
|
||||
sysinfo_set_pref_real (key, value, hwinfos[i].def);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hexchat_print (ph, _("Sysinfo: Invalid variable name\n"));
|
||||
}
|
||||
|
||||
static int
|
||||
sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
gboolean announce = sysinfo_get_bool_pref("announce", DEFAULT_ANNOUNCE);
|
||||
int offset = 0, channel_type;
|
||||
char *cmd;
|
||||
|
||||
/* Allow overriding global announce setting */
|
||||
if (!strcmp ("-e", word[2]))
|
||||
{
|
||||
announce = FALSE;
|
||||
offset++;
|
||||
}
|
||||
else if (!strcmp ("-o", word[2]))
|
||||
{
|
||||
announce = TRUE;
|
||||
offset++;
|
||||
}
|
||||
|
||||
/* Cannot send to server tab */
|
||||
channel_type = hexchat_list_int (ph, NULL, "type");
|
||||
if (channel_type != 2 /* SESS_CHANNEL */ && channel_type != 3 /* SESS_DIALOG */)
|
||||
announce = FALSE;
|
||||
|
||||
cmd = word[2+offset];
|
||||
if (!g_ascii_strcasecmp ("SET", cmd))
|
||||
sysinfo_set_pref (word[3+offset], word_eol[4+offset]);
|
||||
else if (!cmd || !cmd[0])
|
||||
print_summary (announce);
|
||||
else
|
||||
print_info (cmd, announce);
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
ph = plugin_handle;
|
||||
*plugin_name = name;
|
||||
*plugin_desc = desc;
|
||||
*plugin_version = version;
|
||||
|
||||
hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
|
||||
|
||||
hexchat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
||||
hexchat_printf (ph, _("%s plugin loaded\n"), name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
{
|
||||
hexchat_command (ph, "MENU DEL \"Window/Display System Info\"");
|
||||
hexchat_printf (ph, _("%s plugin unloaded\n"), name);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,416 +0,0 @@
|
||||
/* HexChat
|
||||
* Copyright (c) 2011-2012 Berke Viktor.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <comutil.h>
|
||||
#include <wbemidl.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static char name[] = "SysInfo";
|
||||
static char desc[] = "Display info about your hardware and OS";
|
||||
static char version[] = "1.1";
|
||||
static char helptext[] = "USAGE: /sysinfo - Sends info about your hardware and OS to current channel.";
|
||||
static int firstRun;
|
||||
static char *wmiOs;
|
||||
static char *wmiCpu;
|
||||
static char *wmiVga;
|
||||
|
||||
static int
|
||||
getCpuArch (void)
|
||||
{
|
||||
OSVERSIONINFOEX osvi;
|
||||
SYSTEM_INFO si;
|
||||
|
||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
|
||||
GetVersionEx ((LPOSVERSIONINFOW) &osvi);
|
||||
|
||||
GetSystemInfo (&si);
|
||||
|
||||
if (si.wProcessorArchitecture == 9)
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 86;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* use WMI instead, wProcessorArchitecture displays current binary arch instead of OS arch anyway */
|
||||
static char *
|
||||
getOsName (void)
|
||||
{
|
||||
static char winver[32];
|
||||
double mhz;
|
||||
OSVERSIONINFOEX osvi;
|
||||
SYSTEM_INFO si;
|
||||
|
||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
|
||||
GetVersionEx ((LPOSVERSIONINFOW) &osvi);
|
||||
|
||||
GetSystemInfo (&si);
|
||||
|
||||
strcpy (winver, "Windows ");
|
||||
|
||||
switch (osvi.dwMajorVersion)
|
||||
{
|
||||
case 5:
|
||||
switch (osvi.dwMinorVersion)
|
||||
{
|
||||
case 1:
|
||||
strcat (winver, "XP");
|
||||
break;
|
||||
case 2:
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
{
|
||||
strcat (winver, "XP x64 Edition");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetSystemMetrics(SM_SERVERR2) == 0)
|
||||
{
|
||||
strcat (winver, "Server 2003");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat (winver, "Server 2003 R2");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
switch (osvi.dwMinorVersion)
|
||||
{
|
||||
case 0:
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
{
|
||||
strcat (winver, "Vista");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat (winver, "Server 2008");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
{
|
||||
strcat (winver, "7");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat (winver, "Server 2008 R2");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
{
|
||||
strcat (winver, "8");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat (winver, "8 Server");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (si.wProcessorArchitecture == 9)
|
||||
{
|
||||
strcat (winver, " (x64)");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat (winver, " (x86)");
|
||||
}
|
||||
|
||||
return winver;
|
||||
}
|
||||
|
||||
/* x86-only, SDK-only, use WMI instead */
|
||||
static char *
|
||||
getCpuName (void)
|
||||
{
|
||||
/* Get extended ids. */
|
||||
unsigned int nExIds;
|
||||
unsigned int i;
|
||||
int CPUInfo[4] = {-1};
|
||||
static char CPUBrandString[128];
|
||||
|
||||
__cpuid (CPUInfo, 0x80000000);
|
||||
nExIds = CPUInfo[0];
|
||||
|
||||
/* Get the information associated with each extended ID. */
|
||||
for (i=0x80000000; i <= nExIds; ++i)
|
||||
{
|
||||
__cpuid (CPUInfo, i);
|
||||
|
||||
if (i == 0x80000002)
|
||||
{
|
||||
memcpy (CPUBrandString, CPUInfo, sizeof (CPUInfo));
|
||||
}
|
||||
else if (i == 0x80000003)
|
||||
{
|
||||
memcpy( CPUBrandString + 16, CPUInfo, sizeof (CPUInfo));
|
||||
}
|
||||
else if (i == 0x80000004)
|
||||
{
|
||||
memcpy (CPUBrandString + 32, CPUInfo, sizeof (CPUInfo));
|
||||
}
|
||||
}
|
||||
|
||||
return CPUBrandString;
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *
|
||||
getCpuMhz (void)
|
||||
{
|
||||
HKEY hKey;
|
||||
int result;
|
||||
int data;
|
||||
int dataSize;
|
||||
double cpuspeed;
|
||||
static char buffer[16];
|
||||
const char *cpuspeedstr;
|
||||
|
||||
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
dataSize = sizeof (data);
|
||||
result = RegQueryValueEx (hKey, TEXT("~MHz"), 0, 0, (LPBYTE)&data, (LPDWORD)&dataSize);
|
||||
RegCloseKey (hKey);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
cpuspeed = ( data > 1000 ) ? data / 1000 : data;
|
||||
cpuspeedstr = ( data > 1000 ) ? "GHz" : "MHz";
|
||||
sprintf (buffer, "%.2f %s", cpuspeed, cpuspeedstr);
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static char *
|
||||
getMemoryInfo (void)
|
||||
{
|
||||
static char buffer[32];
|
||||
MEMORYSTATUSEX meminfo;
|
||||
|
||||
meminfo.dwLength = sizeof (meminfo);
|
||||
GlobalMemoryStatusEx (&meminfo);
|
||||
|
||||
sprintf (buffer, "%I64d MB Total (%I64d MB Free)", meminfo.ullTotalPhys / 1024 / 1024, meminfo.ullAvailPhys / 1024 / 1024);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static char *
|
||||
getWmiInfo (int mode)
|
||||
{
|
||||
/* for more details about this wonderful API, see
|
||||
http://msdn.microsoft.com/en-us/site/aa394138
|
||||
http://msdn.microsoft.com/en-us/site/aa390423
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394138%28v=vs.85%29.aspx
|
||||
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/d6420012-e432-4964-8506-6f6b65e5a451
|
||||
*/
|
||||
|
||||
char *buffer = (char *) malloc (128);
|
||||
HRESULT hres;
|
||||
HRESULT hr;
|
||||
IWbemLocator *pLoc = NULL;
|
||||
IWbemServices *pSvc = NULL;
|
||||
IEnumWbemClassObject *pEnumerator = NULL;
|
||||
IWbemClassObject *pclsObj;
|
||||
ULONG uReturn = 0;
|
||||
|
||||
hres = CoInitializeEx (0, COINIT_APARTMENTTHREADED | COINIT_SPEED_OVER_MEMORY);
|
||||
|
||||
if (FAILED (hres))
|
||||
{
|
||||
strcpy (buffer, "Error Code 0");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
hres = CoInitializeSecurity (NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
|
||||
|
||||
/* mysteriously failing after the first execution, but only when used as a plugin, skip it */
|
||||
/*if (FAILED (hres))
|
||||
{
|
||||
CoUninitialize ();
|
||||
strcpy (buffer, "Error Code 1");
|
||||
return buffer;
|
||||
}*/
|
||||
|
||||
hres = CoCreateInstance (CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLoc);
|
||||
|
||||
if (FAILED (hres))
|
||||
{
|
||||
CoUninitialize ();
|
||||
strcpy (buffer, "Error Code 2");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
hres = pLoc->ConnectServer (_bstr_t (L"root\\CIMV2"), NULL, NULL, 0, NULL, 0, 0, &pSvc);
|
||||
|
||||
if (FAILED (hres))
|
||||
{
|
||||
pLoc->Release ();
|
||||
CoUninitialize ();
|
||||
strcpy (buffer, "Error Code 3");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
hres = CoSetProxyBlanket (pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
|
||||
|
||||
if (FAILED (hres))
|
||||
{
|
||||
pSvc->Release ();
|
||||
pLoc->Release ();
|
||||
CoUninitialize ();
|
||||
strcpy (buffer, "Error Code 4");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
hres = pSvc->ExecQuery (_bstr_t ("WQL"), _bstr_t ("SELECT * FROM Win32_OperatingSystem"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
|
||||
break;
|
||||
case 1:
|
||||
hres = pSvc->ExecQuery (_bstr_t ("WQL"), _bstr_t ("SELECT * FROM Win32_Processor"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
|
||||
break;
|
||||
case 2:
|
||||
hres = pSvc->ExecQuery (_bstr_t ("WQL"), _bstr_t ("SELECT * FROM Win32_VideoController"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (FAILED (hres))
|
||||
{
|
||||
pSvc->Release ();
|
||||
pLoc->Release ();
|
||||
CoUninitialize ();
|
||||
strcpy (buffer, "Error Code 5");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
while (pEnumerator)
|
||||
{
|
||||
hr = pEnumerator->Next (WBEM_INFINITE, 1, &pclsObj, &uReturn);
|
||||
if (0 == uReturn)
|
||||
{
|
||||
break;
|
||||
}
|
||||
VARIANT vtProp;
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
hr = pclsObj->Get (L"Caption", 0, &vtProp, 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
hr = pclsObj->Get (L"Name", 0, &vtProp, 0, 0);
|
||||
break;
|
||||
case 2:
|
||||
hr = pclsObj->Get (L"Name", 0, &vtProp, 0, 0);
|
||||
break;
|
||||
}
|
||||
WideCharToMultiByte (CP_ACP, 0, vtProp.bstrVal, -1, buffer, SysStringLen (vtProp.bstrVal)+1, NULL, NULL);
|
||||
VariantClear (&vtProp);
|
||||
}
|
||||
|
||||
pSvc->Release ();
|
||||
pLoc->Release ();
|
||||
pEnumerator->Release ();
|
||||
pclsObj->Release ();
|
||||
CoUninitialize ();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static int
|
||||
printInfo (char *word[], char *word_eol[], void *user_data)
|
||||
{
|
||||
/* query WMI info only at the first time SysInfo is called, then cache it to save time */
|
||||
if (firstRun)
|
||||
{
|
||||
hexchat_printf (ph, "%s first execution, querying and caching WMI info...\n", name);
|
||||
wmiOs = getWmiInfo (0);
|
||||
wmiCpu = getWmiInfo (1);
|
||||
wmiVga = getWmiInfo (2);
|
||||
firstRun = 0;
|
||||
}
|
||||
if (hexchat_list_int (ph, NULL, "type") >= 2)
|
||||
{
|
||||
/* uptime will work correctly for up to 50 days, should be enough */
|
||||
hexchat_commandf (ph, "ME ** SysInfo ** Client: HexChat %s (x%d) ** OS: %s ** CPU: %s (%s) ** RAM: %s ** VGA: %s ** Uptime: %.2f Hours **",
|
||||
hexchat_get_info (ph, "version"),
|
||||
getCpuArch (),
|
||||
wmiOs,
|
||||
wmiCpu,
|
||||
getCpuMhz (),
|
||||
getMemoryInfo (),
|
||||
wmiVga, (float) GetTickCount() / 1000 / 60 / 60);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, " * Client: HexChat %s (x%d)\n", hexchat_get_info (ph, "version"), getCpuArch ());
|
||||
hexchat_printf (ph, " * OS: %s\n", wmiOs);
|
||||
hexchat_printf (ph, " * CPU: %s (%s)\n", wmiCpu, getCpuMhz ());
|
||||
hexchat_printf (ph, " * RAM: %s\n", getMemoryInfo ());
|
||||
hexchat_printf (ph, " * VGA: %s\n", wmiVga);
|
||||
hexchat_printf (ph, " * Uptime: %.2f Hours\n", (float) GetTickCount() / 1000 / 60 / 60);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
ph = plugin_handle;
|
||||
|
||||
*plugin_name = name;
|
||||
*plugin_desc = desc;
|
||||
*plugin_version = version;
|
||||
|
||||
firstRun = 1;
|
||||
|
||||
hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, printInfo, helptext, NULL);
|
||||
hexchat_command (ph, "MENU -ishare\\system.png ADD \"Window/Send System Info\" \"SYSINFO\"");
|
||||
|
||||
hexchat_printf (ph, "%s plugin loaded\n", name);
|
||||
|
||||
return 1; /* return 1 for success */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
{
|
||||
hexchat_command (ph, "MENU DEL \"Window/Display System Info\"");
|
||||
hexchat_printf (ph, "%s plugin unloaded\n", name);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* xsys.h - X-Sys general parameters header
|
||||
* Copyright (C) 2005 Gustavo Zacarias
|
||||
* Copyright (C) 2006, 2007 Tony Vroon
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,14 +18,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _XSYS_H_
|
||||
#define _XSYS_H_
|
||||
#ifndef SYSINFO_H
|
||||
#define SYSINFO_H
|
||||
|
||||
#define bsize 1024
|
||||
#define delims ":="
|
||||
#define DEFAULT_PCIIDS "/usr/share/hwdata/pci.ids"
|
||||
|
||||
int sysinfo_get_percent ();
|
||||
void sysinfo_get_pciids (char *dest);
|
||||
void sysinfo_print_error (const char* msg);
|
||||
int sysinfo_get_str_pref (const char *name, char *dest);
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,91 +21,51 @@
|
||||
<RootNamespace>sysinfo</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>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcsysinfo</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcsysinfo</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>wbemuuid.lib;comsupp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(HexChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>wbemuuid.lib;comsupp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(HexChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="sysinfo.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sysinfo.cpp" />
|
||||
<ClCompile Include="format.c" />
|
||||
<ClCompile Include="sysinfo.c" />
|
||||
<ClCompile Include="win32\backend.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="format.h" />
|
||||
<ClInclude Include="sysinfo-backend.h" />
|
||||
<ClInclude Include="sysinfo.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -9,6 +9,9 @@
|
||||
<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="Header Files">
|
||||
<UniqueIdentifier>{c873eb6b-aca6-434d-8ec9-199838b80838}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="sysinfo.def">
|
||||
@@ -16,8 +19,25 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sysinfo.cpp">
|
||||
<ClCompile Include="sysinfo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="win32\backend.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="format.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sysinfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sysinfo-backend.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="format.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
170
plugins/sysinfo/unix/backend.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "parse.h"
|
||||
#include "match.h"
|
||||
#include "sysinfo.h"
|
||||
#include "format.h"
|
||||
#include "df.h"
|
||||
|
||||
char *sysinfo_backend_get_os(void)
|
||||
{
|
||||
char name[bsize];
|
||||
|
||||
if (xs_parse_distro (name) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_strdup(name);
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_disk(void)
|
||||
{
|
||||
gint64 total, free;
|
||||
|
||||
if (xs_parse_df (&total, &free))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sysinfo_format_disk (total, free);
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_memory(void)
|
||||
{
|
||||
unsigned long long mem_total;
|
||||
unsigned long long mem_free;
|
||||
unsigned long long swap_total;
|
||||
unsigned long long swap_free;
|
||||
char *swap_fmt = NULL, *mem_fmt, *ret;
|
||||
|
||||
if (xs_parse_meminfo (&mem_total, &mem_free, 0) == 1)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (xs_parse_meminfo (&swap_total, &swap_free, 1) != 1)
|
||||
{
|
||||
swap_fmt = sysinfo_format_memory (swap_total, swap_free);
|
||||
}
|
||||
|
||||
mem_fmt = sysinfo_format_memory (mem_total, mem_free);
|
||||
|
||||
if (swap_fmt)
|
||||
{
|
||||
ret = g_strdup_printf ("Physical: %s Swap: %s", mem_fmt, swap_fmt);
|
||||
g_free (mem_fmt);
|
||||
g_free (swap_fmt);
|
||||
}
|
||||
else
|
||||
ret = mem_fmt;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_cpu(void)
|
||||
{
|
||||
char model[bsize];
|
||||
char vendor[bsize];
|
||||
char buffer[bsize];
|
||||
double freq;
|
||||
int giga = 0;
|
||||
|
||||
if (xs_parse_cpu (model, vendor, &freq) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (freq > 1000)
|
||||
{
|
||||
freq /= 1000;
|
||||
giga = 1;
|
||||
}
|
||||
|
||||
if (giga)
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%s (%.2fGHz)", model, freq);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%s (%.0fMHz)", model, freq);
|
||||
}
|
||||
|
||||
return g_strdup (buffer);
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_gpu(void)
|
||||
{
|
||||
char vid_card[bsize];
|
||||
char agp_bridge[bsize];
|
||||
char buffer[bsize];
|
||||
int ret;
|
||||
|
||||
if ((ret = xs_parse_video (vid_card)) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (xs_parse_agpbridge (agp_bridge) != 0)
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%s", vid_card);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%s @ %s", vid_card, agp_bridge);
|
||||
}
|
||||
|
||||
return g_strdup (buffer);
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_sound(void)
|
||||
{
|
||||
char sound[bsize];
|
||||
|
||||
if (xs_parse_sound (sound) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return g_strdup (sound);
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_uptime(void)
|
||||
{
|
||||
gint64 uptime;
|
||||
|
||||
if ((uptime = xs_parse_uptime ()) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sysinfo_format_uptime (uptime);
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_network(void)
|
||||
{
|
||||
char ethernet_card[bsize];
|
||||
|
||||
if (xs_parse_ether (ethernet_card))
|
||||
{
|
||||
g_strlcpy (ethernet_card, "None found", bsize);
|
||||
}
|
||||
|
||||
return g_strdup (ethernet_card);
|
||||
}
|
||||
98
plugins/sysinfo/unix/match.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* match.c - matching functions for X-Sys
|
||||
* Copyright (C) 2005, 2006, 2007 Tony Vroon
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "sysinfo.h"
|
||||
|
||||
#define delims ":="
|
||||
|
||||
void find_match_char(char *buffer, char *match, char *result)
|
||||
{
|
||||
char *position;
|
||||
g_strchug(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL)
|
||||
{
|
||||
position += 1;
|
||||
strcpy(result, position);
|
||||
position = strstr(result, "\n");
|
||||
*(position) = '\0';
|
||||
g_strchug(result);
|
||||
}
|
||||
else
|
||||
strcpy(result, "\0");
|
||||
}
|
||||
}
|
||||
|
||||
void find_match_double(char *buffer, char *match, double *result)
|
||||
{
|
||||
char *position;
|
||||
g_strchug(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL)
|
||||
{
|
||||
position += 1;
|
||||
*result = strtod(position, NULL);
|
||||
}
|
||||
else
|
||||
*result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void find_match_double_hex(char *buffer, char *match, double *result)
|
||||
{
|
||||
char *position;
|
||||
g_strchug(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL)
|
||||
{
|
||||
memcpy(position,"0x",2);
|
||||
*result = strtod(position,NULL);
|
||||
}
|
||||
else
|
||||
*result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void find_match_ll(char *buffer, char *match, unsigned long long *result)
|
||||
{
|
||||
char *position;
|
||||
g_strchug(buffer);
|
||||
if(strstr(buffer, match) == strstr(buffer, buffer))
|
||||
{
|
||||
position = strpbrk(buffer, delims);
|
||||
if (position != NULL)
|
||||
{
|
||||
position += 1;
|
||||
*result = strtoll(position, NULL, 10);
|
||||
}
|
||||
else
|
||||
*result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,7 @@
|
||||
void find_match_char(char *buffer, char *match, char *result);
|
||||
void find_match_double(char *buffer, char *match, double *result);
|
||||
void find_match_double_hex(char *buffer, char *match, double *result);
|
||||
void find_match_int(char *buffer, char *match, unsigned int *result);
|
||||
void find_match_ll(char *buffer, char *match, unsigned long long *result);
|
||||
void format_output(const char *arg, char *string, char *format);
|
||||
void flat_format_output(const char *arg, char *string, char *format);
|
||||
float percentage(unsigned long long *free, unsigned long long *total);
|
||||
char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned long long *total_k);
|
||||
void remove_leading_whitespace(char *buffer);
|
||||
char *decruft_filename(char *buffer);
|
||||
|
||||
#endif
|
||||
@@ -23,20 +23,19 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <pci/header.h>
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef __sparc__
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include "pci.h"
|
||||
#include "match.h"
|
||||
#include "xsys.h"
|
||||
#include "parse.h"
|
||||
#include "sysinfo.h"
|
||||
|
||||
int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned int *count)
|
||||
int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
{
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__alpha__) || defined(__ia64__) || defined(__parisc__) || defined(__sparc__)
|
||||
char buffer[bsize];
|
||||
@@ -47,9 +46,6 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
|
||||
FILE *fp = fopen("/proc/cpuinfo", "r");
|
||||
if(fp == NULL)
|
||||
return 1;
|
||||
|
||||
*count = 0;
|
||||
strcpy(cache,"unknown\0");
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
@@ -57,10 +53,7 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
|
||||
find_match_char(buffer, "model name", model);
|
||||
find_match_char(buffer, "vendor_id", vendor);
|
||||
find_match_double(buffer, "cpu MHz", freq);
|
||||
find_match_char(buffer, "cache size", cache);
|
||||
find_match_int(buffer, "processor", count);
|
||||
}
|
||||
*count = *count + 1;
|
||||
#endif
|
||||
#ifdef __powerpc__
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
@@ -68,10 +61,7 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
|
||||
find_match_char(buffer, "cpu", model);
|
||||
find_match_char(buffer, "machine", vendor);
|
||||
find_match_double(buffer, "clock", freq);
|
||||
find_match_char(buffer, "L2 cache", cache);
|
||||
find_match_int(buffer, "processor", count);
|
||||
}
|
||||
*count = *count + 1;
|
||||
pos = strstr(model, ",");
|
||||
if (pos != NULL) *pos = '\0';
|
||||
#endif
|
||||
@@ -81,8 +71,6 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
|
||||
find_match_char(buffer, "cpu model", model);
|
||||
find_match_char(buffer, "system type", vendor);
|
||||
find_match_double(buffer, "cycle frequency [Hz]", freq);
|
||||
find_match_char(buffer, "L2 cache", cache);
|
||||
find_match_int(buffer, "cpus detected", count);
|
||||
}
|
||||
*freq = *freq / 1000000;
|
||||
#endif
|
||||
@@ -92,20 +80,15 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
|
||||
find_match_char(buffer, "model", model);
|
||||
find_match_char(buffer, "vendor", vendor);
|
||||
find_match_double(buffer, "cpu MHz", freq);
|
||||
find_match_int(buffer, "processor", count);
|
||||
}
|
||||
*count = *count + 1;
|
||||
#endif
|
||||
#ifdef __parisc__
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
{
|
||||
find_match_char(buffer, "cpu ", model);
|
||||
find_match_char(buffer, "cpu family", vendor);
|
||||
find_match_char(buffer, "D-cache", cache);
|
||||
find_match_double(buffer, "cpu MHz", freq);
|
||||
find_match_int(buffer, "processor", count);
|
||||
}
|
||||
*count = *count + 1;
|
||||
#endif
|
||||
#ifdef __sparc__
|
||||
DIR *dir;
|
||||
@@ -115,22 +98,8 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
|
||||
{
|
||||
find_match_char(buffer, "cpu ", model);
|
||||
find_match_char(buffer, "type ", vendor);
|
||||
find_match_int(buffer, "ncpus active", count);
|
||||
find_match_double_hex(buffer, "Cpu0ClkTck", freq);
|
||||
}
|
||||
/* Cache is tricky, only implemented for sparc64 */
|
||||
if ((dir = opendir("/proc/openprom")) != NULL)
|
||||
while ((entry = readdir(dir)) != NULL)
|
||||
if (strncmp(entry->d_name,"SUNW,UltraSPARC",15) == 0)
|
||||
{
|
||||
g_snprintf(buffer,bsize,"/proc/openprom/%s/ecache-size",entry->d_name);
|
||||
fp2 = fopen(buffer, "r");
|
||||
if (fp2 == NULL) break;
|
||||
fscanf(fp2,"%16s",cache);
|
||||
fclose(fp2);
|
||||
sprintf(buffer,"0x%s",cache);
|
||||
sprintf(cache,"%0.0f KB",strtod(buffer,NULL)/1024);
|
||||
}
|
||||
*freq = *freq / 1000000;
|
||||
#endif
|
||||
fclose(fp);
|
||||
@@ -138,43 +107,20 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xs_parse_uptime(int *weeks, int *days, int *hours, int *minutes, int *seconds)
|
||||
gint64 xs_parse_uptime(void)
|
||||
{
|
||||
char buffer[bsize];
|
||||
long long uptime = 0;
|
||||
gint64 uptime = 0;
|
||||
FILE *fp = fopen("/proc/uptime", "r");
|
||||
if(fp == NULL)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
if(fgets(buffer, bsize, fp) != NULL)
|
||||
uptime = strtol(buffer, NULL, 0);
|
||||
|
||||
*seconds = uptime%60;
|
||||
*minutes = (uptime/60)%60;
|
||||
*hours = (uptime/3600)%24;
|
||||
*days = (uptime/86400)%7;
|
||||
*weeks = uptime/604800;
|
||||
uptime = g_ascii_strtoll(buffer, NULL, 0);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xs_parse_os(char *user, char *host, char *kernel)
|
||||
{
|
||||
struct utsname osinfo;
|
||||
char hostn[bsize], *usern = getenv("USER");
|
||||
|
||||
if(uname(&osinfo)<0)
|
||||
return 1;
|
||||
if(gethostname(hostn, bsize)<0)
|
||||
return 1;
|
||||
|
||||
strncpy(user, usern, bsize);
|
||||
strcpy(host, hostn);
|
||||
g_snprintf(kernel, bsize, "%s %s %s", osinfo.sysname, osinfo.release, osinfo.machine);
|
||||
|
||||
return 0;
|
||||
return uptime;
|
||||
}
|
||||
|
||||
int xs_parse_sound(char *snd_card)
|
||||
@@ -183,12 +129,13 @@ int xs_parse_sound(char *snd_card)
|
||||
u16 class = PCI_CLASS_MULTIMEDIA_AUDIO;
|
||||
|
||||
FILE *fp = NULL;
|
||||
if((fp = fopen("/proc/asound/cards", "r"))== NULL) {
|
||||
if((fp = fopen("/proc/asound/cards", "r"))== NULL)
|
||||
{
|
||||
if (pci_find_by_class(&class, vendor, device) == 0)
|
||||
{
|
||||
pci_find_fullname(snd_card, vendor, device);
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
pci_find_fullname(snd_card, vendor, device);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
@@ -199,13 +146,13 @@ int xs_parse_sound(char *snd_card)
|
||||
if(isdigit(buffer[0]) || isdigit(buffer[1]))
|
||||
{
|
||||
char card_buf[bsize];
|
||||
long card_id = 0;
|
||||
gint64 card_id = 0;
|
||||
pos = strstr(buffer, ":");
|
||||
card_id = strtoll(buffer, NULL, 0);
|
||||
card_id = g_ascii_strtoll(buffer, NULL, 0);
|
||||
if (card_id == 0)
|
||||
g_snprintf(card_buf, bsize, "%s", pos+2);
|
||||
else
|
||||
g_snprintf(card_buf, bsize, "%ld: %s", card_id, pos+2);
|
||||
g_snprintf(card_buf, bsize, "%"G_GINT64_FORMAT": %s", card_id, pos+2);
|
||||
pos = strstr(card_buf, "\n");
|
||||
*pos = '\0';
|
||||
strcat(cards, card_buf);
|
||||
@@ -251,129 +198,42 @@ int xs_parse_agpbridge(char *agp_bridge)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xs_parse_netdev(const char *device, unsigned long long *bytes_recv, unsigned long long *bytes_sent)
|
||||
{
|
||||
FILE *fp;
|
||||
char buffer[bsize], *pos;
|
||||
int i;
|
||||
|
||||
fp=fopen("/proc/net/dev", "r");
|
||||
if(fp==NULL)
|
||||
return 1;
|
||||
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
{
|
||||
for(i=0; isspace(buffer[i]); i++);
|
||||
if(strncmp(device, &buffer[i], strlen(device)) == 0) break;
|
||||
}
|
||||
fclose(fp);
|
||||
pos = strstr(buffer, ":");
|
||||
pos++;
|
||||
*bytes_recv = g_ascii_strtoull (pos, &pos, 0);
|
||||
|
||||
for(i=0;i<7;i++) g_ascii_strtoull (pos, &pos, 0);
|
||||
|
||||
*bytes_sent = g_ascii_strtoull (pos, NULL, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xs_parse_df(const char *mount_point, char *result)
|
||||
{
|
||||
FILE *pipe;
|
||||
char buffer[bsize], *pos;
|
||||
unsigned long long total_k=0, free_k=0;
|
||||
int i=0;
|
||||
|
||||
pipe = popen("df -k -l -P", "r");
|
||||
if(pipe==NULL)
|
||||
return 1;
|
||||
|
||||
while(fgets(buffer, bsize, pipe) != NULL)
|
||||
{
|
||||
/* Skip over pseudo-filesystems and description line */
|
||||
if(isalpha(buffer[0]))
|
||||
continue;
|
||||
|
||||
for(pos=buffer; !isspace(*pos); pos++);
|
||||
for(;isspace(*pos);pos++);
|
||||
if(mount_point == NULL)
|
||||
{
|
||||
total_k += g_ascii_strtoull (pos, &pos, 0);
|
||||
g_ascii_strtoull(pos, &pos, 0);
|
||||
free_k += g_ascii_strtoull (pos, &pos, 0);
|
||||
continue;
|
||||
}
|
||||
total_k = g_ascii_strtoull (pos, &pos, 0);
|
||||
g_ascii_strtoull(pos, &pos, 0);
|
||||
free_k = g_ascii_strtoull (pos, &pos, 0);
|
||||
g_ascii_strtoull (pos, &pos, 0);
|
||||
for(;isspace(*pos);pos++);
|
||||
for(;*pos!='/';pos++);
|
||||
for(i=0;*(buffer+i)!='\n';i++);
|
||||
*(buffer+i)='\0';
|
||||
|
||||
if(strncasecmp(mount_point, "ALL", 3)==0)
|
||||
{
|
||||
char *tmp_buf = pretty_freespace(pos, &free_k, &total_k);
|
||||
strcat(tmp_buf, " | ");
|
||||
strcat(result, tmp_buf);
|
||||
g_free(tmp_buf);
|
||||
}
|
||||
else if(strncmp(mount_point, pos, strlen(mount_point)) == 0)
|
||||
{
|
||||
char *tmp_buf = pretty_freespace(mount_point, &free_k, &total_k);
|
||||
strncpy(result, tmp_buf, bsize);
|
||||
g_free(tmp_buf);
|
||||
break;
|
||||
}
|
||||
else g_snprintf(result, bsize, "Mount point %s not found!", mount_point);
|
||||
}
|
||||
|
||||
if(mount_point != NULL && strncasecmp(mount_point, "ALL", 3)==0)
|
||||
*(result+strlen(result)-3) = '\0';
|
||||
|
||||
if(mount_point == NULL)
|
||||
{
|
||||
char *tmp_buf = pretty_freespace("Total", &free_k, &total_k);
|
||||
strncpy(result, tmp_buf, bsize);
|
||||
g_free(tmp_buf);
|
||||
}
|
||||
pclose(pipe);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xs_parse_meminfo(unsigned long long *mem_tot, unsigned long long *mem_free, int swap)
|
||||
{
|
||||
FILE *fp;
|
||||
char buffer[bsize];
|
||||
char buffer[bsize];
|
||||
unsigned long long freemem = 0, buffers = 0, cache = 0;
|
||||
*mem_tot = 0;
|
||||
*mem_free = 0;
|
||||
*mem_tot = 0;
|
||||
*mem_free = 0;
|
||||
|
||||
if((fp = fopen("/proc/meminfo", "r")) == NULL)
|
||||
return 1;
|
||||
if((fp = fopen("/proc/meminfo", "r")) == NULL)
|
||||
return 1;
|
||||
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
{
|
||||
if(!swap)
|
||||
{
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
{
|
||||
if(!swap)
|
||||
{
|
||||
find_match_ll(buffer, "MemTotal:", mem_tot);
|
||||
find_match_ll(buffer, "MemFree:", &freemem);
|
||||
find_match_ll(buffer, "Buffers:", &buffers);
|
||||
find_match_ll(buffer, "Cached:", &cache);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
find_match_ll(buffer, "SwapTotal:", mem_tot);
|
||||
find_match_ll(buffer, "SwapFree:", mem_free);
|
||||
}
|
||||
}
|
||||
if (!swap) {
|
||||
}
|
||||
}
|
||||
if (!swap)
|
||||
{
|
||||
*mem_free = freemem + buffers + cache;
|
||||
}
|
||||
fclose(fp);
|
||||
return 0;
|
||||
fclose(fp);
|
||||
|
||||
/* Convert to bytes */
|
||||
*mem_free *= 1000;
|
||||
*mem_tot *= 1000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xs_parse_distro(char *name)
|
||||
@@ -429,10 +289,12 @@ int xs_parse_distro(char *name)
|
||||
}
|
||||
else
|
||||
g_snprintf(buffer, bsize, "Unknown Distro");
|
||||
if(fp != NULL) fclose(fp);
|
||||
if(fp != NULL)
|
||||
fclose(fp);
|
||||
|
||||
pos=strchr(buffer, '\n');
|
||||
if(pos != NULL) *pos = '\0';
|
||||
if(pos != NULL)
|
||||
*pos = '\0';
|
||||
strcpy(name, buffer);
|
||||
return 0;
|
||||
}
|
||||
@@ -23,12 +23,9 @@
|
||||
#ifndef _PARSE_H_
|
||||
#define _PARSE_H_
|
||||
|
||||
int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned int *count);
|
||||
int xs_parse_uptime(int *weeks, int *days, int *hours, int *minutes, int *seconds);
|
||||
int xs_parse_os(char *user, char *host, char *kernel);
|
||||
int xs_parse_cpu(char *model, char *vendor, double *freq);
|
||||
gint64 xs_parse_uptime(void);
|
||||
int xs_parse_sound(char *snd_card);
|
||||
int xs_parse_netdev(const char *device, unsigned long long *bytes_recv, unsigned long long *bytes_sent);
|
||||
int xs_parse_df(const char *mount_point, char *string);
|
||||
int xs_parse_meminfo(unsigned long long *mem_tot, unsigned long long *mem_free, int swap);
|
||||
int xs_parse_video(char *vid_card);
|
||||
int xs_parse_agpbridge(char *agp_bridge);
|
||||
@@ -23,64 +23,67 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <pci/pci.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "xsys.h"
|
||||
#include "sysinfo.h"
|
||||
|
||||
static struct pci_filter filter; /* Device filter */
|
||||
static struct pci_access *pacc;
|
||||
int bus, dev, func; /* Location of the card */
|
||||
|
||||
struct device {
|
||||
struct device *next;
|
||||
struct pci_dev *dev;
|
||||
unsigned int config_cnt;
|
||||
u8 config[256];
|
||||
struct device *next;
|
||||
struct pci_dev *dev;
|
||||
unsigned int config_cnt;
|
||||
u8 config[256];
|
||||
};
|
||||
|
||||
static struct device *first_dev;
|
||||
|
||||
static struct device *scan_device(struct pci_dev *p)
|
||||
{
|
||||
int how_much = 64;
|
||||
struct device *d;
|
||||
int how_much = 64;
|
||||
struct device *d;
|
||||
|
||||
if (!pci_filter_match(&filter, p))
|
||||
return NULL;
|
||||
d = g_new0 (struct device, 1);
|
||||
d->dev = p;
|
||||
if (!pci_read_block(p, 0, d->config, how_much))
|
||||
exit(1);
|
||||
if (how_much < 128 && (d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS) {
|
||||
/* For cardbus bridges, we need to fetch 64 bytes more to get the full standard header... */
|
||||
if (!pci_read_block(p, 64, d->config+64, 64))
|
||||
exit(1);
|
||||
how_much = 128;
|
||||
}
|
||||
d->config_cnt = how_much;
|
||||
pci_setup_cache(p, d->config, d->config_cnt);
|
||||
pci_fill_info(p, PCI_FILL_IDENT);
|
||||
return d;
|
||||
if (!pci_filter_match(&filter, p))
|
||||
return NULL;
|
||||
d = g_new0 (struct device, 1);
|
||||
d->dev = p;
|
||||
if (!pci_read_block(p, 0, d->config, how_much))
|
||||
exit(1);
|
||||
if (how_much < 128 && (d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS)
|
||||
{
|
||||
/* For cardbus bridges, we need to fetch 64 bytes more to get the full standard header... */
|
||||
if (!pci_read_block(p, 64, d->config+64, 64))
|
||||
exit(1);
|
||||
how_much = 128;
|
||||
}
|
||||
d->config_cnt = how_much;
|
||||
pci_setup_cache(p, d->config, d->config_cnt);
|
||||
pci_fill_info(p, PCI_FILL_IDENT);
|
||||
return d;
|
||||
}
|
||||
|
||||
static void scan_devices(void)
|
||||
{
|
||||
struct device *d;
|
||||
struct pci_dev *p;
|
||||
struct device *d;
|
||||
struct pci_dev *p;
|
||||
|
||||
pci_scan_bus(pacc);
|
||||
for(p=pacc->devices; p; p=p->next)
|
||||
if ((d = scan_device(p))) {
|
||||
d->next = first_dev;
|
||||
first_dev = d;
|
||||
}
|
||||
pci_scan_bus(pacc);
|
||||
for(p=pacc->devices; p; p=p->next)
|
||||
{
|
||||
if ((d = scan_device(p)))
|
||||
{
|
||||
d->next = first_dev;
|
||||
first_dev = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static u16 get_conf_word(struct device *d, unsigned int pos)
|
||||
{
|
||||
return d->config[pos] | (d->config[pos+1] << 8);
|
||||
return d->config[pos] | (d->config[pos+1] << 8);
|
||||
}
|
||||
|
||||
int pci_find_by_class(u16 *class, char *vendor, char *device)
|
||||
@@ -94,19 +97,21 @@ int pci_find_by_class(u16 *class, char *vendor, char *device)
|
||||
pci_init(pacc);
|
||||
scan_devices();
|
||||
|
||||
for(d=first_dev; d; d=d->next) {
|
||||
p = d->dev;
|
||||
/* Acquire vendor & device ID if the class matches */
|
||||
if(get_conf_word(d, PCI_CLASS_DEVICE) == *class) {
|
||||
nomatch = 0;
|
||||
for(d=first_dev; d; d=d->next)
|
||||
{
|
||||
p = d->dev;
|
||||
/* Acquire vendor & device ID if the class matches */
|
||||
if(get_conf_word(d, PCI_CLASS_DEVICE) == *class)
|
||||
{
|
||||
nomatch = 0;
|
||||
g_snprintf(vendor,7,"%04x",p->vendor_id);
|
||||
g_snprintf(device,7,"%04x",p->device_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pci_cleanup(pacc);
|
||||
return nomatch;
|
||||
pci_cleanup(pacc);
|
||||
return nomatch;
|
||||
}
|
||||
|
||||
void pci_find_fullname(char *fullname, char *vendor, char *device)
|
||||
@@ -117,38 +122,44 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
|
||||
char *position;
|
||||
int cardfound = 0;
|
||||
FILE *fp;
|
||||
|
||||
if (!sysinfo_get_str_pref ("pciids", buffer))
|
||||
strcpy (buffer, DEFAULT_PCIIDS);
|
||||
|
||||
sysinfo_get_pciids (buffer);
|
||||
fp = fopen (buffer, "r");
|
||||
|
||||
if(fp == NULL) {
|
||||
if(fp == NULL)
|
||||
{
|
||||
g_snprintf(fullname, bsize, "%s:%s", vendor, device);
|
||||
sysinfo_print_error ("pci.ids file not found! You might want to adjust your pciids setting with /SYSINFO SET pciids (you can query its current value with /SYSINFO LIST).\n");
|
||||
//sysinfo_print_error ("pci.ids file not found! You might want to adjust your pciids setting with /SYSINFO SET pciids (you can query its current value with /SYSINFO LIST).\n");
|
||||
return;
|
||||
}
|
||||
|
||||
while(fgets(buffer, bsize, fp) != NULL) {
|
||||
if (!isspace(buffer[0]) && strstr(buffer, vendor) != NULL) {
|
||||
position = strstr(buffer, vendor);
|
||||
position += 6;
|
||||
strncpy(vendorname, position, bsize/2);
|
||||
position = strstr(vendorname, "\n");
|
||||
*(position) = '\0';
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
{
|
||||
if (!isspace(buffer[0]) && strstr(buffer, vendor) != NULL)
|
||||
{
|
||||
position = strstr(buffer, vendor);
|
||||
position += 6;
|
||||
strncpy(vendorname, position, bsize/2);
|
||||
position = strstr(vendorname, "\n");
|
||||
*(position) = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while(fgets(buffer, bsize, fp) != NULL) {
|
||||
if(strstr(buffer, device) != NULL) {
|
||||
position = strstr(buffer, device);
|
||||
position += 6;
|
||||
strncpy(devicename, position, bsize/2);
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
{
|
||||
if(strstr(buffer, device) != NULL)
|
||||
{
|
||||
position = strstr(buffer, device);
|
||||
position += 6;
|
||||
strncpy(devicename, position, bsize/2);
|
||||
position = strstr(devicename, " (");
|
||||
if (position == NULL)
|
||||
position = strstr(devicename, "\n");
|
||||
*(position) = '\0';
|
||||
position = strstr(devicename, "\n");
|
||||
*(position) = '\0';
|
||||
cardfound = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cardfound == 1)
|
||||
g_snprintf(fullname, bsize, "%s %s", vendorname, devicename);
|
||||
117
plugins/sysinfo/win32/backend.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/* HexChat
|
||||
* Copyright (c) 2011-2012 Berke Viktor.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <wbemidl.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "../../../src/common/sysinfo/sysinfo.h"
|
||||
|
||||
#include "../format.h"
|
||||
|
||||
static int command_callback (char *word[], char *word_eol[], void *user_data);
|
||||
|
||||
void print_info (void);
|
||||
|
||||
guint64 hdd_capacity;
|
||||
guint64 hdd_free_space;
|
||||
char *read_hdd_info (IWbemClassObject *object);
|
||||
char *get_memory_info (void);
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_sound (void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_network (void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_uptime (void)
|
||||
{
|
||||
return sysinfo_format_uptime (GetTickCount64 () / 1000);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_disk (void)
|
||||
{
|
||||
guint64 hdd_capacity;
|
||||
guint64 hdd_free_space;
|
||||
|
||||
sysinfo_get_hdd_info (&hdd_capacity, &hdd_free_space);
|
||||
|
||||
if (hdd_capacity != 0)
|
||||
{
|
||||
return sysinfo_format_disk(hdd_capacity, hdd_free_space);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_cpu (void)
|
||||
{
|
||||
return sysinfo_get_cpu ();
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_memory (void)
|
||||
{
|
||||
/* Memory information is always loaded dynamically since it includes the current amount of free memory */
|
||||
return get_memory_info ();
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_gpu (void)
|
||||
{
|
||||
return sysinfo_get_gpu ();
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_os (void)
|
||||
{
|
||||
return sysinfo_get_os ();
|
||||
}
|
||||
|
||||
static int get_cpu_arch (void)
|
||||
{
|
||||
return sysinfo_get_cpu_arch ();
|
||||
}
|
||||
|
||||
static char *get_memory_info (void)
|
||||
{
|
||||
MEMORYSTATUSEX meminfo = { 0 };
|
||||
meminfo.dwLength = sizeof (meminfo);
|
||||
|
||||
if (!GlobalMemoryStatusEx (&meminfo))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sysinfo_format_memory (meminfo.ullTotalPhys, meminfo.ullAvailPhys);
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
v2.2.0
|
||||
* (Thomas Cort) Report L2 cache info for Alpha CPUs
|
||||
* (Tony Vroon) Drop XMMS, port audacious features to D-Bus, make dependency mandatory
|
||||
* (Tony Vroon) Use pretty_freespace for memory & swap reporting as well as disk space
|
||||
* (Tony Vroon) Make pretty_freespace report none if total_size is 0, thanks to Emopig <andrew@nelless.net> for the report
|
||||
* (Tony Vroon) Make pretty_freespace aware of terabytes, petabytes, exabytes, zettabytes & yottabytes
|
||||
* (Tony Vroon) Remove xchatdirfs workaround
|
||||
|
||||
v2.1.0
|
||||
Removals & pending removal:
|
||||
* (Tony Vroon) Remove support for BMP, it is an abandoned project. Suggested upgrade path: audacious
|
||||
* (Tony Vroon) Remove /uname & /euname; the OS part of sysinfo displays similar info without requiring a process pipe
|
||||
* (Tony Vroon) Added a note that the xchatdirfs workaround is due for removal as X-Chat Gnome has fixed the bug
|
||||
|
||||
Bugfixes:
|
||||
* (Tony Vroon) Actually show the vendor that we retrieve in cpuinfo
|
||||
* (Tony Vroon) Display Gentoo Linux as stable or ~arch, the baselayout version doesn't really interest anyone
|
||||
* (Tony Vroon) Match framework: Make remove_leading_whitespace actually work
|
||||
* (Tony Vroon) Match framework: Do not assume that a delimiter is always followed by a space
|
||||
|
||||
Code improvements:
|
||||
* (Tony Vroon) PCI framework: We were requesting more info then we actually return to the caller
|
||||
* (Tony Vroon) Match framework: Consolidate delimiters in a single define & use 1 strpbrk instead of 2 strstr's
|
||||
* (Tony Vroon) Display the machine string instead of the pmac-generation as vendor info for PPC machines
|
||||
|
||||
New features
|
||||
* (Tony Vroon) Show memory capacity in gigabytes instead of in megabytes when appropriate
|
||||
* (Tony Vroon) Cut cpu name at comma (so overly long other info such as "altivec supported" is no longer displayed)
|
||||
* (Tony Vroon) Now Playing: Report time played as well as the song length
|
||||
* (Tony Vroon) Now Playing: Support reporting as an action; configurable at runtime
|
||||
* (Tony Vroon) Check LSB release data, prefer above all others; based on a code sample submitted by Thomas Winwood
|
||||
|
||||
v2.0.9
|
||||
* (Tony Vroon) Protect the matching framework against spurious matches (bug reported by Harm Geerts)
|
||||
* (Tony Vroon) Unexporting unnecessary symbols for PCI framework
|
||||
* (Tony Vroon) Deal with incompatible header changes in pciutils
|
||||
* (Tony Vroon) Begin implementing hardware monitoring support, not yet activated
|
||||
* (Tony Vroon) Add support for Audacious, a BMP fork
|
||||
|
||||
v2.0.8
|
||||
* (Tony Vroon) Make XMMS interface actually work, thanks to a patch from Morten Cools
|
||||
* (Tony Vroon) Use percentages for df information as well
|
||||
* (Gustavo Zacarias) Add support for Sparc architecture, cache size detection on sparc64 only
|
||||
* (Gustavo Zacarias) Consolidate buffer sizes into a single define
|
||||
|
||||
v2.0.7
|
||||
* (Tony Vroon) Have df parser ignore pseudo-filesystems; deal with other locales more gracefully
|
||||
* (Tony Vroon) Change default formatstring not to use mIRC color codes
|
||||
* (Tony Vroon) Add fallback to ~/.xchat2 for xchat-gnome which does not report xchatdirfs properly
|
||||
* (Tony Vroon) Revert to beepctrl.h style calls as infopipe is too unreliable
|
||||
|
||||
v2.0.6
|
||||
* (Tony Vroon) Rewrote PCI framework, no longer depends on sysfs, kernel 2.4 and lower will work now
|
||||
* (Tony Vroon) Made percentages configurable, can be set at runtime (feature request by Halcy0n)
|
||||
* (Tony Vroon) Abstract out all pointer voodoo from xsys.c
|
||||
* (Tony Vroon) Do not return XCHAT_EAT_NONE, causes spurious "unknown command" errors
|
||||
* (Tony Vroon) Deal more gracefully with a missing soundcard or unknown linux distribution
|
||||
* (Tony Vroon) Add error handling to the matching framework
|
||||
|
||||
v2.0.5
|
||||
* (Tony Vroon) Added support for parisc/hppa & ia64 architectures
|
||||
* (Tony Vroon) Proper report of L2 cache as "unknown" instead of showing bits of unitialized memory
|
||||
* (Tony Vroon) Upped PCI parser yield for ppc64 architecture, has high bus number for AGP card
|
||||
* (Tony Vroon) Use percentages in memory/swap information
|
||||
|
||||
v2.0.4
|
||||
* (Tony Vroon) /sound uses ALSA if possible, PCI now fallback (false positives reported with PCI code)
|
||||
* (Tony Vroon) Remove 0 prefix from first ALSA card; 1: and up will be shown for extra cards
|
||||
* (Tony Vroon) Matching code rewritten and separated out from other code
|
||||
* (Tony Vroon) Use new matching framework where possible
|
||||
* (Tony Vroon) Added support for Alpha architecture, thanks to Bert (bert@ev6.net)
|
||||
|
||||
v2.0.3
|
||||
* (Tony Vroon) Fix buttons, XMMS -> NP
|
||||
* (Tony Vroon) PCI functions separated out from other code; fully rewritten
|
||||
* (Tony Vroon) Use new PCI framework for sound detection; ALSA is now fallback
|
||||
* (Tony Vroon) Implement /ether
|
||||
* (Tony Vroon) /video now reports video card @ AGP bridge; resolution info dropped
|
||||
|
||||
v2.0.2
|
||||
* (Tony Vroon) XMMS/BMP: Delete XMMS/BMP detection; it just got obsoleted by a BMP bugfix
|
||||
* (Tony Vroon) XMMS/BMP: Change to /np & /enp as commands (np -> now playing)
|
||||
* (Tony Vroon) Allow customization of now_playing with /playing
|
||||
* (Tony Vroon) Separate out the length field for now_playing
|
||||
* (Tony Vroon) Better configuration file handling
|
||||
* (Tony Vroon) Set homepage to http://dev.gentoo.org/~chainsaw/xsys
|
||||
* (Tony Vroon) Make channel buttons optional, not everyone appreciates them
|
||||
* (Tony Vroon) Fix cpuinfo parsing on x86_64, a necessary define was missing
|
||||
|
||||
v2.0.1
|
||||
* (Tony Vroon) XMMS/BMP: Report "stream" if song length is -1
|
||||
* (Tony Vroon) XMMS/BMP: Determine whether XMMS or BMP is playing
|
||||
* (Tony Vroon) Better errorhandling if pci.ids parsing fails; at least mention raw PCI ID of card
|
||||
* (Tony Vroon) Remove AGP from video card messages; we detect plain PCI cards too
|
||||
* (Tony Vroon) Fix Debian release detector
|
||||
|
||||
v2.0.0
|
||||
* (mikeshoup) Clean up of code for 2.0.0 release
|
||||
* (Tony Vroon) Added PowerPC /proc/cpuinfo support
|
||||
* (Tony Vroon) Changed LSPCI to SYSFS
|
||||
|
||||
v1.9.3
|
||||
* (mikeshoup) Introduced distro function
|
||||
* (mikeshoup, Tony Vroon's suggestion) Removed bitrate from /XMMS
|
||||
|
||||
v1.9.2
|
||||
* 2005/01/14 (mikeshoup) Put in the userlist buttons
|
||||
* 2005/01/10 (mikeshoup) Added XMMS/BMP Support
|
||||
|
||||
v1.9.1
|
||||
* 2004/12/20 (mikeshoup) Added a dynamic formatting scheme
|
||||
* 2004/12/19 (mikeshoup) Changed some commands
|
||||
* 2004/12/18 (mikeshoup) Reintroducted /VIDEO
|
||||
|
||||
v1.9.0
|
||||
* 2004/12/17 (mikeshoup) Initial Release
|
||||
@@ -1,15 +0,0 @@
|
||||
INSTALLATION
|
||||
============
|
||||
Installation is straightforward. You need Audacious 1.4 or higher and D-Bus.
|
||||
Open up the Makefile, check to make sure PCIIDS points to your pci.ids file.
|
||||
(Symptom if you get it wrong: raw PCI ID's (XXXX:XXXX) emitted by /VIDEO and friends).
|
||||
|
||||
Run: make
|
||||
Run: make install
|
||||
|
||||
Voila!
|
||||
|
||||
NOTES:
|
||||
`make install' copies the compiled library (something like xsys-v.v.v.so) to
|
||||
$HOME/.xchat2/xsys-plugin.so for autoloading. If $HOME/.xchat2/xsys-plugin.so
|
||||
exists, it is removed first.
|
||||
@@ -1,38 +0,0 @@
|
||||
#### SET THIS VALUE TO THE LOCATION OF THE `pci.ids` file ####
|
||||
PCIIDS = /usr/share/misc/pci.ids
|
||||
|
||||
#### UNCOMMENT THIS IF YOU WANT THE BUTTONS ####
|
||||
#BUTTON = -Dbuttonbar
|
||||
|
||||
#### SHOULD NOT NEED TO EDIT BELOW THIS LINE ####
|
||||
VER_MAJOR = 2
|
||||
VER_MINOR = 2
|
||||
VER_PATCH = 0
|
||||
CC = gcc
|
||||
CFLAGS += -O2 -Wall -fPIC
|
||||
CFLAGS += -DVER_MINOR=$(VER_MINOR) -DVER_MAJOR=$(VER_MAJOR) -DVER_PATCH=$(VER_PATCH) \
|
||||
-DVER_STRING=\"$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)\" -DPCIIDS=\"$(PCIIDS)\" $(BUTTON)
|
||||
LDFLAGS = $(CFLAGS) -shared
|
||||
LIBRARY = xsys-$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH).so
|
||||
OBJECTS = xsys.o parse.o pci.o match.o hwmon.o
|
||||
|
||||
ALL : $(LIBRARY)
|
||||
|
||||
$(LIBRARY) : $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $(LIBRARY) $(OBJECTS) -lpci
|
||||
|
||||
xsys.o : xsys.c
|
||||
parse.o : parse.c
|
||||
pci.o : pci.c
|
||||
match.o : match.c
|
||||
hwmon.o : hwmon.c
|
||||
|
||||
.PHONY : clean
|
||||
clean :
|
||||
rm -rf *.o *.so *~
|
||||
|
||||
.PHONY : install
|
||||
install : $(LIBRARY)
|
||||
rm -f $(HOME)/.xchat2/xsys-plugin.so
|
||||
cp ./$(LIBRARY) $(HOME)/.xchat2/xsys-plugin.so
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
X-Sys README
|
||||
============
|
||||
What is X-Sys?
|
||||
|
||||
X-Sys is a plugin for X-Chat that allows you to display your current system statistics in
|
||||
a channel, private conversation or just in an echo to yourself for testing purposes.
|
||||
It is supported on Linux, running on various architectures. Right now x86, ppc, ppc64, sparc,
|
||||
sparc64 and alpha are supported, with parisc and ia64 implemented but awaiting testing.
|
||||
|
||||
---------------
|
||||
Who wrote this?
|
||||
|
||||
X-Sys is originally a Mike Shoup creation, from the very first alpha releases to the open-source
|
||||
version 1 releases. But then, things stalled. For a few months (more like a year almost)
|
||||
Mike didn't work on X-Sys. The last version that had been written was 1.0.5.
|
||||
The website was gone, and I (Tony) couldn't find Mike. So, I took over and improved it to my liking.
|
||||
It turned out that Mike was still around, though, he contacted me and started development again,
|
||||
now called version 2, a complete rewrite. Various 1.9 betas came out that I contributed patches to,
|
||||
and starting with version 2.0.0 I'm maintaining xchat-xsys again, this time with Mike's blessing.
|
||||
|
||||
---------------
|
||||
What do I need?
|
||||
|
||||
- X-Chat (regular or Gnome version)
|
||||
- Audacious 1.4 or higher
|
||||
- D-Bus (for communication with Audacious)
|
||||
- a working toolchain (compiler, binutils, etc).
|
||||
|
||||
------------------------------------------------
|
||||
What if I get errors about u8 not being defined?
|
||||
|
||||
Sorry to hear that, it appears your linux distribution neglected to install essential headers on your
|
||||
system. On Debian & Ubuntu, apt-get install pciutils-dev should make it happy.
|
||||
|
||||
========
|
||||
COMMANDS
|
||||
|
||||
X-Sys 2 has the following implemented commands:
|
||||
/XSYS & /EXSYS - Output current version, either to channel or echoed on screen.
|
||||
/CPUINFO & /ECPUINFO - Echoes or says current cpu statistics
|
||||
/SYSUPTIME & /ESYSUPTIME - Echoes or says current uptime
|
||||
/OSINFO & /EOSINFO - Echoes or says various OS statistics
|
||||
/SOUND & /ESOUND - Echoes or says the current sound card, as determined by ALSA
|
||||
/NETDATA & /ENETDATA - Echoes or says total amount transferred through a network
|
||||
interface. Use like: `/netdata eth0' (where eth0 is a network interface)
|
||||
/NETSTREAM & /ENETSTREAM - Echoes or says amount of bandwidth being used.
|
||||
Use like: `/netstream eth0' (where eth0 is a network interface)
|
||||
/DISKINFO & /EDISKINFO - Echoes or says free space on partitions. The DISK command has a
|
||||
few arguments as follows:
|
||||
ALL - Displays every partitions
|
||||
/mount - Displays free space for that specific mount point
|
||||
No arguments just displays total free space
|
||||
/MEMINFO & /EMEMINFO - Echoes or says memory information.
|
||||
/VIDEO & /EVIDEO - Echoes or says the current video card on the PCI bus
|
||||
/ETHER & /EETHER - Echoes or says the current network card on the PCI bus
|
||||
/DISTRO & /EDISTRO - Echoes or says which distro you're running
|
||||
If this doesn't work for your distro, look for a *-release file or similar in /etc
|
||||
E-mail this to chainsaw@gentoo.org
|
||||
|
||||
and the big one:
|
||||
/SYSINFO & /ESYSINFO - Complete system information!
|
||||
|
||||
Two output control commands:
|
||||
/XSYS2FORMAT , No arguments, it will print just the current formatting string.
|
||||
It will take any arguments to it as the formatting string.
|
||||
The formatting string can consist of any letter/numbers, and is used to format
|
||||
the output. The following special symbols can be used:
|
||||
|
||||
%B : Bold
|
||||
%Cnn : Foreground Color, where nn is a number corresponding to a mIRC color
|
||||
%Cnn,nn : Foreground,Background Color
|
||||
%R : Reverse Foreground/Background Colors
|
||||
%O : Reset Color and Format (thats an 'oh' not a 'zero (0)')
|
||||
%C : Reset Color
|
||||
%U : Underline
|
||||
|
||||
/PLAYING will either print or allow you to set the text for /np.
|
||||
The default is now_playing, but you can set this to whatever text you prefer.
|
||||
|
||||
/PERCENTAGES will allow you to set whether to use percentages in plugin output or not.
|
||||
Percentages are enabled by default. Use a zero value to disable, and a non-zero value
|
||||
to enable. If unsure, use 1.
|
||||
|
||||
/NP & /ENP - Reports what's currently playing in Audacious.
|
||||
|
||||
====
|
||||
BUGS
|
||||
(none known)
|
||||
|
||||
E-mail me your bug reports at chainsaw@gentoo.org
|
||||
Please include the following information:
|
||||
- what architecture you are using (amd64, ia64, parisc, ppc, ppc64, sparc, sparc64 or x86)
|
||||
- what linux distribution you are using (Gentoo 2007.1, Fedora Core 8, etc)
|
||||
- what compiler you have used to compile X-Sys, i.e. gcc (GCC) 4.1.2 (Gentoo 4.1.2)
|
||||
- what version of X-Sys you are using
|
||||
|
||||
=======
|
||||
Thanks!
|
||||
Remember, everything here is:
|
||||
(C) 2003, 2004, 2005 by Michael Shoup
|
||||
(C) 2005, 2006, 2007 by Tony Vroon
|
||||
All Rights Reserved.
|
||||
Visit http://dev.gentoo.org/~chainsaw/xsys/ for release information.
|
||||
|
||||
Feel free to e-mail me for feature requests, or see if I'm online on irc.freenode.net
|
||||
@@ -1,927 +0,0 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2012 Berke Viktor.
|
||||
*
|
||||
* xsys.c - main functions for X-Sys 2
|
||||
* by mikeshoup
|
||||
* Copyright (C) 2003, 2004, 2005 Michael Shoup
|
||||
* Copyright (C) 2005, 2006, 2007 Tony Vroon
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
#include "parse.h"
|
||||
#include "match.h"
|
||||
#include "xsys.h"
|
||||
|
||||
#define DEFAULT_FORMAT "%B%1:%B %2 **"
|
||||
#define DEFAULT_PERCENT 1
|
||||
#define DEFAULT_ANNOUNCE 1
|
||||
#define DEFAULT_PCIIDS "/usr/share/hwdata/pci.ids"
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static int error_printed = 0; /* semaphore, make sure not to print the same error more than once during one execution */
|
||||
|
||||
static char name[] = "SysInfo";
|
||||
static char desc[] = "Display info about your hardware and OS";
|
||||
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";
|
||||
|
||||
void
|
||||
sysinfo_get_pciids (char* dest)
|
||||
{
|
||||
hexchat_pluginpref_get_str (ph, "pciids", dest);
|
||||
}
|
||||
|
||||
int
|
||||
sysinfo_get_percent ()
|
||||
{
|
||||
return hexchat_pluginpref_get_int (ph, "percent");
|
||||
}
|
||||
|
||||
int
|
||||
sysinfo_get_announce ()
|
||||
{
|
||||
return hexchat_pluginpref_get_int (ph, "announce");
|
||||
}
|
||||
|
||||
void
|
||||
sysinfo_print_error (const char* msg)
|
||||
{
|
||||
if (!error_printed)
|
||||
{
|
||||
hexchat_printf (ph, "%s\t%s", name, msg);
|
||||
}
|
||||
error_printed++;
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
print_summary (int announce, char* format)
|
||||
{
|
||||
char sysinfo[bsize];
|
||||
char buffer[bsize];
|
||||
char cpu_model[bsize];
|
||||
char cpu_cache[bsize];
|
||||
char cpu_vendor[bsize];
|
||||
char os_host[bsize];
|
||||
char os_user[bsize];
|
||||
char os_kernel[bsize];
|
||||
char *free_space;
|
||||
unsigned long long mem_total;
|
||||
unsigned long long mem_free;
|
||||
unsigned int count;
|
||||
double cpu_freq;
|
||||
int giga = 0;
|
||||
int weeks;
|
||||
int days;
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
sysinfo[0] = '\0';
|
||||
|
||||
g_snprintf (buffer, bsize, "%s", hexchat_get_info (ph, "version"));
|
||||
format_output ("HexChat", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (sysinfo));
|
||||
|
||||
/* BEGIN OS PARSING */
|
||||
if (xs_parse_os (os_user, os_host, os_kernel) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_os()", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
g_snprintf (buffer, bsize, "%s", os_kernel);
|
||||
format_output ("OS", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (sysinfo));
|
||||
|
||||
/* BEGIN DISTRO PARSING */
|
||||
if (xs_parse_distro (buffer) != 0)
|
||||
{
|
||||
strncpy (buffer, "Unknown", bsize);
|
||||
}
|
||||
|
||||
format_output ("Distro", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (sysinfo));
|
||||
|
||||
/* BEGIN CPU PARSING */
|
||||
if (xs_parse_cpu (cpu_model, cpu_vendor, &cpu_freq, cpu_cache, &count) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_cpu()", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (cpu_freq > 1000)
|
||||
{
|
||||
cpu_freq /= 1000;
|
||||
giga = 1;
|
||||
}
|
||||
|
||||
if (giga)
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz", count, cpu_model, cpu_vendor, cpu_freq);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz", count, cpu_model, cpu_vendor, cpu_freq);
|
||||
}
|
||||
|
||||
format_output ("CPU", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (sysinfo));
|
||||
|
||||
/* BEGIN MEMORY PARSING */
|
||||
if (xs_parse_meminfo (&mem_total, &mem_free, 0) == 1)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
free_space = pretty_freespace ("Physical", &mem_free, &mem_total);
|
||||
g_snprintf (buffer, bsize, "%s", free_space);
|
||||
g_free (free_space);
|
||||
format_output ("RAM", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (sysinfo));
|
||||
|
||||
/* BEGIN DISK PARSING */
|
||||
if (xs_parse_df (NULL, buffer))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_df", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
format_output ("Disk", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (buffer));
|
||||
|
||||
/* BEGIN VIDEO PARSING */
|
||||
if (xs_parse_video (buffer))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_video", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
format_output ("VGA", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (buffer));
|
||||
|
||||
/* BEGIN SOUND PARSING */
|
||||
if (xs_parse_sound (buffer))
|
||||
{
|
||||
strncpy (buffer, "Not present", bsize);
|
||||
}
|
||||
|
||||
format_output ("Sound", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (buffer));
|
||||
|
||||
/* BEGIN ETHERNET PARSING */
|
||||
if (xs_parse_ether (buffer))
|
||||
{
|
||||
strncpy (buffer, "None found", bsize);
|
||||
}
|
||||
|
||||
format_output ("Ethernet", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (buffer));
|
||||
|
||||
/* BEGIN UPTIME PARSING */
|
||||
if (xs_parse_uptime (&weeks, &days, &hours, &minutes, &seconds))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_uptime()", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (minutes != 0 || hours != 0 || days != 0 || weeks != 0)
|
||||
{
|
||||
if (hours != 0 || days != 0 || weeks != 0)
|
||||
{
|
||||
if (days !=0 || weeks != 0)
|
||||
{
|
||||
if (weeks != 0)
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dw %dd %dh %dm %ds", weeks, days, hours, minutes, seconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dm %ds", minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
format_output ("Uptime", buffer, format);
|
||||
strcat (sysinfo, "\017 ");
|
||||
strncat (sysinfo, buffer, bsize - strlen (buffer));
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", sysinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", sysinfo);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_os (int announce, char* format)
|
||||
{
|
||||
char buffer[bsize];
|
||||
char user[bsize];
|
||||
char host[bsize];
|
||||
char kernel[bsize];
|
||||
|
||||
if (xs_parse_os (user, host, kernel) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_os()", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
g_snprintf (buffer, bsize, "%s@%s, %s", user, host, kernel);
|
||||
format_output ("OS", buffer, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", buffer);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_distro (int announce, char* format)
|
||||
{
|
||||
char name[bsize];
|
||||
|
||||
if (xs_parse_distro (name) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_distro()!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
format_output("Distro", name, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", name);
|
||||
}
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_cpu (int announce, char* format)
|
||||
{
|
||||
char model[bsize];
|
||||
char vendor[bsize];
|
||||
char cache[bsize];
|
||||
char buffer[bsize];
|
||||
unsigned int count;
|
||||
double freq;
|
||||
int giga = 0;
|
||||
|
||||
if (xs_parse_cpu (model, vendor, &freq, cache, &count) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_cpu()", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (freq > 1000)
|
||||
{
|
||||
freq /= 1000;
|
||||
giga = 1;
|
||||
}
|
||||
|
||||
if (giga)
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz w/ %s L2 Cache", count, model, vendor, freq, cache);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz w/ %s L2 Cache", count, model, vendor, freq, cache);
|
||||
}
|
||||
|
||||
format_output ("CPU", buffer, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", buffer);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_ram (int announce, char* format)
|
||||
{
|
||||
unsigned long long mem_total;
|
||||
unsigned long long mem_free;
|
||||
unsigned long long swap_total;
|
||||
unsigned long long swap_free;
|
||||
char string[bsize];
|
||||
|
||||
if (xs_parse_meminfo (&mem_total, &mem_free, 0) == 1)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
if (xs_parse_meminfo (&swap_total, &swap_free, 1) == 1)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
g_snprintf (string, bsize, "%s - %s", pretty_freespace ("Physical", &mem_free, &mem_total), pretty_freespace ("Swap", &swap_free, &swap_total));
|
||||
format_output ("RAM", string, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", string);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", string);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_disk (int announce, char* format)
|
||||
{
|
||||
char string[bsize] = {0,};
|
||||
|
||||
#if 0
|
||||
if (*word == '\0')
|
||||
{
|
||||
if (xs_parse_df (NULL, string))
|
||||
{
|
||||
hexchat_printf (ph, "ERROR in parse_df");
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xs_parse_df (*word, string))
|
||||
{
|
||||
hexchat_printf (ph, "ERROR in parse_df");
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (xs_parse_df (NULL, string))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_df", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
format_output ("Disk", string, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", string);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", string);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_vga (int announce, char* format)
|
||||
{
|
||||
char vid_card[bsize];
|
||||
char agp_bridge[bsize];
|
||||
char buffer[bsize];
|
||||
int ret;
|
||||
|
||||
if ((ret = xs_parse_video (vid_card)) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_video! %d", name, ret);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (xs_parse_agpbridge (agp_bridge) != 0)
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%s", vid_card);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%s @ %s", vid_card, agp_bridge);
|
||||
}
|
||||
|
||||
format_output ("VGA", buffer, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", buffer);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_sound (int announce, char* format)
|
||||
{
|
||||
char sound[bsize];
|
||||
|
||||
if (xs_parse_sound (sound) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_asound()!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
format_output ("Sound", sound, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", sound);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", sound);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
print_ethernet (int announce, char* format)
|
||||
{
|
||||
char ethernet_card[bsize];
|
||||
|
||||
if (xs_parse_ether (ethernet_card))
|
||||
{
|
||||
strncpy (ethernet_card, "None found", bsize);
|
||||
}
|
||||
|
||||
format_output ("Ethernet", ethernet_card, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", ethernet_card);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", ethernet_card);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
print_uptime (int announce, char* format)
|
||||
{
|
||||
char buffer[bsize];
|
||||
int weeks;
|
||||
int days;
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
|
||||
if (xs_parse_uptime (&weeks, &days, &hours, &minutes, &seconds))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_uptime()", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (minutes != 0 || hours != 0 || days != 0 || weeks != 0)
|
||||
{
|
||||
if (hours != 0 || days != 0 || weeks != 0)
|
||||
{
|
||||
if (days !=0 || weeks != 0)
|
||||
{
|
||||
if (weeks != 0)
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dw %dd %dh %dm %ds", weeks, days, hours, minutes, seconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (buffer, bsize, "%dm %ds", minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
format_output ("Uptime", buffer, format);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", buffer);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
netdata_cb (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
char netdata[bsize];
|
||||
char format[bsize];
|
||||
unsigned long long bytes_recv;
|
||||
unsigned long long bytes_sent;
|
||||
|
||||
if (*word[2] == '\0')
|
||||
{
|
||||
hexchat_printf (ph, "%s\tYou must specify a network device (e.g. /NETDATA eth0)!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (xs_parse_netdev (word[2], &bytes_recv, &bytes_sent) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_netdev", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
bytes_recv /= 1024;
|
||||
bytes_sent /= 1024;
|
||||
|
||||
g_snprintf (netdata, bsize, "%s: %.1f MB Received, %.1f MB Sent", word[2], (double)bytes_recv/1024.0, (double)bytes_sent/1024.0);
|
||||
hexchat_pluginpref_get_str (ph, "format", format);
|
||||
format_output ("Netdata", netdata, format);
|
||||
|
||||
if (hexchat_list_int (ph, NULL, "type") >= 2)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", netdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", netdata);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int
|
||||
netstream_cb (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
char netstream[bsize];
|
||||
char mag_r[5];
|
||||
char mag_s[5];
|
||||
char format[bsize];
|
||||
unsigned long long bytes_recv;
|
||||
unsigned long long bytes_sent;
|
||||
unsigned long long bytes_recv_p;
|
||||
unsigned long long bytes_sent_p;
|
||||
|
||||
struct timespec ts = {1, 0};
|
||||
|
||||
if (*word[2] == '\0')
|
||||
{
|
||||
hexchat_printf (ph, "%s\tYou must specify a network device (e.g. /NETSTREAM eth0)!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (xs_parse_netdev(word[2], &bytes_recv, &bytes_sent) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_netdev", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
while (nanosleep (&ts, &ts) < 0);
|
||||
|
||||
if (xs_parse_netdev(word[2], &bytes_recv_p, &bytes_sent_p) != 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tERROR in parse_netdev", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
bytes_recv = (bytes_recv_p - bytes_recv);
|
||||
bytes_sent = (bytes_sent_p - bytes_sent);
|
||||
|
||||
if (bytes_recv > 1024)
|
||||
{
|
||||
bytes_recv /= 1024;
|
||||
g_snprintf (mag_r, 5, "KB/s");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (mag_r, 5, "B/s");
|
||||
}
|
||||
|
||||
if (bytes_sent > 1024)
|
||||
{
|
||||
bytes_sent /= 1024;
|
||||
g_snprintf (mag_s, 5, "KB/s");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (mag_s, 5, "B/s");
|
||||
}
|
||||
|
||||
g_snprintf (netstream, bsize, "%s: Receiving %llu %s, Sending %llu %s", word[2], bytes_recv, mag_r, bytes_sent, mag_s);
|
||||
hexchat_pluginpref_get_str (ph, "format", format);
|
||||
format_output ("Netstream", netstream, format);
|
||||
|
||||
if (hexchat_list_int (ph, NULL, "type") >= 2)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", netstream);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", netstream);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static void
|
||||
list_settings ()
|
||||
{
|
||||
char list[512];
|
||||
char buffer[512];
|
||||
char* token;
|
||||
|
||||
hexchat_pluginpref_list (ph, list);
|
||||
hexchat_printf (ph, "%s\tCurrent Settings:", name);
|
||||
token = strtok (list, ",");
|
||||
|
||||
while (token != NULL)
|
||||
{
|
||||
hexchat_pluginpref_get_str (ph, token, buffer);
|
||||
hexchat_printf (ph, "%s\t%s: %s\n", name, token, buffer);
|
||||
token = strtok (NULL, ",");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reset_settings ()
|
||||
{
|
||||
hexchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
|
||||
hexchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
|
||||
hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
|
||||
hexchat_pluginpref_set_int (ph, "announce", DEFAULT_ANNOUNCE);
|
||||
}
|
||||
|
||||
static int
|
||||
sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
error_printed = 0;
|
||||
int announce = sysinfo_get_announce ();
|
||||
int offset = 0;
|
||||
int buffer;
|
||||
char format[bsize];
|
||||
|
||||
if (!hexchat_pluginpref_get_str (ph, "format", format))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tError reading config file!", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
/* Cannot send to server tab */
|
||||
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;
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (!g_ascii_strcasecmp ("HELP", word[2+offset]))
|
||||
{
|
||||
hexchat_printf (ph, "%s", sysinfo_help);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("LIST", word[2+offset]))
|
||||
{
|
||||
list_settings ();
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("SET", word[2+offset]))
|
||||
{
|
||||
if (!g_ascii_strcasecmp ("", word_eol[4+offset]))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tEnter a value!\n", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
if (!g_ascii_strcasecmp ("format", word[3+offset]))
|
||||
{
|
||||
hexchat_pluginpref_set_str (ph, "format", word_eol[4+offset]);
|
||||
hexchat_printf (ph, "%s\tformat is set to: %s\n", name, word_eol[4+offset]);
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("percent", word[3+offset]))
|
||||
{
|
||||
buffer = atoi (word[4+offset]); /* don't use word_eol, numbers must not contain spaces */
|
||||
|
||||
if (buffer > 0 && buffer < INT_MAX)
|
||||
{
|
||||
hexchat_pluginpref_set_int (ph, "percent", buffer);
|
||||
hexchat_printf (ph, "%s\tpercent is set to: %d\n", name, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s\tInvalid input!\n", name);
|
||||
}
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("announce", word[3+offset]))
|
||||
{
|
||||
buffer = atoi (word[4+offset]); /* don't use word_eol, numbers must not contain spaces */
|
||||
|
||||
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
|
||||
{
|
||||
hexchat_printf (ph, "%s\tInvalid variable name! Use 'pciids', 'format' or 'percent'!\n", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("RESET", word[2+offset]))
|
||||
{
|
||||
reset_settings ();
|
||||
hexchat_printf (ph, "%s\tSettings have been restored to defaults.\n", name);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("OS", word[2+offset]))
|
||||
{
|
||||
print_os (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("DISTRO", word[2+offset]))
|
||||
{
|
||||
print_distro (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("CPU", word[2+offset]))
|
||||
{
|
||||
print_cpu (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("RAM", word[2+offset]))
|
||||
{
|
||||
print_ram (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("DISK", word[2+offset]))
|
||||
{
|
||||
print_disk (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("VGA", word[2+offset]))
|
||||
{
|
||||
print_vga (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("SOUND", word[2+offset]))
|
||||
{
|
||||
print_sound (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("ETHERNET", word[2+offset]))
|
||||
{
|
||||
print_ethernet (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("UPTIME", word[2+offset]))
|
||||
{
|
||||
print_uptime (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("", word[2+offset]))
|
||||
{
|
||||
print_summary (announce, format);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", sysinfo_help);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
char buffer[bsize];
|
||||
ph = plugin_handle;
|
||||
*plugin_name = name;
|
||||
*plugin_desc = desc;
|
||||
*plugin_version = version;
|
||||
|
||||
hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
|
||||
hexchat_hook_command (ph, "NETDATA", HEXCHAT_PRI_NORM, netdata_cb, NULL, NULL);
|
||||
hexchat_hook_command (ph, "NETSTREAM", HEXCHAT_PRI_NORM, netstream_cb, NULL, NULL);
|
||||
|
||||
/* this is required for the very first run */
|
||||
if (hexchat_pluginpref_get_str (ph, "pciids", buffer) == 0)
|
||||
{
|
||||
hexchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
|
||||
}
|
||||
|
||||
if (hexchat_pluginpref_get_str (ph, "format", buffer) == 0)
|
||||
{
|
||||
hexchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
|
||||
}
|
||||
|
||||
if (hexchat_pluginpref_get_int (ph, "percent") == -1)
|
||||
{
|
||||
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_printf (ph, "%s plugin loaded\n", name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
{
|
||||
hexchat_command (ph, "MENU DEL \"Window/Display System Info\"");
|
||||
hexchat_printf (ph, "%s plugin unloaded\n", name);
|
||||
return 1;
|
||||
}
|
||||
@@ -20,260 +20,50 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <wininet.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <winsparkle.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
|
||||
#define DEFAULT_DELAY 30 /* 30 seconds */
|
||||
#define DEFAULT_FREQ 360 /* 6 hours */
|
||||
#define DOWNLOAD_URL "http://dl.hexchat.net/hexchat"
|
||||
#define APPCAST_URL "https://dl.hexchat.net/appcast.xml"
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static char name[] = "Update Checker";
|
||||
static char desc[] = "Check for HexChat updates automatically";
|
||||
static char version[] = "4.0";
|
||||
static const char upd_help[] = "Update Checker Usage:\n /UPDCHK, check for HexChat updates\n /UPDCHK SET delay|freq, set startup delay or check frequency\n";
|
||||
|
||||
static char*
|
||||
check_version ()
|
||||
{
|
||||
HINTERNET hOpen, hConnect, hResource;
|
||||
|
||||
hOpen = InternetOpen (TEXT ("Update Checker"),
|
||||
INTERNET_OPEN_TYPE_PRECONFIG,
|
||||
NULL,
|
||||
NULL,
|
||||
0);
|
||||
if (!hOpen)
|
||||
{
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
hConnect = InternetConnect (hOpen,
|
||||
TEXT ("raw.github.com"),
|
||||
INTERNET_DEFAULT_HTTPS_PORT,
|
||||
NULL,
|
||||
NULL,
|
||||
INTERNET_SERVICE_HTTP,
|
||||
0,
|
||||
0);
|
||||
if (!hConnect)
|
||||
{
|
||||
InternetCloseHandle (hOpen);
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
hResource = HttpOpenRequest (hConnect,
|
||||
TEXT ("GET"),
|
||||
TEXT ("/hexchat/hexchat/master/win32/version.txt"),
|
||||
TEXT ("HTTP/1.0"),
|
||||
NULL,
|
||||
NULL,
|
||||
INTERNET_FLAG_SECURE | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_AUTH,
|
||||
0);
|
||||
if (!hResource)
|
||||
{
|
||||
InternetCloseHandle (hConnect);
|
||||
InternetCloseHandle (hOpen);
|
||||
return "Unknown";
|
||||
}
|
||||
else
|
||||
{
|
||||
static char buffer[1024];
|
||||
char infobuffer[32];
|
||||
int statuscode;
|
||||
|
||||
DWORD dwRead;
|
||||
DWORD infolen = sizeof(infobuffer);
|
||||
|
||||
HttpAddRequestHeaders (hResource, TEXT ("Connection: close\r\n"), -1L, HTTP_ADDREQ_FLAG_ADD); /* workaround for GC bug */
|
||||
HttpSendRequest (hResource, NULL, 0, NULL, 0);
|
||||
|
||||
while (InternetReadFile (hResource, buffer, 1023, &dwRead))
|
||||
{
|
||||
if (dwRead == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
buffer[dwRead] = 0;
|
||||
}
|
||||
|
||||
HttpQueryInfo(hResource,
|
||||
HTTP_QUERY_STATUS_CODE,
|
||||
&infobuffer,
|
||||
&infolen,
|
||||
NULL);
|
||||
|
||||
InternetCloseHandle (hResource);
|
||||
InternetCloseHandle (hConnect);
|
||||
InternetCloseHandle (hOpen);
|
||||
|
||||
statuscode = atoi(infobuffer);
|
||||
if (statuscode == 200)
|
||||
return buffer;
|
||||
else
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
static char version[] = "5.0";
|
||||
static const char upd_help[] = "Update Checker Usage:\n /UPDCHK, check for HexChat updates\n";
|
||||
|
||||
static int
|
||||
print_version (char *word[], char *word_eol[], void *userdata)
|
||||
check_cmd (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
char *version;
|
||||
int prevbuf;
|
||||
int convbuf;
|
||||
win_sparkle_check_update_with_ui ();
|
||||
|
||||
if (!g_ascii_strcasecmp ("HELP", word[2]))
|
||||
{
|
||||
hexchat_printf (ph, "%s", upd_help);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("SET", word[2]))
|
||||
{
|
||||
if (!g_ascii_strcasecmp ("", word_eol[4]))
|
||||
{
|
||||
hexchat_printf (ph, "%s\tEnter a value!\n", name);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
if (!g_ascii_strcasecmp ("delay", word[3]))
|
||||
{
|
||||
convbuf = atoi (word[4]); /* don't use word_eol, numbers must not contain spaces */
|
||||
|
||||
if (convbuf > 0 && convbuf < INT_MAX)
|
||||
{
|
||||
prevbuf = hexchat_pluginpref_get_int (ph, "delay");
|
||||
hexchat_pluginpref_set_int (ph, "delay", convbuf);
|
||||
hexchat_printf (ph, "%s\tUpdate check startup delay is set to %d seconds (from %d).\n", name, convbuf, prevbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s\tInvalid input!\n", name);
|
||||
}
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("freq", word[3]))
|
||||
{
|
||||
convbuf = atoi (word[4]); /* don't use word_eol, numbers must not contain spaces */
|
||||
|
||||
if (convbuf > 0 && convbuf < INT_MAX)
|
||||
{
|
||||
prevbuf = hexchat_pluginpref_get_int (ph, "freq");
|
||||
hexchat_pluginpref_set_int (ph, "freq", convbuf);
|
||||
hexchat_printf (ph, "%s\tUpdate check frequency is set to %d minutes (from %d).\n", name, convbuf, prevbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s\tInvalid input!\n", name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s\tInvalid variable name! Use 'delay' or 'freq'!\n", name);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
else if (!g_ascii_strcasecmp ("", word[2]))
|
||||
{
|
||||
version = check_version ();
|
||||
|
||||
if (strcmp (version, hexchat_get_info (ph, "version")) == 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tYou have the latest version of HexChat installed!\n", name);
|
||||
}
|
||||
else if (strcmp (version, "Unknown") == 0)
|
||||
{
|
||||
hexchat_printf (ph, "%s\tUnable to check for HexChat updates!\n", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
#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);
|
||||
#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);
|
||||
#endif
|
||||
}
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, "%s", upd_help);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
print_version_quiet (void *userdata)
|
||||
{
|
||||
char *version = check_version ();
|
||||
|
||||
/* if it's not the current version AND not network error */
|
||||
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 */
|
||||
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);
|
||||
#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);
|
||||
#endif
|
||||
/* print update url once, then stop the timer */
|
||||
return 0;
|
||||
}
|
||||
/* keep checking */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
delayed_check (void *userdata)
|
||||
{
|
||||
int freq = hexchat_pluginpref_get_int (ph, "freq");
|
||||
|
||||
/* only start the timer if there's no update available during startup */
|
||||
if (print_version_quiet (NULL))
|
||||
{
|
||||
/* check for updates, every 6 hours by default */
|
||||
hexchat_hook_timer (ph, freq * 1000 * 60, print_version_quiet, NULL);
|
||||
}
|
||||
|
||||
return 0; /* run delayed_check() only once */
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
int delay;
|
||||
ph = plugin_handle;
|
||||
|
||||
*plugin_name = name;
|
||||
*plugin_desc = desc;
|
||||
*plugin_version = version;
|
||||
|
||||
/* these are required for the very first run */
|
||||
delay = hexchat_pluginpref_get_int (ph, "delay");
|
||||
if (delay == -1)
|
||||
{
|
||||
delay = DEFAULT_DELAY;
|
||||
hexchat_pluginpref_set_int (ph, "delay", DEFAULT_DELAY);
|
||||
}
|
||||
win_sparkle_set_appcast_url (APPCAST_URL);
|
||||
win_sparkle_init ();
|
||||
|
||||
if (hexchat_pluginpref_get_int (ph, "freq") == -1)
|
||||
{
|
||||
hexchat_pluginpref_set_int (ph, "freq", DEFAULT_FREQ);
|
||||
}
|
||||
|
||||
hexchat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, print_version, upd_help, NULL);
|
||||
hexchat_hook_timer (ph, delay * 1000, delayed_check, NULL);
|
||||
hexchat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, check_cmd, upd_help, NULL);
|
||||
hexchat_command (ph, "MENU -ishare\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
|
||||
hexchat_printf (ph, "%s plugin loaded\n", name);
|
||||
|
||||
return 1; /* return 1 for success */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
{
|
||||
win_sparkle_cleanup ();
|
||||
|
||||
hexchat_command (ph, "MENU DEL \"Help/Check for updates\"");
|
||||
hexchat_printf (ph, "%s plugin unloaded\n", name);
|
||||
return 1;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,80 +20,33 @@
|
||||
<RootNamespace>upd</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcupd</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcupd</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UPD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(WinSparklePath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>upd.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);WinSparkle.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(WinSparklePath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;UPD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(WinSparklePath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>upd.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);WinSparkle.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(WinSparklePath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -102,6 +56,4 @@
|
||||
<ClCompile Include="upd.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
|
||||
@@ -21,163 +22,127 @@
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
|
||||
BOOL winamp_found = FALSE;
|
||||
|
||||
int status = 0;
|
||||
|
||||
/* Slightly modified from X-Chat's log_escape_strcpy */
|
||||
static char *
|
||||
song_strcpy (char *dest, char *src)
|
||||
{
|
||||
while (*src)
|
||||
{
|
||||
*dest = *src;
|
||||
dest++;
|
||||
src++;
|
||||
|
||||
if (*src == '%')
|
||||
{
|
||||
dest[0] = '%';
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
||||
dest[0] = 0;
|
||||
return dest - 1;
|
||||
}
|
||||
|
||||
static int
|
||||
winamp(char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL);
|
||||
|
||||
char current_play[2048], *p;
|
||||
char p_esc[2048];
|
||||
char cur_esc[2048];
|
||||
char truc[2048];
|
||||
HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);
|
||||
|
||||
if (hwndWinamp)
|
||||
if (hwndWinamp)
|
||||
{
|
||||
{
|
||||
if (!stricmp("PAUSE", word[2]))
|
||||
if (!stricmp("PAUSE", word[2]))
|
||||
{
|
||||
if (SendMessage(hwndWinamp,WM_USER, 0, 104))
|
||||
{
|
||||
if (SendMessage(hwndWinamp,WM_USER, 0, 104))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
|
||||
|
||||
if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)
|
||||
hexchat_printf(ph, "Winamp: playing");
|
||||
else
|
||||
hexchat_printf(ph, "Winamp: paused");
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!stricmp("STOP", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
|
||||
hexchat_printf(ph, "Winamp: stopped");
|
||||
}
|
||||
else
|
||||
if (!stricmp("PLAY", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
|
||||
hexchat_printf(ph, "Winamp: playing");
|
||||
}
|
||||
else
|
||||
|
||||
if (!stricmp("NEXT", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
|
||||
hexchat_printf(ph, "Winamp: next playlist entry");
|
||||
}
|
||||
else
|
||||
|
||||
if (!stricmp("PREV", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
|
||||
hexchat_printf(ph, "Winamp: previous playlist entry");
|
||||
}
|
||||
else
|
||||
|
||||
if (!stricmp("START", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
|
||||
hexchat_printf(ph, "Winamp: playlist start");
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
if (!word_eol[2][0])
|
||||
{
|
||||
GetWindowText(hwndWinamp, current_play, sizeof(current_play));
|
||||
|
||||
if (strchr(current_play, '-'))
|
||||
{
|
||||
|
||||
p = current_play + strlen(current_play) - 8;
|
||||
while (p >= current_play)
|
||||
{
|
||||
if (!strnicmp(p, "- Winamp", 8)) break;
|
||||
p--;
|
||||
}
|
||||
|
||||
if (p >= current_play) p--;
|
||||
|
||||
while (p >= current_play && *p == ' ') p--;
|
||||
*++p=0;
|
||||
|
||||
|
||||
p = strchr(current_play, '.') + 1;
|
||||
|
||||
song_strcpy(p_esc, p);
|
||||
song_strcpy(cur_esc, current_play);
|
||||
|
||||
if (p)
|
||||
{
|
||||
sprintf(truc, "me is now playing:%s", p_esc);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(truc, "me is now playing:%s", cur_esc);
|
||||
}
|
||||
|
||||
hexchat_commandf(ph, truc);
|
||||
|
||||
}
|
||||
else hexchat_print(ph, "Winamp: Nothing being played.");
|
||||
if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)
|
||||
hexchat_printf(ph, "Winamp: playing");
|
||||
else
|
||||
hexchat_printf(ph, "Winamp: paused");
|
||||
}
|
||||
else
|
||||
hexchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
|
||||
}
|
||||
}
|
||||
else if (!stricmp("STOP", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
|
||||
hexchat_printf(ph, "Winamp: stopped");
|
||||
}
|
||||
else if (!stricmp("PLAY", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
|
||||
hexchat_printf(ph, "Winamp: playing");
|
||||
}
|
||||
else if (!stricmp("NEXT", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
|
||||
hexchat_printf(ph, "Winamp: next playlist entry");
|
||||
}
|
||||
else if (!stricmp("PREV", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
|
||||
hexchat_printf(ph, "Winamp: previous playlist entry");
|
||||
}
|
||||
else if (!stricmp("START", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
|
||||
hexchat_printf(ph, "Winamp: playlist start");
|
||||
}
|
||||
else if (!word_eol[2][0])
|
||||
{
|
||||
wchar_t wcurrent_play[2048];
|
||||
char *current_play, *p;
|
||||
int len = GetWindowTextW(hwndWinamp, wcurrent_play, G_N_ELEMENTS(wcurrent_play));
|
||||
|
||||
current_play = g_utf16_to_utf8 (wcurrent_play, len, NULL, NULL, NULL);
|
||||
if (!current_play)
|
||||
{
|
||||
hexchat_print (ph, "Winamp: Error getting song information.");
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (strchr(current_play, '-'))
|
||||
{
|
||||
/* Remove any trailing text and whitespace */
|
||||
p = current_play + strlen(current_play) - 8;
|
||||
while (p >= current_play)
|
||||
{
|
||||
if (!strnicmp(p, "- Winamp", 8))
|
||||
break;
|
||||
p--;
|
||||
}
|
||||
|
||||
if (p >= current_play)
|
||||
p--;
|
||||
|
||||
while (p >= current_play && *p == ' ')
|
||||
p--;
|
||||
*++p = '\0';
|
||||
|
||||
/* Ignore any leading track number */
|
||||
p = strstr (current_play, ". ");
|
||||
if (p)
|
||||
p += 2;
|
||||
else
|
||||
p = current_play;
|
||||
|
||||
if (*p != '\0')
|
||||
hexchat_commandf (ph, "me is now playing: %s", p);
|
||||
else
|
||||
hexchat_print (ph, "Winamp: No song information found.");
|
||||
g_free (current_play);
|
||||
}
|
||||
else
|
||||
hexchat_print(ph, "Winamp: Nothing being played.");
|
||||
}
|
||||
else
|
||||
hexchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_print(ph, "Winamp not found.\n");
|
||||
hexchat_print(ph, "Winamp not found.\n");
|
||||
}
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
||||
char **plugin_name,
|
||||
char **plugin_desc,
|
||||
char **plugin_version,
|
||||
char *arg)
|
||||
char **plugin_name,
|
||||
char **plugin_desc,
|
||||
char **plugin_version,
|
||||
char *arg)
|
||||
{
|
||||
/* we need to save this for use with any hexchat_* functions */
|
||||
ph = plugin_handle;
|
||||
|
||||
*plugin_name = "Winamp";
|
||||
*plugin_desc = "Winamp plugin for HexChat";
|
||||
*plugin_version = "0.5";
|
||||
*plugin_version = "0.6";
|
||||
|
||||
hexchat_hook_command (ph, "WINAMP", HEXCHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
|
||||
hexchat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
|
||||
|
||||
hexchat_print (ph, "Winamp plugin loaded\n");
|
||||
|
||||
return 1; /* return 1 for success */
|
||||
return 1; /* return 1 for success */
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,76 +20,31 @@
|
||||
<RootNamespace>winamp</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>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcwinamp</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hcwinamp</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WINAMP_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>winamp.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>winamp.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -98,6 +54,4 @@
|
||||
<ClCompile Include="winamp.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -32,6 +32,7 @@ src/fe-gtk/joind.c
|
||||
src/fe-gtk/maingui.c
|
||||
src/fe-gtk/menu.c
|
||||
src/fe-gtk/notifygui.c
|
||||
src/fe-gtk/plugin-notification.c
|
||||
src/fe-gtk/plugin-tray.c
|
||||
src/fe-gtk/plugingui.c
|
||||
src/fe-gtk/rawlog.c
|
||||
@@ -42,3 +43,4 @@ src/fe-gtk/textgui.c
|
||||
src/fe-gtk/urlgrab.c
|
||||
src/fe-gtk/userlistgui.c
|
||||
src/fe-text/fe-text.c
|
||||
plugins/sysinfo/sysinfo.c
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# HexChat [](https://travis-ci.org/hexchat/hexchat) [](http://nekomimi.cloudapp.net:8080/job/hexchat/)
|
||||
# HexChat [](https://travis-ci.org/hexchat/hexchat) [](http://node1.sored.pl:8090/job/hexchat/)
|
||||
|
||||
HexChat is an IRC client for Windows and UNIX-like operating systems.
|
||||
See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
|
||||
|
||||
@@ -16,11 +16,11 @@ EXTRA_DIST = \
|
||||
hexchatc.h \
|
||||
hexchat-plugin.h \
|
||||
history.h \
|
||||
identd.c \
|
||||
ignore.h \
|
||||
inbound.h \
|
||||
inet.h \
|
||||
make-te.c \
|
||||
marshalers.list \
|
||||
modes.h \
|
||||
network.h \
|
||||
notify.h \
|
||||
@@ -34,6 +34,7 @@ EXTRA_DIST = \
|
||||
ssl.h \
|
||||
ssl.c \
|
||||
text.h \
|
||||
typedef.h \
|
||||
textenums.h \
|
||||
textevents.h \
|
||||
textevents.in \
|
||||
@@ -63,6 +64,7 @@ libhexchatcommon_a_SOURCES = cfgfiles.c chanopt.c ctcp.c dcc.c hexchat.c \
|
||||
history.c ignore.c inbound.c marshal.c modes.c network.c notify.c \
|
||||
outbound.c plugin.c plugin-identd.c plugin-timer.c proto-irc.c server.c servlist.c \
|
||||
$(ssl_c) text.c tree.c url.c userlist.c util.c
|
||||
libhexchatcommon_a_CFLAGS = $(LIBPROXY_CFLAGS)
|
||||
|
||||
textenums.h: textevents.h
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#endif
|
||||
|
||||
#define DEF_FONT "Monospace 9"
|
||||
#define DEF_FONT_ALTER "Arial Unicode MS,Lucida Sans Unicode,MS Gothic,Unifont"
|
||||
#define DEF_FONT_ALTER "Arial Unicode MS,Segoe UI Emoji,Lucida Sans Unicode,Meiryo,Symbola,Unifont"
|
||||
|
||||
const char * const languages[LANGUAGES_LENGTH] = {
|
||||
"af", "sq", "am", "ast", "az", "eu", "be", "bg", "ca", "zh_CN", /* 0 .. 9 */
|
||||
@@ -77,7 +77,7 @@ list_addentry (GSList ** list, char *cmd, char *name)
|
||||
/* read it in from a buffer to our linked list */
|
||||
|
||||
static void
|
||||
list_load_from_data (GSList ** list, char *ibuf, int size)
|
||||
list_load_from_data (GSList ** list, char *ibuf, gsize size)
|
||||
{
|
||||
char cmd[384];
|
||||
char name[128];
|
||||
@@ -110,36 +110,28 @@ list_load_from_data (GSList ** list, char *ibuf, int size)
|
||||
}
|
||||
|
||||
void
|
||||
list_loadconf (char *file, GSList ** list, char *defaultconf)
|
||||
list_loadconf (char *filename, GSList ** list, char *defaultconf)
|
||||
{
|
||||
char *filebuf;
|
||||
char *ibuf;
|
||||
int fd;
|
||||
struct stat st;
|
||||
GFile *file;
|
||||
char *data;
|
||||
gsize len;
|
||||
|
||||
filebuf = g_build_filename (get_xdir (), file, NULL);
|
||||
fd = g_open (filebuf, O_RDONLY | OFLAGS, 0);
|
||||
g_free (filebuf);
|
||||
file = hexchat_open_gfile (filename);
|
||||
|
||||
if (fd == -1)
|
||||
if (!g_file_query_exists (file, NULL))
|
||||
{
|
||||
if (defaultconf)
|
||||
list_load_from_data (list, defaultconf, strlen (defaultconf));
|
||||
return;
|
||||
}
|
||||
if (fstat (fd, &st) != 0)
|
||||
|
||||
if (g_file_load_contents (file, NULL, &data, &len, NULL, NULL))
|
||||
{
|
||||
perror ("fstat");
|
||||
abort ();
|
||||
list_load_from_data (list, data, len);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
ibuf = g_malloc (st.st_size);
|
||||
read (fd, ibuf, st.st_size);
|
||||
close (fd);
|
||||
|
||||
list_load_from_data (list, ibuf, st.st_size);
|
||||
|
||||
g_free (ibuf);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -214,51 +206,36 @@ cfg_get_str (char *cfg, const char *var, char *dest, int dest_len)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
cfg_put_str (int fh, char *var, char *value)
|
||||
int
|
||||
cfg_put_str (GOutputStream *ostream, const char *var, const char *value)
|
||||
{
|
||||
char buf[512];
|
||||
int len;
|
||||
|
||||
g_snprintf (buf, sizeof buf, "%s = %s\n", var, value);
|
||||
len = strlen (buf);
|
||||
return (write (fh, buf, len) == len);
|
||||
return (stream_writef (ostream, "%s = %s\n", var, value) != 0);
|
||||
}
|
||||
|
||||
int
|
||||
cfg_put_color (int fh, int r, int g, int b, char *var)
|
||||
cfg_put_color (GOutputStream *ostream, guint16 r, guint16 g, guint16 b, char *var)
|
||||
{
|
||||
char buf[400];
|
||||
int len;
|
||||
|
||||
g_snprintf (buf, sizeof buf, "%s = %04x %04x %04x\n", var, r, g, b);
|
||||
len = strlen (buf);
|
||||
return (write (fh, buf, len) == len);
|
||||
return (stream_writef (ostream, "%s = %04x %04x %04x\n", var, r, g, b) != 0);
|
||||
}
|
||||
|
||||
int
|
||||
cfg_put_int (int fh, int value, char *var)
|
||||
cfg_put_int (GOutputStream *ostream, int value, char *var)
|
||||
{
|
||||
char buf[400];
|
||||
int len;
|
||||
|
||||
if (value == -1)
|
||||
value = 1;
|
||||
|
||||
g_snprintf (buf, sizeof buf, "%s = %d\n", var, value);
|
||||
len = strlen (buf);
|
||||
return (write (fh, buf, len) == len);
|
||||
return (stream_writef (ostream, "%s = %d\n", var, value) != 0);
|
||||
}
|
||||
|
||||
int
|
||||
cfg_get_color (char *cfg, char *var, int *r, int *g, int *b)
|
||||
cfg_get_color (char *cfg, char *var, guint16 *r, guint16 *g, guint16 *b)
|
||||
{
|
||||
char str[128];
|
||||
|
||||
if (!cfg_get_str (cfg, var, str, sizeof (str)))
|
||||
return 0;
|
||||
|
||||
sscanf (str, "%04x %04x %04x", r, g, b);
|
||||
sscanf (str, "%04hx %04hx %04hx", r, g, b);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -338,18 +315,6 @@ check_config_dir (void)
|
||||
return g_access (get_xdir (), F_OK);
|
||||
}
|
||||
|
||||
static char *
|
||||
default_file (void)
|
||||
{
|
||||
static char *dfile = NULL;
|
||||
|
||||
if (!dfile)
|
||||
{
|
||||
dfile = g_build_filename (get_xdir (), "hexchat.conf", NULL);
|
||||
}
|
||||
return dfile;
|
||||
}
|
||||
|
||||
/* Keep these sorted!! */
|
||||
|
||||
const struct prefs vars[] =
|
||||
@@ -476,13 +441,12 @@ const struct prefs vars[] =
|
||||
{"gui_win_ucount", P_OFFINT (hex_gui_win_ucount), TYPE_BOOL},
|
||||
{"gui_win_width", P_OFFINT (hex_gui_win_width), TYPE_INT},
|
||||
|
||||
{"identd", P_OFFINT (hex_identd), TYPE_BOOL},
|
||||
{"identd_server", P_OFFINT (hex_identd_server), TYPE_BOOL},
|
||||
{"identd_port", P_OFFINT (hex_identd_port), TYPE_INT},
|
||||
|
||||
{"input_balloon_chans", P_OFFINT (hex_input_balloon_chans), TYPE_BOOL},
|
||||
{"input_balloon_hilight", P_OFFINT (hex_input_balloon_hilight), TYPE_BOOL},
|
||||
{"input_balloon_priv", P_OFFINT (hex_input_balloon_priv), TYPE_BOOL},
|
||||
{"input_balloon_time", P_OFFINT (hex_input_balloon_time), TYPE_INT},
|
||||
{"input_beep_chans", P_OFFINT (hex_input_beep_chans), TYPE_BOOL},
|
||||
{"input_beep_hilight", P_OFFINT (hex_input_beep_hilight), TYPE_BOOL},
|
||||
{"input_beep_priv", P_OFFINT (hex_input_beep_priv), TYPE_BOOL},
|
||||
@@ -529,7 +493,9 @@ const struct prefs vars[] =
|
||||
{"irc_whois_front", P_OFFINT (hex_irc_whois_front), TYPE_BOOL},
|
||||
|
||||
{"net_auto_reconnect", P_OFFINT (hex_net_auto_reconnect), TYPE_BOOL},
|
||||
#ifndef WIN32 /* FIXME fix reconnect crashes and remove this ifdef! */
|
||||
{"net_auto_reconnectonfail", P_OFFINT (hex_net_auto_reconnectonfail), TYPE_BOOL},
|
||||
#endif
|
||||
{"net_bind_host", P_OFFSET (hex_net_bind_host), TYPE_STR},
|
||||
{"net_ping_timeout", P_OFFINT (hex_net_ping_timeout), TYPE_INT},
|
||||
{"net_proxy_auth", P_OFFINT (hex_net_proxy_auth), TYPE_BOOL},
|
||||
@@ -584,16 +550,17 @@ const struct prefs vars[] =
|
||||
{0, 0, 0},
|
||||
};
|
||||
|
||||
static const char *
|
||||
convert_with_fallback (const char *str, const char *fallback)
|
||||
|
||||
static char *
|
||||
convert_with_fallback (char *str, const char *fallback)
|
||||
{
|
||||
const char *utf;
|
||||
char *utf;
|
||||
|
||||
#ifndef WIN32
|
||||
/* On non-Windows, g_get_user_name and g_get_real_name return a string in system locale, so convert it to utf-8. */
|
||||
utf = g_locale_to_utf8 (str, -1, NULL, NULL, 0);
|
||||
|
||||
g_free ((char*)str);
|
||||
g_free (str);
|
||||
|
||||
/* The returned string is NULL if conversion from locale to utf-8 failed for any reason. Return the fallback. */
|
||||
if (!utf)
|
||||
@@ -710,14 +677,15 @@ get_default_spell_languages (void)
|
||||
void
|
||||
load_default_config(void)
|
||||
{
|
||||
const char *username, *realname, *font, *langs;
|
||||
char *username, *realname, *langs;
|
||||
const char *font;
|
||||
char *sp;
|
||||
#ifdef WIN32
|
||||
wchar_t* roaming_path_wide;
|
||||
gchar* roaming_path;
|
||||
#endif
|
||||
|
||||
username = g_get_user_name ();
|
||||
username = g_strdup(g_get_user_name ());
|
||||
if (!username)
|
||||
username = g_strdup ("root");
|
||||
|
||||
@@ -826,7 +794,6 @@ load_default_config(void)
|
||||
prefs.hex_gui_ulist_pos = 3;
|
||||
prefs.hex_gui_win_height = 400;
|
||||
prefs.hex_gui_win_width = 640;
|
||||
prefs.hex_input_balloon_time = 20;
|
||||
prefs.hex_irc_ban_type = 1;
|
||||
prefs.hex_irc_join_delay = 5;
|
||||
prefs.hex_net_reconnect_delay = 10;
|
||||
@@ -904,9 +871,9 @@ load_default_config(void)
|
||||
if (sp)
|
||||
sp[0] = 0; /* spaces in username would break the login */
|
||||
|
||||
g_free ((char *)username);
|
||||
g_free ((char *)realname);
|
||||
g_free ((char *)langs);
|
||||
g_free (username);
|
||||
g_free (realname);
|
||||
g_free (langs);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -951,13 +918,21 @@ make_dcc_dirs (void)
|
||||
int
|
||||
load_config (void)
|
||||
{
|
||||
GFile *file;
|
||||
char *cfg, *sp;
|
||||
int res, val, i;
|
||||
|
||||
g_assert(check_config_dir () == 0);
|
||||
|
||||
file = hexchat_open_gfile ("hexchat.conf");
|
||||
|
||||
if (!g_file_get_contents (default_file (), &cfg, NULL, NULL))
|
||||
if (!g_file_load_contents (file, NULL, &cfg, NULL, NULL, NULL))
|
||||
{
|
||||
g_object_unref (file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
/* If the config is incomplete we have the default values loaded */
|
||||
load_default_config();
|
||||
@@ -999,26 +974,26 @@ load_config (void)
|
||||
int
|
||||
save_config (void)
|
||||
{
|
||||
int fh, i;
|
||||
char *config, *new_config;
|
||||
GFile *file, *tmpfile;
|
||||
GOutputStream *ostream;
|
||||
GFileIOStream *tmpstream;
|
||||
gboolean ret;
|
||||
int i;
|
||||
|
||||
if (check_config_dir () != 0)
|
||||
make_config_dirs ();
|
||||
|
||||
config = default_file ();
|
||||
new_config = g_strconcat (config, ".new", NULL);
|
||||
|
||||
fh = g_open (new_config, OFLAGS | O_TRUNC | O_WRONLY | O_CREAT, 0600);
|
||||
if (fh == -1)
|
||||
tmpfile = g_file_new_tmp (NULL, &tmpstream, NULL);
|
||||
if (!tmpfile)
|
||||
{
|
||||
g_free (new_config);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ostream = g_io_stream_get_output_stream (G_IO_STREAM(tmpstream));
|
||||
|
||||
if (!cfg_put_str (fh, "version", PACKAGE_VERSION))
|
||||
if (!cfg_put_str (ostream, "version", PACKAGE_VERSION))
|
||||
{
|
||||
close (fh);
|
||||
g_free (new_config);
|
||||
g_object_unref (tmpfile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1028,19 +1003,17 @@ save_config (void)
|
||||
switch (vars[i].type)
|
||||
{
|
||||
case TYPE_STR:
|
||||
if (!cfg_put_str (fh, vars[i].name, (char *) &prefs + vars[i].offset))
|
||||
if (!cfg_put_str (ostream, vars[i].name, (char *) &prefs + vars[i].offset))
|
||||
{
|
||||
close (fh);
|
||||
g_free (new_config);
|
||||
g_object_unref (tmpfile);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case TYPE_INT:
|
||||
case TYPE_BOOL:
|
||||
if (!cfg_put_int (fh, *((int *) &prefs + vars[i].offset), vars[i].name))
|
||||
if (!cfg_put_int (ostream, *((int *) &prefs + vars[i].offset), vars[i].name))
|
||||
{
|
||||
close (fh);
|
||||
g_free (new_config);
|
||||
g_object_unref (tmpfile);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1048,23 +1021,15 @@ save_config (void)
|
||||
}
|
||||
while (vars[i].name);
|
||||
|
||||
if (close (fh) == -1)
|
||||
{
|
||||
g_free (new_config);
|
||||
return 0;
|
||||
}
|
||||
g_object_unref (ostream);
|
||||
|
||||
#ifdef WIN32
|
||||
g_unlink (config); /* win32 can't rename to an existing file */
|
||||
#endif
|
||||
if (g_rename (new_config, config) == -1)
|
||||
{
|
||||
g_free (new_config);
|
||||
return 0;
|
||||
}
|
||||
g_free (new_config);
|
||||
file = hexchat_open_gfile ("hexchat.conf");
|
||||
ret = g_file_move (tmpfile, file, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL);
|
||||
|
||||
return 1;
|
||||
g_object_unref (tmpfile);
|
||||
g_object_unref (file);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1347,7 +1312,7 @@ hexchat_fopen_file (const char *file, const char *mode, int xof_flags)
|
||||
FILE *fh;
|
||||
|
||||
if (xof_flags & XOF_FULLPATH)
|
||||
return fopen (file, mode);
|
||||
return g_fopen (file, mode);
|
||||
|
||||
buf = g_build_filename (get_xdir (), file, NULL);
|
||||
fh = g_fopen (buf, mode);
|
||||
@@ -1355,3 +1320,69 @@ hexchat_fopen_file (const char *file, const char *mode, int xof_flags)
|
||||
|
||||
return fh;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a #GFile* to a file in HexChat's config dir.
|
||||
* Must be g_object_unref()'d when done.
|
||||
* @filename must be in utf8 encoding.
|
||||
*/
|
||||
GFile *
|
||||
hexchat_open_gfile (const char *filename)
|
||||
{
|
||||
GFile *file;
|
||||
gchar *full_path, *full_path_fs;
|
||||
|
||||
if (g_path_is_absolute (filename))
|
||||
full_path = g_strdup (filename);
|
||||
else
|
||||
full_path = g_build_filename (get_xdir(), filename, NULL);
|
||||
full_path_fs = g_filename_from_utf8 (full_path, -1, NULL, NULL, NULL);
|
||||
|
||||
file = g_file_new_for_path (full_path_fs);
|
||||
|
||||
g_free (full_path);
|
||||
g_free (full_path_fs);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
G_GNUC_PRINTF (2, 3)
|
||||
gsize
|
||||
stream_writef (GOutputStream *ostream, const char *fmt, ...)
|
||||
{
|
||||
char *tmp;
|
||||
va_list args;
|
||||
gint len;
|
||||
gsize ret;
|
||||
|
||||
va_start (args, fmt);
|
||||
len = g_vasprintf (&tmp, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
ret = g_output_stream_write (ostream, tmp, len, NULL, NULL);
|
||||
g_free (tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
GDataInputStream *
|
||||
file_get_datainputstream (GFile *file)
|
||||
{
|
||||
GInputStream *stream;
|
||||
GDataInputStream *datastream;
|
||||
|
||||
stream = G_INPUT_STREAM(g_file_read (file, NULL, NULL));
|
||||
if (!stream)
|
||||
return NULL;
|
||||
|
||||
datastream = g_data_input_stream_new (stream);
|
||||
/*
|
||||
* This is to avoid any issues moving between windows/unix
|
||||
* but the docs mention an invalid \r without a following \n
|
||||
* can lock up the program
|
||||
*/
|
||||
g_data_input_stream_set_newline_type (datastream, G_DATA_STREAM_NEWLINE_TYPE_ANY);
|
||||
g_object_unref (stream);
|
||||
|
||||
return datastream;
|
||||
}
|
||||
|
||||
@@ -30,12 +30,13 @@ extern char *xdir;
|
||||
extern const char * const languages[LANGUAGES_LENGTH];
|
||||
|
||||
char *cfg_get_str (char *cfg, const char *var, char *dest, int dest_len);
|
||||
int cfg_put_str (GOutputStream *ostream, const char *var, const char *value);
|
||||
int cfg_get_bool (char *var);
|
||||
int cfg_get_int_with_result (char *cfg, char *var, int *result);
|
||||
int cfg_get_int (char *cfg, char *var);
|
||||
int cfg_put_int (int fh, int value, char *var);
|
||||
int cfg_get_color (char *cfg, char *var, int *r, int *g, int *b);
|
||||
int cfg_put_color (int fh, int r, int g, int b, char *var);
|
||||
int cfg_put_int (GOutputStream *ostream, int value, char *var);
|
||||
int cfg_get_color (char *cfg, char *var, guint16 *r, guint16 *g, guint16 *b);
|
||||
int cfg_put_color (GOutputStream *ostream, guint16 r, guint16 g, guint16 b, char *var);
|
||||
char *get_xdir (void);
|
||||
int check_config_dir (void);
|
||||
void load_default_config (void);
|
||||
@@ -44,12 +45,15 @@ int make_dcc_dirs (void);
|
||||
int load_config (void);
|
||||
int save_config (void);
|
||||
void list_free (GSList ** list);
|
||||
void list_loadconf (char *file, GSList ** list, char *defaultconf);
|
||||
void list_loadconf (char *filename, GSList ** list, char *defaultconf);
|
||||
int list_delentry (GSList ** list, char *name);
|
||||
void list_addentry (GSList ** list, char *cmd, char *name);
|
||||
int cmd_set (session *sess, char *tbuf, char *word[], char *word_eol[]);
|
||||
int hexchat_open_file (const char *file, int flags, int mode, int xof_flags);
|
||||
FILE *hexchat_fopen_file (const char *file, const char *mode, int xof_flags);
|
||||
GFile *hexchat_open_gfile (const char *filename);
|
||||
gsize stream_writef (GOutputStream *ostream, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
|
||||
GDataInputStream *file_get_datainputstream (GFile *file);
|
||||
|
||||
#define XOF_DOMODE 1
|
||||
#define XOF_FULLPATH 2
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -23,7 +24,7 @@
|
||||
<ClInclude Include="ignore.h" />
|
||||
<ClInclude Include="inbound.h" />
|
||||
<ClInclude Include="inet.h" />
|
||||
<ClInclude Include="marshal.h" />
|
||||
<ClInclude Include="$(HexChatLib)marshal.h" />
|
||||
<ClInclude Include="modes.h" />
|
||||
<ClInclude Include="network.h" />
|
||||
<ClInclude Include="notify.h" />
|
||||
@@ -35,9 +36,10 @@
|
||||
<ClInclude Include="server.h" />
|
||||
<ClInclude Include="servlist.h" />
|
||||
<ClInclude Include="ssl.h" />
|
||||
<ClInclude Include="sysinfo\sysinfo.h" />
|
||||
<ClInclude Include="text.h" />
|
||||
<ClInclude Include="textenums.h" />
|
||||
<ClInclude Include="textevents.h" />
|
||||
<ClInclude Include="$(HexChatLib)textenums.h" />
|
||||
<ClInclude Include="$(HexChatLib)textevents.h" />
|
||||
<ClInclude Include="tree.h" />
|
||||
<ClInclude Include="typedef.h" />
|
||||
<ClInclude Include="url.h" />
|
||||
@@ -56,7 +58,7 @@
|
||||
<ClCompile Include="plugin-identd.c" />
|
||||
<ClCompile Include="ignore.c" />
|
||||
<ClCompile Include="inbound.c" />
|
||||
<ClCompile Include="marshal.c" />
|
||||
<ClCompile Include="$(HexChatLib)marshal.c" />
|
||||
<ClCompile Include="modes.c" />
|
||||
<ClCompile Include="network.c" />
|
||||
<ClCompile Include="notify.c" />
|
||||
@@ -67,6 +69,7 @@
|
||||
<ClCompile Include="server.c" />
|
||||
<ClCompile Include="servlist.c" />
|
||||
<ClCompile Include="ssl.c" />
|
||||
<ClCompile Include="sysinfo\win32\backend.c" />
|
||||
<ClCompile Include="text.c" />
|
||||
<ClCompile Include="tree.c" />
|
||||
<ClCompile Include="url.c" />
|
||||
@@ -76,7 +79,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\win32\config.h.tt" />
|
||||
<ClInclude Include="..\..\config.h" />
|
||||
<ClInclude Include="$(HexChatLib)config.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid>
|
||||
@@ -84,83 +87,34 @@
|
||||
<RootNamespace>common</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</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'">
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<OutDir>$(HexChatLib)</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<PreBuildEvent>
|
||||
<Command><![CDATA[
|
||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\config.h.tt" "$(SolutionDir)..\config.h"
|
||||
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --header "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.h"
|
||||
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.c"
|
||||
"$(HexChatLib)make-te.exe" < "$(ProjectDir)textevents.in" > "$(HexChatLib)textevents.h" 2> "$(HexChatLib)textenums.h"
|
||||
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\config.h.tt" "$(HexChatLib)config.h"
|
||||
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --header "$(ProjectDir)marshalers.list" > "$(HexChatLib)marshal.h"
|
||||
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" > "$(HexChatLib)marshal.c"
|
||||
|
||||
]]></Command>
|
||||
</PreBuildEvent>
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\sysinfo">
|
||||
<UniqueIdentifier>{d5a3d281-8400-4663-b60d-036ade5fbff7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\sysinfo\win32">
|
||||
<UniqueIdentifier>{a6d80da7-bc0a-4f1f-a156-c8cdafb7831d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="cfgfiles.h">
|
||||
@@ -71,10 +77,10 @@
|
||||
<ClInclude Include="text.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textenums.h">
|
||||
<ClInclude Include="$(HexChatLib)textenums.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textevents.h">
|
||||
<ClInclude Include="$(HexChatLib)textevents.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tree.h">
|
||||
@@ -98,18 +104,21 @@
|
||||
<ClInclude Include="hexchat-plugin.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\config.h">
|
||||
<ClInclude Include="$(HexChatLib)config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="typedef.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="marshal.h">
|
||||
<ClInclude Include="$(HexChatLib)marshal.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="plugin-identd.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sysinfo\sysinfo.h">
|
||||
<Filter>Source Files\sysinfo</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="cfgfiles.c">
|
||||
@@ -181,12 +190,15 @@
|
||||
<ClCompile Include="hexchat.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="marshal.c">
|
||||
<ClCompile Include="$(HexChatLib)marshal.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="plugin-identd.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sysinfo\win32\backend.c">
|
||||
<Filter>Source Files\sysinfo\win32</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\win32\config.h.tt" />
|
||||
|
||||
@@ -366,6 +366,7 @@ remote_object_connect (RemoteObject *obj,
|
||||
static guint count = 0;
|
||||
char *sender, *path;
|
||||
RemoteObject *remote_object;
|
||||
gchar count_buffer[15];
|
||||
|
||||
sender = dbus_g_method_get_sender (context);
|
||||
remote_object = g_hash_table_lookup (clients, sender);
|
||||
@@ -374,7 +375,8 @@ remote_object_connect (RemoteObject *obj,
|
||||
g_free (sender);
|
||||
return TRUE;
|
||||
}
|
||||
path = g_build_filename (DBUS_OBJECT_PATH, count++, NULL);
|
||||
g_snprintf(count_buffer, sizeof(count_buffer), "%u", count++);
|
||||
path = g_build_filename (DBUS_OBJECT_PATH, count_buffer, NULL);
|
||||
remote_object = g_object_new (REMOTE_TYPE_OBJECT, NULL);
|
||||
remote_object->dbus_path = path;
|
||||
remote_object->filename = g_path_get_basename (filename);
|
||||
|
||||
@@ -83,15 +83,6 @@ static gboolean dcc_send_data (GIOChannel *, GIOCondition, struct DCC *);
|
||||
static gboolean dcc_read (GIOChannel *, GIOCondition, struct DCC *);
|
||||
static gboolean dcc_read_ack (GIOChannel *source, GIOCondition condition, struct DCC *dcc);
|
||||
|
||||
char *
|
||||
net_ip (guint32 addr)
|
||||
{
|
||||
struct in_addr ia;
|
||||
|
||||
ia.s_addr = htonl (addr);
|
||||
return inet_ntoa (ia);
|
||||
}
|
||||
|
||||
static int new_id()
|
||||
{
|
||||
static int id = 0;
|
||||
@@ -496,8 +487,7 @@ dcc_write_chat (char *nick, char *text)
|
||||
if (dcc && dcc->dccstat == STAT_ACTIVE)
|
||||
{
|
||||
len = strlen (text);
|
||||
tcp_send_real (NULL, dcc->sok, dcc->serv->encoding, dcc->serv->using_irc,
|
||||
text, len);
|
||||
tcp_send_real (NULL, dcc->sok, dcc->serv->write_converter, text, len);
|
||||
send (dcc->sok, "\n", 1, 0);
|
||||
dcc->size += len;
|
||||
fe_dcc_update (dcc);
|
||||
@@ -515,36 +505,11 @@ dcc_chat_line (struct DCC *dcc, char *line)
|
||||
session *sess;
|
||||
char *word[PDIWORDS];
|
||||
char *po;
|
||||
char *utf;
|
||||
char *conv;
|
||||
int ret, i;
|
||||
gssize len;
|
||||
gsize utf_len;
|
||||
char portbuf[32];
|
||||
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
|
||||
|
||||
len = strlen (line);
|
||||
if (dcc->serv->using_cp1255)
|
||||
len++; /* include the NUL terminator */
|
||||
|
||||
if (dcc->serv->using_irc) /* using "IRC" encoding (CP1252/UTF-8 hybrid) */
|
||||
utf = NULL;
|
||||
else if (dcc->serv->encoding == NULL) /* system */
|
||||
utf = g_locale_to_utf8 (line, len, NULL, &utf_len, NULL);
|
||||
else
|
||||
utf = g_convert (line, len, "UTF-8", dcc->serv->encoding, 0, &utf_len, 0);
|
||||
|
||||
if (utf)
|
||||
{
|
||||
line = utf;
|
||||
len = utf_len;
|
||||
}
|
||||
|
||||
if (dcc->serv->using_cp1255 && len > 0)
|
||||
len--;
|
||||
|
||||
/* we really need valid UTF-8 now */
|
||||
conv = text_validate (&line, &len);
|
||||
line = text_convert_invalid (line, -1, dcc->serv->read_converter, unicode_fallback_string, NULL);
|
||||
|
||||
sess = find_dialog (dcc->serv, dcc->nick);
|
||||
if (!sess)
|
||||
@@ -565,16 +530,14 @@ dcc_chat_line (struct DCC *dcc, char *line)
|
||||
/* did the plugin close it? */
|
||||
if (!g_slist_find (dcc_list, dcc))
|
||||
{
|
||||
g_free (utf);
|
||||
g_free (conv);
|
||||
g_free (line);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* did the plugin eat the event? */
|
||||
if (ret)
|
||||
{
|
||||
g_free (utf);
|
||||
g_free (conv);
|
||||
g_free (line);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -591,8 +554,7 @@ dcc_chat_line (struct DCC *dcc, char *line)
|
||||
{
|
||||
inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, &no_tags);
|
||||
}
|
||||
g_free (utf);
|
||||
g_free (conv);
|
||||
g_free (line);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1677,7 +1639,6 @@ dcc_listen_init (struct DCC *dcc, session *sess)
|
||||
if (dcc->sok == -1)
|
||||
return FALSE;
|
||||
|
||||
#if 0
|
||||
memset (&SAddr, 0, sizeof (struct sockaddr_in));
|
||||
|
||||
len = sizeof (SAddr);
|
||||
@@ -1714,7 +1675,6 @@ dcc_listen_init (struct DCC *dcc, session *sess)
|
||||
setsockopt (dcc->sok, SOL_SOCKET, SO_REUSEADDR, (char *) &len, sizeof (len));
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* try random port */
|
||||
SAddr.sin_port = 0;
|
||||
@@ -2162,6 +2122,8 @@ update_is_resumable (struct DCC *dcc)
|
||||
dcc->resume_error = 1;
|
||||
}
|
||||
|
||||
g_free (filename_fs);
|
||||
|
||||
/* Now verify that this DCC is not already in progress from someone else */
|
||||
if (dcc->resumable)
|
||||
{
|
||||
|
||||
@@ -123,6 +123,5 @@ void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[],
|
||||
void dcc_show_list (session *sess);
|
||||
guint32 dcc_get_my_address (void);
|
||||
void dcc_get_with_destfile (struct DCC *dcc, char *utf8file);
|
||||
char *net_ip (guint32 addr);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -178,7 +178,6 @@ typedef enum
|
||||
} feicon;
|
||||
void fe_tray_set_icon (feicon icon);
|
||||
void fe_tray_set_tooltip (const char *text);
|
||||
void fe_tray_set_balloon (const char *title, const char *text);
|
||||
void fe_open_chan_list (server *serv, char *filter, int do_refresh);
|
||||
const char *fe_get_default_font ();
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "chanopt.h"
|
||||
#include "ignore.h"
|
||||
#include "hexchat-plugin.h"
|
||||
#include "inbound.h"
|
||||
#include "plugin.h"
|
||||
#include "plugin-identd.h"
|
||||
#include "plugin-timer.h"
|
||||
@@ -56,6 +57,10 @@
|
||||
#include <glib-object.h> /* for g_type_init() */
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBPROXY
|
||||
#include <proxy.h>
|
||||
#endif
|
||||
|
||||
GSList *popup_list = 0;
|
||||
GSList *button_list = 0;
|
||||
GSList *dlgbutton_list = 0;
|
||||
@@ -106,6 +111,10 @@ struct session *current_tab;
|
||||
struct session *current_sess = 0;
|
||||
struct hexchatprefs prefs;
|
||||
|
||||
#ifdef USE_LIBPROXY
|
||||
pxProxyFactory *libproxy_factory;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Update the priority queue of the "interesting sessions"
|
||||
* (sess_list_by_lastact).
|
||||
@@ -438,7 +447,6 @@ session_new (server *serv, char *from, int type, int focus)
|
||||
|
||||
sess->server = serv;
|
||||
sess->logfd = -1;
|
||||
sess->scrollfd = -1;
|
||||
sess->type = type;
|
||||
|
||||
sess->alert_beep = SET_DEFAULT;
|
||||
@@ -483,7 +491,6 @@ new_ircwindow (server *serv, char *name, int type, int focus)
|
||||
break;
|
||||
case SESS_DIALOG:
|
||||
sess = session_new (serv, name, type, focus);
|
||||
log_open_or_close (sess);
|
||||
break;
|
||||
default:
|
||||
/* case SESS_CHANNEL:
|
||||
@@ -498,6 +505,16 @@ new_ircwindow (server *serv, char *name, int type, int focus)
|
||||
scrollback_load (sess);
|
||||
if (sess->scrollwritten && sess->scrollback_replay_marklast)
|
||||
sess->scrollback_replay_marklast (sess);
|
||||
if (type == SESS_DIALOG)
|
||||
{
|
||||
struct User *user;
|
||||
|
||||
log_open_or_close (sess);
|
||||
|
||||
user = userlist_find_global (serv, name);
|
||||
if (user && user->hostname)
|
||||
set_topic (sess, user->hostname, user->hostname);
|
||||
}
|
||||
plugin_emit_dummy_print (sess, "Open Context");
|
||||
|
||||
return sess;
|
||||
@@ -749,7 +766,6 @@ static void
|
||||
xchat_init (void)
|
||||
{
|
||||
char buf[3068];
|
||||
const char *cs = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
WSADATA wsadata;
|
||||
@@ -787,9 +803,6 @@ xchat_init (void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (g_get_charset (&cs))
|
||||
prefs.utf8_locale = TRUE;
|
||||
|
||||
load_text_events ();
|
||||
sound_load ();
|
||||
notify_load ();
|
||||
@@ -982,6 +995,10 @@ main (int argc, char *argv[])
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
#ifdef WIN32
|
||||
HRESULT coinit_result;
|
||||
#endif
|
||||
|
||||
srand ((unsigned int) time (NULL)); /* CL: do this only once! */
|
||||
|
||||
/* We must check for the config dir parameter, otherwise load_config() will behave incorrectly.
|
||||
@@ -1040,6 +1057,18 @@ main (int argc, char *argv[])
|
||||
hexchat_remote ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBPROXY
|
||||
libproxy_factory = px_proxy_factory_new();
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
coinit_result = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
|
||||
if (SUCCEEDED (coinit_result))
|
||||
{
|
||||
CoInitializeSecurity (NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
fe_init ();
|
||||
|
||||
/* This is done here because cfgfiles.c is too early in
|
||||
@@ -1067,6 +1096,17 @@ main (int argc, char *argv[])
|
||||
|
||||
fe_main ();
|
||||
|
||||
#ifdef WIN32
|
||||
if (SUCCEEDED (coinit_result))
|
||||
{
|
||||
CoUninitialize ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBPROXY
|
||||
px_proxy_factory_free(libproxy_factory);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
WSACleanup ();
|
||||
#endif
|
||||
|
||||
@@ -154,7 +154,7 @@ struct hexchatprefs
|
||||
unsigned int hex_gui_win_save;
|
||||
unsigned int hex_gui_win_swap;
|
||||
unsigned int hex_gui_win_ucount;
|
||||
unsigned int hex_identd;
|
||||
unsigned int hex_identd_server;
|
||||
unsigned int hex_input_balloon_chans;
|
||||
unsigned int hex_input_balloon_hilight;
|
||||
unsigned int hex_input_balloon_priv;
|
||||
@@ -265,7 +265,6 @@ struct hexchatprefs
|
||||
int hex_gui_win_top;
|
||||
int hex_gui_win_width;
|
||||
int hex_identd_port;
|
||||
int hex_input_balloon_time;
|
||||
int hex_irc_ban_type;
|
||||
int hex_irc_join_delay;
|
||||
int hex_irc_notice_pos;
|
||||
@@ -317,7 +316,6 @@ struct hexchatprefs
|
||||
guint32 dcc_ip;
|
||||
|
||||
unsigned int wait_on_exit; /* wait for logs to be flushed to disk IF we're connected */
|
||||
unsigned int utf8_locale;
|
||||
|
||||
/* Tells us if we need to save, only when they've been edited.
|
||||
This is so that we continue using internal defaults (which can
|
||||
@@ -379,7 +377,8 @@ typedef struct session
|
||||
char channelkey[64]; /* XXX correct max length? */
|
||||
int limit; /* channel user limit */
|
||||
int logfd;
|
||||
int scrollfd; /* scrollback filedes */
|
||||
|
||||
GFile *scrollfile; /* scrollback file */
|
||||
int scrollwritten; /* number of lines written */
|
||||
|
||||
char lastnick[NICKLEN]; /* last nick you /msg'ed */
|
||||
@@ -424,9 +423,7 @@ typedef struct session
|
||||
|
||||
/* SASL Mechanisms */
|
||||
#define MECH_PLAIN 0
|
||||
#define MECH_BLOWFISH 1
|
||||
#define MECH_AES 2
|
||||
#define MECH_EXTERNAL 3
|
||||
#define MECH_EXTERNAL 1
|
||||
|
||||
typedef struct server
|
||||
{
|
||||
@@ -471,10 +468,14 @@ typedef struct server
|
||||
int (*p_raw)(struct server *, char *raw);
|
||||
int (*p_cmp)(const char *s1, const char *s2);
|
||||
|
||||
guint16 port;
|
||||
GSocket *sok; /* is equal to sok4 or sok6 (the one we are using) */
|
||||
GSocket *sok4; /* tcp4 socket */
|
||||
GSocket *sok6; /* tcp6 socket */
|
||||
int port;
|
||||
int sok; /* is equal to sok4 or sok6 (the one we are using) */
|
||||
int sok4; /* tcp4 socket */
|
||||
int sok6; /* tcp6 socket */
|
||||
int proxy_type;
|
||||
int proxy_sok; /* Additional information for MS Proxy beast */
|
||||
int proxy_sok4;
|
||||
int proxy_sok6;
|
||||
int id; /* unique ID number (for plugin API) */
|
||||
#ifdef USE_OPENSSL
|
||||
SSL_CTX *ctx;
|
||||
@@ -483,7 +484,9 @@ typedef struct server
|
||||
#else
|
||||
void *ssl;
|
||||
#endif
|
||||
GCancellable *cancellable; /* to cancel connecting thread */
|
||||
int childread;
|
||||
int childwrite;
|
||||
int childpid;
|
||||
int iotag;
|
||||
int recondelay_tag; /* reconnect delay timeout */
|
||||
int joindelay_tag; /* waiting before we send JOIN */
|
||||
@@ -528,7 +531,10 @@ typedef struct server
|
||||
time_t ping_recv; /* when we last got a ping reply */
|
||||
time_t away_time; /* when we were marked away */
|
||||
|
||||
char *encoding; /* NULL for system */
|
||||
char *encoding;
|
||||
GIConv read_converter; /* iconv converter for converting from server encoding to UTF-8. */
|
||||
GIConv write_converter; /* iconv converter for converting from UTF-8 to server encoding. */
|
||||
|
||||
GSList *favlist; /* list of channels & keys to join */
|
||||
|
||||
unsigned int motd_skipped:1;
|
||||
@@ -539,7 +545,6 @@ typedef struct server
|
||||
unsigned int skip_next_whois:1; /* hide whois output */
|
||||
unsigned int inside_whois:1;
|
||||
unsigned int doing_dns:1; /* /dns has been done */
|
||||
unsigned int retry_sasl:1; /* retrying another sasl mech */
|
||||
unsigned int end_of_motd:1; /* end of motd reached (logged in) */
|
||||
unsigned int sent_quit:1; /* sent a QUIT already? */
|
||||
unsigned int use_listargs:1; /* undernet and dalnet need /list >0,<10000 */
|
||||
@@ -561,12 +566,10 @@ typedef struct server
|
||||
unsigned int have_except:1; /* ban exemptions +e */
|
||||
unsigned int have_invite:1; /* invite exemptions +I */
|
||||
unsigned int have_cert:1; /* have loaded a cert */
|
||||
unsigned int using_cp1255:1; /* encoding is CP1255/WINDOWS-1255? */
|
||||
unsigned int using_irc:1; /* encoding is "IRC" (CP1252/UTF-8 hybrid)? */
|
||||
unsigned int use_who:1; /* whether to use WHO command to get dcc_ip */
|
||||
unsigned int sasl_mech; /* mechanism for sasl auth */
|
||||
unsigned int sent_saslauth:1; /* have sent AUTHENICATE yet */
|
||||
unsigned int sent_capend:1; /* have sent CAP END yet */
|
||||
unsigned int waiting_on_cap:1; /* waiting on another line of CAP LS */
|
||||
#ifdef USE_OPENSSL
|
||||
unsigned int use_ssl:1; /* is server SSL capable? */
|
||||
unsigned int accept_invalid_cert:1;/* ignore result of server's cert. verify */
|
||||
|
||||
@@ -81,6 +81,15 @@ clear_channel (session *sess)
|
||||
void
|
||||
set_topic (session *sess, char *topic, char *stripped_topic)
|
||||
{
|
||||
/* The topic of dialogs are the users hostname which is logged is new */
|
||||
if (sess->type == SESS_DIALOG && (!sess->topic || strcmp(sess->topic, stripped_topic))
|
||||
&& sess->logfd != -1)
|
||||
{
|
||||
char tbuf[1024];
|
||||
g_snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n", sess->channel, stripped_topic);
|
||||
write (sess->logfd, tbuf, strlen (tbuf));
|
||||
}
|
||||
|
||||
g_free (sess->topic);
|
||||
sess->topic = g_strdup (stripped_topic);
|
||||
fe_set_topic (sess, topic, stripped_topic);
|
||||
@@ -179,16 +188,7 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
|
||||
}
|
||||
|
||||
if (ip && ip[0])
|
||||
{
|
||||
if (prefs.hex_irc_logging && sess->logfd != -1 &&
|
||||
(!sess->topic || strcmp(sess->topic, ip)))
|
||||
{
|
||||
char tbuf[1024];
|
||||
g_snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n", from, ip);
|
||||
write (sess->logfd, tbuf, strlen (tbuf));
|
||||
}
|
||||
set_topic (sess, ip, ip);
|
||||
}
|
||||
inbound_chanmsg (serv, NULL, NULL, from, text, FALSE, id, tags_data);
|
||||
return;
|
||||
}
|
||||
@@ -1633,6 +1633,58 @@ inbound_identified (server *serv) /* 'MODE +e MYSELF' on freenode */
|
||||
}
|
||||
}
|
||||
|
||||
static const char *sasl_mechanisms[] =
|
||||
{
|
||||
"PLAIN",
|
||||
"EXTERNAL"
|
||||
};
|
||||
|
||||
static void
|
||||
inbound_toggle_caps (server *serv, const char *extensions_str, gboolean enable)
|
||||
{
|
||||
char **extensions;
|
||||
gsize i;
|
||||
|
||||
extensions = g_strsplit (extensions_str, " ", 0);
|
||||
|
||||
for (i = 0; extensions[i]; i++)
|
||||
{
|
||||
const char *extension = extensions[i];
|
||||
|
||||
if (!strcmp (extension, "identify-msg"))
|
||||
serv->have_idmsg = enable;
|
||||
else if (!strcmp (extension, "multi-prefix"))
|
||||
serv->have_namesx = enable;
|
||||
else if (!strcmp (extension, "account-notify"))
|
||||
serv->have_accnotify = enable;
|
||||
else if (!strcmp (extension, "extended-join"))
|
||||
serv->have_extjoin = enable;
|
||||
else if (!strcmp (extension, "userhost-in-names"))
|
||||
serv->have_uhnames = enable;
|
||||
else if (!strcmp (extension, "server-time")
|
||||
|| !strcmp (extension, "znc.in/server-time")
|
||||
|| !strcmp (extension, "znc.in/server-time-iso"))
|
||||
serv->have_server_time = enable;
|
||||
else if (!strcmp (extension, "away-notify"))
|
||||
serv->have_awaynotify = enable;
|
||||
else if (!strcmp (extension, "sasl"))
|
||||
{
|
||||
serv->have_sasl = enable;
|
||||
if (enable)
|
||||
{
|
||||
#ifdef USE_OPENSSL
|
||||
if (serv->loginmethod == LOGIN_SASLEXTERNAL)
|
||||
serv->sasl_mech = MECH_EXTERNAL;
|
||||
#endif
|
||||
/* Mechanism either defaulted to PLAIN or server gave us list */
|
||||
tcp_sendf (serv, "AUTHENTICATE %s\r\n", sasl_mechanisms[serv->sasl_mech]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (extensions);
|
||||
}
|
||||
|
||||
void
|
||||
inbound_cap_ack (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data)
|
||||
@@ -1640,79 +1692,97 @@ inbound_cap_ack (server *serv, char *nick, char *extensions,
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPACK, serv->server_session, nick, extensions,
|
||||
NULL, NULL, 0, tags_data->timestamp);
|
||||
|
||||
if (strstr (extensions, "identify-msg") != NULL)
|
||||
{
|
||||
serv->have_idmsg = TRUE;
|
||||
}
|
||||
inbound_toggle_caps (serv, extensions, TRUE);
|
||||
}
|
||||
|
||||
if (strstr (extensions, "multi-prefix") != NULL)
|
||||
{
|
||||
serv->have_namesx = TRUE;
|
||||
}
|
||||
void
|
||||
inbound_cap_del (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data)
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPDEL, serv->server_session, nick, extensions,
|
||||
NULL, NULL, 0, tags_data->timestamp);
|
||||
|
||||
if (strstr (extensions, "away-notify") != NULL)
|
||||
{
|
||||
serv->have_awaynotify = TRUE;
|
||||
}
|
||||
inbound_toggle_caps (serv, extensions, FALSE);
|
||||
}
|
||||
|
||||
if (strstr (extensions, "account-notify") != NULL)
|
||||
{
|
||||
serv->have_accnotify = TRUE;
|
||||
}
|
||||
|
||||
if (strstr (extensions, "extended-join") != NULL)
|
||||
{
|
||||
serv->have_extjoin = TRUE;
|
||||
}
|
||||
static const char * const supported_caps[] = {
|
||||
"identify-msg",
|
||||
|
||||
if (strstr (extensions, "userhost-in-names") != NULL)
|
||||
{
|
||||
serv->have_uhnames = TRUE;
|
||||
}
|
||||
/* IRCv3.1 */
|
||||
"multi-prefix",
|
||||
"away-notify",
|
||||
"account-notify",
|
||||
"extended-join",
|
||||
/* "sasl", Handled manually */
|
||||
|
||||
if (strstr (extensions, "server-time") != NULL)
|
||||
{
|
||||
serv->have_server_time = TRUE;
|
||||
}
|
||||
/* IRCv3.2 */
|
||||
"server-time",
|
||||
"userhost-in-names",
|
||||
"cap-notify",
|
||||
"chghost",
|
||||
|
||||
if (strstr (extensions, "sasl") != NULL)
|
||||
{
|
||||
serv->have_sasl = TRUE;
|
||||
serv->sent_saslauth = FALSE;
|
||||
/* ZNC */
|
||||
"znc.in/server-time-iso",
|
||||
"znc.in/server-time",
|
||||
|
||||
/* Twitch */
|
||||
"twitch.tv/membership",
|
||||
};
|
||||
|
||||
static int
|
||||
get_supported_mech (server *serv, const char *list)
|
||||
{
|
||||
char **mechs = g_strsplit (list, ",", 0);
|
||||
gsize i;
|
||||
int ret = -1;
|
||||
|
||||
for (i = 0; mechs[i]; ++i)
|
||||
{
|
||||
#ifdef USE_OPENSSL
|
||||
if (serv->loginmethod == LOGIN_SASLEXTERNAL)
|
||||
{
|
||||
serv->sasl_mech = MECH_EXTERNAL;
|
||||
tcp_send_len (serv, "AUTHENTICATE EXTERNAL\r\n", 23);
|
||||
if (!strcmp (mechs[i], "EXTERNAL"))
|
||||
{
|
||||
ret = MECH_EXTERNAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* default to most secure, it will fallback if not supported */
|
||||
serv->sasl_mech = MECH_AES;
|
||||
tcp_send_len (serv, "AUTHENTICATE DH-AES\r\n", 21);
|
||||
}
|
||||
#else
|
||||
serv->sasl_mech = MECH_PLAIN;
|
||||
tcp_send_len (serv, "AUTHENTICATE PLAIN\r\n", 20);
|
||||
#endif
|
||||
if (!strcmp (mechs[i], "PLAIN"))
|
||||
{
|
||||
ret = MECH_PLAIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (mechs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
const message_tags_data *tags_data)
|
||||
{
|
||||
char buffer[256]; /* buffer for requesting capabilities and emitting the signal */
|
||||
guint32 want_cap; /* format the CAP REQ string based on previous capabilities being requested or not */
|
||||
guint32 want_sasl; /* CAP END shouldn't be sent when SASL is requested, it needs further responses */
|
||||
char buffer[500]; /* buffer for requesting capabilities and emitting the signal */
|
||||
gboolean want_cap = FALSE; /* format the CAP REQ string based on previous capabilities being requested or not */
|
||||
gboolean want_sasl = FALSE; /* CAP END shouldn't be sent when SASL is requested, it needs further responses */
|
||||
char **extensions;
|
||||
int i;
|
||||
|
||||
if (g_str_has_prefix (extensions_str, "* "))
|
||||
{
|
||||
serv->waiting_on_cap = TRUE;
|
||||
extensions_str += 2;
|
||||
extensions_str += extensions_str[0] == ':' ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
serv->waiting_on_cap = FALSE;
|
||||
}
|
||||
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPLIST, serv->server_session, nick,
|
||||
extensions_str, NULL, NULL, 0, tags_data->timestamp);
|
||||
want_cap = 0;
|
||||
want_sasl = 0;
|
||||
|
||||
extensions = g_strsplit (extensions_str, " ", 0);
|
||||
|
||||
@@ -1720,67 +1790,43 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
|
||||
for (i=0; extensions[i]; i++)
|
||||
{
|
||||
const char *extension = extensions[i];
|
||||
char *extension = extensions[i];
|
||||
char *value;
|
||||
gsize x;
|
||||
|
||||
if (!strcmp (extension, "identify-msg"))
|
||||
/* CAP 3.2 can provide values */
|
||||
if ((value = strchr (extension, '=')))
|
||||
{
|
||||
strcat (buffer, "identify-msg ");
|
||||
want_cap = 1;
|
||||
}
|
||||
if (!strcmp (extension, "multi-prefix"))
|
||||
{
|
||||
strcat (buffer, "multi-prefix ");
|
||||
want_cap = 1;
|
||||
}
|
||||
if (!strcmp (extension, "away-notify"))
|
||||
{
|
||||
strcat (buffer, "away-notify ");
|
||||
want_cap = 1;
|
||||
}
|
||||
if (!strcmp (extension, "account-notify"))
|
||||
{
|
||||
strcat (buffer, "account-notify ");
|
||||
want_cap = 1;
|
||||
}
|
||||
if (!strcmp (extension, "extended-join"))
|
||||
{
|
||||
strcat (buffer, "extended-join ");
|
||||
want_cap = 1;
|
||||
}
|
||||
if (!strcmp (extension, "userhost-in-names"))
|
||||
{
|
||||
strcat (buffer, "userhost-in-names ");
|
||||
want_cap = 1;
|
||||
*value = '\0';
|
||||
value++;
|
||||
}
|
||||
|
||||
/* bouncers can prefix a name space to the extension so we should use.
|
||||
* znc <= 1.0 uses "znc.in/server-time" and newer use "znc.in/server-time-iso".
|
||||
*/
|
||||
if (!strcmp (extension, "znc.in/server-time-iso"))
|
||||
{
|
||||
strcat (buffer, "znc.in/server-time-iso ");
|
||||
want_cap = 1;
|
||||
}
|
||||
if (!strcmp (extension, "znc.in/server-time"))
|
||||
{
|
||||
strcat (buffer, "znc.in/server-time ");
|
||||
want_cap = 1;
|
||||
}
|
||||
if (prefs.hex_irc_cap_server_time
|
||||
&& !strcmp (extension, "server-time"))
|
||||
{
|
||||
strcat (buffer, "server-time ");
|
||||
want_cap = 1;
|
||||
}
|
||||
|
||||
/* if the SASL password is set AND auth mode is set to SASL, request SASL auth */
|
||||
if (!strcmp (extension, "sasl")
|
||||
&& ((serv->loginmethod == LOGIN_SASL && strlen (serv->password) != 0)
|
||||
|| (serv->loginmethod == LOGIN_SASLEXTERNAL && serv->have_cert)))
|
||||
if (!g_strcmp0 (extension, "sasl") &&
|
||||
((serv->loginmethod == LOGIN_SASL && strlen (serv->password) != 0)
|
||||
|| (serv->loginmethod == LOGIN_SASLEXTERNAL && serv->have_cert)))
|
||||
{
|
||||
strcat (buffer, "sasl ");
|
||||
want_cap = 1;
|
||||
want_sasl = 1;
|
||||
if (value)
|
||||
{
|
||||
int sasl_mech = get_supported_mech (serv, value);
|
||||
if (sasl_mech == -1) /* No supported mech */
|
||||
continue;
|
||||
serv->sasl_mech = sasl_mech;
|
||||
}
|
||||
want_cap = TRUE;
|
||||
want_sasl = TRUE;
|
||||
g_strlcat (buffer, "sasl ", sizeof(buffer));
|
||||
continue;
|
||||
}
|
||||
|
||||
for (x = 0; x < G_N_ELEMENTS(supported_caps); ++x)
|
||||
{
|
||||
if (!g_strcmp0 (extension, supported_caps[x]))
|
||||
{
|
||||
g_strlcat (buffer, extension, sizeof(buffer));
|
||||
g_strlcat (buffer, " ", sizeof(buffer));
|
||||
want_cap = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1794,7 +1840,7 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
tags_data->timestamp);
|
||||
tcp_sendf (serv, "%s\r\n", g_strchomp (buffer));
|
||||
}
|
||||
if (!want_sasl)
|
||||
if (!want_sasl && !serv->waiting_on_cap)
|
||||
{
|
||||
/* if we use SASL, CAP END is dealt via raw numerics */
|
||||
serv->sent_capend = TRUE;
|
||||
@@ -1805,52 +1851,26 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
void
|
||||
inbound_cap_nak (server *serv, const message_tags_data *tags_data)
|
||||
{
|
||||
serv->sent_capend = TRUE;
|
||||
tcp_send_len (serv, "CAP END\r\n", 9);
|
||||
if (!serv->waiting_on_cap && !serv->sent_capend)
|
||||
{
|
||||
serv->sent_capend = TRUE;
|
||||
tcp_send_len (serv, "CAP END\r\n", 9);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
inbound_cap_list (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data)
|
||||
{
|
||||
if (g_str_has_prefix (extensions, "* "))
|
||||
{
|
||||
extensions += 2;
|
||||
extensions += extensions[0] == ':' ? 1 : 0;
|
||||
}
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPACK, serv->server_session, nick, extensions,
|
||||
NULL, NULL, 0, tags_data->timestamp);
|
||||
}
|
||||
|
||||
static const char *sasl_mechanisms[] =
|
||||
{
|
||||
"PLAIN",
|
||||
"DH-BLOWFISH",
|
||||
"DH-AES",
|
||||
"EXTERNAL"
|
||||
};
|
||||
|
||||
void
|
||||
inbound_sasl_supportedmechs (server *serv, char *list)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (serv->sasl_mech != MECH_EXTERNAL)
|
||||
{
|
||||
/* Use most secure one supported */
|
||||
for (i = MECH_AES; i >= MECH_PLAIN; i--)
|
||||
{
|
||||
if (strstr (list, sasl_mechanisms[i]) != NULL)
|
||||
{
|
||||
serv->sasl_mech = i;
|
||||
serv->retry_sasl = TRUE;
|
||||
tcp_sendf (serv, "AUTHENTICATE %s\r\n", sasl_mechanisms[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Abort, none supported */
|
||||
serv->sent_saslauth = TRUE;
|
||||
tcp_sendf (serv, "AUTHENTICATE *\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
inbound_sasl_authenticate (server *serv, char *data)
|
||||
{
|
||||
@@ -1858,12 +1878,10 @@ inbound_sasl_authenticate (server *serv, char *data)
|
||||
char *user, *pass = NULL;
|
||||
const char *mech = sasl_mechanisms[serv->sasl_mech];
|
||||
|
||||
/* Got a list of supported mechanisms from inspircd */
|
||||
/* Got a list of supported mechanisms from outdated inspircd
|
||||
* just ignore it as it goes against spec */
|
||||
if (strchr (data, ',') != NULL)
|
||||
{
|
||||
inbound_sasl_supportedmechs (serv, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (net->user && !(net->flags & FLAG_USE_GLOBAL))
|
||||
user = net->user;
|
||||
@@ -1876,12 +1894,6 @@ inbound_sasl_authenticate (server *serv, char *data)
|
||||
pass = encode_sasl_pass_plain (user, serv->password);
|
||||
break;
|
||||
#ifdef USE_OPENSSL
|
||||
case MECH_BLOWFISH:
|
||||
pass = encode_sasl_pass_blowfish (user, serv->password, data);
|
||||
break;
|
||||
case MECH_AES:
|
||||
pass = encode_sasl_pass_aes (user, serv->password, data);
|
||||
break;
|
||||
case MECH_EXTERNAL:
|
||||
pass = g_strdup ("+");
|
||||
break;
|
||||
@@ -1891,12 +1903,10 @@ inbound_sasl_authenticate (server *serv, char *data)
|
||||
if (pass == NULL)
|
||||
{
|
||||
/* something went wrong abort */
|
||||
serv->sent_saslauth = TRUE; /* prevent trying PLAIN */
|
||||
tcp_sendf (serv, "AUTHENTICATE *\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
serv->sent_saslauth = TRUE;
|
||||
tcp_sendf (serv, "AUTHENTICATE %s\r\n", pass);
|
||||
g_free (pass);
|
||||
|
||||
@@ -1905,19 +1915,9 @@ inbound_sasl_authenticate (server *serv, char *data)
|
||||
NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
inbound_sasl_error (server *serv)
|
||||
{
|
||||
if (serv->retry_sasl && !serv->sent_saslauth)
|
||||
return 1;
|
||||
|
||||
/* If server sent 904 before we sent password,
|
||||
* mech not support so fallback to next mech */
|
||||
if (!serv->sent_saslauth && serv->sasl_mech != MECH_EXTERNAL && serv->sasl_mech != MECH_PLAIN)
|
||||
{
|
||||
serv->sasl_mech -= 1;
|
||||
tcp_sendf (serv, "AUTHENTICATE %s\r\n", sasl_mechanisms[serv->sasl_mech]);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
/* Just abort, not much we can do */
|
||||
tcp_sendf (serv, "AUTHENTICATE *\r\n");
|
||||
}
|
||||
|
||||
@@ -95,9 +95,10 @@ void inbound_cap_ls (server *serv, char *nick, char *extensions,
|
||||
void inbound_cap_nak (server *serv, const message_tags_data *tags_data);
|
||||
void inbound_cap_list (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data);
|
||||
void inbound_cap_del (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data);
|
||||
void inbound_sasl_authenticate (server *serv, char *data);
|
||||
int inbound_sasl_error (server *serv);
|
||||
void inbound_sasl_supportedmechs (server *serv, char *list);
|
||||
void inbound_sasl_error (server *serv);
|
||||
void do_dns (session *sess, char *nick, char *host,
|
||||
const message_tags_data *tags_data);
|
||||
gboolean alert_match_word (char *word, char *masks);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,82 +20,30 @@
|
||||
<RootNamespace>makete</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<OutDir>$(HexChatLib)</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(HexChatBin)make-te.exe" < "$(ProjectDir)textevents.in" > "$(ProjectDir)textevents.h" 2> "$(ProjectDir)textenums.h"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(HexChatBin)make-te.exe" < "$(ProjectDir)textevents.in" > "$(ProjectDir)textevents.h" 2> "$(ProjectDir)textenums.h"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="make-te.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -20,18 +20,53 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define WANTSOCKET
|
||||
#define WANTARPA
|
||||
#define WANTDNS
|
||||
#include "inet.h"
|
||||
|
||||
#define NETWORK_PRIVATE
|
||||
#include "network.h"
|
||||
|
||||
void
|
||||
net_store_destroy (netstore *ns)
|
||||
{
|
||||
g_return_if_fail (ns != NULL);
|
||||
#define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n)))
|
||||
|
||||
g_resolver_free_addresses (ns->addrs);
|
||||
|
||||
/* ================== COMMON ================= */
|
||||
|
||||
static void
|
||||
net_set_socket_options (int sok)
|
||||
{
|
||||
socklen_t sw;
|
||||
|
||||
sw = 1;
|
||||
setsockopt (sok, SOL_SOCKET, SO_REUSEADDR, (char *) &sw, sizeof (sw));
|
||||
sw = 1;
|
||||
setsockopt (sok, SOL_SOCKET, SO_KEEPALIVE, (char *) &sw, sizeof (sw));
|
||||
}
|
||||
|
||||
char *
|
||||
net_ip (guint32 addr)
|
||||
{
|
||||
struct in_addr ia;
|
||||
|
||||
ia.s_addr = htonl (addr);
|
||||
return inet_ntoa (ia);
|
||||
}
|
||||
|
||||
void
|
||||
net_store_destroy (netstore * ns)
|
||||
{
|
||||
if (ns->ip6_hostent)
|
||||
freeaddrinfo (ns->ip6_hostent);
|
||||
g_free (ns);
|
||||
}
|
||||
|
||||
@@ -41,208 +76,115 @@ net_store_new (void)
|
||||
return g_new0 (netstore, 1);
|
||||
}
|
||||
|
||||
/* =================== IPV6 ================== */
|
||||
|
||||
char *
|
||||
net_resolve (netstore *ns, char *hostname, char **real_host, GError **error)
|
||||
net_resolve (netstore * ns, char *hostname, int port, char **real_host)
|
||||
{
|
||||
GResolver *res;
|
||||
GList *addrs;
|
||||
GInetAddress *addr;
|
||||
char *ipstring;
|
||||
struct addrinfo hints;
|
||||
char ipstring[MAX_HOSTNAME];
|
||||
char portstring[MAX_HOSTNAME];
|
||||
int ret;
|
||||
|
||||
res = g_resolver_get_default ();
|
||||
/* if (ns->ip6_hostent)
|
||||
freeaddrinfo (ns->ip6_hostent);*/
|
||||
|
||||
// todo: lookup by irc service?
|
||||
addrs = g_resolver_lookup_by_name (res, hostname, NULL, error);
|
||||
if (!addrs)
|
||||
{
|
||||
g_object_unref (res);
|
||||
sprintf (portstring, "%d", port);
|
||||
|
||||
memset (&hints, 0, sizeof (struct addrinfo));
|
||||
hints.ai_family = PF_UNSPEC; /* support ipv6 and ipv4 */
|
||||
hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
if (port == 0)
|
||||
ret = getaddrinfo (hostname, NULL, &hints, &ns->ip6_hostent);
|
||||
else
|
||||
ret = getaddrinfo (hostname, portstring, &hints, &ns->ip6_hostent);
|
||||
if (ret != 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ns->addrs = addrs;
|
||||
addr = G_INET_ADDRESS(addrs->data);
|
||||
ipstring = g_inet_address_to_string (addr);
|
||||
#ifdef LOOKUPD /* See note about lookupd above the IPv4 version of net_resolve. */
|
||||
struct addrinfo *tmp;
|
||||
int count = 0;
|
||||
|
||||
if (real_host)
|
||||
{
|
||||
if (!(*real_host = g_resolver_lookup_by_address (res, addr, NULL, NULL)))
|
||||
*real_host = g_strdup (hostname);
|
||||
}
|
||||
for (tmp = ns->ip6_hostent; tmp; tmp = tmp->ai_next)
|
||||
count ++;
|
||||
|
||||
g_object_unref (res);
|
||||
count = RAND_INT(count);
|
||||
|
||||
while (count--) ns->ip6_hostent = ns->ip6_hostent->ai_next;
|
||||
#endif
|
||||
|
||||
return ipstring;
|
||||
/* find the numeric IP number */
|
||||
ipstring[0] = 0;
|
||||
getnameinfo (ns->ip6_hostent->ai_addr, ns->ip6_hostent->ai_addrlen,
|
||||
ipstring, sizeof (ipstring), NULL, 0, NI_NUMERICHOST);
|
||||
|
||||
if (ns->ip6_hostent->ai_canonname)
|
||||
*real_host = g_strdup (ns->ip6_hostent->ai_canonname);
|
||||
else
|
||||
*real_host = g_strdup (hostname);
|
||||
|
||||
return g_strdup (ipstring);
|
||||
}
|
||||
|
||||
/* the only thing making this interface unclean, this shitty sok4, sok6 business */
|
||||
|
||||
GSocket *
|
||||
net_connect (netstore *ns, guint16 port, GSocket *sok4, GSocket *sok6, GError **error)
|
||||
int
|
||||
net_connect (netstore * ns, int sok4, int sok6, int *sok_return)
|
||||
{
|
||||
GSocket *sok;
|
||||
GList *addrs;
|
||||
gboolean success;
|
||||
struct addrinfo *res, *res0;
|
||||
int error = -1;
|
||||
|
||||
for (addrs = ns->addrs; addrs; addrs = g_list_next (addrs))
|
||||
res0 = ns->ip6_hostent;
|
||||
|
||||
for (res = res0; res; res = res->ai_next)
|
||||
{
|
||||
GInetAddress *inet_addr = G_INET_ADDRESS(addrs->data);
|
||||
GSocketAddress *sok_addr;
|
||||
|
||||
g_clear_error (error); /* Last failed attempt set */
|
||||
|
||||
sok_addr = g_inet_socket_address_new (inet_addr, port);
|
||||
if (g_socket_address_get_family (sok_addr) == G_SOCKET_FAMILY_IPV4)
|
||||
sok = sok4;
|
||||
else
|
||||
sok = sok6;
|
||||
success = g_socket_connect (sok, sok_addr, NULL, error);
|
||||
g_object_unref (sok_addr);
|
||||
|
||||
if (success)
|
||||
return sok;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
net_bind (netstore *ns, GSocket *sok4, GSocket *sok6, GError **error4, GError **error6)
|
||||
{
|
||||
GInetAddress *inet_addr = G_INET_ADDRESS(ns->addrs->data);
|
||||
GSocketAddress *sok_addr;
|
||||
gboolean success;
|
||||
|
||||
sok_addr = g_inet_socket_address_new (inet_addr, 0);
|
||||
success = g_socket_bind (sok4, sok_addr, TRUE, error4);
|
||||
success &= g_socket_bind (sok6, sok_addr, TRUE, error6);
|
||||
g_object_unref (sok_addr);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
net_sockets (GSocket **sok4, GSocket **sok6, GError **error4, GError **error6)
|
||||
{
|
||||
*sok4 = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_TCP, error4);
|
||||
*sok6 = g_socket_new (G_SOCKET_FAMILY_IPV6, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_TCP, error6);
|
||||
|
||||
if (!*sok4 || !*sok6)
|
||||
{
|
||||
g_warning ("Creating sockets failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
g_socket_set_keepalive (*sok4, TRUE);
|
||||
g_socket_set_keepalive (*sok6, TRUE);
|
||||
}
|
||||
|
||||
char *
|
||||
net_resolve_proxy (const char *hostname, guint16 port, GError **error)
|
||||
{
|
||||
GProxyResolver *res;
|
||||
char *uri;
|
||||
char **proxies;
|
||||
char *proxy = NULL;
|
||||
guint i;
|
||||
|
||||
res = g_proxy_resolver_get_default ();
|
||||
if (!res)
|
||||
return NULL;
|
||||
|
||||
// FIXME: ircs also
|
||||
uri = g_strdup_printf ("irc://%s:%d", hostname, port);
|
||||
proxies = g_proxy_resolver_lookup (res, uri, NULL, error);
|
||||
g_free (uri);
|
||||
if (g_strv_length (proxies) == 0)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < g_strv_length (proxies); i++)
|
||||
{
|
||||
int type;
|
||||
|
||||
net_parse_proxy_uri (proxies[i], NULL, NULL, &type);
|
||||
|
||||
if (type != -1)
|
||||
/* sok = socket (res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (sok < 0)
|
||||
continue;*/
|
||||
switch (res->ai_family)
|
||||
{
|
||||
proxy = g_strdup (proxies[i]);
|
||||
case AF_INET:
|
||||
error = connect (sok4, res->ai_addr, res->ai_addrlen);
|
||||
*sok_return = sok4;
|
||||
break;
|
||||
case AF_INET6:
|
||||
error = connect (sok6, res->ai_addr, res->ai_addrlen);
|
||||
*sok_return = sok6;
|
||||
break;
|
||||
default:
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (error == 0)
|
||||
break;
|
||||
}
|
||||
g_strfreev (proxies);
|
||||
|
||||
if (!proxy) /* FIXME: error code */
|
||||
*error = g_error_new_literal (0, 0, "No system proxy found that is supported");
|
||||
|
||||
return proxy;
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
net_parse_proxy_uri (const char *proxy_uri, char **host, guint16 *port, int *type)
|
||||
net_bind (netstore * tobindto, int sok4, int sok6)
|
||||
{
|
||||
if (type)
|
||||
{
|
||||
char *scheme = g_uri_parse_scheme (proxy_uri);
|
||||
|
||||
if (!strcmp (scheme, "direct"))
|
||||
*type = 0;
|
||||
else if (!strcmp (scheme, "http"))
|
||||
*type = 4;
|
||||
else if (!strcmp (scheme, "socks5"))
|
||||
*type = 3;
|
||||
else if (!strcmp (scheme, "socks"))
|
||||
*type = 2;
|
||||
else
|
||||
*type = -1;
|
||||
|
||||
g_free (scheme);
|
||||
}
|
||||
|
||||
if (host)
|
||||
{
|
||||
char *c1, *c2;
|
||||
|
||||
c1 = strchr (proxy_uri, ':') + 3;
|
||||
if (c1)
|
||||
{
|
||||
c2 = strrchr (c1, ':');
|
||||
|
||||
if (c2)
|
||||
*host = g_strndup (c1, c2 - c1);
|
||||
else
|
||||
*host = g_strdup (c1);
|
||||
}
|
||||
else
|
||||
*host = NULL;
|
||||
}
|
||||
|
||||
if (port)
|
||||
{
|
||||
char *c;
|
||||
guint64 p;
|
||||
|
||||
c = strrchr (proxy_uri, ':');
|
||||
if (c)
|
||||
{
|
||||
p = g_ascii_strtoull (c + 1, NULL, 0);
|
||||
if (p <= G_MAXUINT16)
|
||||
*port = (guint16)p;
|
||||
}
|
||||
else
|
||||
*port = 0;
|
||||
}
|
||||
bind (sok4, tobindto->ip6_hostent->ai_addr,
|
||||
tobindto->ip6_hostent->ai_addrlen);
|
||||
bind (sok6, tobindto->ip6_hostent->ai_addr,
|
||||
tobindto->ip6_hostent->ai_addrlen);
|
||||
}
|
||||
|
||||
guint16
|
||||
net_get_local_port (GSocket *sok)
|
||||
void
|
||||
net_sockets (int *sok4, int *sok6)
|
||||
{
|
||||
GSocketAddress *addr;
|
||||
guint16 port;
|
||||
|
||||
addr = g_socket_get_local_address (sok, NULL);
|
||||
if (!addr)
|
||||
return 0;
|
||||
|
||||
port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS(addr));
|
||||
g_object_unref (addr);
|
||||
|
||||
return port;
|
||||
*sok4 = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
*sok6 = socket (AF_INET6, SOCK_STREAM, IPPROTO_TCP);
|
||||
net_set_socket_options (*sok4);
|
||||
net_set_socket_options (*sok6);
|
||||
}
|
||||
|
||||
void
|
||||
udp_sockets (int *sok4, int *sok6)
|
||||
{
|
||||
*sok4 = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
*sok6 = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
|
||||
}
|
||||
|
||||
@@ -22,18 +22,21 @@
|
||||
|
||||
typedef struct netstore_
|
||||
{
|
||||
GList *addrs;
|
||||
#ifdef NETWORK_PRIVATE
|
||||
struct addrinfo *ip6_hostent;
|
||||
#else
|
||||
int _dummy; /* some compilers don't like empty structs */
|
||||
#endif
|
||||
} netstore;
|
||||
|
||||
#define MAX_HOSTNAME 128
|
||||
|
||||
netstore *net_store_new (void);
|
||||
void net_store_destroy (netstore *ns);
|
||||
GSocket *net_connect (netstore *ns, guint16 port, GSocket *sok4, GSocket *sok6, GError **error);
|
||||
char *net_resolve (netstore *ns, char *hostname, char **real_host, GError **error);
|
||||
char * net_resolve_proxy (const char *hostname, guint16 port, GError **error);
|
||||
gboolean net_bind (netstore *ns, GSocket *sok4, GSocket *sok6, GError **error4, GError **error6);
|
||||
void net_sockets (GSocket **sok4, GSocket **sok6, GError **error4, GError **error6);
|
||||
void net_parse_proxy_uri (const char *proxy_uri, char **host, guint16 *port, int *type);
|
||||
guint16 net_get_local_port (GSocket *sok);
|
||||
int net_connect (netstore *ns, int sok4, int sok6, int *sok_return);
|
||||
char *net_resolve (netstore *ns, char *hostname, int port, char **real_host);
|
||||
void net_bind (netstore *tobindto, int sok4, int sok6);
|
||||
char *net_ip (guint32 addr);
|
||||
void net_sockets (int *sok4, int *sok6);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -78,40 +78,72 @@ notc_msg (struct session *sess)
|
||||
static char *
|
||||
random_line (char *file_name)
|
||||
{
|
||||
FILE *fh;
|
||||
char buf[512];
|
||||
int lines, ran;
|
||||
GFile *file;
|
||||
char *data, *p, *ret = NULL;
|
||||
int lines = 0, ran;
|
||||
gsize len;
|
||||
|
||||
if (!file_name[0])
|
||||
goto nofile;
|
||||
return g_strdup ("");
|
||||
|
||||
fh = hexchat_fopen_file (file_name, "r", 0);
|
||||
if (!fh)
|
||||
file = hexchat_open_gfile (file_name);
|
||||
|
||||
if (!g_file_query_exists (file, NULL))
|
||||
{
|
||||
nofile:
|
||||
/* reason is not a file, an actual reason! */
|
||||
return g_strdup (file_name);
|
||||
}
|
||||
|
||||
/* count number of lines in file */
|
||||
lines = 0;
|
||||
while (fgets (buf, sizeof (buf), fh))
|
||||
lines++;
|
||||
|
||||
if (lines < 1)
|
||||
goto nofile;
|
||||
|
||||
/* go down a random number */
|
||||
rewind (fh);
|
||||
ran = RAND_INT (lines);
|
||||
do
|
||||
if (!g_file_load_contents (file, NULL, &data, &len, NULL, NULL))
|
||||
{
|
||||
fgets (buf, sizeof (buf), fh);
|
||||
lines--;
|
||||
g_object_unref (file);
|
||||
return g_strdup (file_name);
|
||||
}
|
||||
while (lines > ran);
|
||||
fclose (fh);
|
||||
return g_strdup (buf);
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
/* count number of lines in file */
|
||||
p = data;
|
||||
while (p != data + len)
|
||||
{
|
||||
if (*p == '\n')
|
||||
lines++;
|
||||
p++;
|
||||
}
|
||||
|
||||
if (!lines)
|
||||
{
|
||||
g_free (data);
|
||||
return g_strdup (file_name);
|
||||
}
|
||||
|
||||
/* create random number */
|
||||
ran = RAND_INT (lines);
|
||||
|
||||
/* get that random line */
|
||||
p = data;
|
||||
while (p != data + len)
|
||||
{
|
||||
if (*p == '\n')
|
||||
{
|
||||
if (!--ran)
|
||||
{
|
||||
char *end;
|
||||
end = strchr (++p, '\n');
|
||||
*end = '\0';
|
||||
ret = g_strdup (p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
g_free (data);
|
||||
if (ret)
|
||||
return ret;
|
||||
else
|
||||
return g_strdup (file_name);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -590,7 +622,6 @@ static int
|
||||
cmd_charset (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
{
|
||||
server *serv = sess->server;
|
||||
const char *locale = NULL;
|
||||
int offset = 0;
|
||||
|
||||
if (strcmp (word[2], "-quiet") == 0)
|
||||
@@ -598,9 +629,7 @@ cmd_charset (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
|
||||
if (!word[2 + offset][0])
|
||||
{
|
||||
g_get_charset (&locale);
|
||||
PrintTextf (sess, "Current charset: %s\n",
|
||||
serv->encoding ? serv->encoding : locale);
|
||||
PrintTextf (sess, "Current charset: %s\n", serv->encoding);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -907,7 +936,7 @@ cmd_debug (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
{
|
||||
v = (struct server *) list->data;
|
||||
sprintf (tbuf, "%p %-5d %s\n",
|
||||
v, g_socket_get_fd (v->sok), v->servername);
|
||||
v, v->sok, v->servername);
|
||||
PrintText (sess, tbuf);
|
||||
list = list->next;
|
||||
}
|
||||
@@ -2490,30 +2519,32 @@ cmd_list (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
}
|
||||
|
||||
gboolean
|
||||
load_perform_file (session *sess, char *file)
|
||||
load_perform_file (session *sess, char *filename)
|
||||
{
|
||||
char tbuf[1024 + 4];
|
||||
char *nl;
|
||||
FILE *fp;
|
||||
GFile *file;
|
||||
GDataInputStream *istream;
|
||||
gchar *buf;
|
||||
|
||||
fp = hexchat_fopen_file (file, "r", 0); /* load files from config dir */
|
||||
if (!fp)
|
||||
return FALSE;
|
||||
file = hexchat_open_gfile (filename);
|
||||
|
||||
tbuf[1024] = 0;
|
||||
while (fgets (tbuf, 1024, fp))
|
||||
istream = file_get_datainputstream (file);
|
||||
if (!istream)
|
||||
{
|
||||
nl = strchr (tbuf, '\n');
|
||||
if (nl == tbuf) /* skip empty commands */
|
||||
continue;
|
||||
if (nl)
|
||||
*nl = 0;
|
||||
if (tbuf[0] == prefs.hex_input_command_char[0])
|
||||
handle_command (sess, tbuf + 1, TRUE);
|
||||
else
|
||||
handle_command (sess, tbuf, TRUE);
|
||||
g_object_unref (file);
|
||||
return FALSE;
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
while ((buf = g_data_input_stream_read_line_utf8 (istream, NULL, NULL, NULL)))
|
||||
{
|
||||
if (g_str_has_prefix (buf, prefs.hex_input_command_char))
|
||||
handle_command (sess, buf + 1, TRUE);
|
||||
else
|
||||
handle_command (sess, buf, TRUE);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
g_object_unref (istream);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2682,17 +2713,26 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
static int
|
||||
cmd_mode (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
{
|
||||
/* +channel channels are dying, let those servers whine about modes.
|
||||
* return info about current channel if available and no info is given */
|
||||
if ((*word[2] == '+') || (*word[2] == 0) || (!is_channel(sess->server, word[2]) &&
|
||||
!(rfc_casecmp(sess->server->nick, word[2]) == 0)))
|
||||
/* We allow omitting the target, so we have to figure it out:
|
||||
* - Can only use info from channels or dialogs
|
||||
* - Empty arg is always sess info
|
||||
* - Assume + is mode not channel
|
||||
* - We know valid channels and our nick
|
||||
* - We cannot easily know if other nick or valid mode (Need to store 004)
|
||||
*/
|
||||
if ((sess->type != SESS_CHANNEL && sess->type != SESS_DIALOG)
|
||||
|| (!(*word[2] == '-' || *word[2] == '+' || *word[2] == '\0')
|
||||
&& (is_channel (sess->server, word[2]) || !rfc_casecmp (sess->server->nick, word[2])))
|
||||
)
|
||||
{
|
||||
sess->server->p_mode (sess->server, word[2], word_eol[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sess->channel[0] == 0)
|
||||
return FALSE;
|
||||
sess->server->p_mode (sess->server, sess->channel, word_eol[2]);
|
||||
}
|
||||
else
|
||||
sess->server->p_mode (sess->server, word[2], word_eol[3]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3205,7 +3245,7 @@ cmd_send (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
|
||||
if (!word[2][0])
|
||||
return FALSE;
|
||||
#if 0
|
||||
|
||||
addr = dcc_get_my_address ();
|
||||
if (addr == 0)
|
||||
{
|
||||
@@ -3223,7 +3263,7 @@ cmd_send (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
g_snprintf (tbuf, 512, "DCC PSEND %s", word_eol[2]);
|
||||
else
|
||||
g_snprintf (tbuf, 512, "DCC SEND %s", word_eol[2]);
|
||||
#endif
|
||||
|
||||
handle_command (sess, tbuf, FALSE);
|
||||
|
||||
return TRUE;
|
||||
@@ -3407,8 +3447,9 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
safe_strcpy (serv->password, net->pass, sizeof (serv->password));
|
||||
serv->loginmethod = net->logintype;
|
||||
}
|
||||
else /* Otherwise ensure no password is sent */
|
||||
else /* Otherwise ensure no password is sent or SASL started */
|
||||
{
|
||||
serv->loginmethod = LOGIN_DEFAULT;
|
||||
serv->password[0] = 0;
|
||||
}
|
||||
}
|
||||
@@ -3473,12 +3514,6 @@ cmd_topic (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
static int
|
||||
cmd_tray (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
{
|
||||
if (strcmp (word[2], "-b") == 0)
|
||||
{
|
||||
fe_tray_set_balloon (word[3], word[4][0] ? word[4] : NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (word[2], "-t") == 0)
|
||||
{
|
||||
fe_tray_set_tooltip (word[3][0] ? word[3] : NULL);
|
||||
@@ -3862,7 +3897,7 @@ const struct commands xc_cmds[] = {
|
||||
N_("ALLCHANL <cmd>, sends a command to all channels on the current server")},
|
||||
{"ALLSERV", cmd_allservers, 0, 0, 1,
|
||||
N_("ALLSERV <cmd>, sends a command to all servers you're in")},
|
||||
{"AWAY", cmd_away, 1, 0, 1, N_("AWAY [<reason>], sets you away")},
|
||||
{"AWAY", cmd_away, 1, 0, 1, N_("AWAY [<reason>], sets you away (use /BACK to unset)")},
|
||||
{"BACK", cmd_back, 1, 0, 1, N_("BACK, sets you back (not away)")},
|
||||
{"BAN", cmd_ban, 1, 1, 1,
|
||||
N_("BAN <mask> [<bantype>], bans everyone matching the mask from the current channel. If they are already on the channel this doesn't kick them (needs chanop)")},
|
||||
@@ -4749,13 +4784,13 @@ handle_command (session *sess, char *cmd, int check_spch)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* unknown command, just send it to the server and hope */
|
||||
if (!sess->server->connected)
|
||||
{
|
||||
PrintText (sess, _("Unknown Command. Try /help\n"));
|
||||
PrintTextf (sess, _("Unknown Command %s. Try /help\n"), word[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* unknown command, just send it to the server and hope */
|
||||
sess->server->p_raw (sess->server, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,17 +22,17 @@
|
||||
#include "hexchat-plugin.h"
|
||||
|
||||
#define _(x) hexchat_gettext(ph,x)
|
||||
static void identd_start_server (void);
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
static GSocketService *service;
|
||||
static GHashTable *responses;
|
||||
|
||||
struct ident_info
|
||||
typedef struct ident_info
|
||||
{
|
||||
GSocketConnection *conn;
|
||||
gchar *username;
|
||||
gchar read_buf[16];
|
||||
} typedef ident_info;
|
||||
} ident_info;
|
||||
|
||||
static int
|
||||
identd_cleanup_response_cb (gpointer userdata)
|
||||
@@ -49,6 +49,23 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
g_return_val_if_fail (responses != NULL, HEXCHAT_EAT_ALL);
|
||||
|
||||
if (!g_strcmp0 (word[2], "reload"))
|
||||
{
|
||||
if (service)
|
||||
{
|
||||
g_socket_service_stop (service);
|
||||
g_clear_object (&service);
|
||||
}
|
||||
|
||||
identd_start_server ();
|
||||
|
||||
if (service)
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (service == NULL) /* If we are not running plugins can handle it */
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
|
||||
if (word[2] && *word[2] && word[3] && *word[3])
|
||||
{
|
||||
guint64 port = g_ascii_strtoull (word[2], NULL, 0);
|
||||
@@ -65,7 +82,7 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
||||
hexchat_command (ph, "HELP IDENTD");
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -79,21 +96,25 @@ identd_write_ready (GOutputStream *stream, GAsyncResult *res, ident_info *info)
|
||||
}
|
||||
|
||||
static void
|
||||
identd_read_ready (GInputStream *in_stream, GAsyncResult *res, ident_info *info)
|
||||
identd_read_ready (GDataInputStream *in_stream, GAsyncResult *res, ident_info *info)
|
||||
{
|
||||
GSocketAddress *sok_addr;
|
||||
GOutputStream *out_stream;
|
||||
guint64 local, remote;
|
||||
gchar buf[512], *p;
|
||||
gchar *read_buf, buf[512], *p;
|
||||
|
||||
if (g_input_stream_read_finish (in_stream, res, NULL))
|
||||
if ((read_buf = g_data_input_stream_read_line_finish (in_stream, res, NULL, NULL)))
|
||||
{
|
||||
local = g_ascii_strtoull (info->read_buf, NULL, 0);
|
||||
p = strchr (info->read_buf, ',');
|
||||
local = g_ascii_strtoull (read_buf, NULL, 0);
|
||||
p = strchr (read_buf, ',');
|
||||
if (!p)
|
||||
{
|
||||
g_free (read_buf);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
remote = g_ascii_strtoull (p + 1, NULL, 0);
|
||||
g_free (read_buf);
|
||||
|
||||
if (!local || !remote || local > G_MAXUINT16 || remote > G_MAXUINT16)
|
||||
goto cleanup;
|
||||
@@ -135,6 +156,7 @@ static gboolean
|
||||
identd_incoming_cb (GSocketService *service, GSocketConnection *conn,
|
||||
GObject *source, gpointer userdata)
|
||||
{
|
||||
GDataInputStream *data_stream;
|
||||
GInputStream *stream;
|
||||
ident_info *info;
|
||||
|
||||
@@ -144,22 +166,24 @@ identd_incoming_cb (GSocketService *service, GSocketConnection *conn,
|
||||
g_object_ref (conn);
|
||||
|
||||
stream = g_io_stream_get_input_stream (G_IO_STREAM (conn));
|
||||
g_input_stream_read_async (stream, info->read_buf, sizeof (info->read_buf), G_PRIORITY_DEFAULT,
|
||||
NULL, (GAsyncReadyCallback)identd_read_ready, info);
|
||||
data_stream = g_data_input_stream_new (stream);
|
||||
g_data_input_stream_set_newline_type (data_stream, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
|
||||
g_data_input_stream_read_line_async (data_stream, G_PRIORITY_DEFAULT,
|
||||
NULL, (GAsyncReadyCallback)identd_read_ready, info);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
identd_start_server (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
int enabled, port = 113;
|
||||
|
||||
if (hexchat_get_prefs (ph, "identd", NULL, &enabled) == 3 && enabled)
|
||||
if (hexchat_get_prefs (ph, "identd_server", NULL, &enabled) == 3)
|
||||
{
|
||||
if (!enabled)
|
||||
return TRUE; /*...*/
|
||||
return;
|
||||
}
|
||||
if (hexchat_get_prefs (ph, "identd_port", NULL, &port) == 2 && (port <= 0 || port > G_MAXUINT16))
|
||||
{
|
||||
@@ -173,15 +197,13 @@ identd_start_server (void)
|
||||
{
|
||||
hexchat_printf (ph, _("*\tError starting identd server: %s"), error->message);
|
||||
|
||||
g_object_unref (service);
|
||||
return FALSE;
|
||||
g_clear_object (&service);
|
||||
return;
|
||||
}
|
||||
/*hexchat_printf (ph, "*\tIdentd listening on port: %d", port); */
|
||||
|
||||
g_signal_connect (G_OBJECT (service), "incoming", G_CALLBACK(identd_incoming_cb), NULL);
|
||||
g_socket_service_start (service);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -198,7 +220,9 @@ identd_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
|
||||
hexchat_hook_command (ph, "IDENTD", HEXCHAT_PRI_NORM, identd_command_cb,
|
||||
_("IDENTD <port> <username>"), NULL);
|
||||
|
||||
return identd_start_server ();
|
||||
identd_start_server ();
|
||||
|
||||
return 1; /* This must always succeed for /identd to work */
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -355,15 +355,11 @@ plugin_kill_all (void)
|
||||
|
||||
#ifdef USE_PLUGIN
|
||||
|
||||
/* load a plugin from a filename. Returns: NULL-success or an error string */
|
||||
|
||||
char *
|
||||
plugin_load (session *sess, char *filename, char *arg)
|
||||
GModule *
|
||||
module_load (char *filename)
|
||||
{
|
||||
void *handle;
|
||||
char *filepart;
|
||||
hexchat_init_func *init_func;
|
||||
hexchat_deinit_func *deinit_func;
|
||||
char *pluginpath;
|
||||
|
||||
/* get the filename without path */
|
||||
@@ -383,6 +379,18 @@ plugin_load (session *sess, char *filename, char *arg)
|
||||
handle = g_module_open (filename, 0);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* load a plugin from a filename. Returns: NULL-success or an error string */
|
||||
|
||||
char *
|
||||
plugin_load (session *sess, char *filename, char *arg)
|
||||
{
|
||||
GModule *handle = module_load (filename);
|
||||
hexchat_init_func *init_func;
|
||||
hexchat_deinit_func *deinit_func;
|
||||
|
||||
if (handle == NULL)
|
||||
return (char *)g_module_error ();
|
||||
|
||||
@@ -659,26 +667,31 @@ plugin_emit_dummy_print (session *sess, char *name)
|
||||
}
|
||||
|
||||
int
|
||||
plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval,
|
||||
int len, char *string)
|
||||
plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, gunichar key)
|
||||
{
|
||||
char *word[PDIWORDS];
|
||||
char keyval_str[16];
|
||||
char state_str[16];
|
||||
char len_str[16];
|
||||
int i;
|
||||
char key_str[7];
|
||||
int i, len;
|
||||
|
||||
if (!hook_list)
|
||||
return 0;
|
||||
|
||||
sprintf (keyval_str, "%u", keyval);
|
||||
sprintf (state_str, "%u", state);
|
||||
if (!key)
|
||||
len = 0;
|
||||
else
|
||||
len = g_unichar_to_utf8 (key, key_str);
|
||||
key_str[len] = '\0';
|
||||
sprintf (len_str, "%d", len);
|
||||
|
||||
word[0] = "Key Press";
|
||||
word[1] = keyval_str;
|
||||
word[2] = state_str;
|
||||
word[3] = string;
|
||||
word[3] = key_str;
|
||||
word[4] = len_str;
|
||||
for (i = 5; i < PDIWORDS; i++)
|
||||
word[i] = "\000";
|
||||
@@ -970,8 +983,7 @@ hexchat_printf (hexchat_plugin *ph, const char *format, ...)
|
||||
void
|
||||
hexchat_command (hexchat_plugin *ph, const char *command)
|
||||
{
|
||||
char *conv;
|
||||
gssize len = -1;
|
||||
char *command_utf8;
|
||||
|
||||
if (!is_session (ph->context))
|
||||
{
|
||||
@@ -980,9 +992,9 @@ hexchat_command (hexchat_plugin *ph, const char *command)
|
||||
}
|
||||
|
||||
/* scripts/plugins continue to send non-UTF8... *sigh* */
|
||||
conv = text_validate ((char **)&command, &len);
|
||||
handle_command (ph->context, (char *)command, FALSE);
|
||||
g_free (conv);
|
||||
command_utf8 = text_fixup_invalid_utf8 (command, -1, NULL);
|
||||
handle_command (ph->context, command_utf8, FALSE);
|
||||
g_free (command_utf8);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1809,7 +1821,7 @@ hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char
|
||||
{
|
||||
prevSetting = 0;
|
||||
|
||||
while (fscanf (fpIn, " %[^\n]", line_bufp) != EOF) /* read whole lines including whitespaces */
|
||||
while (fscanf (fpIn, " %511[^\n]", line_bufp) != EOF) /* read whole lines including whitespaces */
|
||||
{
|
||||
buffer_tmp = g_strdup_printf ("%s ", var); /* add one space, this way it works against var - var2 checks too */
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ struct _hexchat_plugin
|
||||
};
|
||||
#endif
|
||||
|
||||
GModule *module_load (char *filename);
|
||||
char *plugin_load (session *sess, char *filename, char *arg);
|
||||
int plugin_reload (session *sess, char *name, int by_filename);
|
||||
void plugin_add (session *sess, char *filename, void *handle, void *init_func, void *deinit_func, char *arg, int fake);
|
||||
@@ -174,7 +175,7 @@ int plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[
|
||||
time_t server_time);
|
||||
int plugin_emit_print (session *sess, char *word[], time_t server_time);
|
||||
int plugin_emit_dummy_print (session *sess, char *name);
|
||||
int plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, int len, char *string);
|
||||
int plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, gunichar key);
|
||||
GList* plugin_command_list(GList *tmp_list);
|
||||
int plugin_show_help (session *sess, char *cmd);
|
||||
void plugin_command_foreach (session *sess, void *userdata, void (*cb) (session *sess, void *userdata, char *name, char *usage));
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
static void
|
||||
irc_login (server *serv, char *user, char *realname)
|
||||
{
|
||||
tcp_sendf (serv, "CAP LS\r\n"); /* start with CAP LS as Charybdis sasl.txt suggests */
|
||||
tcp_sendf (serv, "CAP LS 302\r\n"); /* start with CAP LS as Charybdis sasl.txt suggests */
|
||||
serv->sent_capend = FALSE; /* track if we have finished */
|
||||
|
||||
if (serv->password[0] && serv->loginmethod == LOGIN_PASS)
|
||||
@@ -569,7 +569,8 @@ process_numeric (session * sess, int n,
|
||||
inbound_user_info_start (sess, word[4], tags_data);
|
||||
if (!serv->skip_next_whois)
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS1, whois_sess, word[4], word[5],
|
||||
word[6], word_eol[8] + 1, 0, tags_data->timestamp);
|
||||
word[6], (word_eol[8][0] == ':') ? word_eol[8] + 1 : word_eol[8],
|
||||
0, tags_data->timestamp);
|
||||
else
|
||||
inbound_user_info (sess, NULL, word[5], word[6], NULL, word[4],
|
||||
word_eol[8][0] == ':' ? word_eol[8] + 1 : word_eol[8],
|
||||
@@ -666,7 +667,6 @@ process_numeric (session * sess, int n,
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMODES, sess, word[4], word_eol[5],
|
||||
NULL, NULL, 0, tags_data->timestamp);
|
||||
fe_update_mode_buttons (sess, 'c', '-');
|
||||
fe_update_mode_buttons (sess, 'r', '-');
|
||||
fe_update_mode_buttons (sess, 't', '-');
|
||||
fe_update_mode_buttons (sess, 'n', '-');
|
||||
fe_update_mode_buttons (sess, 'i', '-');
|
||||
@@ -680,7 +680,7 @@ process_numeric (session * sess, int n,
|
||||
sess = find_channel (serv, word[4]);
|
||||
if (sess)
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANURL, sess, word[4], word[5] + 1,
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANURL, sess, word[4], (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5],
|
||||
NULL, NULL, 0, tags_data->timestamp);
|
||||
}
|
||||
break;
|
||||
@@ -946,10 +946,9 @@ process_numeric (session * sess, int n,
|
||||
word_eol[6]+1, word[1], word[2], NULL, 0,
|
||||
tags_data->timestamp);
|
||||
break;
|
||||
case 903: /* successful SASL auth */
|
||||
case 904: /* failed SASL auth */
|
||||
if (inbound_sasl_error (serv))
|
||||
break; /* might retry */
|
||||
inbound_sasl_error (serv);
|
||||
case 903: /* successful SASL auth */
|
||||
case 905: /* failed SASL auth */
|
||||
case 906: /* aborted */
|
||||
case 907: /* attempting to re-auth after a successful auth */
|
||||
@@ -963,7 +962,7 @@ process_numeric (session * sess, int n,
|
||||
}
|
||||
break;
|
||||
case 908: /* Supported SASL Mechs */
|
||||
inbound_sasl_supportedmechs (serv, word[4]);
|
||||
/* ignored for now, SASL 3.2 is a better solution and we only do PLAIN atm */
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1105,6 +1104,10 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
||||
}
|
||||
return;
|
||||
|
||||
case WORDL('P', 'I', 'N', 'G'):
|
||||
tcp_sendf (sess->server, "PONG %s\r\n", word_eol[3]);
|
||||
return;
|
||||
|
||||
case WORDL('P','O','N','G'):
|
||||
inbound_ping_reply (serv->server_session,
|
||||
(word[4][0] == ':') ? word[4] + 1 : word[4],
|
||||
@@ -1139,7 +1142,16 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
||||
case WORDL('A','C','C','O'):
|
||||
inbound_account (serv, nick, word[3], tags_data);
|
||||
return;
|
||||
|
||||
|
||||
case WORDL('A', 'U', 'T', 'H'):
|
||||
inbound_sasl_authenticate (sess->server, word_eol[3]);
|
||||
return;
|
||||
|
||||
case WORDL('C', 'H', 'G', 'H'):
|
||||
inbound_user_info (sess, NULL, word[3], word[4], NULL, nick, NULL,
|
||||
NULL, 0xff, tags_data);
|
||||
return;
|
||||
|
||||
case WORDL('I','N','V','I'):
|
||||
if (ignore_check (word[1], IG_INVI))
|
||||
return;
|
||||
@@ -1281,7 +1293,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
||||
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],
|
||||
tags_data);
|
||||
}
|
||||
else if (strncasecmp (word[4], "LS", 2) == 0)
|
||||
else if (strncasecmp (word[4], "LS", 2) == 0 || strncasecmp (word[4], "NEW", 3) == 0)
|
||||
{
|
||||
inbound_cap_ls (serv, word[1],
|
||||
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],
|
||||
@@ -1297,6 +1309,12 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
||||
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],
|
||||
tags_data);
|
||||
}
|
||||
else if (strncasecmp (word[4], "DEL", 3) == 0)
|
||||
{
|
||||
inbound_cap_del (serv, word[1],
|
||||
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],
|
||||
tags_data);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@ extern GSList *serv_list;
|
||||
|
||||
/* eventually need to keep the tcp_* functions isolated to server.c */
|
||||
int tcp_send_len (server *serv, char *buf, int len);
|
||||
int tcp_send (server *serv, char *buf);
|
||||
void tcp_sendf (server *serv, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
|
||||
int tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int len);
|
||||
int tcp_send_real (void *ssl, int sok, GIConv write_converter, char *buf, int len);
|
||||
|
||||
server *server_new (void);
|
||||
int is_server (server *serv);
|
||||
|
||||
@@ -45,6 +45,7 @@ struct defaultserver
|
||||
char *charset;
|
||||
int loginmode; /* default authentication type */
|
||||
char *connectcmd; /* default connect command - should only be used for rare login types, paired with LOGIN_CUSTOM */
|
||||
gboolean ssl;
|
||||
};
|
||||
|
||||
static const struct defaultserver def[] =
|
||||
@@ -59,12 +60,9 @@ static const struct defaultserver def[] =
|
||||
|
||||
{"AccessIRC", 0},
|
||||
{0, "irc.accessirc.net"},
|
||||
{0, "eu.accessirc.net"},
|
||||
|
||||
{"AfterNET", 0},
|
||||
{0, "irc.afternet.org"},
|
||||
{0, "us.afternet.org"},
|
||||
{0, "eu.afternet.org"},
|
||||
|
||||
{"Aitvaras", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
@@ -80,52 +78,25 @@ static const struct defaultserver def[] =
|
||||
{0, "irc.kis.lt"},
|
||||
{0, "irc.vub.lt"},
|
||||
|
||||
{"AlphaChat", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.alphachat.net"},
|
||||
{0, "na.alphachat.net"},
|
||||
{0, "eu.alphachat.net"},
|
||||
{0, "au.alphachat.net"},
|
||||
{0, "za.alphachat.net"},
|
||||
|
||||
{"Anthrochat", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.anthrochat.net/+6697"},
|
||||
#endif
|
||||
{"Anthrochat", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.anthrochat.net"},
|
||||
|
||||
{"ARCNet", 0},
|
||||
{0, "se1.arcnet.vapor.com"},
|
||||
{0, "us1.arcnet.vapor.com"},
|
||||
{0, "us2.arcnet.vapor.com"},
|
||||
{0, "us3.arcnet.vapor.com"},
|
||||
{0, "ca1.arcnet.vapor.com"},
|
||||
{0, "de1.arcnet.vapor.com"},
|
||||
{0, "de3.arcnet.vapor.com"},
|
||||
{0, "ch1.arcnet.vapor.com"},
|
||||
{0, "be1.arcnet.vapor.com"},
|
||||
{0, "nl3.arcnet.vapor.com"},
|
||||
{0, "uk1.arcnet.vapor.com"},
|
||||
{0, "uk2.arcnet.vapor.com"},
|
||||
{0, "fr1.arcnet.vapor.com"},
|
||||
{0, "arcnet-irc.org"},
|
||||
|
||||
{"AthemeNet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.atheme.org"},
|
||||
|
||||
{"AustNet", 0},
|
||||
{0, "au.austnet.org"},
|
||||
{0, "us.austnet.org"},
|
||||
{0, "irc.austnet.org"},
|
||||
|
||||
{"AzzurraNet", 0},
|
||||
{0, "irc.azzurra.org"},
|
||||
{0, "crypto.azzurra.org"},
|
||||
|
||||
{"Canternet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.canternet.org/+6697"},
|
||||
#endif
|
||||
{"Canternet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.canternet.org"},
|
||||
|
||||
{"Chat4all", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.chat4all.org/+7001"},
|
||||
#endif
|
||||
{"Chat4all", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.chat4all.org"},
|
||||
|
||||
{"ChattingAway", 0},
|
||||
@@ -133,26 +104,21 @@ static const struct defaultserver def[] =
|
||||
|
||||
{"ChatJunkies", 0},
|
||||
{0, "irc.chatjunkies.org"},
|
||||
{0, "nl.chatjunkies.org"},
|
||||
|
||||
{"ChatNet", 0},
|
||||
{0, "US.ChatNet.Org"},
|
||||
{0, "irc.chatnet.org"},
|
||||
|
||||
{"ChatSpike", 0},
|
||||
{0, "irc.chatspike.net"},
|
||||
|
||||
{"Criten", 0},
|
||||
{0, "irc.criten.net"},
|
||||
{0, "irc.eu.criten.net"},
|
||||
|
||||
{"DALnet", 0},
|
||||
{0, "irc.dal.net"},
|
||||
{0, "irc.eu.dal.net"},
|
||||
|
||||
{"Dark-Tou-Net", 0},
|
||||
{0, "irc.d-t-net.de"},
|
||||
{0, "bw.d-t-net.de"},
|
||||
{0, "nc.d-t-net.de"},
|
||||
|
||||
{"DarkMyst", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.darkmyst.org"},
|
||||
@@ -171,60 +137,36 @@ static const struct defaultserver def[] =
|
||||
{0, "irc.lightning.net"},
|
||||
{0, "irc.servercentral.net"},
|
||||
|
||||
{"ElectroCode", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
|
||||
{0, "irc.electrocode.net/+6697"},
|
||||
#endif
|
||||
{"ElectroCode", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.electrocode.net"},
|
||||
|
||||
{"EnterTheGame", 0},
|
||||
{0, "IRC.EnterTheGame.Com"},
|
||||
{0, "irc.enterthegame.com"},
|
||||
|
||||
{"EntropyNet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.entropynet.net/+6697"},
|
||||
#endif
|
||||
{"EntropyNet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.entropynet.net"},
|
||||
|
||||
{"EsperNet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.esper.net/+6697"},
|
||||
#endif
|
||||
{"EsperNet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.esper.net"},
|
||||
|
||||
{"EUIrc", 0},
|
||||
{0, "irc.euirc.net"},
|
||||
{0, "irc.ham.de.euirc.net"},
|
||||
{0, "irc.ber.de.euirc.net"},
|
||||
{0, "irc.ffm.de.euirc.net"},
|
||||
{0, "irc.bre.de.euirc.net"},
|
||||
{0, "irc.hes.de.euirc.net"},
|
||||
{0, "irc.inn.at.euirc.net"},
|
||||
{0, "irc.bas.ch.euirc.net"},
|
||||
|
||||
{"EuropNet", 0},
|
||||
{0, "irc.europnet.org"},
|
||||
|
||||
{"FDFNet", 0},
|
||||
{0, "irc.fdfnet.net"},
|
||||
{0, "irc.eu.fdfnet.net"},
|
||||
|
||||
{"FEFNet", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.fef.net"},
|
||||
|
||||
{"freenode", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "chat.freenode.net/+6697"},
|
||||
#endif
|
||||
{"freenode", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "chat.freenode.net"},
|
||||
/* irc. points to chat. but many users and urls still reference it */
|
||||
{0, "irc.freenode.net"},
|
||||
|
||||
{"Furnet", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.furnet.org/+6697"},
|
||||
#endif
|
||||
{"Furnet", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.furnet.org"},
|
||||
|
||||
{"GalaxyNet", 0},
|
||||
@@ -233,18 +175,14 @@ static const struct defaultserver def[] =
|
||||
{"GameSurge", 0},
|
||||
{0, "irc.gamesurge.net"},
|
||||
|
||||
{"GeeksIRC", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.geeksirc.net/+6697"},
|
||||
#endif
|
||||
{"GeeksIRC", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.geeksirc.net"},
|
||||
|
||||
{"GeekShed", 0},
|
||||
{0, "irc.geekshed.net"},
|
||||
|
||||
{"German-Elite", 0},
|
||||
{0, "dominion.german-elite.net"},
|
||||
{0, "komatu.german-elite.net"},
|
||||
{0, "irc.german-elite.net"},
|
||||
|
||||
{"GIMPNet", 0},
|
||||
{0, "irc.gimp.org"},
|
||||
@@ -256,22 +194,13 @@ static const struct defaultserver def[] =
|
||||
{"IdleMonkeys", 0},
|
||||
{0, "irc.idlemonkeys.net"},
|
||||
|
||||
{"IndirectIRC", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.indirectirc.com/+6697"},
|
||||
#endif
|
||||
{"IndirectIRC", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.indirectirc.com"},
|
||||
|
||||
{"Interlinked", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.interlinked.me/+6697"},
|
||||
#endif
|
||||
{"Interlinked", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.interlinked.me"},
|
||||
|
||||
{"IRC4Fun", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.irc4fun.net/+6697"},
|
||||
#endif
|
||||
{"IRC4Fun", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.irc4fun.net"},
|
||||
|
||||
{"IRCHighWay", 0},
|
||||
@@ -282,28 +211,15 @@ static const struct defaultserver def[] =
|
||||
|
||||
{"IrcLink", 0},
|
||||
{0, "irc.irclink.net"},
|
||||
{0, "Alesund.no.eu.irclink.net"},
|
||||
{0, "Oslo.no.eu.irclink.net"},
|
||||
{0, "frogn.no.eu.irclink.net"},
|
||||
{0, "tonsberg.no.eu.irclink.net"},
|
||||
|
||||
{"IRCNet", 0},
|
||||
{0, "open.ircnet.net"},
|
||||
{0, "irc.de.ircnet.net"},
|
||||
|
||||
{"IRCNode", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.ircnode.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.ircnode.org"},
|
||||
|
||||
{"Irctoo.net", 0},
|
||||
{0, "irc.irctoo.net"},
|
||||
|
||||
{"iZ-smart.net", 0},
|
||||
{0, "irc.iZ-smart.net/6666"},
|
||||
{0, "irc.iZ-smart.net/6667"},
|
||||
{0, "irc.iZ-smart.net/6668"},
|
||||
{0, "irc.iz-smart.net"},
|
||||
|
||||
{"Krstarica", 0},
|
||||
{0, "irc.krstarica.com"},
|
||||
@@ -311,9 +227,6 @@ static const struct defaultserver def[] =
|
||||
#ifdef USE_OPENSSL
|
||||
{"LinkNet", 0},
|
||||
{0, "irc.link-net.org/+7000"},
|
||||
{0, "as.link-net.org/+7000"},
|
||||
{0, "eu.link-net.org/+7000"},
|
||||
{0, "us.link-net.org/+7000"},
|
||||
#endif
|
||||
|
||||
{"MindForge", 0},
|
||||
@@ -343,31 +256,14 @@ static const struct defaultserver def[] =
|
||||
{"PIRC.PL", 0},
|
||||
{0, "irc.pirc.pl"},
|
||||
|
||||
{"PonyChat", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.ponychat.net/+6697"},
|
||||
#endif
|
||||
{"PonyChat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.ponychat.net"},
|
||||
|
||||
{"PTNet.org", 0},
|
||||
{0, "irc.PTNet.org"},
|
||||
{0, "world.PTnet.org"},
|
||||
{0, "netvisao.PTnet.org"},
|
||||
{0, "uevora.PTnet.org"},
|
||||
{0, "vianetworks.PTnet.org"},
|
||||
{0, "uc.PTnet.org"},
|
||||
{0, "nfsi.ptnet.org"},
|
||||
{0, "fctunl.ptnet.org"},
|
||||
{0, "irc.ptnet.org"},
|
||||
|
||||
{"QuakeNet", 0, 0, 0, LOGIN_CHALLENGEAUTH},
|
||||
{0, "irc.quakenet.org"},
|
||||
{0, "irc.se.quakenet.org"},
|
||||
{0, "irc.dk.quakenet.org"},
|
||||
{0, "irc.no.quakenet.org"},
|
||||
{0, "irc.fi.quakenet.org"},
|
||||
{0, "irc.be.quakenet.org"},
|
||||
{0, "irc.uk.quakenet.org"},
|
||||
{0, "irc.it.quakenet.org"},
|
||||
|
||||
{"Rizon", 0},
|
||||
{0, "irc.rizon.net"},
|
||||
@@ -380,37 +276,21 @@ static const struct defaultserver def[] =
|
||||
|
||||
{"SceneNet", 0},
|
||||
{0, "irc.scene.org"},
|
||||
{0, "irc.eu.scene.org"},
|
||||
{0, "irc.us.scene.org"},
|
||||
|
||||
{"SeilEn.de", 0},
|
||||
{0, "irc.seilen.de"},
|
||||
|
||||
{"SeionIRC", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.seion.us/+6697"},
|
||||
#endif
|
||||
{0, "irc.seion.us"},
|
||||
|
||||
{"Serenity-IRC", 0},
|
||||
{0, "irc.serenity-irc.net"},
|
||||
{0, "eu.serenity-irc.net"},
|
||||
{0, "us.serenity-irc.net"},
|
||||
|
||||
{"SlashNET", 0},
|
||||
{0, "irc.slashnet.org"},
|
||||
{0, "area51.slashnet.org"},
|
||||
{0, "moo.slashnet.org"},
|
||||
{0, "radon.slashnet.org"},
|
||||
|
||||
{"Snoonet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.snoonet.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.snoonet.org/6667"},
|
||||
{"Snoonet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.snoonet.org"},
|
||||
|
||||
{"Snyde", 0},
|
||||
{0, "irc.snyde.net/6667"},
|
||||
{0, "irc.snyde.net"},
|
||||
|
||||
{"Sohbet.Net", 0},
|
||||
{0, "irc.sohbet.net"},
|
||||
@@ -419,57 +299,28 @@ static const struct defaultserver def[] =
|
||||
{0, "irc.solidirc.com"},
|
||||
|
||||
{"SorceryNet", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.sorcery.net/9000"},
|
||||
{0, "irc.us.sorcery.net/9000"},
|
||||
{0, "irc.eu.sorcery.net/9000"},
|
||||
{0, "irc.sorcery.net"},
|
||||
|
||||
{"SpotChat", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.spotchat.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.spotchat.org/6667"},
|
||||
{"SpotChat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.spotchat.org"},
|
||||
|
||||
{"StarChat", 0},
|
||||
{0, "irc.starchat.net"},
|
||||
{0, "gainesville.starchat.net"},
|
||||
{0, "freebsd.starchat.net"},
|
||||
{0, "sunset.starchat.net"},
|
||||
{0, "revenge.starchat.net"},
|
||||
{0, "tahoma.starchat.net"},
|
||||
{0, "neo.starchat.net"},
|
||||
|
||||
{"StaticBox", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.staticbox.net"},
|
||||
|
||||
{"Station51", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.station51.net/+6697"},
|
||||
#endif
|
||||
{"Station51", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.station51.net"},
|
||||
|
||||
{"StormBit", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.stormbit.net/+6697"},
|
||||
#endif
|
||||
{"StormBit", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.stormbit.net"},
|
||||
|
||||
{"SwiftIRC", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.swiftirc.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.swiftirc.net/6667"},
|
||||
{"SwiftIRC", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.swiftirc.net"},
|
||||
|
||||
{"synIRC", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.synirc.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.synirc.net/6667"},
|
||||
{"synIRC", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.synirc.net"},
|
||||
|
||||
{"Techman's World IRC", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.techmansworld.com/+6697"},
|
||||
#endif
|
||||
{0, "irc.techmansworld.com/6667"},
|
||||
{"Techtronix", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.techtronix.net"},
|
||||
|
||||
{"TinyCrab", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.tinycrab.net"},
|
||||
@@ -493,16 +344,10 @@ static const struct defaultserver def[] =
|
||||
{"Worldnet", 0},
|
||||
{0, "irc.worldnet.net"},
|
||||
|
||||
{"Windfyre", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.windfyre.net/+6697"},
|
||||
#endif
|
||||
{"Windfyre", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.windfyre.net"},
|
||||
|
||||
{"Xertion", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.xertion.org/+6697"},
|
||||
#endif
|
||||
{"Xertion", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.xertion.org"},
|
||||
|
||||
{0,0}
|
||||
@@ -1126,6 +971,10 @@ servlist_load_defaults (void)
|
||||
{
|
||||
servlist_command_add (net, def[i].connectcmd);
|
||||
}
|
||||
if (def[i].ssl)
|
||||
{
|
||||
net->flags |= FLAG_USE_SSL;
|
||||
}
|
||||
|
||||
if (g_str_hash (def[i].network) == def_hash)
|
||||
{
|
||||
@@ -1149,9 +998,9 @@ servlist_load_defaults (void)
|
||||
static int
|
||||
servlist_load (void)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[2048];
|
||||
int len;
|
||||
GFile *file;
|
||||
GDataInputStream *istream;
|
||||
gchar *buf;
|
||||
ircnet *net = NULL;
|
||||
|
||||
/* simple migration we will keep for a short while */
|
||||
@@ -1166,15 +1015,16 @@ servlist_load (void)
|
||||
g_free (oldfile);
|
||||
g_free (newfile);
|
||||
|
||||
fp = hexchat_fopen_file ("servlist.conf", "r", 0);
|
||||
if (!fp)
|
||||
|
||||
file = hexchat_open_gfile ("servlist.conf");
|
||||
|
||||
istream = file_get_datainputstream (file);
|
||||
if (!istream)
|
||||
return FALSE;
|
||||
|
||||
while (fgets (buf, sizeof (buf) - 2, fp))
|
||||
|
||||
while ((buf = g_data_input_stream_read_line_utf8 (istream, NULL, NULL, NULL)))
|
||||
{
|
||||
len = strlen (buf);
|
||||
buf[len] = 0;
|
||||
buf[len-1] = 0; /* remove the trailing \n */
|
||||
if (net)
|
||||
{
|
||||
switch (buf[0])
|
||||
@@ -1198,7 +1048,7 @@ servlist_load (void)
|
||||
net->logintype = atoi (buf + 2);
|
||||
break;
|
||||
case 'E':
|
||||
net->encoding = g_strdup (buf + 2);
|
||||
net->encoding = servlist_check_encoding (buf + 2) ? g_strdup (buf + 2) : g_strdup ("UTF-8");
|
||||
break;
|
||||
case 'F':
|
||||
net->flags = atoi (buf + 2);
|
||||
@@ -1247,8 +1097,12 @@ servlist_load (void)
|
||||
}
|
||||
if (buf[0] == 'N')
|
||||
net = servlist_net_add (buf + 2, /* comment */ NULL, FALSE);
|
||||
|
||||
g_free (buf);
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
g_object_unref (file);
|
||||
g_object_unref (istream);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1272,13 +1126,6 @@ servlist_check_encoding (char *charset)
|
||||
if (c)
|
||||
c[0] = 0;
|
||||
|
||||
if (!g_ascii_strcasecmp (charset, "IRC")) /* special case */
|
||||
{
|
||||
if (c)
|
||||
c[0] = ' ';
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gic = g_iconv_open (charset, "UTF-8");
|
||||
|
||||
if (c)
|
||||
@@ -1296,8 +1143,9 @@ servlist_check_encoding (char *charset)
|
||||
int
|
||||
servlist_save (void)
|
||||
{
|
||||
FILE *fp;
|
||||
char *buf;
|
||||
GFile *file;
|
||||
GOutputStream *ostream;
|
||||
gchar *buf;
|
||||
ircnet *net;
|
||||
ircserver *serv;
|
||||
commandentry *cmd;
|
||||
@@ -1306,53 +1154,37 @@ servlist_save (void)
|
||||
GSList *netlist;
|
||||
GSList *cmdlist;
|
||||
GSList *favlist;
|
||||
#ifndef WIN32
|
||||
int first = FALSE;
|
||||
|
||||
buf = g_build_filename (get_xdir (), "servlist.conf", NULL);
|
||||
if (g_access (buf, F_OK) != 0)
|
||||
first = TRUE;
|
||||
#endif
|
||||
file = hexchat_open_gfile ("servlist.conf");
|
||||
|
||||
fp = hexchat_fopen_file ("servlist.conf", "w", 0);
|
||||
if (!fp)
|
||||
{
|
||||
#ifndef WIN32
|
||||
g_free (buf);
|
||||
#endif
|
||||
ostream = G_OUTPUT_STREAM(g_file_replace (file, NULL, TRUE,
|
||||
G_FILE_CREATE_PRIVATE, NULL, NULL));
|
||||
if (!ostream)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
if (first)
|
||||
g_chmod (buf, 0600);
|
||||
|
||||
g_free (buf);
|
||||
#endif
|
||||
fprintf (fp, "v=" PACKAGE_VERSION "\n\n");
|
||||
stream_writef (ostream, "v=%s\n\n", PACKAGE_VERSION);
|
||||
|
||||
list = network_list;
|
||||
while (list)
|
||||
{
|
||||
net = list->data;
|
||||
|
||||
fprintf (fp, "N=%s\n", net->name);
|
||||
stream_writef (ostream, "N=%s\n", net->name);
|
||||
if (net->nick)
|
||||
fprintf (fp, "I=%s\n", net->nick);
|
||||
stream_writef (ostream, "I=%s\n", net->nick);
|
||||
if (net->nick2)
|
||||
fprintf (fp, "i=%s\n", net->nick2);
|
||||
stream_writef (ostream, "i=%s\n", net->nick2);
|
||||
if (net->user)
|
||||
fprintf (fp, "U=%s\n", net->user);
|
||||
stream_writef (ostream, "U=%s\n", net->user);
|
||||
if (net->real)
|
||||
fprintf (fp, "R=%s\n", net->real);
|
||||
stream_writef (ostream, "R=%s\n", net->real);
|
||||
if (net->pass)
|
||||
fprintf (fp, "P=%s\n", net->pass);
|
||||
stream_writef (ostream, "P=%s\n", net->pass);
|
||||
if (net->logintype)
|
||||
fprintf (fp, "L=%d\n", net->logintype);
|
||||
if (net->encoding && g_ascii_strcasecmp (net->encoding, "System") &&
|
||||
g_ascii_strcasecmp (net->encoding, "System default"))
|
||||
stream_writef (ostream, "L=%d\n", net->logintype);
|
||||
if (net->encoding)
|
||||
{
|
||||
fprintf (fp, "E=%s\n", net->encoding);
|
||||
stream_writef (ostream, "E=%s\n", net->encoding);
|
||||
if (!servlist_check_encoding (net->encoding))
|
||||
{
|
||||
buf = g_strdup_printf (_("Warning: \"%s\" character set is unknown. No conversion will be applied for network %s."),
|
||||
@@ -1362,13 +1194,13 @@ servlist_save (void)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (fp, "F=%d\nD=%d\n", net->flags, net->selected);
|
||||
stream_writef (ostream, "F=%d\nD=%d\n", net->flags, net->selected);
|
||||
|
||||
netlist = net->servlist;
|
||||
while (netlist)
|
||||
{
|
||||
serv = netlist->data;
|
||||
fprintf (fp, "S=%s\n", serv->hostname);
|
||||
stream_writef (ostream, "S=%s\n", serv->hostname);
|
||||
netlist = netlist->next;
|
||||
}
|
||||
|
||||
@@ -1376,7 +1208,7 @@ servlist_save (void)
|
||||
while (cmdlist)
|
||||
{
|
||||
cmd = cmdlist->data;
|
||||
fprintf (fp, "C=%s\n", cmd->command);
|
||||
stream_writef (ostream, "C=%s\n", cmd->command);
|
||||
cmdlist = cmdlist->next;
|
||||
}
|
||||
|
||||
@@ -1387,26 +1219,24 @@ servlist_save (void)
|
||||
|
||||
if (favchan->key)
|
||||
{
|
||||
fprintf (fp, "J=%s,%s\n", favchan->name, favchan->key);
|
||||
stream_writef (ostream, "J=%s,%s\n", favchan->name, favchan->key);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (fp, "J=%s\n", favchan->name);
|
||||
stream_writef (ostream, "J=%s\n", favchan->name);
|
||||
}
|
||||
|
||||
favlist = favlist->next;
|
||||
}
|
||||
|
||||
if (fprintf (fp, "\n") < 1)
|
||||
{
|
||||
fclose (fp);
|
||||
if (!stream_writef (ostream, "\n"))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
g_object_unref (file);
|
||||
g_object_unref (ostream);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,16 +80,13 @@ __SSL_critical_error (char *funcname)
|
||||
/* +++++ SSL functions +++++ */
|
||||
|
||||
SSL_CTX *
|
||||
_SSL_context_init (void (*info_cb_func), int server)
|
||||
_SSL_context_init (void (*info_cb_func))
|
||||
{
|
||||
SSL_CTX *ctx;
|
||||
#ifdef WIN32
|
||||
int i, r;
|
||||
#endif
|
||||
|
||||
SSLeay_add_ssl_algorithms ();
|
||||
SSL_load_error_strings ();
|
||||
ctx = SSL_CTX_new (server ? SSLv23_server_method() : SSLv23_client_method ());
|
||||
ctx = SSL_CTX_new (SSLv23_client_method ());
|
||||
|
||||
SSL_CTX_set_session_cache_mode (ctx, SSL_SESS_CACHE_BOTH);
|
||||
SSL_CTX_set_timeout (ctx, 300);
|
||||
@@ -99,22 +96,13 @@ _SSL_context_init (void (*info_cb_func), int server)
|
||||
|SSL_OP_NO_TICKET
|
||||
|SSL_OP_CIPHER_SERVER_PREFERENCE);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x00908000L /* workaround for OpenSSL 0.9.8 */
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined (OPENSSL_NO_COMP) /* workaround for OpenSSL 0.9.8 */
|
||||
sk_SSL_COMP_zero(SSL_COMP_get_compression_methods());
|
||||
#endif
|
||||
|
||||
/* used in SSL_connect(), SSL_accept() */
|
||||
SSL_CTX_set_info_callback (ctx, info_cb_func);
|
||||
|
||||
#ifdef WIN32
|
||||
/* under win32, OpenSSL needs to be seeded with some randomness */
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
r = rand ();
|
||||
RAND_seed ((unsigned char *)&r, sizeof (r));
|
||||
}
|
||||
#endif
|
||||
|
||||
return(ctx);
|
||||
}
|
||||
|
||||
@@ -483,7 +471,7 @@ _SSL_check_subject_altname (X509 *cert, const char *host)
|
||||
|
||||
if (addr != NULL)
|
||||
g_object_unref (addr);
|
||||
sk_GENERAL_NAME_free (altname_stack);
|
||||
sk_GENERAL_NAME_pop_free (altname_stack, GENERAL_NAME_free);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ struct chiper_info {
|
||||
int chiper_bits;
|
||||
};
|
||||
|
||||
SSL_CTX *_SSL_context_init (void (*info_cb_func), int server);
|
||||
SSL_CTX *_SSL_context_init (void (*info_cb_func));
|
||||
#define _SSL_context_free(a) SSL_CTX_free(a);
|
||||
|
||||
SSL *_SSL_socket (SSL_CTX *ctx, int sd);
|
||||
|
||||
13
src/common/sysinfo/sysinfo.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef HEXCHAT_SYSINFO_H
|
||||
#define HEXCHAT_SYSINFO_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
int sysinfo_get_cpu_arch (void);
|
||||
int sysinfo_get_build_arch (void);
|
||||
char *sysinfo_get_cpu (void);
|
||||
char *sysinfo_get_os (void);
|
||||
void sysinfo_get_hdd_info (guint64 *hdd_capacity_out, guint64 *hdd_free_space_out);
|
||||
char *sysinfo_get_gpu (void);
|
||||
|
||||
#endif
|
||||
478
src/common/sysinfo/win32/backend.c
Normal file
@@ -0,0 +1,478 @@
|
||||
/* HexChat
|
||||
* Copyright (c) 2011-2012 Berke Viktor.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <wbemidl.h>
|
||||
|
||||
#include "../sysinfo.h"
|
||||
|
||||
/* Cache */
|
||||
static int cpu_arch = 0;
|
||||
static int build_arch = 0;
|
||||
static char *os_name = NULL;
|
||||
static char *cpu_info = NULL;
|
||||
static char *vga_name = NULL;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QUERY_WMI_OS,
|
||||
QUERY_WMI_CPU,
|
||||
QUERY_WMI_VGA,
|
||||
QUERY_WMI_HDD,
|
||||
} QueryWmiType;
|
||||
|
||||
char *query_wmi (QueryWmiType mode);
|
||||
char *read_os_name (IWbemClassObject *object);
|
||||
char *read_cpu_info (IWbemClassObject *object);
|
||||
char *read_vga_name (IWbemClassObject *object);
|
||||
|
||||
guint64 hdd_capacity;
|
||||
guint64 hdd_free_space;
|
||||
char *read_hdd_info (IWbemClassObject *object);
|
||||
|
||||
char *bstr_to_utf8 (BSTR bstr);
|
||||
guint64 variant_to_uint64 (VARIANT *variant);
|
||||
|
||||
char *
|
||||
sysinfo_get_cpu (void)
|
||||
{
|
||||
if (cpu_info == NULL)
|
||||
cpu_info = query_wmi (QUERY_WMI_CPU);
|
||||
|
||||
return g_strdup (cpu_info);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_get_os (void)
|
||||
{
|
||||
if (os_name == NULL)
|
||||
os_name = query_wmi (QUERY_WMI_OS);
|
||||
|
||||
return g_strdup_printf ("%s (x%d)", os_name, sysinfo_get_cpu_arch ());
|
||||
}
|
||||
|
||||
int
|
||||
sysinfo_get_cpu_arch (void)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
|
||||
if (cpu_arch != 0)
|
||||
{
|
||||
return cpu_arch;
|
||||
}
|
||||
|
||||
GetNativeSystemInfo (&si);
|
||||
|
||||
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
||||
{
|
||||
return cpu_arch = 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return cpu_arch = 86;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
sysinfo_get_build_arch (void)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
|
||||
if (build_arch != 0)
|
||||
{
|
||||
return build_arch;
|
||||
}
|
||||
|
||||
GetSystemInfo (&si);
|
||||
|
||||
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
||||
{
|
||||
return build_arch = 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return build_arch = 86;
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_get_gpu (void)
|
||||
{
|
||||
if (vga_name == NULL)
|
||||
vga_name = query_wmi (QUERY_WMI_VGA);
|
||||
|
||||
return g_strdup (vga_name);
|
||||
}
|
||||
|
||||
void
|
||||
sysinfo_get_hdd_info (guint64 *hdd_capacity_out, guint64 *hdd_free_space_out)
|
||||
{
|
||||
char *hdd_info;
|
||||
|
||||
/* HDD information is always loaded dynamically since it includes the current amount of free space */
|
||||
*hdd_capacity_out = hdd_capacity = 0;
|
||||
*hdd_free_space_out = hdd_free_space = 0;
|
||||
|
||||
hdd_info = query_wmi (QUERY_WMI_HDD);
|
||||
if (hdd_info == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
*hdd_capacity_out = hdd_capacity;
|
||||
*hdd_free_space_out = hdd_free_space;
|
||||
}
|
||||
|
||||
/* https://msdn.microsoft.com/en-us/library/aa390423 */
|
||||
static char *query_wmi (QueryWmiType type)
|
||||
{
|
||||
GString *result = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
IWbemLocator *locator = NULL;
|
||||
BSTR namespaceName = NULL;
|
||||
BSTR queryLanguageName = NULL;
|
||||
BSTR query = NULL;
|
||||
IWbemServices *namespace = NULL;
|
||||
IUnknown *namespaceUnknown = NULL;
|
||||
IEnumWbemClassObject *enumerator = NULL;
|
||||
int i;
|
||||
gboolean atleast_one_appended = FALSE;
|
||||
|
||||
hr = CoCreateInstance (&CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (LPVOID *) &locator);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
|
||||
namespaceName = SysAllocString (L"root\\CIMV2");
|
||||
|
||||
hr = locator->lpVtbl->ConnectServer (locator, namespaceName, NULL, NULL, NULL, 0, NULL, NULL, &namespace);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
goto release_locator;
|
||||
}
|
||||
|
||||
hr = namespace->lpVtbl->QueryInterface (namespace, &IID_IUnknown, &namespaceUnknown);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
goto release_namespace;
|
||||
}
|
||||
|
||||
hr = CoSetProxyBlanket (namespaceUnknown, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
goto release_namespaceUnknown;
|
||||
}
|
||||
|
||||
queryLanguageName = SysAllocString (L"WQL");
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case QUERY_WMI_OS:
|
||||
query = SysAllocString (L"SELECT Caption FROM Win32_OperatingSystem");
|
||||
break;
|
||||
case QUERY_WMI_CPU:
|
||||
query = SysAllocString (L"SELECT Name, MaxClockSpeed FROM Win32_Processor");
|
||||
break;
|
||||
case QUERY_WMI_VGA:
|
||||
query = SysAllocString (L"SELECT Name FROM Win32_VideoController");
|
||||
break;
|
||||
case QUERY_WMI_HDD:
|
||||
query = SysAllocString (L"SELECT Name, Capacity, FreeSpace FROM Win32_Volume");
|
||||
break;
|
||||
default:
|
||||
goto release_queryLanguageName;
|
||||
}
|
||||
|
||||
hr = namespace->lpVtbl->ExecQuery (namespace, queryLanguageName, query, WBEM_FLAG_FORWARD_ONLY, NULL, &enumerator);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
goto release_query;
|
||||
}
|
||||
|
||||
result = g_string_new ("");
|
||||
|
||||
for (i = 0;; i++)
|
||||
{
|
||||
ULONG numReturned = 0;
|
||||
IWbemClassObject *object;
|
||||
char *line;
|
||||
|
||||
hr = enumerator->lpVtbl->Next (enumerator, WBEM_INFINITE, 1, &object, &numReturned);
|
||||
if (FAILED (hr) || numReturned == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case QUERY_WMI_OS:
|
||||
line = read_os_name (object);
|
||||
break;
|
||||
|
||||
case QUERY_WMI_CPU:
|
||||
line = read_cpu_info (object);
|
||||
break;
|
||||
|
||||
case QUERY_WMI_VGA:
|
||||
line = read_vga_name (object);
|
||||
break;
|
||||
|
||||
case QUERY_WMI_HDD:
|
||||
line = read_hdd_info (object);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
object->lpVtbl->Release (object);
|
||||
|
||||
if (line != NULL)
|
||||
{
|
||||
if (atleast_one_appended)
|
||||
{
|
||||
g_string_append (result, ", ");
|
||||
}
|
||||
|
||||
g_string_append (result, line);
|
||||
|
||||
g_free (line);
|
||||
|
||||
atleast_one_appended = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
enumerator->lpVtbl->Release (enumerator);
|
||||
|
||||
release_query:
|
||||
SysFreeString (query);
|
||||
|
||||
release_queryLanguageName:
|
||||
SysFreeString (queryLanguageName);
|
||||
|
||||
release_namespaceUnknown:
|
||||
namespaceUnknown->lpVtbl->Release (namespaceUnknown);
|
||||
|
||||
release_namespace:
|
||||
namespace->lpVtbl->Release (namespace);
|
||||
|
||||
release_locator:
|
||||
locator->lpVtbl->Release (locator);
|
||||
SysFreeString (namespaceName);
|
||||
|
||||
exit:
|
||||
if (result == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_string_free (result, FALSE);
|
||||
}
|
||||
|
||||
static char *read_os_name (IWbemClassObject *object)
|
||||
{
|
||||
HRESULT hr;
|
||||
VARIANT caption_variant;
|
||||
char *caption_utf8;
|
||||
|
||||
hr = object->lpVtbl->Get (object, L"Caption", 0, &caption_variant, NULL, NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
caption_utf8 = bstr_to_utf8 (caption_variant.bstrVal);
|
||||
|
||||
VariantClear(&caption_variant);
|
||||
|
||||
if (caption_utf8 == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_strchomp (caption_utf8);
|
||||
|
||||
return caption_utf8;
|
||||
}
|
||||
|
||||
static char *read_cpu_info (IWbemClassObject *object)
|
||||
{
|
||||
HRESULT hr;
|
||||
VARIANT name_variant;
|
||||
char *name_utf8;
|
||||
VARIANT max_clock_speed_variant;
|
||||
guint cpu_freq_mhz;
|
||||
char *result;
|
||||
|
||||
hr = object->lpVtbl->Get (object, L"Name", 0, &name_variant, NULL, NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name_utf8 = bstr_to_utf8 (name_variant.bstrVal);
|
||||
|
||||
VariantClear (&name_variant);
|
||||
|
||||
if (name_utf8 == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hr = object->lpVtbl->Get (object, L"MaxClockSpeed", 0, &max_clock_speed_variant, NULL, NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
g_free (name_utf8);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cpu_freq_mhz = max_clock_speed_variant.uintVal;
|
||||
|
||||
VariantClear (&max_clock_speed_variant);
|
||||
|
||||
if (cpu_freq_mhz > 1000)
|
||||
{
|
||||
result = g_strdup_printf ("%s (%.2fGHz)", name_utf8, cpu_freq_mhz / 1000.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = g_strdup_printf ("%s (%" G_GUINT32_FORMAT "MHz)", name_utf8, cpu_freq_mhz);
|
||||
}
|
||||
|
||||
g_free (name_utf8);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static char *read_vga_name (IWbemClassObject *object)
|
||||
{
|
||||
HRESULT hr;
|
||||
VARIANT name_variant;
|
||||
char *name_utf8;
|
||||
|
||||
hr = object->lpVtbl->Get (object, L"Name", 0, &name_variant, NULL, NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name_utf8 = bstr_to_utf8 (name_variant.bstrVal);
|
||||
|
||||
VariantClear (&name_variant);
|
||||
|
||||
if (name_utf8 == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_strchomp (name_utf8);
|
||||
}
|
||||
|
||||
static char *read_hdd_info (IWbemClassObject *object)
|
||||
{
|
||||
HRESULT hr;
|
||||
VARIANT name_variant;
|
||||
BSTR name_bstr;
|
||||
gsize name_len;
|
||||
VARIANT capacity_variant;
|
||||
guint64 capacity;
|
||||
VARIANT free_space_variant;
|
||||
guint64 free_space;
|
||||
|
||||
hr = object->lpVtbl->Get (object, L"Name", 0, &name_variant, NULL, NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name_bstr = name_variant.bstrVal;
|
||||
name_len = SysStringLen (name_variant.bstrVal);
|
||||
|
||||
if (name_len >= 4 && name_bstr[0] == L'\\' && name_bstr[1] == L'\\' && name_bstr[2] == L'?' && name_bstr[3] == L'\\')
|
||||
{
|
||||
// This is not a named volume. Skip it.
|
||||
VariantClear (&name_variant);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VariantClear (&name_variant);
|
||||
|
||||
hr = object->lpVtbl->Get (object, L"Capacity", 0, &capacity_variant, NULL, NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
capacity = variant_to_uint64 (&capacity_variant);
|
||||
|
||||
VariantClear (&capacity_variant);
|
||||
|
||||
if (capacity == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hr = object->lpVtbl->Get (object, L"FreeSpace", 0, &free_space_variant, NULL, NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
free_space = variant_to_uint64 (&free_space_variant);
|
||||
|
||||
VariantClear (&free_space_variant);
|
||||
|
||||
if (free_space == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hdd_capacity += capacity;
|
||||
hdd_free_space += free_space;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *bstr_to_utf8 (BSTR bstr)
|
||||
{
|
||||
return g_utf16_to_utf8 (bstr, SysStringLen (bstr), NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static guint64 variant_to_uint64 (VARIANT *variant)
|
||||
{
|
||||
switch (V_VT (variant))
|
||||
{
|
||||
case VT_UI8:
|
||||
return variant->ullVal;
|
||||
|
||||
case VT_BSTR:
|
||||
return wcstoull (variant->bstrVal, NULL, 10);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,9 @@
|
||||
#include <canberra.h>
|
||||
#endif
|
||||
|
||||
const gchar* unicode_fallback_string = "\357\277\275"; /* The Unicode replacement character 0xFFFD */
|
||||
const gchar* arbitrary_encoding_fallback_string = "?";
|
||||
|
||||
struct pevt_stage1
|
||||
{
|
||||
int len;
|
||||
@@ -62,13 +65,15 @@ struct pevt_stage1
|
||||
static ca_context *ca_con;
|
||||
#endif
|
||||
|
||||
#define SCROLLBACK_MAX 32000
|
||||
|
||||
static void mkdir_p (char *filename);
|
||||
static char *log_create_filename (char *channame);
|
||||
|
||||
static char *
|
||||
scrollback_get_filename (session *sess)
|
||||
{
|
||||
char *net, *chan, *buf;
|
||||
char *net, *chan, *buf, *ret = NULL;
|
||||
|
||||
net = server_get_network (sess->server, FALSE);
|
||||
if (!net)
|
||||
@@ -85,54 +90,19 @@ scrollback_get_filename (session *sess)
|
||||
buf = NULL;
|
||||
g_free (chan);
|
||||
|
||||
return buf;
|
||||
if (buf)
|
||||
{
|
||||
ret = g_filename_from_utf8 (buf, -1, NULL, NULL, NULL);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
static void
|
||||
scrollback_unlock (session *sess)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
if (scrollback_get_filename (sess, buf, sizeof (buf) - 6) == NULL)
|
||||
return;
|
||||
|
||||
strcat (buf, ".lock");
|
||||
unlink (buf);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
scrollback_lock (session *sess)
|
||||
{
|
||||
char buf[1024];
|
||||
int fh;
|
||||
|
||||
if (scrollback_get_filename (sess, buf, sizeof (buf) - 6) == NULL)
|
||||
return FALSE;
|
||||
|
||||
strcat (buf, ".lock");
|
||||
|
||||
if (access (buf, F_OK) == 0)
|
||||
return FALSE; /* can't get lock */
|
||||
|
||||
fh = open (buf, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY, 0644);
|
||||
if (fh == -1)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
scrollback_close (session *sess)
|
||||
{
|
||||
if (sess->scrollfd != -1)
|
||||
{
|
||||
close (sess->scrollfd);
|
||||
sess->scrollfd = -1;
|
||||
}
|
||||
g_clear_object (&sess->scrollfile);
|
||||
}
|
||||
|
||||
/* shrink the file to roughly prefs.hex_text_max_lines */
|
||||
@@ -140,29 +110,13 @@ scrollback_close (session *sess)
|
||||
static void
|
||||
scrollback_shrink (session *sess)
|
||||
{
|
||||
char *file;
|
||||
char *buf;
|
||||
int fh;
|
||||
int lines;
|
||||
int line;
|
||||
char *buf, *p;
|
||||
gsize len;
|
||||
char *p;
|
||||
gint offset, lines = 0;
|
||||
const gint max_lines = MIN(prefs.hex_text_max_lines, SCROLLBACK_MAX);
|
||||
|
||||
scrollback_close (sess);
|
||||
sess->scrollwritten = 0;
|
||||
lines = 0;
|
||||
|
||||
if ((file = scrollback_get_filename (sess)) == NULL)
|
||||
{
|
||||
g_free (file);
|
||||
if (!g_file_load_contents (sess->scrollfile, NULL, &buf, &len, NULL, NULL))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_file_get_contents (file, &buf, &len, NULL))
|
||||
{
|
||||
g_free (file);
|
||||
return;
|
||||
}
|
||||
|
||||
/* count all lines */
|
||||
p = buf;
|
||||
@@ -173,42 +127,37 @@ scrollback_shrink (session *sess)
|
||||
p++;
|
||||
}
|
||||
|
||||
fh = g_open (file, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY, 0644);
|
||||
g_free (file);
|
||||
if (fh == -1)
|
||||
{
|
||||
g_free (buf);
|
||||
return;
|
||||
}
|
||||
offset = lines - max_lines;
|
||||
|
||||
line = 0;
|
||||
/* now just go back to where we want to start the file */
|
||||
p = buf;
|
||||
lines = 0;
|
||||
while (p != buf + len)
|
||||
{
|
||||
if (*p == '\n')
|
||||
{
|
||||
line++;
|
||||
if (line >= lines - prefs.hex_text_max_lines &&
|
||||
p + 1 != buf + len)
|
||||
lines++;
|
||||
if (lines == offset)
|
||||
{
|
||||
p++;
|
||||
write (fh, p, len - (p - buf));
|
||||
break;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
close (fh);
|
||||
if (g_file_replace_contents (sess->scrollfile, p, strlen(p), NULL, FALSE,
|
||||
G_FILE_CREATE_PRIVATE, NULL, NULL, NULL))
|
||||
sess->scrollwritten = lines;
|
||||
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
static void
|
||||
scrollback_save (session *sess, char *text)
|
||||
scrollback_save (session *sess, char *text, time_t stamp)
|
||||
{
|
||||
GOutputStream *ostream;
|
||||
char *buf;
|
||||
time_t stamp;
|
||||
int len;
|
||||
|
||||
if (sess->type == SESS_SERVER && prefs.hex_gui_tab_server == 1)
|
||||
return;
|
||||
@@ -224,47 +173,55 @@ scrollback_save (session *sess, char *text)
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess->scrollfd == -1)
|
||||
if (!sess->scrollfile)
|
||||
{
|
||||
if ((buf = scrollback_get_filename (sess)) == NULL)
|
||||
return;
|
||||
|
||||
sess->scrollfd = g_open (buf, O_CREAT | O_APPEND | O_WRONLY, 0644);
|
||||
sess->scrollfile = g_file_new_for_path (buf);
|
||||
g_free (buf);
|
||||
if (sess->scrollfd == -1)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Users can delete the folder after it's created... */
|
||||
GFile *parent = g_file_get_parent (sess->scrollfile);
|
||||
g_file_make_directory_with_parents (parent, NULL, NULL);
|
||||
g_object_unref (parent);
|
||||
}
|
||||
|
||||
stamp = time (0);
|
||||
ostream = G_OUTPUT_STREAM(g_file_append_to (sess->scrollfile, G_FILE_CREATE_PRIVATE, NULL, NULL));
|
||||
if (!ostream)
|
||||
return;
|
||||
|
||||
if (!stamp)
|
||||
stamp = time(0);
|
||||
if (sizeof (stamp) == 4) /* gcc will optimize one of these out */
|
||||
buf = g_strdup_printf ("T %d ", (int) stamp);
|
||||
else
|
||||
buf = g_strdup_printf ("T %" G_GINT64_FORMAT " ", (gint64)stamp);
|
||||
write (sess->scrollfd, buf, strlen (buf));
|
||||
g_free (buf);
|
||||
|
||||
len = strlen (text);
|
||||
write (sess->scrollfd, text, len);
|
||||
if (len && text[len - 1] != '\n')
|
||||
write (sess->scrollfd, "\n", 1);
|
||||
g_output_stream_write (ostream, buf, strlen (buf), NULL, NULL);
|
||||
g_output_stream_write (ostream, text, strlen (text), NULL, NULL);
|
||||
if (!g_str_has_suffix (text, "\n"))
|
||||
g_output_stream_write (ostream, "\n", 1, NULL, NULL);
|
||||
|
||||
g_free (buf);
|
||||
g_object_unref (ostream);
|
||||
|
||||
sess->scrollwritten++;
|
||||
|
||||
if ((sess->scrollwritten * 2 > prefs.hex_text_max_lines && prefs.hex_text_max_lines > 0) ||
|
||||
sess->scrollwritten > 32000)
|
||||
if ((sess->scrollwritten > prefs.hex_text_max_lines && prefs.hex_text_max_lines > 0) ||
|
||||
sess->scrollwritten > SCROLLBACK_MAX)
|
||||
scrollback_shrink (sess);
|
||||
}
|
||||
|
||||
void
|
||||
scrollback_load (session *sess)
|
||||
{
|
||||
char *buf;
|
||||
char *text;
|
||||
GDataInputStream *istream;
|
||||
gchar *buf, *text;
|
||||
gint lines = 0;
|
||||
time_t stamp;
|
||||
int lines;
|
||||
GIOChannel *io;
|
||||
GError *file_error = NULL;
|
||||
GError *io_err = NULL;
|
||||
|
||||
if (sess->text_scrollback == SET_DEFAULT)
|
||||
{
|
||||
@@ -277,39 +234,28 @@ scrollback_load (session *sess)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((buf = scrollback_get_filename (sess)) == NULL)
|
||||
return;
|
||||
if (!sess->scrollfile)
|
||||
{
|
||||
if ((buf = scrollback_get_filename (sess)) == NULL)
|
||||
return;
|
||||
|
||||
io = g_io_channel_new_file (buf, "r", &file_error);
|
||||
g_free (buf);
|
||||
if (!io)
|
||||
return;
|
||||
sess->scrollfile = g_file_new_for_path (buf);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
lines = 0;
|
||||
istream = file_get_datainputstream (sess->scrollfile);
|
||||
if (!istream)
|
||||
return;
|
||||
|
||||
while (1)
|
||||
{
|
||||
GError *err = NULL;
|
||||
gsize n_bytes;
|
||||
GIOStatus io_status;
|
||||
|
||||
io_status = g_io_channel_read_line (io, &buf, &n_bytes, NULL, &io_err);
|
||||
|
||||
if (io_status == G_IO_STATUS_NORMAL)
|
||||
buf = g_data_input_stream_read_line_utf8 (istream, &n_bytes, NULL, &err);
|
||||
|
||||
if (!err && buf)
|
||||
{
|
||||
char *buf_tmp;
|
||||
|
||||
/* If nothing but funny trailing matter e.g. 0x0d or 0x0d0a, toss it */
|
||||
if (n_bytes >= 1 && buf[0] == 0x0d)
|
||||
{
|
||||
g_free (buf);
|
||||
continue;
|
||||
}
|
||||
|
||||
n_bytes--;
|
||||
buf_tmp = buf;
|
||||
buf = g_strndup (buf_tmp, n_bytes);
|
||||
g_free (buf_tmp);
|
||||
|
||||
/*
|
||||
* Some scrollback lines have three blanks after the timestamp and a newline
|
||||
* Some have only one blank and a newline
|
||||
@@ -353,12 +299,27 @@ scrollback_load (session *sess)
|
||||
|
||||
g_free (buf);
|
||||
}
|
||||
else if (err)
|
||||
{
|
||||
/* If its only an encoding error it may be specific to the line */
|
||||
if (g_error_matches (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
|
||||
{
|
||||
g_warning ("Invalid utf8 in scrollback file\n");
|
||||
g_clear_error (&err);
|
||||
continue;
|
||||
}
|
||||
|
||||
else
|
||||
/* For general errors just give up */
|
||||
g_clear_error (&err);
|
||||
break;
|
||||
}
|
||||
else /* No new line */
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_io_channel_unref (io);
|
||||
g_object_unref (istream);
|
||||
|
||||
sess->scrollwritten = lines;
|
||||
|
||||
@@ -390,14 +351,30 @@ log_close (session *sess)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* filename should be in utf8 encoding and will be
|
||||
* converted to filesystem encoding automatically.
|
||||
*/
|
||||
static void
|
||||
mkdir_p (char *filename)
|
||||
{
|
||||
char *dirname = g_path_get_dirname (filename);
|
||||
char *dirname, *dirname_fs;
|
||||
GError *err = NULL;
|
||||
|
||||
dirname = g_path_get_dirname (filename);
|
||||
dirname_fs = g_filename_from_utf8 (dirname, -1, NULL, NULL, &err);
|
||||
if (!dirname_fs)
|
||||
{
|
||||
g_warning ("%s", err->message);
|
||||
g_error_free (err);
|
||||
g_free (dirname);
|
||||
return;
|
||||
}
|
||||
|
||||
g_mkdir_with_parents (dirname, 0700);
|
||||
g_mkdir_with_parents (dirname_fs, 0700);
|
||||
|
||||
g_free (dirname);
|
||||
g_free (dirname_fs);
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -505,34 +482,6 @@ log_insert_vars (char *buf, int bufsize, char *fmt, char *c, char *n, char *s)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
logmask_is_fullpath ()
|
||||
{
|
||||
/* Check if final path/filename is absolute or relative.
|
||||
* If one uses log mask variables, such as "%c/...", %c will be empty upon
|
||||
* connecting since there's no channel name yet, so we have to make sure
|
||||
* we won't try to write to the FS root. On Windows we can be sure it's
|
||||
* full path if the 2nd character is a colon since Windows doesn't allow
|
||||
* colons in filenames.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
/* Treat it as full path if it
|
||||
* - starts with '\' which denotes the root directory of the current drive letter
|
||||
* - starts with a drive letter and followed by ':'
|
||||
*/
|
||||
if (prefs.hex_irc_logmask[0] == '\\' || (((prefs.hex_irc_logmask[0] >= 'A' && prefs.hex_irc_logmask[0] <= 'Z') || (prefs.hex_irc_logmask[0] >= 'a' && prefs.hex_irc_logmask[0] <= 'z')) && prefs.hex_irc_logmask[1] == ':'))
|
||||
#else
|
||||
if (prefs.hex_irc_logmask[0] == '/')
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
log_create_pathname (char *servname, char *channame, char *netname)
|
||||
{
|
||||
@@ -559,16 +508,21 @@ log_create_pathname (char *servname, char *channame, char *netname)
|
||||
channame = log_create_filename (channame);
|
||||
}
|
||||
|
||||
servname = log_create_filename (servname);
|
||||
|
||||
log_insert_vars (fname, sizeof (fname), prefs.hex_irc_logmask, channame, netname, servname);
|
||||
g_free (channame);
|
||||
g_free (netname);
|
||||
g_free (servname);
|
||||
|
||||
/* insert time/date */
|
||||
now = time (NULL);
|
||||
strftime_utf8 (fnametime, sizeof (fnametime), fname, now);
|
||||
|
||||
/* create final path/filename */
|
||||
if (logmask_is_fullpath ())
|
||||
/* If one uses log mask variables, such as "%c/...", %c will be empty upon
|
||||
* connecting since there's no channel name yet, so we have to make sure
|
||||
* we won't try to write to the FS root. */
|
||||
if (g_path_is_absolute (prefs.hex_irc_logmask))
|
||||
{
|
||||
g_snprintf (fname, sizeof (fname), "%s", fnametime);
|
||||
}
|
||||
@@ -595,11 +549,7 @@ log_open_file (char *servname, char *channame, char *netname)
|
||||
if (!file)
|
||||
return -1;
|
||||
|
||||
#ifdef WIN32
|
||||
fd = g_open (file, O_CREAT | O_APPEND | O_WRONLY, S_IREAD|S_IWRITE);
|
||||
#else
|
||||
fd = g_open (file, O_CREAT | O_APPEND | O_WRONLY, 0644);
|
||||
#endif
|
||||
fd = g_open (file, O_CREAT | O_APPEND | O_WRONLY | OFLAGS, 0644);
|
||||
g_free (file);
|
||||
|
||||
if (fd == -1)
|
||||
@@ -658,33 +608,29 @@ log_open_or_close (session *sess)
|
||||
int
|
||||
get_stamp_str (char *fmt, time_t tim, char **ret)
|
||||
{
|
||||
char *loc = NULL;
|
||||
char dest[128];
|
||||
gsize len;
|
||||
gsize len_locale;
|
||||
gsize len_utf8;
|
||||
|
||||
/* strftime wants the format string in LOCALE! */
|
||||
if (!prefs.utf8_locale)
|
||||
/* strftime requires the format string to be in locale encoding. */
|
||||
fmt = g_locale_from_utf8 (fmt, -1, NULL, NULL, NULL);
|
||||
|
||||
len_locale = strftime_validated (dest, sizeof (dest), fmt, localtime (&tim));
|
||||
|
||||
g_free (fmt);
|
||||
|
||||
if (len_locale == 0)
|
||||
{
|
||||
const gchar *charset;
|
||||
|
||||
g_get_charset (&charset);
|
||||
loc = g_convert_with_fallback (fmt, -1, charset, "UTF-8", "?", 0, 0, 0);
|
||||
if (loc)
|
||||
fmt = loc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = strftime_validated (dest, sizeof (dest), fmt, localtime (&tim));
|
||||
if (len)
|
||||
*ret = g_locale_to_utf8 (dest, len_locale, NULL, &len_utf8, NULL);
|
||||
if (*ret == NULL)
|
||||
{
|
||||
if (prefs.utf8_locale)
|
||||
*ret = g_strdup (dest);
|
||||
else
|
||||
*ret = g_locale_to_utf8 (dest, len, 0, &len, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_free (loc);
|
||||
|
||||
return len;
|
||||
return len_utf8;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -707,7 +653,9 @@ log_write (session *sess, char *text, time_t ts)
|
||||
}
|
||||
|
||||
if (sess->logfd == -1)
|
||||
{
|
||||
log_open (sess);
|
||||
}
|
||||
|
||||
/* change to a different log file? */
|
||||
file = log_create_pathname (sess->server->servername, sess->channel, server_get_network (sess->server, FALSE));
|
||||
@@ -715,12 +663,22 @@ log_write (session *sess, char *text, time_t ts)
|
||||
{
|
||||
if (g_access (file, F_OK) != 0)
|
||||
{
|
||||
close (sess->logfd);
|
||||
if (sess->logfd != -1)
|
||||
{
|
||||
close (sess->logfd);
|
||||
}
|
||||
|
||||
sess->logfd = log_open_file (sess->server->servername, sess->channel, server_get_network (sess->server, FALSE));
|
||||
}
|
||||
|
||||
g_free (file);
|
||||
}
|
||||
|
||||
if (sess->logfd == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (prefs.hex_stamp_log)
|
||||
{
|
||||
if (!ts) ts = time(0);
|
||||
@@ -731,6 +689,7 @@ log_write (session *sess, char *text, time_t ts)
|
||||
g_free (stamp);
|
||||
}
|
||||
}
|
||||
|
||||
temp = strip_color (text, -1, STRIP_ALL);
|
||||
len = strlen (temp);
|
||||
write (sess->logfd, temp, len);
|
||||
@@ -740,154 +699,104 @@ log_write (session *sess, char *text, time_t ts)
|
||||
g_free (temp);
|
||||
}
|
||||
|
||||
/* converts a CP1252/ISO-8859-1(5) hybrid to UTF-8 */
|
||||
/* Features: 1. It never fails, all 00-FF chars are converted to valid UTF-8 */
|
||||
/* 2. Uses CP1252 in the range 80-9f because ISO doesn't have any- */
|
||||
/* thing useful in this range and it helps us receive from mIRC */
|
||||
/* 3. The five undefined chars in CP1252 80-9f are replaced with */
|
||||
/* ISO-8859-15 control codes. */
|
||||
/* 4. Handles 0xa4 as a Euro symbol ala ISO-8859-15. */
|
||||
/* 5. Uses ISO-8859-1 (which matches CP1252) for everything else. */
|
||||
/* 6. This routine measured 3x faster than g_convert :) */
|
||||
|
||||
static unsigned char *
|
||||
iso_8859_1_to_utf8 (unsigned char *text, int len, gsize *bytes_written)
|
||||
/**
|
||||
* Converts a given string using the given iconv converter. This is similar to g_convert_with_fallback, except that it is tolerant of sequences in
|
||||
* the original input that are invalid even in from_encoding. g_convert_with_fallback fails for such text, whereas this function replaces such a
|
||||
* sequence with the fallback string.
|
||||
*
|
||||
* If len is -1, strlen(text) is used to calculate the length. Do not pass -1 if text is supposed to contain \0 bytes, such as if from_encoding is a
|
||||
* multi-byte encoding like UTF-16.
|
||||
*/
|
||||
gchar *
|
||||
text_convert_invalid (const gchar* text, gssize len, GIConv converter, const gchar *fallback, gsize *len_out)
|
||||
{
|
||||
unsigned int idx;
|
||||
unsigned char *res, *output;
|
||||
static const unsigned short lowtable[] = /* 74 byte table for 80-a4 */
|
||||
{
|
||||
/* compressed utf-8 table: if the first byte's 0x20 bit is set, it
|
||||
indicates a 2-byte utf-8 sequence, otherwise prepend a 0xe2. */
|
||||
0x82ac, /* 80 Euro. CP1252 from here on... */
|
||||
0xe281, /* 81 NA */
|
||||
0x809a, /* 82 */
|
||||
0xe692, /* 83 */
|
||||
0x809e, /* 84 */
|
||||
0x80a6, /* 85 */
|
||||
0x80a0, /* 86 */
|
||||
0x80a1, /* 87 */
|
||||
0xeb86, /* 88 */
|
||||
0x80b0, /* 89 */
|
||||
0xe5a0, /* 8a */
|
||||
0x80b9, /* 8b */
|
||||
0xe592, /* 8c */
|
||||
0xe28d, /* 8d NA */
|
||||
0xe5bd, /* 8e */
|
||||
0xe28f, /* 8f NA */
|
||||
0xe290, /* 90 NA */
|
||||
0x8098, /* 91 */
|
||||
0x8099, /* 92 */
|
||||
0x809c, /* 93 */
|
||||
0x809d, /* 94 */
|
||||
0x80a2, /* 95 */
|
||||
0x8093, /* 96 */
|
||||
0x8094, /* 97 */
|
||||
0xeb9c, /* 98 */
|
||||
0x84a2, /* 99 */
|
||||
0xe5a1, /* 9a */
|
||||
0x80ba, /* 9b */
|
||||
0xe593, /* 9c */
|
||||
0xe29d, /* 9d NA */
|
||||
0xe5be, /* 9e */
|
||||
0xe5b8, /* 9f */
|
||||
0xe2a0, /* a0 */
|
||||
0xe2a1, /* a1 */
|
||||
0xe2a2, /* a2 */
|
||||
0xe2a3, /* a3 */
|
||||
0x82ac /* a4 ISO-8859-15 Euro. */
|
||||
};
|
||||
gchar *result_part;
|
||||
gsize result_part_len;
|
||||
const gchar *end;
|
||||
gsize invalid_start_pos;
|
||||
GString *result;
|
||||
const gchar *current_start;
|
||||
|
||||
if (len == -1)
|
||||
len = strlen (text);
|
||||
|
||||
/* worst case scenario: every byte turns into 3 bytes */
|
||||
res = output = g_malloc ((len * 3) + 1);
|
||||
|
||||
while (len)
|
||||
{
|
||||
if (G_LIKELY (*text < 0x80))
|
||||
{
|
||||
*output = *text; /* ascii maps directly */
|
||||
}
|
||||
else if (*text <= 0xa4) /* 80-a4 use a lookup table */
|
||||
{
|
||||
idx = *text - 0x80;
|
||||
if (lowtable[idx] & 0x2000)
|
||||
{
|
||||
*output++ = (lowtable[idx] >> 8) & 0xdf; /* 2 byte utf-8 */
|
||||
*output = lowtable[idx] & 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
*output++ = 0xe2; /* 3 byte utf-8 */
|
||||
*output++ = (lowtable[idx] >> 8) & 0xff;
|
||||
*output = lowtable[idx] & 0xff;
|
||||
}
|
||||
}
|
||||
else if (*text < 0xc0)
|
||||
{
|
||||
*output++ = 0xc2;
|
||||
*output = *text;
|
||||
}
|
||||
else
|
||||
{
|
||||
*output++ = 0xc3;
|
||||
*output = *text - 0x40;
|
||||
}
|
||||
output++;
|
||||
text++;
|
||||
len--;
|
||||
len = strlen (text);
|
||||
}
|
||||
*output = 0; /* terminate */
|
||||
*bytes_written = output - res;
|
||||
|
||||
return res;
|
||||
end = text + len;
|
||||
|
||||
/* Find the first position of an invalid sequence. */
|
||||
result_part = g_convert_with_iconv (text, len, converter, &invalid_start_pos, &result_part_len, NULL);
|
||||
if (result_part != NULL)
|
||||
{
|
||||
/* All text converted successfully on the first try. Return it. */
|
||||
|
||||
if (len_out != NULL)
|
||||
{
|
||||
*len_out = result_part_len;
|
||||
}
|
||||
|
||||
return result_part;
|
||||
}
|
||||
|
||||
/* One or more invalid sequences exist that need to be replaced with the fallback. */
|
||||
|
||||
result = g_string_sized_new (len);
|
||||
current_start = text;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
g_assert (current_start + invalid_start_pos < end);
|
||||
|
||||
/* Convert everything before the position of the invalid sequence. It should be successful. */
|
||||
result_part = g_convert_with_iconv (current_start, invalid_start_pos, converter, &invalid_start_pos, &result_part_len, NULL);
|
||||
g_assert (result_part != NULL);
|
||||
g_string_append_len (result, result_part, result_part_len);
|
||||
g_free (result_part);
|
||||
|
||||
/* Append the fallback */
|
||||
g_string_append (result, fallback);
|
||||
|
||||
/* Now try converting everything after the invalid sequence. */
|
||||
current_start += invalid_start_pos + 1;
|
||||
|
||||
result_part = g_convert_with_iconv (current_start, end - current_start, converter, &invalid_start_pos, &result_part_len, NULL);
|
||||
if (result_part != NULL)
|
||||
{
|
||||
/* The rest of the text converted successfully. Append it and return the whole converted text. */
|
||||
|
||||
g_string_append_len (result, result_part, result_part_len);
|
||||
g_free (result_part);
|
||||
|
||||
if (len_out != NULL)
|
||||
{
|
||||
*len_out = result->len;
|
||||
}
|
||||
|
||||
return g_string_free (result, FALSE);
|
||||
}
|
||||
|
||||
/* The rest of the text didn't convert successfully. invalid_start_pos has the position of the next invalid sequence. */
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
text_validate (char **text, gssize *len)
|
||||
/**
|
||||
* Replaces any invalid UTF-8 in the given text with the unicode replacement character.
|
||||
*/
|
||||
gchar *
|
||||
text_fixup_invalid_utf8 (const gchar* text, gssize len, gsize *len_out)
|
||||
{
|
||||
char *utf;
|
||||
gsize utf_len;
|
||||
|
||||
/* valid utf8? */
|
||||
if (g_utf8_validate (*text, *len, 0))
|
||||
return NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
if (GetACP () == 1252) /* our routine is better than iconv's 1252 */
|
||||
#else
|
||||
if (prefs.utf8_locale)
|
||||
#endif
|
||||
/* fallback to iso-8859-1 */
|
||||
utf = iso_8859_1_to_utf8 (*text, *len, &utf_len);
|
||||
else
|
||||
static GIConv utf8_fixup_converter = NULL;
|
||||
if (utf8_fixup_converter == NULL)
|
||||
{
|
||||
/* fallback to locale */
|
||||
utf = g_locale_to_utf8 (*text, *len, 0, &utf_len, NULL);
|
||||
if (!utf)
|
||||
utf = iso_8859_1_to_utf8 (*text, *len, &utf_len);
|
||||
utf8_fixup_converter = g_iconv_open ("UTF-8", "UTF-8");
|
||||
}
|
||||
|
||||
if (!utf)
|
||||
{
|
||||
*text = g_strdup ("%INVALID%");
|
||||
*len = 9;
|
||||
} else
|
||||
{
|
||||
*text = utf;
|
||||
*len = utf_len;
|
||||
}
|
||||
|
||||
return utf;
|
||||
return text_convert_invalid (text, len, utf8_fixup_converter, unicode_fallback_string, len_out);
|
||||
}
|
||||
|
||||
void
|
||||
PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
|
||||
{
|
||||
char *conv;
|
||||
|
||||
if (!sess)
|
||||
{
|
||||
if (!sess_list)
|
||||
@@ -896,22 +805,19 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
|
||||
}
|
||||
|
||||
/* make sure it's valid utf8 */
|
||||
if (text[0] == 0)
|
||||
if (text[0] == '\0')
|
||||
{
|
||||
text = "\n";
|
||||
conv = NULL;
|
||||
text = g_strdup ("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
gssize len = -1;
|
||||
conv = text_validate ((char **)&text, &len);
|
||||
text = text_fixup_invalid_utf8 (text, -1, NULL);
|
||||
}
|
||||
|
||||
log_write (sess, text, timestamp);
|
||||
scrollback_save (sess, text);
|
||||
scrollback_save (sess, text, timestamp);
|
||||
fe_print_text (sess, text, timestamp, FALSE);
|
||||
|
||||
g_free (conv);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1054,6 +960,11 @@ static char * const pevt_capack_help[] = {
|
||||
N_("Acknowledged Capabilities")
|
||||
};
|
||||
|
||||
static char * const pevt_capdel_help[] = {
|
||||
N_("Server Name"),
|
||||
N_("Removed Capabilities")
|
||||
};
|
||||
|
||||
static char * const pevt_caplist_help[] = {
|
||||
N_("Server Name"),
|
||||
N_("Server Capabilities")
|
||||
@@ -1205,26 +1116,26 @@ static char * const pevt_chanrmlimit_help[] = {
|
||||
};
|
||||
|
||||
static char * const pevt_chandeop_help[] = {
|
||||
N_("The nick of the person of did the deop'ing"),
|
||||
N_("The nick of the person who did the deop'ing"),
|
||||
N_("The nick of the person who has been deop'ed"),
|
||||
};
|
||||
static char * const pevt_chandehop_help[] = {
|
||||
N_("The nick of the person of did the dehalfop'ing"),
|
||||
N_("The nick of the person who did the dehalfop'ing"),
|
||||
N_("The nick of the person who has been dehalfop'ed"),
|
||||
};
|
||||
|
||||
static char * const pevt_chandevoice_help[] = {
|
||||
N_("The nick of the person of did the devoice'ing"),
|
||||
N_("The nick of the person who did the devoice'ing"),
|
||||
N_("The nick of the person who has been devoice'ed"),
|
||||
};
|
||||
|
||||
static char * const pevt_chanunban_help[] = {
|
||||
N_("The nick of the person of did the unban'ing"),
|
||||
N_("The nick of the person who did the unban'ing"),
|
||||
N_("The ban mask"),
|
||||
};
|
||||
|
||||
static char * const pevt_chanunquiet_help[] = {
|
||||
N_("The nick of the person of did the unquiet'ing"),
|
||||
N_("The nick of the person who did the unquiet'ing"),
|
||||
N_("The quiet mask"),
|
||||
};
|
||||
|
||||
@@ -2212,7 +2123,7 @@ char *sound_files[NUM_XP];
|
||||
void
|
||||
sound_beep (session *sess)
|
||||
{
|
||||
if (!prefs.hex_gui_focus_omitalerts || !fe_gui_info (sess, 0) == 1)
|
||||
if (!prefs.hex_gui_focus_omitalerts || fe_gui_info (sess, 0) != 1)
|
||||
{
|
||||
if (sound_files[XP_TE_BEEP] && sound_files[XP_TE_BEEP][0])
|
||||
/* user defined beep _file_ */
|
||||
@@ -2238,12 +2149,8 @@ sound_play (const char *file, gboolean quiet)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/* check for fullpath */
|
||||
if (file[0] == '\\' || (((file[0] >= 'A' && file[0] <= 'Z') || (file[0] >= 'a' && file[0] <= 'z')) && file[1] == ':'))
|
||||
#else
|
||||
if (file[0] == '/')
|
||||
#endif
|
||||
if (g_path_is_absolute (file))
|
||||
{
|
||||
wavfile = g_strdup (file);
|
||||
}
|
||||
|
||||
@@ -57,11 +57,15 @@ void text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
|
||||
time_t timestamp);
|
||||
int text_emit_by_name (char *name, session *sess, time_t timestamp,
|
||||
char *a, char *b, char *c, char *d);
|
||||
char *text_validate (char **text, gssize *len);
|
||||
gchar *text_convert_invalid (const gchar* text, gssize len, GIConv converter, const gchar *fallback, gsize *len_out);
|
||||
gchar *text_fixup_invalid_utf8 (const gchar* text, gssize len, gsize *len_out);
|
||||
int get_stamp_str (char *fmt, time_t tim, char **ret);
|
||||
void format_event (session *sess, int index, char **args, char *o, gsize sizeofo, unsigned int stripcolor_args);
|
||||
char *text_find_format_string (char *name);
|
||||
|
||||
|
||||
extern const gchar* unicode_fallback_string;
|
||||
extern const gchar* arbitrary_encoding_fallback_string;
|
||||
|
||||
void sound_play (const char *file, gboolean quiet);
|
||||
void sound_play_event (int i);
|
||||
void sound_beep (session *);
|
||||
|
||||
@@ -28,6 +28,12 @@ pevt_capack_help
|
||||
%C29*%O$tCapabilities acknowledged: %C29$2%O
|
||||
2
|
||||
|
||||
Capability Deleted
|
||||
XP_TE_CAPDEL
|
||||
pevt_capdel_help
|
||||
%C29*%O$tCapabilities removed: %C29$2%O
|
||||
2
|
||||
|
||||
Capability List
|
||||
XP_TE_CAPLIST
|
||||
pevt_caplist_help
|
||||
@@ -751,8 +757,8 @@ n2
|
||||
Stop Connection
|
||||
XP_TE_STOPCONNECT
|
||||
pevt_sconnect_help
|
||||
%C23*%O$tStopped previous connection attempt
|
||||
0
|
||||
%C23*%O$tStopped previous connection attempt (%C24$1%O)
|
||||
1
|
||||
|
||||
Topic
|
||||
XP_TE_TOPIC
|
||||
|
||||
@@ -68,42 +68,47 @@ url_clear (void)
|
||||
}
|
||||
|
||||
static int
|
||||
url_save_cb (char *url, FILE *fd)
|
||||
url_save_cb (char *url, GOutputStream *ostream)
|
||||
{
|
||||
fprintf (fd, "%s\n", url);
|
||||
stream_writef (ostream, "%s\n", url);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
url_save_tree (const char *fname, const char *mode, gboolean fullpath)
|
||||
url_save_tree (const char *fname)
|
||||
{
|
||||
FILE *fd;
|
||||
GFile *file;
|
||||
GOutputStream *ostream;
|
||||
|
||||
if (fullpath)
|
||||
fd = hexchat_fopen_file (fname, mode, XOF_FULLPATH);
|
||||
else
|
||||
fd = hexchat_fopen_file (fname, mode, 0);
|
||||
if (fd == NULL)
|
||||
return;
|
||||
file = hexchat_open_gfile (fname);
|
||||
|
||||
tree_foreach (url_tree, (tree_traverse_func *)url_save_cb, fd);
|
||||
fclose (fd);
|
||||
ostream = G_OUTPUT_STREAM(g_file_append_to (file, G_FILE_CREATE_NONE, NULL, NULL));
|
||||
if (ostream)
|
||||
{
|
||||
tree_foreach (url_tree, (tree_traverse_func *)url_save_cb, ostream);
|
||||
g_object_unref (ostream);
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
url_save_node (char* url)
|
||||
{
|
||||
FILE *fd;
|
||||
GFile *file;
|
||||
GOutputStream *ostream;
|
||||
|
||||
/* open <config>/url.log in append mode */
|
||||
fd = hexchat_fopen_file ("url.log", "a", 0);
|
||||
if (fd == NULL)
|
||||
file = hexchat_open_gfile ("url.log");
|
||||
|
||||
ostream = G_OUTPUT_STREAM(g_file_append_to (file, G_FILE_CREATE_NONE, NULL, NULL));
|
||||
if (ostream)
|
||||
{
|
||||
return;
|
||||
stream_writef (ostream, "%s\n", url);
|
||||
g_object_unref (ostream);
|
||||
}
|
||||
|
||||
fprintf (fd, "%s\n", url);
|
||||
fclose (fd);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -33,7 +33,7 @@ extern void *url_tree;
|
||||
#define WORD_PATH -2
|
||||
|
||||
void url_clear (void);
|
||||
void url_save_tree (const char *fname, const char *mode, gboolean fullpath);
|
||||
void url_save_tree (const char *fname);
|
||||
int url_last (int *, int *);
|
||||
int url_check_word (const char *word);
|
||||
void url_check_line (char *buf);
|
||||
|
||||