Compare commits
2 Commits
pr-1320
...
wip/connec
Author | SHA1 | Date | |
---|---|---|---|
![]() |
480fa3cefc | ||
![]() |
eb08bcfacf |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,7 +2,6 @@
|
||||
# Unix generated files
|
||||
.deps/
|
||||
.libs/
|
||||
.dirstamp
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
|
64
configure.ac
64
configure.ac
@@ -18,7 +18,6 @@ AM_MAINTAINER_MODE
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CPP
|
||||
AC_PROG_OBJC
|
||||
AM_PROG_AS
|
||||
AM_PROG_AR
|
||||
AM_DISABLE_STATIC
|
||||
@@ -39,8 +38,6 @@ 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])
|
||||
@@ -74,12 +71,9 @@ else
|
||||
fi
|
||||
|
||||
platform_win32=no
|
||||
platform_osx=no
|
||||
case $host_os in
|
||||
*mingw*|*cygwin*|*msys*)
|
||||
platform_win32=yes;;
|
||||
darwin*)
|
||||
platform_osx=yes;;
|
||||
*);;
|
||||
esac
|
||||
|
||||
@@ -144,10 +138,6 @@ 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)
|
||||
@@ -180,25 +170,31 @@ dnl *********************************************************************
|
||||
dnl ** GLIB *************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
AM_PATH_GLIB_2_0([2.32.0], [], [AC_MSG_ERROR([Glib not found!])], [gmodule gobject gio])
|
||||
AM_PATH_GLIB_2_0([2.36.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_32], [Dont warn using older APIs])
|
||||
AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_32], [Prevents using newer APIs])
|
||||
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])
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** GTK **************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
# we might get undefined macro without this test
|
||||
if test "$gtkfe" = yes ; then
|
||||
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"
|
||||
], [
|
||||
AM_PATH_GTK_2_0(2.24.0, havegtk=yes, havegtk=no)
|
||||
|
||||
if test "$havegtk" = no; then
|
||||
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 *********************************************************************
|
||||
@@ -399,26 +395,6 @@ if test "$retry" = "yes"; then
|
||||
LIBS=$SAVED_LIBS
|
||||
fi
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** LIBPROXY *********************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "x$libproxy" = "xyes" -o "x$libproxy" = "xauto" ; then
|
||||
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
|
||||
], [
|
||||
if test "x$libproxy" = "xyes" ; then
|
||||
AC_MSG_ERROR(Cannot find libproxy!)
|
||||
fi
|
||||
libproxy=no
|
||||
])
|
||||
else
|
||||
libproxy=no
|
||||
fi
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** PLUGIN ***********************************************************
|
||||
dnl *********************************************************************
|
||||
@@ -490,14 +466,7 @@ if test "$sysinfo" != "no"; then
|
||||
AC_MSG_CHECKING(for plugin interface used by SysInfo)
|
||||
if test "$plugin" = yes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if test "$platform_osx" = yes; then
|
||||
sysinfo=yes
|
||||
else
|
||||
PKG_CHECK_MODULES(LIBPCI, libpci >= 3.0.0, [
|
||||
sysinfo=yes
|
||||
AC_DEFINE(HAVE_LIBPCI)
|
||||
], [sysinfo=no])
|
||||
fi
|
||||
PKG_CHECK_MODULES(LIBPCI, libpci >= 3.0.0, [sysinfo=yes], [sysinfo=no])
|
||||
else
|
||||
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for SysInfo])
|
||||
sysinfo=no
|
||||
@@ -603,9 +572,7 @@ 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 ********************************************************
|
||||
@@ -825,7 +792,6 @@ 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
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,19 +19,57 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcchecksum</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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>
|
||||
@@ -40,10 +77,19 @@
|
||||
</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;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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>
|
||||
@@ -56,4 +102,6 @@
|
||||
<None Include="checksum.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,19 +19,57 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcdoat</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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;$(HexChatLib);$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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>
|
||||
@@ -40,10 +77,19 @@
|
||||
</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;$(HexChatLib);$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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>
|
||||
@@ -56,4 +102,6 @@
|
||||
<None Include="doat.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,28 +19,75 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcexec</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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>
|
||||
@@ -52,4 +98,6 @@
|
||||
<ClCompile Include="exec.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,19 +19,57 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcfishlim</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(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>
|
||||
@@ -40,10 +77,19 @@
|
||||
</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>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;%(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>
|
||||
@@ -66,4 +112,6 @@
|
||||
<ClCompile Include="plugin_hexchat.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,19 +19,57 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcmpcinfo</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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>
|
||||
@@ -40,10 +77,19 @@
|
||||
</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>
|
||||
@@ -56,4 +102,6 @@
|
||||
<ClCompile Include="mpcInfo.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,20 +19,58 @@
|
||||
<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" />
|
||||
<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>
|
||||
<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>
|
||||
</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>$(IntDir);..\..\src\common;$(HexChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(PerlPath)\lib\CORE;$(IntDir);..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(IntDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(PerlLib).lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>perl.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>$(PerlLib).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
@@ -41,7 +78,7 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(GendefPath)\gendef" "$(PerlPath)\bin\$(PerlLib).dll"
|
||||
move $(PerlLib).def "$(IntDir)"
|
||||
lib /nologo /machine:x86 "/def:$(IntDir)$(PerlLib).def" "/out:$(IntDir)\$(PerlLib).lib"
|
||||
lib /nologo /machine:x86 "/def:$(IntDir)$(PerlLib).def" "/out:$(OutDir)\$(PerlLib).lib"
|
||||
"$(PerlPath)\bin\perl.exe" generate_header
|
||||
move irc.pm.h "$(IntDir)"
|
||||
move hexchat.pm.h "$(IntDir)"</Command>
|
||||
@@ -49,11 +86,20 @@ 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>$(IntDir);..\..\src\common;$(HexChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(PerlPath)\lib\CORE;$(IntDir);..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(IntDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(PerlLib).lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>perl.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>$(PerlLib).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
@@ -61,7 +107,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:$(IntDir)\$(PerlLib).lib"
|
||||
lib /nologo /machine:x64 "/def:$(IntDir)$(PerlLib).def" "/out:$(OutDir)\$(PerlLib).lib"
|
||||
"$(PerlPath)\bin\perl.exe" generate_header
|
||||
move irc.pm.h "$(IntDir)"
|
||||
move hexchat.pm.h "$(IntDir)"</Command>
|
||||
@@ -74,4 +120,6 @@ move hexchat.pm.h "$(IntDir)"</Command>
|
||||
<ClCompile Include="perl.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,33 +19,80 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>$(Python2Output)</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python2Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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;$(Python2Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(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;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python2Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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;$(Python2Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(Python2Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -56,4 +102,6 @@
|
||||
<ClCompile Include="python.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,33 +19,80 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>$(Python3Output)</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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;$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(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;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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;$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -56,4 +102,6 @@
|
||||
<ClCompile Include="python.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -1,17 +1,7 @@
|
||||
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 = $(sources)
|
||||
sysinfo_la_SOURCES = match.c parse.c pci.c xsys.c
|
||||
sysinfo_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
sysinfo_la_LIBADD = $(LIBPCI_LIBS) $(GLIB_LIBS)
|
||||
AM_CPPFLAGS = $(LIBPCI_CFLAGS) $(GLIB_CFLAGS) -I$(top_srcdir)/src/common -I$(srcdir)/shared
|
||||
sysinfo_la_CFLAGS = $(LIBPCI_CFLAGS) $(GLIB_CFLAGS) -I$(srcdir)/../../src/common
|
||||
|
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* 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
|
228
plugins/sysinfo/match.c
Normal file
228
plugins/sysinfo/match.c
Normal file
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
@@ -23,7 +23,13 @@
|
||||
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
|
@@ -1,263 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@@ -23,19 +23,20 @@
|
||||
#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)
|
||||
int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned int *count)
|
||||
{
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__alpha__) || defined(__ia64__) || defined(__parisc__) || defined(__sparc__)
|
||||
char buffer[bsize];
|
||||
@@ -46,6 +47,9 @@ int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
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)
|
||||
@@ -53,7 +57,10 @@ int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
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)
|
||||
@@ -61,7 +68,10 @@ int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
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
|
||||
@@ -71,6 +81,8 @@ int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
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
|
||||
@@ -80,15 +92,20 @@ int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
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;
|
||||
@@ -98,8 +115,22 @@ int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
{
|
||||
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);
|
||||
@@ -107,20 +138,43 @@ int xs_parse_cpu(char *model, char *vendor, double *freq)
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint64 xs_parse_uptime(void)
|
||||
int xs_parse_uptime(int *weeks, int *days, int *hours, int *minutes, int *seconds)
|
||||
{
|
||||
char buffer[bsize];
|
||||
gint64 uptime = 0;
|
||||
long long uptime = 0;
|
||||
FILE *fp = fopen("/proc/uptime", "r");
|
||||
if(fp == NULL)
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
if(fgets(buffer, bsize, fp) != NULL)
|
||||
uptime = g_ascii_strtoll(buffer, NULL, 0);
|
||||
uptime = strtol(buffer, NULL, 0);
|
||||
|
||||
*seconds = uptime%60;
|
||||
*minutes = (uptime/60)%60;
|
||||
*hours = (uptime/3600)%24;
|
||||
*days = (uptime/86400)%7;
|
||||
*weeks = uptime/604800;
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return uptime;
|
||||
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;
|
||||
}
|
||||
|
||||
int xs_parse_sound(char *snd_card)
|
||||
@@ -129,13 +183,12 @@ 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;
|
||||
}
|
||||
@@ -146,13 +199,13 @@ int xs_parse_sound(char *snd_card)
|
||||
if(isdigit(buffer[0]) || isdigit(buffer[1]))
|
||||
{
|
||||
char card_buf[bsize];
|
||||
gint64 card_id = 0;
|
||||
long card_id = 0;
|
||||
pos = strstr(buffer, ":");
|
||||
card_id = g_ascii_strtoll(buffer, NULL, 0);
|
||||
card_id = strtoll(buffer, NULL, 0);
|
||||
if (card_id == 0)
|
||||
g_snprintf(card_buf, bsize, "%s", pos+2);
|
||||
else
|
||||
g_snprintf(card_buf, bsize, "%"G_GINT64_FORMAT": %s", card_id, pos+2);
|
||||
g_snprintf(card_buf, bsize, "%ld: %s", card_id, pos+2);
|
||||
pos = strstr(card_buf, "\n");
|
||||
*pos = '\0';
|
||||
strcat(cards, card_buf);
|
||||
@@ -198,42 +251,129 @@ 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);
|
||||
|
||||
/* Convert to bytes */
|
||||
*mem_free *= 1000;
|
||||
*mem_tot *= 1000;
|
||||
return 0;
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xs_parse_distro(char *name)
|
||||
@@ -289,12 +429,10 @@ 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,9 +23,12 @@
|
||||
#ifndef _PARSE_H_
|
||||
#define _PARSE_H_
|
||||
|
||||
int xs_parse_cpu(char *model, char *vendor, double *freq);
|
||||
gint64 xs_parse_uptime(void);
|
||||
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_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,67 +23,64 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <pci/pci.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "sysinfo.h"
|
||||
#include "xsys.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)
|
||||
@@ -97,21 +94,19 @@ 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)
|
||||
@@ -122,44 +117,38 @@ 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);
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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
|
@@ -1,277 +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 "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;
|
||||
}
|
416
plugins/sysinfo/sysinfo.cpp
Normal file
416
plugins/sysinfo/sysinfo.cpp
Normal file
@@ -0,0 +1,416 @@
|
||||
/* 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;
|
||||
}
|
@@ -2,8 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -21,51 +19,91 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcsysinfo</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>wbemuuid.lib;comsupp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
</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;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>wbemuuid.lib;comsupp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="sysinfo.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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" />
|
||||
<ClCompile Include="sysinfo.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -9,9 +9,6 @@
|
||||
<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">
|
||||
@@ -19,25 +16,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sysinfo.c">
|
||||
<ClCompile Include="sysinfo.cpp">
|
||||
<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>
|
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
@@ -1,98 +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 <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;
|
||||
}
|
||||
}
|
||||
|
@@ -1,493 +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 <wbemidl.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "../format.h"
|
||||
|
||||
/* Cache the info for subsequent invocations of /SYSINFO */
|
||||
static int cpu_arch = 0;
|
||||
static char *os_name = NULL;
|
||||
static char *cpu_info = NULL;
|
||||
static char *vga_name = NULL;
|
||||
|
||||
static int command_callback (char *word[], char *word_eol[], void *user_data);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QUERY_WMI_OS,
|
||||
QUERY_WMI_CPU,
|
||||
QUERY_WMI_VGA,
|
||||
QUERY_WMI_HDD,
|
||||
} QueryWmiType;
|
||||
|
||||
void print_info (void);
|
||||
int get_cpu_arch (void);
|
||||
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 *get_memory_info (void);
|
||||
char *bstr_to_utf8 (BSTR bstr);
|
||||
guint64 variant_to_uint64 (VARIANT *variant);
|
||||
|
||||
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)
|
||||
{
|
||||
char *hdd_info;
|
||||
|
||||
/* HDD information is always loaded dynamically since it includes the current amount of free space */
|
||||
hdd_capacity = 0;
|
||||
hdd_free_space = 0;
|
||||
hdd_info = query_wmi (QUERY_WMI_HDD);
|
||||
if (hdd_info)
|
||||
return sysinfo_format_disk (hdd_capacity, hdd_free_space);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_cpu (void)
|
||||
{
|
||||
if (cpu_info == NULL)
|
||||
cpu_info = query_wmi (QUERY_WMI_CPU);
|
||||
|
||||
return g_strdup (cpu_info);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (vga_name == NULL)
|
||||
vga_name = query_wmi (QUERY_WMI_VGA);
|
||||
|
||||
return g_strdup (vga_name);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_os (void)
|
||||
{
|
||||
if (os_name == NULL)
|
||||
os_name = query_wmi (QUERY_WMI_OS);
|
||||
|
||||
if (cpu_arch == 0)
|
||||
cpu_arch = get_cpu_arch ();
|
||||
|
||||
return g_strdup_printf ("%s (x%d)", os_name, cpu_arch);
|
||||
}
|
||||
|
||||
static int get_cpu_arch (void)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
|
||||
GetNativeSystemInfo (&si);
|
||||
|
||||
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 86;
|
||||
}
|
||||
}
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/site/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 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 *get_memory_info (void)
|
||||
{
|
||||
MEMORYSTATUSEX meminfo = { 0 };
|
||||
meminfo.dwLength = sizeof (meminfo);
|
||||
|
||||
if (!GlobalMemoryStatusEx (&meminfo))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sysinfo_format_memory (meminfo.ullTotalPhys, meminfo.ullAvailPhys);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
116
plugins/sysinfo/xsys-changelog
Normal file
116
plugins/sysinfo/xsys-changelog
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
15
plugins/sysinfo/xsys-install
Normal file
15
plugins/sysinfo/xsys-install
Normal file
@@ -0,0 +1,15 @@
|
||||
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.
|
38
plugins/sysinfo/xsys-makefile
Normal file
38
plugins/sysinfo/xsys-makefile
Normal file
@@ -0,0 +1,38 @@
|
||||
#### 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
|
||||
|
105
plugins/sysinfo/xsys-readme
Normal file
105
plugins/sysinfo/xsys-readme
Normal file
@@ -0,0 +1,105 @@
|
||||
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
|
927
plugins/sysinfo/xsys.c
Normal file
927
plugins/sysinfo/xsys.c
Normal file
@@ -0,0 +1,927 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
* xsys.h - X-Sys general parameters header
|
||||
* Copyright (C) 2005 Gustavo Zacarias
|
||||
* Copyright (C) 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
|
||||
@@ -18,12 +19,14 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SYSINFO_H
|
||||
#define SYSINFO_H
|
||||
#ifndef _XSYS_H_
|
||||
#define _XSYS_H_
|
||||
|
||||
#define bsize 1024
|
||||
#define DEFAULT_PCIIDS "/usr/share/hwdata/pci.ids"
|
||||
#define delims ":="
|
||||
|
||||
int sysinfo_get_str_pref (const char *name, char *dest);
|
||||
int sysinfo_get_percent ();
|
||||
void sysinfo_get_pciids (char *dest);
|
||||
void sysinfo_print_error (const char* msg);
|
||||
|
||||
#endif
|
@@ -20,50 +20,260 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <winsparkle.h>
|
||||
#include <windows.h>
|
||||
#include <wininet.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
|
||||
#define APPCAST_URL "https://dl.hexchat.net/appcast.xml"
|
||||
#define DEFAULT_DELAY 30 /* 30 seconds */
|
||||
#define DEFAULT_FREQ 360 /* 6 hours */
|
||||
#define DOWNLOAD_URL "http://dl.hexchat.net/hexchat"
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static char name[] = "Update Checker";
|
||||
static char desc[] = "Check for HexChat updates automatically";
|
||||
static char version[] = "5.0";
|
||||
static const char upd_help[] = "Update Checker Usage:\n /UPDCHK, check for HexChat updates\n";
|
||||
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 int
|
||||
check_cmd (char *word[], char *word_eol[], void *userdata)
|
||||
print_version (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
win_sparkle_check_update_with_ui ();
|
||||
char *version;
|
||||
int prevbuf;
|
||||
int convbuf;
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
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 */
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
win_sparkle_set_appcast_url (APPCAST_URL);
|
||||
win_sparkle_init ();
|
||||
/* 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);
|
||||
}
|
||||
|
||||
hexchat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, check_cmd, upd_help, NULL);
|
||||
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_command (ph, "MENU -ishare\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
|
||||
hexchat_printf (ph, "%s plugin loaded\n", name);
|
||||
|
||||
return 1;
|
||||
return 1; /* return 1 for success */
|
||||
}
|
||||
|
||||
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;
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,33 +19,80 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcupd</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UPD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(WinSparklePath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<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>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>upd.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>$(DepLibs);WinSparkle.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(WinSparklePath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(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>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(WinSparklePath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>upd.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>$(DepLibs);WinSparkle.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(WinSparklePath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -56,4 +102,6 @@
|
||||
<ClCompile Include="upd.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,28 +19,75 @@
|
||||
<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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hcwinamp</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<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>
|
||||
</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>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>winamp.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -52,4 +98,6 @@
|
||||
<ClCompile Include="winamp.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -32,7 +32,6 @@ src/fe-gtk/joind.c
|
||||
src/fe-gtk/maingui.c
|
||||
src/fe-gtk/menu.c
|
||||
src/fe-gtk/notifygui.c
|
||||
src/fe-gtk/plugin-notifications.c
|
||||
src/fe-gtk/plugin-tray.c
|
||||
src/fe-gtk/plugingui.c
|
||||
src/fe-gtk/rawlog.c
|
||||
@@ -43,4 +42,3 @@ 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
|
||||
|
@@ -16,6 +16,7 @@ EXTRA_DIST = \
|
||||
hexchatc.h \
|
||||
hexchat-plugin.h \
|
||||
history.h \
|
||||
identd.c \
|
||||
ignore.h \
|
||||
inbound.h \
|
||||
inet.h \
|
||||
@@ -33,7 +34,6 @@ EXTRA_DIST = \
|
||||
ssl.h \
|
||||
ssl.c \
|
||||
text.h \
|
||||
typedef.h \
|
||||
textenums.h \
|
||||
textevents.h \
|
||||
textevents.in \
|
||||
@@ -63,7 +63,6 @@ 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,Meiryo,Symbola,Unifont"
|
||||
#define DEF_FONT_ALTER "Arial Unicode MS,Lucida Sans Unicode,MS Gothic,Unifont"
|
||||
|
||||
const char * const languages[LANGUAGES_LENGTH] = {
|
||||
"af", "sq", "am", "ast", "az", "eu", "be", "bg", "ca", "zh_CN", /* 0 .. 9 */
|
||||
@@ -482,6 +482,7 @@ const struct prefs vars[] =
|
||||
{"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},
|
||||
@@ -528,9 +529,7 @@ 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},
|
||||
@@ -827,6 +826,7 @@ 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;
|
||||
@@ -1347,7 +1347,7 @@ hexchat_fopen_file (const char *file, const char *mode, int xof_flags)
|
||||
FILE *fh;
|
||||
|
||||
if (xof_flags & XOF_FULLPATH)
|
||||
return g_fopen (file, mode);
|
||||
return fopen (file, mode);
|
||||
|
||||
buf = g_build_filename (get_xdir (), file, NULL);
|
||||
fh = g_fopen (buf, mode);
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -24,7 +23,7 @@
|
||||
<ClInclude Include="ignore.h" />
|
||||
<ClInclude Include="inbound.h" />
|
||||
<ClInclude Include="inet.h" />
|
||||
<ClInclude Include="$(HexChatLib)marshal.h" />
|
||||
<ClInclude Include="marshal.h" />
|
||||
<ClInclude Include="modes.h" />
|
||||
<ClInclude Include="network.h" />
|
||||
<ClInclude Include="notify.h" />
|
||||
@@ -37,8 +36,8 @@
|
||||
<ClInclude Include="servlist.h" />
|
||||
<ClInclude Include="ssl.h" />
|
||||
<ClInclude Include="text.h" />
|
||||
<ClInclude Include="$(HexChatLib)textenums.h" />
|
||||
<ClInclude Include="$(HexChatLib)textevents.h" />
|
||||
<ClInclude Include="textenums.h" />
|
||||
<ClInclude Include="textevents.h" />
|
||||
<ClInclude Include="tree.h" />
|
||||
<ClInclude Include="typedef.h" />
|
||||
<ClInclude Include="url.h" />
|
||||
@@ -57,7 +56,7 @@
|
||||
<ClCompile Include="plugin-identd.c" />
|
||||
<ClCompile Include="ignore.c" />
|
||||
<ClCompile Include="inbound.c" />
|
||||
<ClCompile Include="$(HexChatLib)marshal.c" />
|
||||
<ClCompile Include="marshal.c" />
|
||||
<ClCompile Include="modes.c" />
|
||||
<ClCompile Include="network.c" />
|
||||
<ClCompile Include="notify.c" />
|
||||
@@ -77,7 +76,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\win32\config.h.tt" />
|
||||
<ClInclude Include="$(HexChatLib)config.h" />
|
||||
<ClInclude Include="..\..\config.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid>
|
||||
@@ -85,34 +84,83 @@
|
||||
<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" />
|
||||
<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>
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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>$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<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)..\
|
||||
"$(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"
|
||||
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"
|
||||
|
||||
]]></Command>
|
||||
</PreBuildEvent>
|
||||
|
@@ -71,10 +71,10 @@
|
||||
<ClInclude Include="text.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(HexChatLib)textenums.h">
|
||||
<ClInclude Include="textenums.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(HexChatLib)textevents.h">
|
||||
<ClInclude Include="textevents.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tree.h">
|
||||
@@ -98,13 +98,13 @@
|
||||
<ClInclude Include="hexchat-plugin.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(HexChatLib)config.h">
|
||||
<ClInclude Include="..\..\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="typedef.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(HexChatLib)marshal.h">
|
||||
<ClInclude Include="marshal.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="plugin-identd.h">
|
||||
@@ -181,7 +181,7 @@
|
||||
<ClCompile Include="hexchat.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(HexChatLib)marshal.c">
|
||||
<ClCompile Include="marshal.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="plugin-identd.c">
|
||||
|
@@ -83,6 +83,15 @@ 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;
|
||||
@@ -487,7 +496,8 @@ dcc_write_chat (char *nick, char *text)
|
||||
if (dcc && dcc->dccstat == STAT_ACTIVE)
|
||||
{
|
||||
len = strlen (text);
|
||||
tcp_send_real (NULL, dcc->sok, dcc->serv->write_converter, text, len);
|
||||
tcp_send_real (NULL, dcc->sok, dcc->serv->encoding, dcc->serv->using_irc,
|
||||
text, len);
|
||||
send (dcc->sok, "\n", 1, 0);
|
||||
dcc->size += len;
|
||||
fe_dcc_update (dcc);
|
||||
@@ -505,11 +515,36 @@ 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;
|
||||
|
||||
line = text_convert_invalid (line, -1, dcc->serv->read_converter, unicode_fallback_string, NULL);
|
||||
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);
|
||||
|
||||
sess = find_dialog (dcc->serv, dcc->nick);
|
||||
if (!sess)
|
||||
@@ -530,14 +565,16 @@ dcc_chat_line (struct DCC *dcc, char *line)
|
||||
/* did the plugin close it? */
|
||||
if (!g_slist_find (dcc_list, dcc))
|
||||
{
|
||||
g_free (line);
|
||||
g_free (utf);
|
||||
g_free (conv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* did the plugin eat the event? */
|
||||
if (ret)
|
||||
{
|
||||
g_free (line);
|
||||
g_free (utf);
|
||||
g_free (conv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -554,7 +591,8 @@ dcc_chat_line (struct DCC *dcc, char *line)
|
||||
{
|
||||
inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, &no_tags);
|
||||
}
|
||||
g_free (line);
|
||||
g_free (utf);
|
||||
g_free (conv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1639,6 +1677,7 @@ 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);
|
||||
@@ -1675,6 +1714,7 @@ 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;
|
||||
|
@@ -123,5 +123,6 @@ 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,6 +178,7 @@ 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,7 +41,6 @@
|
||||
#include "chanopt.h"
|
||||
#include "ignore.h"
|
||||
#include "hexchat-plugin.h"
|
||||
#include "inbound.h"
|
||||
#include "plugin.h"
|
||||
#include "plugin-identd.h"
|
||||
#include "plugin-timer.h"
|
||||
@@ -57,10 +56,6 @@
|
||||
#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;
|
||||
@@ -111,10 +106,6 @@ 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).
|
||||
@@ -257,39 +248,35 @@ lag_check (void)
|
||||
GSList *list = serv_list;
|
||||
unsigned long tim;
|
||||
char tbuf[128];
|
||||
time_t now = time(NULL);
|
||||
time_t now = time (0);
|
||||
time_t lag;
|
||||
|
||||
tim = make_ping_time ();
|
||||
|
||||
time_t ping_interval = 15;
|
||||
time_t ping_timeout = 30;
|
||||
|
||||
if (prefs.hex_net_ping_timeout != 0)
|
||||
{
|
||||
ping_timeout = prefs.hex_net_ping_timeout;
|
||||
ping_interval = ping_timeout/2;
|
||||
}
|
||||
|
||||
while (list)
|
||||
{
|
||||
serv = list->data;
|
||||
if (serv->connected && serv->end_of_motd)
|
||||
{
|
||||
if(!serv->lag_sent && (now - serv->ping_recv) > ping_interval)
|
||||
lag = now - serv->ping_recv;
|
||||
if (prefs.hex_net_ping_timeout != 0 && lag > prefs.hex_net_ping_timeout && lag > 0)
|
||||
{
|
||||
sprintf (tbuf, "%" G_GINT64_FORMAT, (gint64) lag);
|
||||
EMIT_SIGNAL (XP_TE_PINGTIMEOUT, serv->server_session, tbuf, NULL,
|
||||
NULL, NULL, 0);
|
||||
if (prefs.hex_net_auto_reconnect)
|
||||
serv->auto_reconnect (serv, FALSE, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
|
||||
serv->p_ping (serv, "", tbuf);
|
||||
serv->lag_sent = tim;
|
||||
fe_set_lag (serv, -1);
|
||||
}
|
||||
|
||||
if (prefs.hex_net_ping_timeout != 0 && (now - serv->socket_recv) > ping_timeout)
|
||||
{
|
||||
sprintf (tbuf, "%" G_GINT64_FORMAT, (gint64) now - serv->socket_recv);
|
||||
EMIT_SIGNAL (XP_TE_PINGTIMEOUT, serv->server_session, tbuf, NULL,
|
||||
NULL, NULL, 0);
|
||||
if (prefs.hex_net_auto_reconnect)
|
||||
serv->auto_reconnect (serv, FALSE, -1);
|
||||
|
||||
if (!serv->lag_sent)
|
||||
{
|
||||
serv->lag_sent = tim;
|
||||
fe_set_lag (serv, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
list = list->next;
|
||||
@@ -370,11 +357,10 @@ hexchat_misc_checks (void) /* this gets called every 1/2 second */
|
||||
if (count % 2)
|
||||
dcc_check_timeouts (); /* every 1 second */
|
||||
|
||||
if (count % 2) /* every 1 second*/
|
||||
lag_check ();
|
||||
|
||||
if (count > 3600)
|
||||
if (count >= 60) /* every 30 seconds */
|
||||
{
|
||||
if (prefs.hex_gui_lagometer)
|
||||
lag_check ();
|
||||
count = 0;
|
||||
}
|
||||
|
||||
@@ -497,6 +483,7 @@ 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:
|
||||
@@ -511,16 +498,6 @@ 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;
|
||||
@@ -772,6 +749,7 @@ static void
|
||||
xchat_init (void)
|
||||
{
|
||||
char buf[3068];
|
||||
const char *cs = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
WSADATA wsadata;
|
||||
@@ -809,6 +787,9 @@ xchat_init (void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (g_get_charset (&cs))
|
||||
prefs.utf8_locale = TRUE;
|
||||
|
||||
load_text_events ();
|
||||
sound_load ();
|
||||
notify_load ();
|
||||
@@ -1001,10 +982,6 @@ 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.
|
||||
@@ -1063,18 +1040,6 @@ 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
|
||||
@@ -1102,17 +1067,6 @@ 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
|
||||
|
@@ -265,6 +265,7 @@ 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;
|
||||
@@ -316,6 +317,7 @@ 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
|
||||
@@ -469,14 +471,10 @@ typedef struct server
|
||||
int (*p_raw)(struct server *, char *raw);
|
||||
int (*p_cmp)(const char *s1, const char *s2);
|
||||
|
||||
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;
|
||||
guint16 port;
|
||||
GSocket *sok; /* is equal to sok4 or sok6 (the one we are using) */
|
||||
GSocket *sok4; /* tcp4 socket */
|
||||
GSocket *sok6; /* tcp6 socket */
|
||||
int id; /* unique ID number (for plugin API) */
|
||||
#ifdef USE_OPENSSL
|
||||
SSL_CTX *ctx;
|
||||
@@ -485,9 +483,7 @@ typedef struct server
|
||||
#else
|
||||
void *ssl;
|
||||
#endif
|
||||
int childread;
|
||||
int childwrite;
|
||||
int childpid;
|
||||
GCancellable *cancellable; /* to cancel connecting thread */
|
||||
int iotag;
|
||||
int recondelay_tag; /* reconnect delay timeout */
|
||||
int joindelay_tag; /* waiting before we send JOIN */
|
||||
@@ -530,13 +526,9 @@ typedef struct server
|
||||
/*time_t connect_time;*/ /* when did it connect? */
|
||||
unsigned long lag_sent; /* we are still waiting for this ping response*/
|
||||
time_t ping_recv; /* when we last got a ping reply */
|
||||
time_t socket_recv; /* when we last received something from the socket */
|
||||
time_t away_time; /* when we were marked away */
|
||||
|
||||
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. */
|
||||
|
||||
char *encoding; /* NULL for system */
|
||||
GSList *favlist; /* list of channels & keys to join */
|
||||
|
||||
unsigned int motd_skipped:1;
|
||||
@@ -569,6 +561,8 @@ 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 */
|
||||
|
@@ -81,15 +81,6 @@ 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);
|
||||
@@ -188,7 +179,16 @@ 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;
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,30 +19,82 @@
|
||||
<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" />
|
||||
<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>
|
||||
<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>
|
||||
</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" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -20,53 +20,18 @@
|
||||
|
||||
#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"
|
||||
|
||||
#define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n)))
|
||||
|
||||
|
||||
/* ================== 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)
|
||||
net_store_destroy (netstore *ns)
|
||||
{
|
||||
if (ns->ip6_hostent)
|
||||
freeaddrinfo (ns->ip6_hostent);
|
||||
g_return_if_fail (ns != NULL);
|
||||
|
||||
g_resolver_free_addresses (ns->addrs);
|
||||
g_free (ns);
|
||||
}
|
||||
|
||||
@@ -76,115 +41,208 @@ net_store_new (void)
|
||||
return g_new0 (netstore, 1);
|
||||
}
|
||||
|
||||
/* =================== IPV6 ================== */
|
||||
|
||||
char *
|
||||
net_resolve (netstore * ns, char *hostname, int port, char **real_host)
|
||||
net_resolve (netstore *ns, char *hostname, char **real_host, GError **error)
|
||||
{
|
||||
struct addrinfo hints;
|
||||
char ipstring[MAX_HOSTNAME];
|
||||
char portstring[MAX_HOSTNAME];
|
||||
int ret;
|
||||
GResolver *res;
|
||||
GList *addrs;
|
||||
GInetAddress *addr;
|
||||
char *ipstring;
|
||||
|
||||
/* if (ns->ip6_hostent)
|
||||
freeaddrinfo (ns->ip6_hostent);*/
|
||||
res = g_resolver_get_default ();
|
||||
|
||||
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)
|
||||
// todo: lookup by irc service?
|
||||
addrs = g_resolver_lookup_by_name (res, hostname, NULL, error);
|
||||
if (!addrs)
|
||||
{
|
||||
g_object_unref (res);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef LOOKUPD /* See note about lookupd above the IPv4 version of net_resolve. */
|
||||
struct addrinfo *tmp;
|
||||
int count = 0;
|
||||
ns->addrs = addrs;
|
||||
addr = G_INET_ADDRESS(addrs->data);
|
||||
ipstring = g_inet_address_to_string (addr);
|
||||
|
||||
for (tmp = ns->ip6_hostent; tmp; tmp = tmp->ai_next)
|
||||
count ++;
|
||||
if (real_host)
|
||||
{
|
||||
if (!(*real_host = g_resolver_lookup_by_address (res, addr, NULL, NULL)))
|
||||
*real_host = g_strdup (hostname);
|
||||
}
|
||||
|
||||
count = RAND_INT(count);
|
||||
|
||||
while (count--) ns->ip6_hostent = ns->ip6_hostent->ai_next;
|
||||
#endif
|
||||
g_object_unref (res);
|
||||
|
||||
/* 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);
|
||||
return ipstring;
|
||||
}
|
||||
|
||||
/* the only thing making this interface unclean, this shitty sok4, sok6 business */
|
||||
|
||||
int
|
||||
net_connect (netstore * ns, int sok4, int sok6, int *sok_return)
|
||||
GSocket *
|
||||
net_connect (netstore *ns, guint16 port, GSocket *sok4, GSocket *sok6, GError **error)
|
||||
{
|
||||
struct addrinfo *res, *res0;
|
||||
int error = -1;
|
||||
GSocket *sok;
|
||||
GList *addrs;
|
||||
gboolean success;
|
||||
|
||||
res0 = ns->ip6_hostent;
|
||||
|
||||
for (res = res0; res; res = res->ai_next)
|
||||
for (addrs = ns->addrs; addrs; addrs = g_list_next (addrs))
|
||||
{
|
||||
/* sok = socket (res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (sok < 0)
|
||||
continue;*/
|
||||
switch (res->ai_family)
|
||||
{
|
||||
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;
|
||||
}
|
||||
GInetAddress *inet_addr = G_INET_ADDRESS(addrs->data);
|
||||
GSocketAddress *sok_addr;
|
||||
|
||||
if (error == 0)
|
||||
break;
|
||||
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;
|
||||
}
|
||||
|
||||
return error;
|
||||
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)
|
||||
{
|
||||
proxy = g_strdup (proxies[i]);
|
||||
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;
|
||||
}
|
||||
|
||||
void
|
||||
net_bind (netstore * tobindto, int sok4, int sok6)
|
||||
net_parse_proxy_uri (const char *proxy_uri, char **host, guint16 *port, int *type)
|
||||
{
|
||||
bind (sok4, tobindto->ip6_hostent->ai_addr,
|
||||
tobindto->ip6_hostent->ai_addrlen);
|
||||
bind (sok6, tobindto->ip6_hostent->ai_addr,
|
||||
tobindto->ip6_hostent->ai_addrlen);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
net_sockets (int *sok4, int *sok6)
|
||||
guint16
|
||||
net_get_local_port (GSocket *sok)
|
||||
{
|
||||
*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);
|
||||
}
|
||||
GSocketAddress *addr;
|
||||
guint16 port;
|
||||
|
||||
void
|
||||
udp_sockets (int *sok4, int *sok6)
|
||||
{
|
||||
*sok4 = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
*sok6 = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
|
||||
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;
|
||||
}
|
||||
|
@@ -22,21 +22,18 @@
|
||||
|
||||
typedef struct netstore_
|
||||
{
|
||||
#ifdef NETWORK_PRIVATE
|
||||
struct addrinfo *ip6_hostent;
|
||||
#else
|
||||
int _dummy; /* some compilers don't like empty structs */
|
||||
#endif
|
||||
GList *addrs;
|
||||
} netstore;
|
||||
|
||||
#define MAX_HOSTNAME 128
|
||||
|
||||
netstore *net_store_new (void);
|
||||
void net_store_destroy (netstore *ns);
|
||||
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);
|
||||
|
||||
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);
|
||||
#endif
|
||||
|
@@ -590,6 +590,7 @@ 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)
|
||||
@@ -597,7 +598,9 @@ cmd_charset (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
|
||||
if (!word[2 + offset][0])
|
||||
{
|
||||
PrintTextf (sess, "Current charset: %s\n", serv->encoding);
|
||||
g_get_charset (&locale);
|
||||
PrintTextf (sess, "Current charset: %s\n",
|
||||
serv->encoding ? serv->encoding : locale);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -904,7 +907,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, v->sok, v->servername);
|
||||
v, g_socket_get_fd (v->sok), v->servername);
|
||||
PrintText (sess, tbuf);
|
||||
list = list->next;
|
||||
}
|
||||
@@ -3202,7 +3205,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)
|
||||
{
|
||||
@@ -3220,7 +3223,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;
|
||||
@@ -3470,6 +3473,12 @@ 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);
|
||||
@@ -4740,13 +4749,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)
|
||||
{
|
||||
PrintTextf (sess, _("Unknown Command %s. Try /help\n"), word[1]);
|
||||
PrintText (sess, _("Unknown Command. Try /help\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* unknown command, just send it to the server and hope */
|
||||
sess->server->p_raw (sess->server, cmd);
|
||||
}
|
||||
}
|
||||
|
@@ -49,9 +49,6 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
g_return_val_if_fail (responses != NULL, 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);
|
||||
@@ -68,7 +65,7 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
||||
hexchat_command (ph, "HELP IDENTD");
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -153,16 +150,16 @@ identd_incoming_cb (GSocketService *service, GSocketConnection *conn,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
identd_start_server (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
int enabled, port = 113;
|
||||
|
||||
if (hexchat_get_prefs (ph, "identd", NULL, &enabled) == 3)
|
||||
if (hexchat_get_prefs (ph, "identd", NULL, &enabled) == 3 && enabled)
|
||||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
return TRUE; /*...*/
|
||||
}
|
||||
if (hexchat_get_prefs (ph, "identd_port", NULL, &port) == 2 && (port <= 0 || port > G_MAXUINT16))
|
||||
{
|
||||
@@ -177,13 +174,14 @@ identd_start_server (void)
|
||||
hexchat_printf (ph, _("*\tError starting identd server: %s"), error->message);
|
||||
|
||||
g_object_unref (service);
|
||||
service = NULL;
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
/*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
|
||||
@@ -200,9 +198,7 @@ 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);
|
||||
|
||||
identd_start_server ();
|
||||
|
||||
return 1; /* This must always succeed for /identd to work */
|
||||
return identd_start_server ();
|
||||
}
|
||||
|
||||
int
|
||||
|
@@ -355,11 +355,15 @@ plugin_kill_all (void)
|
||||
|
||||
#ifdef USE_PLUGIN
|
||||
|
||||
GModule *
|
||||
module_load (char *filename)
|
||||
/* load a plugin from a filename. Returns: NULL-success or an error string */
|
||||
|
||||
char *
|
||||
plugin_load (session *sess, char *filename, char *arg)
|
||||
{
|
||||
void *handle;
|
||||
char *filepart;
|
||||
hexchat_init_func *init_func;
|
||||
hexchat_deinit_func *deinit_func;
|
||||
char *pluginpath;
|
||||
|
||||
/* get the filename without path */
|
||||
@@ -379,18 +383,6 @@ module_load (char *filename)
|
||||
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 ();
|
||||
|
||||
@@ -667,31 +659,26 @@ plugin_emit_dummy_print (session *sess, char *name)
|
||||
}
|
||||
|
||||
int
|
||||
plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, gunichar key)
|
||||
plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval,
|
||||
int len, char *string)
|
||||
{
|
||||
char *word[PDIWORDS];
|
||||
char keyval_str[16];
|
||||
char state_str[16];
|
||||
char len_str[16];
|
||||
char key_str[7];
|
||||
int i, len;
|
||||
int i;
|
||||
|
||||
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] = key_str;
|
||||
word[3] = string;
|
||||
word[4] = len_str;
|
||||
for (i = 5; i < PDIWORDS; i++)
|
||||
word[i] = "\000";
|
||||
@@ -983,7 +970,8 @@ hexchat_printf (hexchat_plugin *ph, const char *format, ...)
|
||||
void
|
||||
hexchat_command (hexchat_plugin *ph, const char *command)
|
||||
{
|
||||
char *command_utf8;
|
||||
char *conv;
|
||||
gssize len = -1;
|
||||
|
||||
if (!is_session (ph->context))
|
||||
{
|
||||
@@ -992,9 +980,9 @@ hexchat_command (hexchat_plugin *ph, const char *command)
|
||||
}
|
||||
|
||||
/* scripts/plugins continue to send non-UTF8... *sigh* */
|
||||
command_utf8 = text_fixup_invalid_utf8 (command, -1, NULL);
|
||||
handle_command (ph->context, command_utf8, FALSE);
|
||||
g_free (command_utf8);
|
||||
conv = text_validate ((char **)&command, &len);
|
||||
handle_command (ph->context, (char *)command, FALSE);
|
||||
g_free (conv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -163,7 +163,6 @@ 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);
|
||||
@@ -175,7 +174,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, gunichar key);
|
||||
int plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, int len, char *string);
|
||||
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));
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -24,8 +24,9 @@ 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, GIConv write_converter, char *buf, int len);
|
||||
int tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int len);
|
||||
|
||||
server *server_new (void);
|
||||
int is_server (server *serv);
|
||||
|
@@ -45,7 +45,6 @@ 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[] =
|
||||
@@ -60,9 +59,12 @@ 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
|
||||
@@ -78,25 +80,52 @@ static const struct defaultserver def[] =
|
||||
{0, "irc.kis.lt"},
|
||||
{0, "irc.vub.lt"},
|
||||
|
||||
{"Anthrochat", 0, 0, 0, 0, 0, TRUE},
|
||||
{"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
|
||||
{0, "irc.anthrochat.net"},
|
||||
|
||||
{"ARCNet", 0},
|
||||
{0, "arcnet-irc.org"},
|
||||
|
||||
{"AthemeNet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.atheme.org"},
|
||||
{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"},
|
||||
|
||||
{"AustNet", 0},
|
||||
{0, "irc.austnet.org"},
|
||||
{0, "au.austnet.org"},
|
||||
{0, "us.austnet.org"},
|
||||
|
||||
{"AzzurraNet", 0},
|
||||
{0, "irc.azzurra.org"},
|
||||
{0, "crypto.azzurra.org"},
|
||||
|
||||
{"Canternet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"Canternet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.canternet.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.canternet.org"},
|
||||
|
||||
{"Chat4all", 0, 0, 0, 0, 0, TRUE},
|
||||
{"Chat4all", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.chat4all.org/+7001"},
|
||||
#endif
|
||||
{0, "irc.chat4all.org"},
|
||||
|
||||
{"ChattingAway", 0},
|
||||
@@ -104,21 +133,26 @@ static const struct defaultserver def[] =
|
||||
|
||||
{"ChatJunkies", 0},
|
||||
{0, "irc.chatjunkies.org"},
|
||||
{0, "nl.chatjunkies.org"},
|
||||
|
||||
{"ChatNet", 0},
|
||||
{0, "irc.chatnet.org"},
|
||||
{0, "US.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"},
|
||||
@@ -137,36 +171,60 @@ static const struct defaultserver def[] =
|
||||
{0, "irc.lightning.net"},
|
||||
{0, "irc.servercentral.net"},
|
||||
|
||||
{"ElectroCode", 0, 0, 0, 0, 0, TRUE},
|
||||
{"ElectroCode", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
|
||||
{0, "irc.electrocode.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.electrocode.net"},
|
||||
|
||||
{"EnterTheGame", 0},
|
||||
{0, "irc.enterthegame.com"},
|
||||
{0, "IRC.EnterTheGame.Com"},
|
||||
|
||||
{"EntropyNet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"EntropyNet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.entropynet.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.entropynet.net"},
|
||||
|
||||
{"EsperNet", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"EsperNet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.esper.net/+6697"},
|
||||
#endif
|
||||
{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, 0, TRUE},
|
||||
{"freenode", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "chat.freenode.net/+6697"},
|
||||
#endif
|
||||
{0, "chat.freenode.net"},
|
||||
/* irc. points to chat. but many users and urls still reference it */
|
||||
{0, "irc.freenode.net"},
|
||||
|
||||
{"Furnet", 0, 0, 0, 0, 0, TRUE},
|
||||
{"Furnet", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.furnet.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.furnet.org"},
|
||||
|
||||
{"GalaxyNet", 0},
|
||||
@@ -175,14 +233,18 @@ static const struct defaultserver def[] =
|
||||
{"GameSurge", 0},
|
||||
{0, "irc.gamesurge.net"},
|
||||
|
||||
{"GeeksIRC", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"GeeksIRC", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.geeksirc.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.geeksirc.net"},
|
||||
|
||||
{"GeekShed", 0},
|
||||
{0, "irc.geekshed.net"},
|
||||
|
||||
{"German-Elite", 0},
|
||||
{0, "irc.german-elite.net"},
|
||||
{0, "dominion.german-elite.net"},
|
||||
{0, "komatu.german-elite.net"},
|
||||
|
||||
{"GIMPNet", 0},
|
||||
{0, "irc.gimp.org"},
|
||||
@@ -194,13 +256,22 @@ static const struct defaultserver def[] =
|
||||
{"IdleMonkeys", 0},
|
||||
{0, "irc.idlemonkeys.net"},
|
||||
|
||||
{"IndirectIRC", 0, 0, 0, 0, 0, TRUE},
|
||||
{"IndirectIRC", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.indirectirc.com/+6697"},
|
||||
#endif
|
||||
{0, "irc.indirectirc.com"},
|
||||
|
||||
{"Interlinked", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"Interlinked", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.interlinked.me/+6697"},
|
||||
#endif
|
||||
{0, "irc.interlinked.me"},
|
||||
|
||||
{"IRC4Fun", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"IRC4Fun", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.irc4fun.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.irc4fun.net"},
|
||||
|
||||
{"IRCHighWay", 0},
|
||||
@@ -211,15 +282,28 @@ 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"},
|
||||
{0, "irc.iZ-smart.net/6666"},
|
||||
{0, "irc.iZ-smart.net/6667"},
|
||||
{0, "irc.iZ-smart.net/6668"},
|
||||
|
||||
{"Krstarica", 0},
|
||||
{0, "irc.krstarica.com"},
|
||||
@@ -227,6 +311,9 @@ 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},
|
||||
@@ -256,14 +343,31 @@ static const struct defaultserver def[] =
|
||||
{"PIRC.PL", 0},
|
||||
{0, "irc.pirc.pl"},
|
||||
|
||||
{"PonyChat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"PonyChat", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.ponychat.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.ponychat.net"},
|
||||
|
||||
{"PTNet.org", 0},
|
||||
{0, "irc.ptnet.org"},
|
||||
{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"},
|
||||
|
||||
{"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"},
|
||||
@@ -276,24 +380,37 @@ 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, 0, TRUE},
|
||||
{"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, 0, TRUE},
|
||||
{0, "irc.snoonet.org"},
|
||||
{"Snoonet", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.snoonet.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.snoonet.org/6667"},
|
||||
|
||||
{"Snyde", 0},
|
||||
{0, "irc.snyde.net"},
|
||||
{0, "irc.snyde.net/6667"},
|
||||
|
||||
{"Sohbet.Net", 0},
|
||||
{0, "irc.sohbet.net"},
|
||||
@@ -302,28 +419,57 @@ static const struct defaultserver def[] =
|
||||
{0, "irc.solidirc.com"},
|
||||
|
||||
{"SorceryNet", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.sorcery.net"},
|
||||
{0, "irc.sorcery.net/9000"},
|
||||
{0, "irc.us.sorcery.net/9000"},
|
||||
{0, "irc.eu.sorcery.net/9000"},
|
||||
|
||||
{"SpotChat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.spotchat.org"},
|
||||
{"SpotChat", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.spotchat.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.spotchat.org/6667"},
|
||||
|
||||
{"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"},
|
||||
|
||||
{"Station51", 0, 0, 0, 0, 0, TRUE},
|
||||
{"StaticBox", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.staticbox.net"},
|
||||
|
||||
{"Station51", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.station51.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.station51.net"},
|
||||
|
||||
{"StormBit", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"StormBit", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.stormbit.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.stormbit.net"},
|
||||
|
||||
{"SwiftIRC", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.swiftirc.net"},
|
||||
{"SwiftIRC", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.swiftirc.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.swiftirc.net/6667"},
|
||||
|
||||
{"synIRC", 0, 0, 0, 0, 0, TRUE},
|
||||
{0, "irc.synirc.net"},
|
||||
{"synIRC", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.synirc.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.synirc.net/6667"},
|
||||
|
||||
{"Techtronix", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{0, "irc.techtronix.net"},
|
||||
{"Techman's World IRC", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.techmansworld.com/+6697"},
|
||||
#endif
|
||||
{0, "irc.techmansworld.com/6667"},
|
||||
|
||||
{"TinyCrab", 0, 0, 0, LOGIN_SASL},
|
||||
{0, "irc.tinycrab.net"},
|
||||
@@ -347,10 +493,16 @@ static const struct defaultserver def[] =
|
||||
{"Worldnet", 0},
|
||||
{0, "irc.worldnet.net"},
|
||||
|
||||
{"Windfyre", 0, 0, 0, 0, 0, TRUE},
|
||||
{"Windfyre", 0},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.windfyre.net/+6697"},
|
||||
#endif
|
||||
{0, "irc.windfyre.net"},
|
||||
|
||||
{"Xertion", 0, 0, 0, LOGIN_SASL, 0, TRUE},
|
||||
{"Xertion", 0, 0, 0, LOGIN_SASL},
|
||||
#ifdef USE_OPENSSL
|
||||
{0, "irc.xertion.org/+6697"},
|
||||
#endif
|
||||
{0, "irc.xertion.org"},
|
||||
|
||||
{0,0}
|
||||
@@ -974,10 +1126,6 @@ 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)
|
||||
{
|
||||
@@ -1050,7 +1198,7 @@ servlist_load (void)
|
||||
net->logintype = atoi (buf + 2);
|
||||
break;
|
||||
case 'E':
|
||||
net->encoding = servlist_check_encoding (buf + 2) ? g_strdup (buf + 2) : g_strdup ("UTF-8");
|
||||
net->encoding = g_strdup (buf + 2);
|
||||
break;
|
||||
case 'F':
|
||||
net->flags = atoi (buf + 2);
|
||||
@@ -1124,6 +1272,13 @@ 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)
|
||||
@@ -1194,7 +1349,8 @@ servlist_save (void)
|
||||
fprintf (fp, "P=%s\n", net->pass);
|
||||
if (net->logintype)
|
||||
fprintf (fp, "L=%d\n", net->logintype);
|
||||
if (net->encoding)
|
||||
if (net->encoding && g_ascii_strcasecmp (net->encoding, "System") &&
|
||||
g_ascii_strcasecmp (net->encoding, "System default"))
|
||||
{
|
||||
fprintf (fp, "E=%s\n", net->encoding);
|
||||
if (!servlist_check_encoding (net->encoding))
|
||||
|
@@ -80,13 +80,16 @@ __SSL_critical_error (char *funcname)
|
||||
/* +++++ SSL functions +++++ */
|
||||
|
||||
SSL_CTX *
|
||||
_SSL_context_init (void (*info_cb_func))
|
||||
_SSL_context_init (void (*info_cb_func), int server)
|
||||
{
|
||||
SSL_CTX *ctx;
|
||||
#ifdef WIN32
|
||||
int i, r;
|
||||
#endif
|
||||
|
||||
SSLeay_add_ssl_algorithms ();
|
||||
SSL_load_error_strings ();
|
||||
ctx = SSL_CTX_new (SSLv23_client_method ());
|
||||
ctx = SSL_CTX_new (server ? SSLv23_server_method() : SSLv23_client_method ());
|
||||
|
||||
SSL_CTX_set_session_cache_mode (ctx, SSL_SESS_CACHE_BOTH);
|
||||
SSL_CTX_set_timeout (ctx, 300);
|
||||
@@ -96,13 +99,22 @@ _SSL_context_init (void (*info_cb_func))
|
||||
|SSL_OP_NO_TICKET
|
||||
|SSL_OP_CIPHER_SERVER_PREFERENCE);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined (OPENSSL_NO_COMP) /* workaround for OpenSSL 0.9.8 */
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x00908000L /* 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);
|
||||
}
|
||||
|
||||
@@ -471,7 +483,7 @@ _SSL_check_subject_altname (X509 *cert, const char *host)
|
||||
|
||||
if (addr != NULL)
|
||||
g_object_unref (addr);
|
||||
sk_GENERAL_NAME_pop_free (altname_stack, GENERAL_NAME_free);
|
||||
sk_GENERAL_NAME_free (altname_stack);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ struct chiper_info {
|
||||
int chiper_bits;
|
||||
};
|
||||
|
||||
SSL_CTX *_SSL_context_init (void (*info_cb_func));
|
||||
SSL_CTX *_SSL_context_init (void (*info_cb_func), int server);
|
||||
#define _SSL_context_free(a) SSL_CTX_free(a);
|
||||
|
||||
SSL *_SSL_socket (SSL_CTX *ctx, int sd);
|
||||
|
@@ -51,9 +51,6 @@
|
||||
#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;
|
||||
@@ -176,7 +173,7 @@ scrollback_shrink (session *sess)
|
||||
p++;
|
||||
}
|
||||
|
||||
fh = g_open (file, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY | OFLAGS, 0644);
|
||||
fh = g_open (file, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY, 0644);
|
||||
g_free (file);
|
||||
if (fh == -1)
|
||||
{
|
||||
@@ -207,9 +204,10 @@ scrollback_shrink (session *sess)
|
||||
}
|
||||
|
||||
static void
|
||||
scrollback_save (session *sess, char *text, time_t stamp)
|
||||
scrollback_save (session *sess, char *text)
|
||||
{
|
||||
char *buf;
|
||||
time_t stamp;
|
||||
int len;
|
||||
|
||||
if (sess->type == SESS_SERVER && prefs.hex_gui_tab_server == 1)
|
||||
@@ -231,14 +229,13 @@ scrollback_save (session *sess, char *text, time_t stamp)
|
||||
if ((buf = scrollback_get_filename (sess)) == NULL)
|
||||
return;
|
||||
|
||||
sess->scrollfd = g_open (buf, O_CREAT | O_APPEND | O_WRONLY | OFLAGS, 0644);
|
||||
sess->scrollfd = g_open (buf, O_CREAT | O_APPEND | O_WRONLY, 0644);
|
||||
g_free (buf);
|
||||
if (sess->scrollfd == -1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stamp)
|
||||
stamp = time(0);
|
||||
stamp = time (0);
|
||||
if (sizeof (stamp) == 4) /* gcc will optimize one of these out */
|
||||
buf = g_strdup_printf ("T %d ", (int) stamp);
|
||||
else
|
||||
@@ -301,6 +298,13 @@ scrollback_load (session *sess)
|
||||
{
|
||||
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);
|
||||
@@ -501,6 +505,34 @@ 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)
|
||||
{
|
||||
@@ -535,10 +567,8 @@ log_create_pathname (char *servname, char *channame, char *netname)
|
||||
now = time (NULL);
|
||||
strftime_utf8 (fnametime, sizeof (fnametime), fname, now);
|
||||
|
||||
/* 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))
|
||||
/* create final path/filename */
|
||||
if (logmask_is_fullpath ())
|
||||
{
|
||||
g_snprintf (fname, sizeof (fname), "%s", fnametime);
|
||||
}
|
||||
@@ -565,7 +595,11 @@ log_open_file (char *servname, char *channame, char *netname)
|
||||
if (!file)
|
||||
return -1;
|
||||
|
||||
fd = g_open (file, O_CREAT | O_APPEND | O_WRONLY | OFLAGS, 0644);
|
||||
#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
|
||||
g_free (file);
|
||||
|
||||
if (fd == -1)
|
||||
@@ -624,29 +658,33 @@ 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_locale;
|
||||
gsize len_utf8;
|
||||
gsize len;
|
||||
|
||||
/* 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)
|
||||
/* strftime wants the format string in LOCALE! */
|
||||
if (!prefs.utf8_locale)
|
||||
{
|
||||
return 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;
|
||||
}
|
||||
|
||||
*ret = g_locale_to_utf8 (dest, len_locale, NULL, &len_utf8, NULL);
|
||||
if (*ret == NULL)
|
||||
len = strftime_validated (dest, sizeof (dest), fmt, localtime (&tim));
|
||||
if (len)
|
||||
{
|
||||
return 0;
|
||||
if (prefs.utf8_locale)
|
||||
*ret = g_strdup (dest);
|
||||
else
|
||||
*ret = g_locale_to_utf8 (dest, len, 0, &len, 0);
|
||||
}
|
||||
|
||||
return len_utf8;
|
||||
g_free (loc);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -669,9 +707,7 @@ 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));
|
||||
@@ -679,22 +715,12 @@ log_write (session *sess, char *text, time_t ts)
|
||||
{
|
||||
if (g_access (file, F_OK) != 0)
|
||||
{
|
||||
if (sess->logfd != -1)
|
||||
{
|
||||
close (sess->logfd);
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -705,7 +731,6 @@ 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);
|
||||
@@ -715,104 +740,154 @@ log_write (session *sess, char *text, time_t ts)
|
||||
g_free (temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
/* 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)
|
||||
{
|
||||
gchar *result_part;
|
||||
gsize result_part_len;
|
||||
const gchar *end;
|
||||
gsize invalid_start_pos;
|
||||
GString *result;
|
||||
const gchar *current_start;
|
||||
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. */
|
||||
};
|
||||
|
||||
if (len == -1)
|
||||
{
|
||||
len = strlen (text);
|
||||
}
|
||||
|
||||
end = text + len;
|
||||
/* worst case scenario: every byte turns into 3 bytes */
|
||||
res = output = g_malloc ((len * 3) + 1);
|
||||
|
||||
/* 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)
|
||||
while (len)
|
||||
{
|
||||
/* All text converted successfully on the first try. Return it. */
|
||||
|
||||
if (len_out != NULL)
|
||||
if (G_LIKELY (*text < 0x80))
|
||||
{
|
||||
*len_out = result_part_len;
|
||||
*output = *text; /* ascii maps directly */
|
||||
}
|
||||
|
||||
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)
|
||||
else if (*text <= 0xa4) /* 80-a4 use a lookup table */
|
||||
{
|
||||
/* 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)
|
||||
idx = *text - 0x80;
|
||||
if (lowtable[idx] & 0x2000)
|
||||
{
|
||||
*len_out = result->len;
|
||||
*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;
|
||||
}
|
||||
|
||||
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. */
|
||||
else if (*text < 0xc0)
|
||||
{
|
||||
*output++ = 0xc2;
|
||||
*output = *text;
|
||||
}
|
||||
else
|
||||
{
|
||||
*output++ = 0xc3;
|
||||
*output = *text - 0x40;
|
||||
}
|
||||
output++;
|
||||
text++;
|
||||
len--;
|
||||
}
|
||||
*output = 0; /* terminate */
|
||||
*bytes_written = output - res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 *
|
||||
text_validate (char **text, gssize *len)
|
||||
{
|
||||
static GIConv utf8_fixup_converter = NULL;
|
||||
if (utf8_fixup_converter == NULL)
|
||||
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
|
||||
{
|
||||
utf8_fixup_converter = g_iconv_open ("UTF-8", "UTF-8");
|
||||
/* 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);
|
||||
}
|
||||
|
||||
return text_convert_invalid (text, len, utf8_fixup_converter, unicode_fallback_string, len_out);
|
||||
if (!utf)
|
||||
{
|
||||
*text = g_strdup ("%INVALID%");
|
||||
*len = 9;
|
||||
} else
|
||||
{
|
||||
*text = utf;
|
||||
*len = utf_len;
|
||||
}
|
||||
|
||||
return utf;
|
||||
}
|
||||
|
||||
void
|
||||
PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
|
||||
{
|
||||
char *conv;
|
||||
|
||||
if (!sess)
|
||||
{
|
||||
if (!sess_list)
|
||||
@@ -821,19 +896,22 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
|
||||
}
|
||||
|
||||
/* make sure it's valid utf8 */
|
||||
if (text[0] == '\0')
|
||||
if (text[0] == 0)
|
||||
{
|
||||
text = g_strdup ("\n");
|
||||
text = "\n";
|
||||
conv = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text_fixup_invalid_utf8 (text, -1, NULL);
|
||||
gssize len = -1;
|
||||
conv = text_validate ((char **)&text, &len);
|
||||
}
|
||||
|
||||
log_write (sess, text, timestamp);
|
||||
scrollback_save (sess, text, timestamp);
|
||||
scrollback_save (sess, text);
|
||||
fe_print_text (sess, text, timestamp, FALSE);
|
||||
g_free (text);
|
||||
|
||||
g_free (conv);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2160,8 +2238,12 @@ sound_play (const char *file, gboolean quiet)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/* check for fullpath */
|
||||
if (g_path_is_absolute (file))
|
||||
if (file[0] == '\\' || (((file[0] >= 'A' && file[0] <= 'Z') || (file[0] >= 'a' && file[0] <= 'z')) && file[1] == ':'))
|
||||
#else
|
||||
if (file[0] == '/')
|
||||
#endif
|
||||
{
|
||||
wavfile = g_strdup (file);
|
||||
}
|
||||
|
@@ -57,15 +57,11 @@ 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);
|
||||
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);
|
||||
char *text_validate (char **text, gssize *len);
|
||||
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 *);
|
||||
|
@@ -751,8 +751,8 @@ n2
|
||||
Stop Connection
|
||||
XP_TE_STOPCONNECT
|
||||
pevt_sconnect_help
|
||||
%C23*%O$tStopped previous connection attempt (%C24$1%O)
|
||||
1
|
||||
%C23*%O$tStopped previous connection attempt
|
||||
0
|
||||
|
||||
Topic
|
||||
XP_TE_TOPIC
|
||||
|
@@ -207,34 +207,6 @@ waitline (int sok, char *buf, int bufsize, int use_recv)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/* waitline2 using win32 file descriptor and glib instead of _read. win32 can't _read() sok! */
|
||||
int
|
||||
waitline2 (GIOChannel *source, char *buf, int bufsize)
|
||||
{
|
||||
int i = 0;
|
||||
gsize len;
|
||||
GError *error = NULL;
|
||||
|
||||
while (1)
|
||||
{
|
||||
g_io_channel_set_buffered (source, FALSE);
|
||||
g_io_channel_set_encoding (source, NULL, &error);
|
||||
|
||||
if (g_io_channel_read_chars (source, &buf[i], 1, &len, &error) != G_IO_STATUS_NORMAL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (buf[i] == '\n' || bufsize == i + 1)
|
||||
{
|
||||
buf[i] = 0;
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* checks for "~" in a file and expands */
|
||||
|
||||
char *
|
||||
@@ -500,22 +472,7 @@ get_sys_str (int with_cpu)
|
||||
static char winver[20];
|
||||
double mhz;
|
||||
|
||||
/* Broken since major bumped to 10, should start to work eventually.
|
||||
* No, IsWindowsVersionOrGreater (10, 0, 0) doesn't work either.
|
||||
* TODO: replace with IsWindows10OrGreater() once added to the SDK.
|
||||
*/
|
||||
if (IsWindowsVersionOrGreater (6, 4, 0))
|
||||
{
|
||||
if (IsWindowsServer ())
|
||||
{
|
||||
strcpy (winver, "Server 10");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (winver, "10");
|
||||
}
|
||||
}
|
||||
else if (IsWindows8Point1OrGreater ())
|
||||
if (IsWindows8Point1OrGreater ())
|
||||
{
|
||||
if (IsWindowsServer ())
|
||||
{
|
||||
|
@@ -61,10 +61,7 @@ int strip_hidden_attribute (char *src, char *dst);
|
||||
char *errorstring (int err);
|
||||
int waitline (int sok, char *buf, int bufsize, int);
|
||||
#ifdef WIN32
|
||||
int waitline2 (GIOChannel *source, char *buf, int bufsize);
|
||||
int get_cpu_arch (void);
|
||||
#else
|
||||
#define waitline2(source,buf,size) waitline(serv->childread,buf,size,0)
|
||||
#endif
|
||||
unsigned long make_ping_time (void);
|
||||
void move_file (char *src_dir, char *dst_dir, char *fname, int dccpermissions);
|
||||
|
@@ -12,7 +12,7 @@ hexchat_LDADD = ../common/libhexchatcommon.a $(GUI_LIBS)
|
||||
EXTRA_DIST = \
|
||||
ascii.h banlist.h chanlist.h chanview.h chanview-tabs.c \
|
||||
chanview-tree.c custom-list.h editlist.h fe-gtk.h fkeys.h gtkutil.h joind.h \
|
||||
maingui.h menu.h notifygui.h notifications palette.h pixmaps.h plugin-notification.h \
|
||||
maingui.h menu.h notifygui.h palette.h pixmaps.h \
|
||||
plugin-tray.h plugingui.c plugingui.h rawlog.h sexy-iso-codes.h \
|
||||
sexy-spell-entry.h textgui.h urlgrab.h userlistgui.h xtext.h \
|
||||
../../data/hexchat.gresource.xml
|
||||
@@ -29,21 +29,10 @@ if HAVE_ISO_CODES
|
||||
iso_codes_c = sexy-iso-codes.c
|
||||
endif
|
||||
|
||||
if USE_LIBNOTIFY
|
||||
notify_c = notifications/notification-libnotify.c
|
||||
else
|
||||
if HAVE_GTK_MAC
|
||||
notify_c = notifications/notification-osx.m
|
||||
hexchat_LDFLAGS = -framework Foundation
|
||||
else
|
||||
notify_c = notifications/notification-dummy.c
|
||||
endif
|
||||
endif
|
||||
|
||||
hexchat_SOURCES = ascii.c banlist.c chanlist.c chanview.c custom-list.c \
|
||||
dccgui.c editlist.c fe-gtk.c fkeys.c gtkutil.c ignoregui.c joind.c menu.c \
|
||||
maingui.c notifygui.c $(notify_c) palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
|
||||
plugin-notification.c rawlog.c resources.c servlistgui.c setup.c $(iso_codes_c) \
|
||||
maingui.c notifygui.c palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
|
||||
rawlog.c resources.c servlistgui.c setup.c $(iso_codes_c) \
|
||||
sexy-spell-entry.c textgui.c urlgrab.c userlistgui.c xtext.c
|
||||
hexchat_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/common
|
||||
|
||||
|
@@ -283,7 +283,6 @@ editlist_treeview_new (GtkWidget *box, char *title1, char *title2)
|
||||
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
|
||||
gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);
|
||||
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view), FALSE);
|
||||
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (view), TRUE);
|
||||
|
||||
g_signal_connect (G_OBJECT (view), "key_press_event",
|
||||
G_CALLBACK (editlist_keypress), NULL);
|
||||
|
@@ -52,7 +52,6 @@
|
||||
#include "plugin-tray.h"
|
||||
#include "urlgrab.h"
|
||||
#include "setup.h"
|
||||
#include "plugin-notification.h"
|
||||
|
||||
#ifdef USE_LIBCANBERRA
|
||||
#include <canberra.h>
|
||||
@@ -382,8 +381,6 @@ fe_idle (gpointer data)
|
||||
{
|
||||
session *sess = sess_list->data;
|
||||
|
||||
plugin_add (sess, NULL, NULL, notification_plugin_init, notification_plugin_deinit, NULL, FALSE);
|
||||
|
||||
plugin_add (sess, NULL, NULL, tray_plugin_init, tray_plugin_deinit, NULL, FALSE);
|
||||
|
||||
if (arg_minimize == 1)
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,38 +19,79 @@
|
||||
<RootNamespace>fegtk</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hexchat</TargetName>
|
||||
<OutDir>$(HexChatRel)</OutDir>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hexchat</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<!-- WholeProgramOptimization must be turned off for gresource constructors to work, otherwise the .CRT$XCU section is not emitted. -->
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\common;$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);$(HexChatLib)common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<!-- WholeProgramOptimization must be turned off for gresource constructors to work, otherwise the .CRT$XCU section is not emitted. -->
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\common;$(HexChatLib);$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);$(HexChatLib)common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -59,10 +99,10 @@
|
||||
<PreBuildEvent>
|
||||
<Command><![CDATA[
|
||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.tt" "$(HexChatLib)hexchat.rc.utf8"
|
||||
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.tt" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8"
|
||||
REM hexchat.rc needs to be in UCS-2 or Resource Compiler will complain
|
||||
powershell "Get-Content -Encoding UTF8 '$(HexChatLib)hexchat.rc.utf8' | Out-File '$(HexChatLib)hexchat.rc'; Remove-Item '$(HexChatLib)hexchat.rc.utf8'"
|
||||
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --sourcedir "$(DataDir)" --target "$(HexChatLib)resources.c" "$(DataDir)hexchat.gresource.xml"
|
||||
powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8' | Out-File '$(SolutionDir)..\src\fe-gtk\hexchat.rc'; Remove-Item '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8'"
|
||||
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --sourcedir "$(DataDir)" --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"
|
||||
]]></Command>
|
||||
<Message>Build hexchat.rc and gresource file</Message>
|
||||
</PreBuildEvent>
|
||||
@@ -80,7 +120,6 @@ powershell "Get-Content -Encoding UTF8 '$(HexChatLib)hexchat.rc.utf8' | Out-File
|
||||
<ClInclude Include="joind.h" />
|
||||
<ClInclude Include="maingui.h" />
|
||||
<ClInclude Include="menu.h" />
|
||||
<ClInclude Include="notifications\notification-backend.h" />
|
||||
<ClInclude Include="notifygui.h" />
|
||||
<ClInclude Include="palette.h" />
|
||||
<ClInclude Include="pixmaps.h" />
|
||||
@@ -111,15 +150,13 @@ powershell "Get-Content -Encoding UTF8 '$(HexChatLib)hexchat.rc.utf8' | Out-File
|
||||
<ClCompile Include="joind.c" />
|
||||
<ClCompile Include="maingui.c" />
|
||||
<ClCompile Include="menu.c" />
|
||||
<ClCompile Include="notifications\notification-windows.c" />
|
||||
<ClCompile Include="notifygui.c" />
|
||||
<ClCompile Include="palette.c" />
|
||||
<ClCompile Include="pixmaps.c" />
|
||||
<ClCompile Include="plugin-notification.c" />
|
||||
<ClCompile Include="plugin-tray.c" />
|
||||
<ClCompile Include="plugingui.c" />
|
||||
<ClCompile Include="rawlog.c" />
|
||||
<ClCompile Include="$(HexChatLib)resources.c" />
|
||||
<ClCompile Include="resources.c" />
|
||||
<ClCompile Include="servlistgui.c" />
|
||||
<ClCompile Include="setup.c" />
|
||||
<ClCompile Include="sexy-iso-codes.c" />
|
||||
@@ -130,11 +167,11 @@ powershell "Get-Content -Encoding UTF8 '$(HexChatLib)hexchat.rc.utf8' | Out-File
|
||||
<ClCompile Include="xtext.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="..\..\win32\hexchat.exe.manifest" />
|
||||
<Manifest Include="hexchat.exe.manifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="hexchat.rc.tt" />
|
||||
<ResourceCompile Include="$(HexChatLib)hexchat.rc" />
|
||||
<ResourceCompile Include="hexchat.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\data\icons\hexchat.ico" />
|
||||
@@ -143,4 +180,6 @@ powershell "Get-Content -Encoding UTF8 '$(HexChatLib)hexchat.rc.utf8' | Out-File
|
||||
<Xml Include="..\..\data\hexchat.gresource.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -93,9 +93,6 @@
|
||||
<ClInclude Include="setup.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="notifications\notification-backend.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ascii.c">
|
||||
@@ -182,23 +179,17 @@
|
||||
<ClCompile Include="xtext.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(HexChatLib)resources.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="plugin-notification.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="notifications\notification-windows.c">
|
||||
<ClCompile Include="resources.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="..\..\win32\hexchat.exe.manifest">
|
||||
<Manifest Include="hexchat.exe.manifest">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Manifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="$(HexChatLib)hexchat.rc">
|
||||
<ResourceCompile Include="hexchat.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
|
@@ -198,7 +198,6 @@ static const struct key_action key_actions[KEY_MAX_ACTIONS + 1] = {
|
||||
"ACCEL=Down\nNext Command\nD1!\nD2!\n\n"\
|
||||
"ACCEL=Up\nLast Command\nD1!\nD2!\n\n"\
|
||||
"ACCEL=Tab\nComplete nick/command\nD1!\nD2!\n\n"\
|
||||
"ACCEL=<Shift>ISO_Left_Tab\nComplete nick/command\nD1:Previous\nD2!\n\n"\
|
||||
"ACCEL=space\nCheck For Replace\nD1!\nD2!\n\n"\
|
||||
"ACCEL=Return\nCheck For Replace\nD1!\nD2!\n\n"\
|
||||
"ACCEL=KP_Enter\nCheck For Replace\nD1!\nD2!\n\n"\
|
||||
@@ -322,7 +321,7 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess)
|
||||
return FALSE;
|
||||
current_sess = sess;
|
||||
|
||||
if (plugin_emit_keypress (sess, evt->state, evt->keyval, gdk_keyval_to_unicode (evt->keyval)))
|
||||
if (plugin_emit_keypress (sess, evt->state, evt->keyval, evt->length, evt->string))
|
||||
return 1;
|
||||
|
||||
/* maybe the plugin closed this tab? */
|
||||
@@ -666,7 +665,6 @@ key_dialog_treeview_new (GtkWidget *box)
|
||||
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
|
||||
gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);
|
||||
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view), FALSE);
|
||||
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (view), TRUE);
|
||||
|
||||
g_signal_connect (G_OBJECT (view), "key-press-event",
|
||||
G_CALLBACK (key_dialog_keypress), NULL);
|
||||
|
@@ -19,14 +19,4 @@
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!--This Id value indicates the application supports Windows 7 functionality-->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!--This Id value indicates the application supports Windows 8 functionality-->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!--This Id value indicates the application supports Windows 8.1 functionality-->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
</assembly>
|
@@ -1,9 +1,9 @@
|
||||
#include <winver.h>
|
||||
#include "config.h"
|
||||
#include "../../config.h"
|
||||
|
||||
#define COMMA_VERSION <#= [string]::Join(',', $versionParts) #>,0
|
||||
|
||||
XC_ICON ICON "<#= $env:SOLUTIONDIR -replace '\\', '/' #>data/icons/hexchat.ico"
|
||||
XC_ICON ICON "../../data/icons/hexchat.ico"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION COMMA_VERSION
|
||||
@@ -15,7 +15,6 @@ VS_VERSION_INFO VERSIONINFO
|
||||
BEGIN
|
||||
|
||||
VALUE "FileDescription", "HexChat IRC Client"
|
||||
VALUE "CompanyName", "HexChat"
|
||||
VALUE "ProductName", "HexChat"
|
||||
VALUE "ProductVersion", PACKAGE_VERSION
|
||||
VALUE "FileVersion", PACKAGE_VERSION
|
||||
|
@@ -3508,6 +3508,7 @@ mg_changui_new (session *sess, restore_gui *res, int tab, int focus)
|
||||
{
|
||||
int first_run = FALSE;
|
||||
session_gui *gui;
|
||||
struct User *user = NULL;
|
||||
|
||||
if (res == NULL)
|
||||
{
|
||||
@@ -3521,6 +3522,9 @@ mg_changui_new (session *sess, restore_gui *res, int tab, int focus)
|
||||
sess->server->front_session = sess;
|
||||
}
|
||||
|
||||
if (!is_channel (sess->server, sess->channel))
|
||||
user = userlist_find_global (sess->server, sess->channel);
|
||||
|
||||
if (!tab)
|
||||
{
|
||||
gui = g_new0 (session_gui, 1);
|
||||
@@ -3528,6 +3532,8 @@ mg_changui_new (session *sess, restore_gui *res, int tab, int focus)
|
||||
sess->gui = gui;
|
||||
mg_create_topwindow (sess);
|
||||
fe_set_title (sess);
|
||||
if (user && user->hostname)
|
||||
set_topic (sess, user->hostname, user->hostname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3547,6 +3553,9 @@ mg_changui_new (session *sess, restore_gui *res, int tab, int focus)
|
||||
gui->is_tab = TRUE;
|
||||
}
|
||||
|
||||
if (user && user->hostname)
|
||||
set_topic (sess, user->hostname, user->hostname);
|
||||
|
||||
mg_add_chan (sess);
|
||||
|
||||
if (first_run || (prefs.hex_gui_tab_newtofront == FOCUS_NEW_ONLY_ASKED && focus)
|
||||
|
@@ -1711,7 +1711,7 @@ menu_about (GtkWidget *wid, gpointer sess)
|
||||
"You should have received a copy of the GNU General Public License\n" \
|
||||
"along with this program. If not, see <http://www.gnu.org/licenses/>";
|
||||
|
||||
g_snprintf (comment, sizeof(comment), ""
|
||||
g_snprintf (comment, sizeof(comment), "Compiled: "__DATE__"\n"
|
||||
#ifdef WIN32
|
||||
"Portable Mode: %s\n"
|
||||
"Build Type: x%d\n"
|
||||
|
@@ -1,27 +0,0 @@
|
||||
/* 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 HEXCHAT_PLUGIN_NOTIFICATION_BACKEND_H
|
||||
#define HEXCHAT_PLUGIN_NOTIFICATION_BACKEND_H
|
||||
|
||||
int notification_backend_supported (void);
|
||||
void notification_backend_show (const char *title, const char *text);
|
||||
int notification_backend_init (void);
|
||||
void notification_backend_deinit (void);
|
||||
|
||||
#endif
|
@@ -1,39 +0,0 @@
|
||||
/* 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
|
||||
*/
|
||||
|
||||
void
|
||||
notification_backend_show (const char *title, const char *text)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
notification_backend_deinit (void)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_supported (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
/* 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 "config.h"
|
||||
#include <glib.h>
|
||||
#include <libnotify/notify.h>
|
||||
|
||||
static gboolean strip_markup = FALSE;
|
||||
|
||||
void
|
||||
notification_backend_show (const char *title, const char *text)
|
||||
{
|
||||
NotifyNotification *notification;
|
||||
|
||||
if (strip_markup)
|
||||
text = g_markup_escape_text (text, -1);
|
||||
|
||||
notification = notify_notification_new (title, text, "hexchat");
|
||||
notify_notification_set_hint (notification, "desktop-entry", g_variant_new_string ("hexchat"));
|
||||
|
||||
notify_notification_show (notification, NULL);
|
||||
|
||||
g_object_unref (notification);
|
||||
if (strip_markup)
|
||||
g_free ((char*)text);
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_init (void)
|
||||
{
|
||||
GList* server_caps;
|
||||
|
||||
if (!NOTIFY_CHECK_VERSION (0, 7, 0))
|
||||
return 0;
|
||||
|
||||
if (!notify_init (PACKAGE_NAME))
|
||||
return 0;
|
||||
|
||||
server_caps = notify_get_server_caps ();
|
||||
if (g_list_find_custom (server_caps, "body-markup", (GCompareFunc)g_strcmp0))
|
||||
strip_markup = TRUE;
|
||||
g_list_free_full (server_caps, g_free);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
notification_backend_deinit (void)
|
||||
{
|
||||
notify_uninit ();
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_supported (void)
|
||||
{
|
||||
return notify_is_initted ();
|
||||
}
|
@@ -1,54 +0,0 @@
|
||||
/* 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
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <gtkosxapplication.h>
|
||||
|
||||
void
|
||||
notification_backend_show (const char *title, const char *text)
|
||||
{
|
||||
NSString *str_title = [[NSString alloc] initWithUTF8String:title];
|
||||
NSString *str_text = [[NSString alloc] initWithUTF8String:text];
|
||||
|
||||
NSUserNotification *userNotification = [NSUserNotification new];
|
||||
userNotification.title = str_title;
|
||||
userNotification.informativeText = str_text;
|
||||
|
||||
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
|
||||
[center scheduleNotification:userNotification];
|
||||
|
||||
[str_title release];
|
||||
[str_text release];
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_init (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
notification_backend_deinit (void)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_supported (void)
|
||||
{
|
||||
return gtkosx_application_get_bundle_id () != NULL;
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
/* HexChat
|
||||
* Copyright (C) 2015 Arnav Singh.
|
||||
*
|
||||
* 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 <gmodule.h>
|
||||
|
||||
#include "hexchat.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
void (*winrt_notification_backend_show) (const char *title, const char *text) = NULL;
|
||||
int (*winrt_notification_backend_init) (void) = NULL;
|
||||
void (*winrt_notification_backend_deinit) (void) = NULL;
|
||||
int (*winrt_notification_backend_supported) (void) = NULL;
|
||||
|
||||
void
|
||||
notification_backend_show (const char *title, const char *text)
|
||||
{
|
||||
if (winrt_notification_backend_show == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
winrt_notification_backend_show (title, text);
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_init (void)
|
||||
{
|
||||
UINT original_error_mode;
|
||||
GModule *module;
|
||||
|
||||
/* Temporarily suppress the "DLL could not be loaded" dialog box before trying to load hcnotifications-winrt.dll */
|
||||
original_error_mode = GetErrorMode ();
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
module = module_load (HEXCHATLIBDIR "\\hcnotifications-winrt.dll");
|
||||
SetErrorMode (original_error_mode);
|
||||
|
||||
if (module == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_module_symbol (module, "notification_backend_show", (gpointer *) &winrt_notification_backend_show);
|
||||
g_module_symbol (module, "notification_backend_init", (gpointer *) &winrt_notification_backend_init);
|
||||
g_module_symbol (module, "notification_backend_deinit", (gpointer *) &winrt_notification_backend_deinit);
|
||||
g_module_symbol (module, "notification_backend_supported", (gpointer *) &winrt_notification_backend_supported);
|
||||
|
||||
return winrt_notification_backend_init ();
|
||||
}
|
||||
|
||||
void
|
||||
notification_backend_deinit (void)
|
||||
{
|
||||
if (winrt_notification_backend_deinit == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
winrt_notification_backend_deinit ();
|
||||
}
|
||||
|
||||
int
|
||||
notification_backend_supported (void)
|
||||
{
|
||||
if (winrt_notification_backend_supported == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return winrt_notification_backend_supported ();
|
||||
}
|
@@ -1,100 +0,0 @@
|
||||
/* HexChat
|
||||
* Copyright (c) 2014 Leetsoftwerx
|
||||
*
|
||||
* 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 <string>
|
||||
#include <codecvt>
|
||||
|
||||
#include <roapi.h>
|
||||
#include <windows.ui.notifications.h>
|
||||
|
||||
using namespace Windows::UI::Notifications;
|
||||
using namespace Windows::Data::Xml::Dom;
|
||||
|
||||
static ToastNotifier ^ notifier = nullptr;
|
||||
|
||||
static std::wstring
|
||||
widen(const std::string & to_widen)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;
|
||||
return converter.from_bytes(to_widen);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
__declspec (dllexport) void
|
||||
notification_backend_show (const char *title, const char *text)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto toastTemplate = ToastNotificationManager::GetTemplateContent (ToastTemplateType::ToastText02);
|
||||
auto node_list = toastTemplate->GetElementsByTagName ("text");
|
||||
UINT node_count = node_list->Length;
|
||||
|
||||
auto wtitle = widen (title);
|
||||
node_list->GetAt (0)->AppendChild (
|
||||
toastTemplate->CreateTextNode (Platform::StringReference (wtitle.c_str (), wtitle.size ())));
|
||||
|
||||
auto wtext = widen (text);
|
||||
node_list->GetAt (1)->AppendChild (
|
||||
toastTemplate->CreateTextNode (Platform::StringReference (wtext.c_str (), wtext.size ())));
|
||||
|
||||
// Mute sound, we already play our own
|
||||
auto node = toastTemplate->SelectSingleNode ("/toast");
|
||||
auto audio_elem = toastTemplate->CreateElement ("audio");
|
||||
audio_elem->SetAttribute ("silent", "true");
|
||||
static_cast<XmlElement^>(node)->AppendChild (audio_elem);
|
||||
|
||||
notifier->Show (ref new ToastNotification (toastTemplate));
|
||||
}
|
||||
catch (Platform::Exception ^ ex)
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
__declspec (dllexport) int
|
||||
notification_backend_init (void)
|
||||
{
|
||||
if (!notifier)
|
||||
notifier = ToastNotificationManager::CreateToastNotifier ("HexChat.Desktop.Notify");
|
||||
|
||||
if (FAILED (Windows::Foundation::Initialize (RO_INIT_SINGLETHREADED)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
__declspec (dllexport) void
|
||||
notification_backend_deinit (void)
|
||||
{
|
||||
notifier = nullptr;
|
||||
Windows::Foundation::Uninitialize ();
|
||||
}
|
||||
|
||||
__declspec (dllexport) int
|
||||
notification_backend_supported (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="notification-winrt.cpp">
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C53145CC-D021-40C9-B97C-0249AB9A43C9}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>notifications-winrt</RootNamespace>
|
||||
<ProjectName>notifications-winrt</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<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>hcnotifications-winrt</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY;_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT;NDEBUG;_WINDOWS;_USRDLL;NOTIFICATIONS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalUsingDirectories>$(VCInstallDir)vcpackages;$(FrameworkSdkDir)References\CommonConfiguration\Neutral;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(DepLibs);mincore.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<MinimumRequiredVersion>6.03</MinimumRequiredVersion>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY;_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT;NDEBUG;_WINDOWS;_USRDLL;NOTIFICATIONS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalUsingDirectories>$(VCInstallDir)vcpackages;$(FrameworkSdkDir)References\CommonConfiguration\Neutral;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(DepLibs);mincore.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<MinimumRequiredVersion>6.03</MinimumRequiredVersion>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="notification-winrt.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -1,215 +0,0 @@
|
||||
/* 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 "config.h"
|
||||
#include <glib.h>
|
||||
|
||||
#include "../common/hexchat-plugin.h"
|
||||
#include "../common/inbound.h" /* For alert_match_word() */
|
||||
#include "notifications/notification-backend.h"
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
|
||||
static gboolean
|
||||
should_alert (void)
|
||||
{
|
||||
int omit_away, omit_focused, omit_tray;
|
||||
|
||||
if (hexchat_get_prefs (ph, "gui_focus_omitalerts", NULL, &omit_focused) == 3 && omit_focused)
|
||||
{
|
||||
const char *status = hexchat_get_info (ph, "win_status");
|
||||
|
||||
if (status && !g_strcmp0 (status, "active"))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (hexchat_get_prefs (ph, "away_omit_alerts", NULL, &omit_away) == 3 && omit_away)
|
||||
{
|
||||
if (hexchat_get_info (ph, "away"))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (hexchat_get_prefs (ph, "gui_tray_quiet", NULL, &omit_tray) == 3 && omit_tray)
|
||||
{
|
||||
int tray_enabled;
|
||||
|
||||
if (hexchat_get_prefs (ph, "gui_tray", NULL, &tray_enabled) == 3 && tray_enabled)
|
||||
{
|
||||
const char *status = hexchat_get_info (ph, "win_status");
|
||||
|
||||
if (status && g_strcmp0 (status, "hidden") != 0)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_ignored (char *nick)
|
||||
{
|
||||
const char *no_hilight;
|
||||
|
||||
if (hexchat_get_prefs (ph, "irc_no_hilight", &no_hilight, NULL) == 1 && no_hilight)
|
||||
{
|
||||
return alert_match_word (nick, (char*)no_hilight);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
show_notification (const char *title, const char *text)
|
||||
{
|
||||
char *stripped_title, *stripped_text;
|
||||
|
||||
/* Strip all colors */
|
||||
stripped_title = hexchat_strip (ph, title, -1, 7);
|
||||
stripped_text = hexchat_strip (ph, text, -1, 7);
|
||||
|
||||
notification_backend_show (stripped_title, stripped_text);
|
||||
|
||||
hexchat_free (ph, stripped_title);
|
||||
hexchat_free (ph, stripped_text);
|
||||
}
|
||||
|
||||
static void
|
||||
show_notificationf (const char *text, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
buf = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
|
||||
show_notification (buf, text);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
static int
|
||||
incoming_hilight_cb (char *word[], gpointer userdata)
|
||||
{
|
||||
int hilight;
|
||||
|
||||
if (hexchat_get_prefs (ph, "input_balloon_hilight", NULL, &hilight) == 3 && hilight && should_alert())
|
||||
{
|
||||
show_notificationf (word[2], _("Highlighted message from: %s (%s)"), word[1], hexchat_get_info (ph, "channel"));
|
||||
}
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
incoming_message_cb (char *word[], gpointer userdata)
|
||||
{
|
||||
int message;
|
||||
|
||||
if (hexchat_get_prefs (ph, "input_balloon_chans", NULL, &message) == 3 && message && should_alert ())
|
||||
{
|
||||
show_notificationf (word[2], _("Channel message from: %s (%s)"), word[1], hexchat_get_info (ph, "channel"));
|
||||
}
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
incoming_priv_cb (char *word[], gpointer userdata)
|
||||
{
|
||||
int priv;
|
||||
|
||||
if (hexchat_get_prefs (ph, "input_balloon_priv", NULL, &priv) == 3 && priv && should_alert ())
|
||||
{
|
||||
const char *network = hexchat_get_info (ph, "network");
|
||||
if (!network)
|
||||
network = hexchat_get_info (ph, "server");
|
||||
|
||||
if (userdata != NULL) /* Special event */
|
||||
{
|
||||
if (GPOINTER_TO_INT (userdata) == 3)
|
||||
{
|
||||
if (!is_ignored (word[2]))
|
||||
show_notificationf (word[1], _("File offer from: %s (%s)"), word[2], network);
|
||||
}
|
||||
else if (GPOINTER_TO_INT (userdata) == 2)
|
||||
{
|
||||
if (!is_ignored (word[2]))
|
||||
show_notificationf (word[1], _("Invited to channel by: %s (%s)"), word[2], network);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!is_ignored (word[1]))
|
||||
show_notificationf (word[2], _("Notice from: %s (%s)"), word[1], network);
|
||||
}
|
||||
}
|
||||
else
|
||||
show_notificationf (word[2], _("Private message from: %s (%s)"), word[1], network);
|
||||
}
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
tray_cmd_cb (char *word[], char *word_eol[], gpointer userdata)
|
||||
{
|
||||
if (word[2] && !g_ascii_strcasecmp (word[2], "-b") && word[3] && word[4])
|
||||
{
|
||||
if (should_alert ())
|
||||
show_notification (word[3], word_eol[4]);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
int
|
||||
notification_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
if (!notification_backend_init ())
|
||||
return 0;
|
||||
|
||||
ph = plugin_handle;
|
||||
*plugin_name = "";
|
||||
*plugin_desc = "";
|
||||
*plugin_version = "";
|
||||
|
||||
hexchat_hook_print (ph, "Channel Msg Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
|
||||
hexchat_hook_print (ph, "Channel Action Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
|
||||
|
||||
hexchat_hook_print (ph, "Channel Message", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
hexchat_hook_print (ph, "Channel Action", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
hexchat_hook_print (ph, "Channel Notice", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
|
||||
hexchat_hook_print (ph, "Private Message", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
hexchat_hook_print (ph, "Private Message to Dialog", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
hexchat_hook_print (ph, "Private Action", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
hexchat_hook_print (ph, "Private Action to Dialog", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
|
||||
/* Special events treated as priv */
|
||||
hexchat_hook_print (ph, "Notice", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (1));
|
||||
hexchat_hook_print (ph, "Invited", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (2));
|
||||
hexchat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (3));
|
||||
|
||||
hexchat_hook_command (ph, "TRAY", HEXCHAT_PRI_HIGH, tray_cmd_cb, NULL, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
notification_plugin_deinit (void)
|
||||
{
|
||||
notification_backend_deinit ();
|
||||
return 1;
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
/* 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 HEXCHAT_PLUGIN_NOTIFICATION_H
|
||||
#define HEXCHAT_PLUGIN_NOTIFICATION_H
|
||||
|
||||
int notification_plugin_init (void *, char **, char **, char **, char *);
|
||||
int notification_plugin_deinit (void *);
|
||||
|
||||
#endif
|
@@ -34,6 +34,18 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBNOTIFY
|
||||
#include <libnotify/notify.h>
|
||||
#ifndef NOTIFY_CHECK_VERSION
|
||||
#define NOTIFY_CHECK_VERSION(x,y,z) 0
|
||||
#endif
|
||||
#if NOTIFY_CHECK_VERSION(0,7,0)
|
||||
#define XC_NOTIFY_NEW(a,b,c,d) notify_notification_new(a,b,c)
|
||||
#else
|
||||
#define XC_NOTIFY_NEW(a,b,c,d) notify_notification_new(a,b,c,d)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef enum /* current icon status */
|
||||
{
|
||||
TS_NONE,
|
||||
@@ -142,6 +154,83 @@ fe_tray_set_tooltip (const char *text)
|
||||
gtk_status_icon_set_tooltip_text (sticon, text);
|
||||
}
|
||||
|
||||
void
|
||||
fe_tray_set_balloon (const char *title, const char *text)
|
||||
{
|
||||
#ifndef WIN32
|
||||
#if 0
|
||||
const char *argv[8];
|
||||
const char *path;
|
||||
char time[16];
|
||||
#endif
|
||||
WinStatus ws;
|
||||
|
||||
/* no balloons if the window is focused */
|
||||
ws = tray_get_window_status ();
|
||||
if ((prefs.hex_away_omit_alerts && hexchat_get_info(ph, "away")) ||
|
||||
(prefs.hex_gui_focus_omitalerts && ws == WS_FOCUSED))
|
||||
return;
|
||||
|
||||
/* bit 1 of flags means "no balloons unless hidden/iconified" */
|
||||
if (ws != WS_HIDDEN && prefs.hex_gui_tray_quiet)
|
||||
return;
|
||||
|
||||
/* FIXME: this should close the current balloon */
|
||||
if (!text)
|
||||
return;
|
||||
|
||||
#ifdef USE_LIBNOTIFY
|
||||
static int notify_text_strip_flags = STRIP_ALL;
|
||||
NotifyNotification *notification;
|
||||
char *notify_text, *notify_title;
|
||||
|
||||
if (!notify_is_initted())
|
||||
{
|
||||
GList* server_caps;
|
||||
notify_init(PACKAGE_NAME);
|
||||
|
||||
server_caps = notify_get_server_caps ();
|
||||
if (g_list_find_custom (server_caps, "body-markup", (GCompareFunc)strcmp))
|
||||
{
|
||||
notify_text_strip_flags |= STRIP_ESCMARKUP;
|
||||
}
|
||||
g_list_free_full (server_caps, g_free);
|
||||
}
|
||||
|
||||
notify_text = strip_color (text, -1, notify_text_strip_flags);
|
||||
notify_title = strip_color (title, -1, STRIP_ALL);
|
||||
|
||||
notification = XC_NOTIFY_NEW (notify_title, notify_text, HEXCHATSHAREDIR "/icons/hicolor/scalable/apps/hexchat.svg", NULL);
|
||||
|
||||
#if NOTIFY_CHECK_VERSION(0,7,0)
|
||||
notify_notification_set_hint (notification, "desktop-entry", g_variant_new_string ("hexchat"));
|
||||
#endif
|
||||
|
||||
g_free ((char *)notify_title);
|
||||
g_free ((char *)notify_text);
|
||||
|
||||
notify_notification_set_timeout (notification, prefs.hex_input_balloon_time*1000);
|
||||
notify_notification_show (notification, NULL);
|
||||
|
||||
g_object_unref (notification);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
tray_set_balloonf (const char *text, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
buf = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
|
||||
fe_tray_set_balloon (buf, text);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
static void
|
||||
tray_set_tipf (const char *format, ...)
|
||||
{
|
||||
@@ -487,32 +576,26 @@ tray_menu_destroy (GtkWidget *menu, gpointer userdata)
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
static gboolean
|
||||
static void
|
||||
tray_menu_enter_cb (GtkWidget *menu)
|
||||
{
|
||||
tray_menu_inactivetime = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
tray_menu_left_cb (GtkWidget *menu)
|
||||
{
|
||||
tray_menu_inactivetime = g_get_real_time ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
tray_check_hide (GtkWidget *menu)
|
||||
{
|
||||
if (tray_menu_inactivetime && g_get_real_time () - tray_menu_inactivetime >= 2000000)
|
||||
{
|
||||
tray_menu_destroy (menu, NULL);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
tray_menu_settings (GtkWidget * wid, gpointer none)
|
||||
@@ -520,6 +603,7 @@ tray_menu_settings (GtkWidget * wid, gpointer none)
|
||||
extern void setup_open (void);
|
||||
setup_open ();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata)
|
||||
@@ -568,9 +652,10 @@ tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata)
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
|
||||
menu_add_plugin_items (menu, "\x5$TRAY", NULL);
|
||||
|
||||
#ifdef WIN32
|
||||
tray_make_item (menu, NULL, tray_menu_quit_cb, NULL);
|
||||
mg_create_icon_item (_("_Preferences"), GTK_STOCK_PREFERENCES, menu, tray_menu_settings, NULL);
|
||||
#endif
|
||||
tray_make_item (menu, NULL, tray_menu_quit_cb, NULL);
|
||||
mg_create_icon_item (_("_Quit"), GTK_STOCK_QUIT, menu, tray_menu_quit_cb, NULL);
|
||||
|
||||
@@ -585,7 +670,7 @@ tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata)
|
||||
g_signal_connect (G_OBJECT (menu), "enter-notify-event",
|
||||
G_CALLBACK (tray_menu_enter_cb), NULL);
|
||||
|
||||
tray_menu_timer = g_timeout_add (500, tray_check_hide, menu);
|
||||
tray_menu_timer = g_timeout_add(500, (GSourceFunc) tray_check_hide, menu);
|
||||
#endif
|
||||
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL,
|
||||
@@ -634,6 +719,10 @@ tray_hilight_cb (char *word[], void *userdata)
|
||||
tray_hilight_count, word[1], hexchat_get_info (ph, "channel"));
|
||||
}
|
||||
|
||||
if (prefs.hex_input_balloon_hilight)
|
||||
tray_set_balloonf (word[2], _("Highlighted message from: %s (%s)"),
|
||||
word[1], hexchat_get_info (ph, "channel"));
|
||||
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
@@ -655,6 +744,10 @@ tray_message_cb (char *word[], void *userdata)
|
||||
tray_set_tipf (_(DISPLAY_NAME": %u channel messages."), tray_pub_count);
|
||||
}
|
||||
|
||||
if (prefs.hex_input_balloon_chans)
|
||||
tray_set_balloonf (word[2], _("Channel message from: %s (%s)"),
|
||||
word[1], hexchat_get_info (ph, "channel"));
|
||||
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
@@ -682,6 +775,10 @@ tray_priv (char *from, char *text)
|
||||
tray_set_tipf (_(DISPLAY_NAME": %u private messages, latest from: %s (%s)"),
|
||||
tray_priv_count, from, network);
|
||||
}
|
||||
|
||||
if (prefs.hex_input_balloon_priv)
|
||||
tray_set_balloonf (text, _("Private message from: %s (%s)"),
|
||||
from, network);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -726,6 +823,10 @@ tray_dcc_cb (char *word[], void *userdata)
|
||||
tray_file_count, word[1], network);
|
||||
}
|
||||
|
||||
if (prefs.hex_input_balloon_priv && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
|
||||
tray_set_balloonf ("", _("File offer from: %s (%s)"),
|
||||
word[1], network);
|
||||
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
@@ -804,6 +905,8 @@ tray_plugin_deinit (hexchat_plugin *plugin_handle)
|
||||
{
|
||||
#ifdef WIN32
|
||||
tray_cleanup ();
|
||||
#elif defined(USE_LIBNOTIFY)
|
||||
notify_uninit ();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ static GtkWidget *servlist_open_edit (GtkWidget *parent, ircnet *net);
|
||||
static const char *pages[]=
|
||||
{
|
||||
IRC_DEFAULT_CHARSET,
|
||||
"CP1252 (Windows-1252)",
|
||||
"IRC (Latin/Unicode Hybrid)",
|
||||
"ISO-8859-15 (Western Europe)",
|
||||
"ISO-8859-2 (Central Europe)",
|
||||
"ISO-8859-7 (Greek)",
|
||||
@@ -1592,6 +1592,7 @@ servlist_create_charsetcombo (void)
|
||||
int i;
|
||||
|
||||
cb = gtk_combo_box_text_new_with_entry ();
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "System default");
|
||||
i = 0;
|
||||
while (pages[i])
|
||||
{
|
||||
@@ -1599,7 +1600,7 @@ servlist_create_charsetcombo (void)
|
||||
i++;
|
||||
}
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN(cb))), selected_net->encoding ? selected_net->encoding : pages[0]);
|
||||
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN(cb))), selected_net->encoding ? selected_net->encoding : "System default");
|
||||
|
||||
g_signal_connect (G_OBJECT (gtk_bin_get_child (GTK_BIN (cb))), "changed",
|
||||
G_CALLBACK (servlist_combo_cb), NULL);
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "pixmaps.h"
|
||||
#include "menu.h"
|
||||
#include "plugin-tray.h"
|
||||
#include "notifications/notification-backend.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "../common/fe.h"
|
||||
@@ -398,47 +397,9 @@ static const setting alert_settings[] =
|
||||
{ST_HEADER, N_("Alerts"),0,0,0},
|
||||
|
||||
{ST_ALERTHEAD},
|
||||
|
||||
|
||||
{ST_3OGGLE, N_("Show notifications on:"), 0, 0, (void *)balloonlist, 0},
|
||||
{ST_3OGGLE, N_("Blink tray icon on:"), 0, 0, (void *)trayblinklist, 0},
|
||||
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
|
||||
#ifdef WIN32
|
||||
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play the \"Instant Message Notification\" system sound upon the selected events"), (void *)beeplist, 0},
|
||||
#else
|
||||
#ifdef USE_LIBCANBERRA
|
||||
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play \"message-new-instant\" from the freedesktop.org sound theme upon the selected events"), (void *)beeplist, 0},
|
||||
#else
|
||||
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play a GTK beep upon the selected events"), (void *)beeplist, 0},
|
||||
#if !defined (WIN32) && !defined (__APPLE__)
|
||||
{ST_3OGGLE, N_("Show tray balloons on:"), 0, 0, (void *)balloonlist, 0},
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Omit alerts while the window is focused"), P_OFFINTNL(hex_gui_focus_omitalerts), 0, 0, 0},
|
||||
|
||||
{ST_HEADER, N_("Tray Behavior"), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 4},
|
||||
{ST_TOGGLE, N_("Minimize to tray"), P_OFFINTNL(hex_gui_tray_minimize), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Close to tray"), P_OFFINTNL(hex_gui_tray_close), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Automatically mark away/back"), P_OFFINTNL(hex_gui_tray_away), N_("Automatically change status when hiding to tray."), 0, 0},
|
||||
{ST_TOGGLE, N_("Only show notifications when hidden or iconified"), P_OFFINTNL(hex_gui_tray_quiet), 0, 0, 0},
|
||||
|
||||
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
|
||||
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
|
||||
|
||||
{ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL(hex_irc_extra_hilight), 0, 0, sizeof prefs.hex_irc_extra_hilight},
|
||||
{ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL(hex_irc_no_hilight), 0, 0, sizeof prefs.hex_irc_no_hilight},
|
||||
{ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL(hex_irc_nick_hilight), 0, 0, sizeof prefs.hex_irc_nick_hilight},
|
||||
{ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")},
|
||||
|
||||
{ST_END, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static const setting alert_settings_nonotifications[] =
|
||||
{
|
||||
{ST_HEADER, N_("Alerts"),0,0,0},
|
||||
|
||||
{ST_ALERTHEAD},
|
||||
{ST_3OGGLE, N_("Blink tray icon on:"), 0, 0, (void *)trayblinklist, 0},
|
||||
#ifdef HAVE_GTK_MAC
|
||||
{ST_3OGGLE, N_("Bounce dock icon on:"), 0, 0, (void *)taskbarlist, 0},
|
||||
@@ -461,10 +422,17 @@ static const setting alert_settings_nonotifications[] =
|
||||
{ST_TOGGLE, N_("Omit alerts while the window is focused"), P_OFFINTNL(hex_gui_focus_omitalerts), 0, 0, 0},
|
||||
|
||||
{ST_HEADER, N_("Tray Behavior"), 0, 0, 0},
|
||||
#ifdef WIN32
|
||||
{ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 3},
|
||||
#else
|
||||
{ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 4},
|
||||
#endif
|
||||
{ST_TOGGLE, N_("Minimize to tray"), P_OFFINTNL(hex_gui_tray_minimize), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Close to tray"), P_OFFINTNL(hex_gui_tray_close), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Automatically mark away/back"), P_OFFINTNL(hex_gui_tray_away), N_("Automatically change status when hiding to tray."), 0, 0},
|
||||
#ifndef WIN32
|
||||
{ST_TOGGLE, N_("Only show tray balloons when hidden or iconified"), P_OFFINTNL(hex_gui_tray_quiet), 0, 0, 0},
|
||||
#endif
|
||||
|
||||
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
|
||||
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
|
||||
@@ -482,7 +450,7 @@ static const setting alert_settings_unity[] =
|
||||
{ST_HEADER, N_("Alerts"),0,0,0},
|
||||
|
||||
{ST_ALERTHEAD},
|
||||
{ST_3OGGLE, N_("Show notifications on:"), 0, 0, (void *)balloonlist, 0},
|
||||
{ST_3OGGLE, N_("Show tray balloons on:"), 0, 0, (void *)balloonlist, 0},
|
||||
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
|
||||
{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
|
||||
|
||||
@@ -500,28 +468,6 @@ static const setting alert_settings_unity[] =
|
||||
{ST_END, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static const setting alert_settings_unityandnonotifications[] =
|
||||
{
|
||||
{ST_HEADER, N_("Alerts"), 0, 0, 0},
|
||||
|
||||
{ST_ALERTHEAD},
|
||||
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
|
||||
{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
|
||||
|
||||
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL (hex_away_omit_alerts), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Omit alerts while the window is focused"), P_OFFINTNL (hex_gui_focus_omitalerts), 0, 0, 0},
|
||||
|
||||
{ST_HEADER, N_("Highlighted Messages"), 0, 0, 0},
|
||||
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
|
||||
|
||||
{ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL (hex_irc_extra_hilight), 0, 0, sizeof prefs.hex_irc_extra_hilight},
|
||||
{ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL (hex_irc_no_hilight), 0, 0, sizeof prefs.hex_irc_no_hilight},
|
||||
{ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL (hex_irc_nick_hilight), 0, 0, sizeof prefs.hex_irc_nick_hilight},
|
||||
{ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")},
|
||||
|
||||
{ST_END, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static const setting general_settings[] =
|
||||
{
|
||||
{ST_HEADER, N_("Default Messages"),0,0,0},
|
||||
@@ -614,9 +560,7 @@ static const char *const proxytypes[] =
|
||||
N_("Socks4"),
|
||||
N_("Socks5"),
|
||||
N_("HTTP"),
|
||||
#ifdef USE_LIBPROXY
|
||||
N_("Auto"),
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -1886,18 +1830,10 @@ setup_create_pages (GtkWidget *box)
|
||||
|
||||
setup_add_page (cata[8], book, setup_create_page (general_settings));
|
||||
|
||||
if (unity_mode () && !notification_backend_supported ())
|
||||
{
|
||||
setup_add_page (cata[9], book, setup_create_page (alert_settings_unityandnonotifications));
|
||||
}
|
||||
else if (unity_mode ())
|
||||
if (unity_mode ())
|
||||
{
|
||||
setup_add_page (cata[9], book, setup_create_page (alert_settings_unity));
|
||||
}
|
||||
else if (!notification_backend_supported ())
|
||||
{
|
||||
setup_add_page (cata[9], book, setup_create_page (alert_settings_nonotifications));
|
||||
}
|
||||
else
|
||||
{
|
||||
setup_add_page (cata[9], book, setup_create_page (alert_settings));
|
||||
@@ -2194,13 +2130,6 @@ setup_apply (struct hexchatprefs *pr)
|
||||
" menu first."),
|
||||
FE_MSG_WARN | FE_MSG_MARKUP);
|
||||
|
||||
/* format cannot be blank, there is already a setting for this */
|
||||
if (pr->hex_stamp_text_format[0] == 0)
|
||||
{
|
||||
pr->hex_stamp_text = 0;
|
||||
strcpy (pr->hex_stamp_text_format, prefs.hex_stamp_text_format);
|
||||
}
|
||||
|
||||
memcpy (&prefs, pr, sizeof (prefs));
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -31,12 +31,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "sexy-iso-codes.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "marshal.h"
|
||||
#else
|
||||
#include "../common/marshal.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include "../common/typedef.h"
|
||||
|
@@ -37,13 +37,7 @@
|
||||
#include "../common/util.h"
|
||||
#include "../common/hexchatc.h"
|
||||
#include "../common/url.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "marshal.h"
|
||||
#else
|
||||
#include "../common/marshal.h"
|
||||
#endif
|
||||
|
||||
#include "fe-gtk.h"
|
||||
#include "xtext.h"
|
||||
#include "fkeys.h"
|
||||
|
@@ -96,8 +96,10 @@ fe_new_window (struct session *sess, int focus)
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
"\n"
|
||||
" \017HexChat-Text \00310"PACKAGE_VERSION"\n"
|
||||
" \017Running on \00310%s\n",
|
||||
get_sys_str (1));
|
||||
" \017Running on \00310%s \017glib \00310%d.%d.%d\n"
|
||||
" \017This binary compiled \00310"__DATE__"\017\n",
|
||||
get_sys_str (1),
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
fe_print_text (sess, buf, 0, FALSE);
|
||||
|
||||
fe_print_text (sess, "\n\nCompiled in Features\0032:\017 "
|
||||
@@ -900,6 +902,7 @@ void fe_tray_set_flash (const char *filename1, const char *filename2, int timeou
|
||||
void fe_tray_set_file (const char *filename){}
|
||||
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_userlist_update (session *sess, struct User *user){}
|
||||
void
|
||||
fe_open_chan_list (server *serv, char *filter, int do_refresh)
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -20,38 +19,77 @@
|
||||
<RootNamespace>fetext</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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<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>hexchat-text</TargetName>
|
||||
<OutDir>$(HexChatRel)</OutDir>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>hexchat-text</TargetName>
|
||||
<OutDir>$(HexChatBin)</OutDir>
|
||||
<IntDir>$(HexChatObj)$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(HexChatLib);$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>$(DepLibs);$(HexChatLib)common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(DepLibs);"$(OutDir)\common.lib";%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_CONSOLE;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(HexChatLib);$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>$(DepLibs);$(HexChatLib)common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(DepLibs);"$(OutDir)\common.lib";%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -62,4 +100,6 @@
|
||||
<ClCompile Include="fe-text.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -61,13 +61,22 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\hexchat-build\x64\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Release\thememan.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
@@ -1,2 +0,0 @@
|
||||
EXPORTS
|
||||
init_enchant_provider
|
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BF0EBC16-68AD-4CD1-864C-5B56836EBE2A}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>libenchant_win8</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<OutDir>$(HexChatRel)lib\enchant\</OutDir>
|
||||
<TargetName>libenchant_win8</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\common;$(HexChatLib);$(DepsRoot)\include\enchant;$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>libenchant_win8.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="win8_provider.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="win8_provider.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -1,293 +0,0 @@
|
||||
/* HexChat
|
||||
* Copyright (c) 2015 Patrick Griffis
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
#include <Spellcheck.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "typedef.h" // for ssize_t
|
||||
#include <enchant-provider.h>
|
||||
|
||||
ENCHANT_PLUGIN_DECLARE ("win8")
|
||||
|
||||
/* --------- Utils ----------*/
|
||||
|
||||
static char *
|
||||
utf16_to_utf8 (const wchar_t * const str, gboolean from_bcp47)
|
||||
{
|
||||
char *utf8 = g_utf16_to_utf8 ((gunichar2*)str, -1, nullptr, nullptr, nullptr);
|
||||
if (utf8 && from_bcp47)
|
||||
{
|
||||
char *p = utf8;
|
||||
/* bcp47 tags use syntax "en-US" while the myspell versions are "en_US" */
|
||||
while (*p)
|
||||
{
|
||||
if (*p == '-')
|
||||
*p = '_';
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return utf8;
|
||||
}
|
||||
|
||||
static wchar_t *
|
||||
utf8_to_utf16 (const char * const str, size_t len, gboolean to_bcp47)
|
||||
{
|
||||
wchar_t *utf16 = (wchar_t*)g_utf8_to_utf16 (str, len, nullptr, nullptr, nullptr);
|
||||
if (utf16 && to_bcp47)
|
||||
{
|
||||
wchar_t *p = utf16;
|
||||
/* bcp47 tags use syntax "en-US" while the myspell versions are "en_US" */
|
||||
while (*p)
|
||||
{
|
||||
if (*p == L'_')
|
||||
*p = L'-';
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return utf16;
|
||||
}
|
||||
|
||||
static char **
|
||||
enumstring_to_chararray (IEnumString *strings, size_t *out_len, gboolean from_bcp47)
|
||||
{
|
||||
char **chars = g_new (char*, 256); /* Hopefully large enough */
|
||||
LPOLESTR wstr = nullptr;
|
||||
size_t i = 0;
|
||||
|
||||
while (SUCCEEDED (strings->Next (1, &wstr, nullptr)) && i < 256 && wstr)
|
||||
{
|
||||
char *str = utf16_to_utf8 (wstr, from_bcp47);
|
||||
if (str)
|
||||
{
|
||||
chars[i] = str;
|
||||
i++;
|
||||
}
|
||||
CoTaskMemFree (wstr);
|
||||
}
|
||||
chars[i] = nullptr;
|
||||
strings->Release ();
|
||||
|
||||
*out_len = i;
|
||||
return chars;
|
||||
}
|
||||
|
||||
/* ---------- Dict ------------ */
|
||||
|
||||
static void
|
||||
win8_dict_add_to_personal (EnchantDict *dict, const char *const word, size_t len)
|
||||
{
|
||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
||||
wchar_t *wword = utf8_to_utf16 (word, len, FALSE);
|
||||
|
||||
checker->Add (wword);
|
||||
g_free (wword);
|
||||
}
|
||||
|
||||
static void
|
||||
win8_dict_add_to_session (EnchantDict *dict, const char *const word, size_t len)
|
||||
{
|
||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
||||
wchar_t *wword = utf8_to_utf16 (word, len, FALSE);
|
||||
|
||||
checker->Ignore (wword);
|
||||
g_free (wword);
|
||||
}
|
||||
|
||||
static int
|
||||
win8_dict_check (EnchantDict *dict, const char *const word, size_t len)
|
||||
{
|
||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
||||
wchar_t *wword = utf8_to_utf16 (word, len, FALSE);
|
||||
IEnumSpellingError *errors;
|
||||
ISpellingError *error = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
hr = checker->Check (wword, &errors);
|
||||
g_free (wword);
|
||||
|
||||
if (FAILED (hr))
|
||||
return -1; /* Error */
|
||||
|
||||
if (errors->Next (&error) == S_OK)
|
||||
{
|
||||
error->Release ();
|
||||
errors->Release ();
|
||||
return 1; /* Spelling Issue */
|
||||
}
|
||||
else
|
||||
{
|
||||
errors->Release ();
|
||||
return 0; /* Correct */
|
||||
}
|
||||
}
|
||||
|
||||
static char **
|
||||
win8_dict_suggest (EnchantDict *dict, const char *const word, size_t len, size_t *out_n_suggs)
|
||||
{
|
||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
||||
wchar_t *wword = utf8_to_utf16 (word, len, FALSE);
|
||||
IEnumString *suggestions;
|
||||
HRESULT hr;
|
||||
|
||||
hr = checker->Suggest (wword, &suggestions);
|
||||
g_free (wword);
|
||||
|
||||
if (FAILED (hr))
|
||||
{
|
||||
*out_n_suggs = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return enumstring_to_chararray (suggestions, out_n_suggs, FALSE);
|
||||
}
|
||||
|
||||
/* ---------- Provider ------------ */
|
||||
|
||||
static EnchantDict *
|
||||
win8_provider_request_dict (EnchantProvider *provider, const char *const tag)
|
||||
{
|
||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
||||
ISpellChecker *checker;
|
||||
EnchantDict *dict;
|
||||
wchar_t *wtag = utf8_to_utf16 (tag, -1, TRUE);
|
||||
HRESULT hr;
|
||||
|
||||
hr = factory->CreateSpellChecker (wtag, &checker);
|
||||
g_free (wtag);
|
||||
|
||||
if (FAILED (hr))
|
||||
return nullptr;
|
||||
|
||||
dict = g_new0 (EnchantDict, 1);
|
||||
dict->suggest = win8_dict_suggest;
|
||||
dict->check = win8_dict_check;
|
||||
dict->add_to_personal = win8_dict_add_to_personal;
|
||||
dict->add_to_exclude = win8_dict_add_to_personal; /* Basically the same */
|
||||
dict->add_to_session = win8_dict_add_to_session;
|
||||
|
||||
dict->user_data = checker;
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
static void
|
||||
win8_provider_dispose_dict (EnchantProvider *provider, EnchantDict *dict)
|
||||
{
|
||||
if (dict)
|
||||
{
|
||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
||||
|
||||
checker->Release ();
|
||||
g_free (dict);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
win8_provider_dictionary_exists (EnchantProvider *provider, const char *const tag)
|
||||
{
|
||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
||||
wchar_t *wtag = utf8_to_utf16 (tag, -1, TRUE);
|
||||
|
||||
BOOL is_supported = FALSE;
|
||||
factory->IsSupported (wtag, &is_supported);
|
||||
|
||||
g_free (wtag);
|
||||
return is_supported;
|
||||
}
|
||||
|
||||
|
||||
static char **
|
||||
win8_provider_list_dicts (EnchantProvider *provider, size_t *out_n_dicts)
|
||||
{
|
||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
||||
IEnumString *dicts;
|
||||
|
||||
if (FAILED(factory->get_SupportedLanguages (&dicts)))
|
||||
{
|
||||
*out_n_dicts = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return enumstring_to_chararray (dicts, out_n_dicts, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
win8_provider_free_string_list (EnchantProvider *provider, char **str_list)
|
||||
{
|
||||
g_strfreev (str_list);
|
||||
}
|
||||
|
||||
static void
|
||||
win8_provider_dispose (EnchantProvider *provider)
|
||||
{
|
||||
if (provider)
|
||||
{
|
||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
||||
|
||||
factory->Release();
|
||||
g_free (provider);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
win8_provider_identify (EnchantProvider *provider)
|
||||
{
|
||||
return "win8";
|
||||
}
|
||||
|
||||
static const char *
|
||||
win8_provider_describe (EnchantProvider *provider)
|
||||
{
|
||||
return "Windows 8 SpellCheck Provider";
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
EnchantProvider *
|
||||
init_enchant_provider (void)
|
||||
{
|
||||
EnchantProvider *provider;
|
||||
ISpellCheckerFactory *factory;
|
||||
|
||||
if (FAILED (CoCreateInstance (__uuidof(SpellCheckerFactory), nullptr,
|
||||
CLSCTX_INPROC_SERVER, IID_PPV_ARGS (&factory))))
|
||||
return nullptr;
|
||||
|
||||
provider = g_new0 (EnchantProvider, 1);
|
||||
provider->dispose = win8_provider_dispose;
|
||||
provider->request_dict = win8_provider_request_dict;
|
||||
provider->dispose_dict = win8_provider_dispose_dict;
|
||||
provider->dictionary_exists = win8_provider_dictionary_exists;
|
||||
provider->identify = win8_provider_identify;
|
||||
provider->describe = win8_provider_describe;
|
||||
provider->list_dicts = win8_provider_list_dicts;
|
||||
provider->free_string_list = win8_provider_free_string_list;
|
||||
|
||||
provider->user_data = factory;
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,6 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
@@ -19,65 +18,73 @@
|
||||
<RootNamespace>copy</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" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\hexchat.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="..\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="..\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>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>$(HexChatCopy)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>$(HexChatCopy)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(DepsRoot)\bin\cert.pem" />
|
||||
<None Include="$(DepsRoot)\bin\atk-1.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\cairo.dll" />
|
||||
<None Include="$(DepsRoot)\bin\fontconfig.dll" />
|
||||
<None Include="$(DepsRoot)\bin\gdk_pixbuf-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\gdk-win32-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\gio-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\glib-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\gmodule-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\gobject-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\gspawn-win$(PlatformArchitecture)-helper.exe" />
|
||||
<None Include="$(DepsRoot)\bin\gspawn-win$(PlatformArchitecture)-helper-console.exe" />
|
||||
<None Include="$(DepsRoot)\bin\gthread-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\gtk-win32-2.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\harfbuzz.dll" />
|
||||
<None Include="$(DepsRoot)\bin\iconv.dll" />
|
||||
<None Include="$(DepsRoot)\bin\libeay32.dll" />
|
||||
<None Include="$(DepsRoot)\bin\libenchant.dll" />
|
||||
<None Include="$(DepsRoot)\bin\libintl.dll" />
|
||||
<None Include="$(DepsRoot)\bin\libpng16.dll" />
|
||||
<None Include="$(DepsRoot)\bin\libxml2.dll" />
|
||||
<None Include="$(DepsRoot)\bin\pango-1.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\pangocairo-1.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\pangoft2-1.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\pangowin32-1.0.dll" />
|
||||
<None Include="$(DepsRoot)\bin\pixman-1.dll" />
|
||||
<None Include="$(DepsRoot)\bin\ssleay32.dll" />
|
||||
<None Include="$(DepsRoot)\bin\zlib1.dll" />
|
||||
<None Include="$(WinSparklePath)\WinSparkle.dll" />
|
||||
<None Include="$(HexChatBin)thememan.exe" />
|
||||
<None Include="changelog.url" />
|
||||
<None Include="readme.url" />
|
||||
|
||||
<Engines Include="$(DepsRoot)\lib\gtk-2.0\i686-pc-vs10\engines\**\*" />
|
||||
|
||||
<Share Include="share\**\*" />
|
||||
|
||||
<DepsRootDocs Include="$(DepsRoot)\share\doc\**\*" />
|
||||
|
||||
<Locale Include="$(HexChatBin)locale\**\*;$(DepsRoot)\share\locale\**\*" />
|
||||
|
||||
<MSWindowsTheme Include="$(DepsRoot)\share\themes\MS-Windows\**\*" />
|
||||
<None Include="share\xml\iso-codes\iso_3166.xml" />
|
||||
<None Include="share\xml\iso-codes\iso_639.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Target Name="Build">
|
||||
<Copy SourceFiles="@(None)" DestinationFolder="$(HexChatRel)" />
|
||||
<Copy SourceFiles="@(Engines)" DestinationFiles="@(Engines->'$(HexChatRel)\lib\gtk-2.0\i686-pc-vs10\engines\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Copy SourceFiles="@(Share)" DestinationFiles="@(Share->'$(HexChatRel)\share\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Copy SourceFiles="@(DepsRootDocs)" DestinationFiles="@(DepsRootDocs->'$(HexChatRel)\share\doc\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Copy SourceFiles="..\..\COPYING" DestinationFolder="$(HexChatRel)\share\doc\hexchat" />
|
||||
<Copy SourceFiles="$(WinSparklePath)\COPYING" DestinationFolder="$(HexChatRel)\share\doc\WinSparkle" />
|
||||
<Copy SourceFiles="$(DepsRoot)\lib\enchant\libenchant_myspell.dll" DestinationFolder="$(HexChatRel)\lib\enchant" />
|
||||
<Copy SourceFiles="@(Locale)" DestinationFiles="@(Locale->'$(HexChatRel)\share\locale\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Copy SourceFiles="@(MSWindowsTheme)" DestinationFiles="@(MSWindowsTheme->'$(HexChatRel)\share\themes\MS-Windows\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
|
||||
<WriteLinesToFile File="$(HexChatRel)portable-mode" Lines="2" Overwrite="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user