From 1319f3775c793bdfb8299f5757e7c198d7a61339 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky <mataes2007@gmail.com> Date: Mon, 27 Apr 2015 07:36:58 +0000 Subject: ConnectionNotify common project git-svn-id: http://svn.miranda-ng.org/main/trunk@13191 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ConnectionNotify/ConnectionNotify.vcxproj | 27 + .../ConnectionNotify.vcxproj.filters | 114 +++ .../ConnectionNotify/ConnectionNotify_10.vcxproj | 220 ----- .../ConnectionNotify_10.vcxproj.filters | 82 -- .../ConnectionNotify/ConnectionNotify_12.vcxproj | 225 ----- .../ConnectionNotify_12.vcxproj.filters | 82 -- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 903 ++++++++++----------- plugins/ConnectionNotify/src/ConnectionNotify.h | 51 -- plugins/ConnectionNotify/src/debug.cpp | 72 +- plugins/ConnectionNotify/src/debug.h | 2 +- plugins/ConnectionNotify/src/filter.cpp | 191 +++-- plugins/ConnectionNotify/src/filter.h | 2 +- plugins/ConnectionNotify/src/netstat.cpp | 40 +- plugins/ConnectionNotify/src/netstat.h | 4 +- plugins/ConnectionNotify/src/pid2name.cpp | 7 +- plugins/ConnectionNotify/src/stdafx.h | 49 ++ plugins/MirOTR/src/dialogs.cpp | 4 +- plugins/MirOTR/src/options.cpp | 48 +- plugins/MirOTR/src/options.h | 6 +- plugins/MirOTR/src/otr.cpp | 8 +- plugins/MirOTR/src/utils.cpp | 2 +- 21 files changed, 827 insertions(+), 1312 deletions(-) create mode 100644 plugins/ConnectionNotify/ConnectionNotify.vcxproj create mode 100644 plugins/ConnectionNotify/ConnectionNotify.vcxproj.filters delete mode 100644 plugins/ConnectionNotify/ConnectionNotify_10.vcxproj delete mode 100644 plugins/ConnectionNotify/ConnectionNotify_10.vcxproj.filters delete mode 100644 plugins/ConnectionNotify/ConnectionNotify_12.vcxproj delete mode 100644 plugins/ConnectionNotify/ConnectionNotify_12.vcxproj.filters delete mode 100644 plugins/ConnectionNotify/src/ConnectionNotify.h create mode 100644 plugins/ConnectionNotify/src/stdafx.h (limited to 'plugins') diff --git a/plugins/ConnectionNotify/ConnectionNotify.vcxproj b/plugins/ConnectionNotify/ConnectionNotify.vcxproj new file mode 100644 index 0000000000..5e71c5fb68 --- /dev/null +++ b/plugins/ConnectionNotify/ConnectionNotify.vcxproj @@ -0,0 +1,27 @@ +<?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="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <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>{3C83B0AB-9739-41C1-A127-ED7DB9551F76}</ProjectGuid> + </PropertyGroup> + <ImportGroup Label="PropertySheets"> + <Import Project="$(ProjectDir)..\..\build\vc.common\common.props" /> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/plugins/ConnectionNotify/ConnectionNotify.vcxproj.filters b/plugins/ConnectionNotify/ConnectionNotify.vcxproj.filters new file mode 100644 index 0000000000..464cabfbb7 --- /dev/null +++ b/plugins/ConnectionNotify/ConnectionNotify.vcxproj.filters @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" /> + <ItemGroup> + <ClCompile Include="src\stdafx.cxx"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\ConnectionNotify.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\debug.cpp" /> + <ClCompile Include="src\filter.cpp" /> + <ClCompile Include="src\netstat.cpp" /> + <ClCompile Include="src\pid2name.cpp" /> + <ClCompile Include="src\ConnectionNotify.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\debug.cpp" /> + <ClCompile Include="src\filter.cpp" /> + <ClCompile Include="src\netstat.cpp" /> + <ClCompile Include="src\pid2name.cpp" /> + <ClCompile Include="src\ConnectionNotify.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\debug.cpp" /> + <ClCompile Include="src\filter.cpp" /> + <ClCompile Include="src\netstat.cpp" /> + <ClCompile Include="src\pid2name.cpp" /> + <ClCompile Include="src\ConnectionNotify.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\debug.cpp" /> + <ClCompile Include="src\filter.cpp" /> + <ClCompile Include="src\netstat.cpp" /> + <ClCompile Include="src\pid2name.cpp" /> + <ClCompile Include="src\ConnectionNotify.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\debug.cpp" /> + <ClCompile Include="src\filter.cpp" /> + <ClCompile Include="src\netstat.cpp" /> + <ClCompile Include="src\pid2name.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="src\debug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h" /> + <ClInclude Include="src\netstat.h" /> + <ClInclude Include="src\pid2name.h" /> + <ClInclude Include="src\resource.h" /> + <ClInclude Include="src\stdafx.h" /> + <ClInclude Include="src\version.h" /> + <ClInclude Include="src\debug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h" /> + <ClInclude Include="src\netstat.h" /> + <ClInclude Include="src\pid2name.h" /> + <ClInclude Include="src\resource.h" /> + <ClInclude Include="src\stdafx.h" /> + <ClInclude Include="src\version.h" /> + <ClInclude Include="src\debug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h" /> + <ClInclude Include="src\netstat.h" /> + <ClInclude Include="src\pid2name.h" /> + <ClInclude Include="src\resource.h" /> + <ClInclude Include="src\stdafx.h" /> + <ClInclude Include="src\version.h" /> + <ClInclude Include="src\debug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h" /> + <ClInclude Include="src\netstat.h" /> + <ClInclude Include="src\pid2name.h" /> + <ClInclude Include="src\resource.h" /> + <ClInclude Include="src\stdafx.h" /> + <ClInclude Include="src\version.h" /> + <ClInclude Include="src\debug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h" /> + <ClInclude Include="src\netstat.h" /> + <ClInclude Include="src\pid2name.h" /> + <ClInclude Include="src\resource.h" /> + <ClInclude Include="src\stdafx.h" /> + <ClInclude Include="src\version.h" /> + <ClInclude Include="src\debug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h" /> + <ClInclude Include="src\netstat.h" /> + <ClInclude Include="src\pid2name.h" /> + <ClInclude Include="src\resource.h" /> + <ClInclude Include="src\stdafx.h" /> + <ClInclude Include="src\version.h" /> + <ClInclude Include="src\debug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h" /> + <ClInclude Include="src\netstat.h" /> + <ClInclude Include="src\pid2name.h" /> + <ClInclude Include="src\resource.h" /> + <ClInclude Include="src\stdafx.h" /> + <ClInclude Include="src\version.h" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="res\*.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/plugins/ConnectionNotify/ConnectionNotify_10.vcxproj b/plugins/ConnectionNotify/ConnectionNotify_10.vcxproj deleted file mode 100644 index c91c3fca60..0000000000 --- a/plugins/ConnectionNotify/ConnectionNotify_10.vcxproj +++ /dev/null @@ -1,220 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <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="src\ConnectionNotify.cpp" /> - <ClCompile Include="src\debug.cpp" /> - <ClCompile Include="src\filter.cpp" /> - <ClCompile Include="src\netstat.cpp" /> - <ClCompile Include="src\pid2name.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="src\ConnectionNotify.h" /> - <ClInclude Include="src\debug.h" /> - <ClInclude Include="src\filter.h" /> - <ClInclude Include="src\netstat.h" /> - <ClInclude Include="src\pid2name.h" /> - <ClInclude Include="src\resource.h" /> - <ClInclude Include="src\version.h" /> - </ItemGroup> - <ItemGroup> - <None Include="res\add.ico" /> - <None Include="res\arrowdown.ico" /> - <None Include="res\arrowup.ico" /> - <None Include="res\delete_item.ico" /> - <None Include="res\icon1.ico" /> - <None Include="res\icon2.ico" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="res\ConnectionNotify.rc" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>ConnectionNotify</ProjectName> - <ProjectGuid>{3C83B0AB-9739-41C1-A127-ED7DB9551F76}</ProjectGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </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" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir> - <IgnoreImportLibrary>true</IgnoreImportLibrary> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>Full</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FloatingPointModel>Fast</FloatingPointModel> - <WarningLevel>Level3</WarningLevel> - <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories> - <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <Optimization>Full</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories> - <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Optimization>Disabled</Optimization> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/plugins/ConnectionNotify/ConnectionNotify_10.vcxproj.filters b/plugins/ConnectionNotify/ConnectionNotify_10.vcxproj.filters deleted file mode 100644 index df30d4662e..0000000000 --- a/plugins/ConnectionNotify/ConnectionNotify_10.vcxproj.filters +++ /dev/null @@ -1,82 +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>{cf1940c5-1f67-4b6c-8964-345adcdc30c1}</UniqueIdentifier> - </Filter> - <Filter Include="Resource files"> - <UniqueIdentifier>{2f3c4c59-a0c6-4bfb-ae62-634579279aa6}</UniqueIdentifier> - </Filter> - <Filter Include="Header files"> - <UniqueIdentifier>{6a763351-ef34-466b-a73f-2ce593c607a8}</UniqueIdentifier> - </Filter> - <Filter Include="Resource files\Icons"> - <UniqueIdentifier>{faf68487-f64e-4c1c-96a1-45b570b5a687}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\ConnectionNotify.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\debug.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\filter.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\netstat.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\pid2name.cpp"> - <Filter>Source files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="src\ConnectionNotify.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\debug.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\filter.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\netstat.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\pid2name.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\version.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\resource.h"> - <Filter>Header files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <None Include="res\arrowup.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\arrowdown.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\add.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\delete_item.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\icon1.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\icon2.ico"> - <Filter>Resource files\Icons</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="res\ConnectionNotify.rc"> - <Filter>Resource files</Filter> - </ResourceCompile> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/plugins/ConnectionNotify/ConnectionNotify_12.vcxproj b/plugins/ConnectionNotify/ConnectionNotify_12.vcxproj deleted file mode 100644 index 54a1b83859..0000000000 --- a/plugins/ConnectionNotify/ConnectionNotify_12.vcxproj +++ /dev/null @@ -1,225 +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="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <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="src\ConnectionNotify.cpp" /> - <ClCompile Include="src\debug.cpp" /> - <ClCompile Include="src\filter.cpp" /> - <ClCompile Include="src\netstat.cpp" /> - <ClCompile Include="src\pid2name.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="src\ConnectionNotify.h" /> - <ClInclude Include="src\debug.h" /> - <ClInclude Include="src\filter.h" /> - <ClInclude Include="src\netstat.h" /> - <ClInclude Include="src\pid2name.h" /> - <ClInclude Include="src\resource.h" /> - <ClInclude Include="src\version.h" /> - </ItemGroup> - <ItemGroup> - <None Include="res\add.ico" /> - <None Include="res\arrowdown.ico" /> - <None Include="res\arrowup.ico" /> - <None Include="res\delete_item.ico" /> - <None Include="res\icon1.ico" /> - <None Include="res\icon2.ico" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="res\ConnectionNotify.rc" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>ConnectionNotify</ProjectName> - <ProjectGuid>{3C83B0AB-9739-41C1-A127-ED7DB9551F76}</ProjectGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120_xp</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v120_xp</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v120_xp</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v120_xp</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </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" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir> - <IgnoreImportLibrary>true</IgnoreImportLibrary> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>Full</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BufferSecurityCheck>false</BufferSecurityCheck> - <FloatingPointModel>Fast</FloatingPointModel> - <WarningLevel>Level3</WarningLevel> - <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories> - <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <Optimization>Full</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories> - <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Optimization>Disabled</Optimization> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <ExceptionHandling>false</ExceptionHandling> - <PrecompiledHeaderFile> - </PrecompiledHeaderFile> - </ClCompile> - <Link> - <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories> - <AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/plugins/ConnectionNotify/ConnectionNotify_12.vcxproj.filters b/plugins/ConnectionNotify/ConnectionNotify_12.vcxproj.filters deleted file mode 100644 index d2f396a9c0..0000000000 --- a/plugins/ConnectionNotify/ConnectionNotify_12.vcxproj.filters +++ /dev/null @@ -1,82 +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>{cf1940c5-1f67-4b6c-8964-345adcdc30c1}</UniqueIdentifier> - </Filter> - <Filter Include="Resource files"> - <UniqueIdentifier>{2f3c4c59-a0c6-4bfb-ae62-634579279aa6}</UniqueIdentifier> - </Filter> - <Filter Include="Header files"> - <UniqueIdentifier>{6a763351-ef34-466b-a73f-2ce593c607a8}</UniqueIdentifier> - </Filter> - <Filter Include="Resource files\Icons"> - <UniqueIdentifier>{4a4f9fa3-56b1-4098-bfb6-2f7c63869e0c}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\ConnectionNotify.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\debug.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\filter.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\netstat.cpp"> - <Filter>Source files</Filter> - </ClCompile> - <ClCompile Include="src\pid2name.cpp"> - <Filter>Source files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="src\ConnectionNotify.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\debug.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\filter.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\netstat.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\pid2name.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\version.h"> - <Filter>Header files</Filter> - </ClInclude> - <ClInclude Include="src\resource.h"> - <Filter>Header files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <None Include="res\arrowup.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\arrowdown.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\add.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\icon1.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\delete_item.ico"> - <Filter>Resource files\Icons</Filter> - </None> - <None Include="res\icon2.ico"> - <Filter>Resource files\Icons</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="res\ConnectionNotify.rc"> - <Filter>Resource files</Filter> - </ResourceCompile> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index b579d937de..3b8417abfd 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -1,46 +1,46 @@ -#include "ConnectionNotify.h" +#include "stdafx.h" HINSTANCE hInst; //PLUGINLINK *pluginLink=NULL; -HANDLE hOptInit=NULL; +HANDLE hOptInit = NULL; static HWND hTimerWnd = (HWND)NULL; static UINT TID = (UINT)12021; //HANDLE hHookModulesLoaded=NULL; -HANDLE hCheckEvent=NULL; -HANDLE hCheckHook=NULL; -HANDLE hHookModulesLoaded=NULL; -HANDLE hHookPreShutdown=NULL; +HANDLE hCheckEvent = NULL; +HANDLE hCheckHook = NULL; +HANDLE hHookModulesLoaded = NULL; +HANDLE hHookPreShutdown = NULL; HANDLE hConnectionCheckThread = NULL; -HANDLE hFilterOptionsThread=NULL; -HANDLE killCheckThreadEvent=NULL; -HANDLE hExceptionsMutex=NULL; +HANDLE hFilterOptionsThread = NULL; +HANDLE killCheckThreadEvent = NULL; +HANDLE hExceptionsMutex = NULL; //HANDLE hCurrentEditMutex=NULL; -int hLangpack=0; +int hLangpack = 0; DWORD FilterOptionsThreadId; DWORD ConnectionCheckThreadId; -BYTE settingSetColours=0; +BYTE settingSetColours = 0; COLORREF settingBgColor; COLORREF settingFgColor; -int settingInterval=0; -int settingInterval1=0; -BYTE settingResolveIp=0; +int settingInterval = 0; +int settingInterval1 = 0; +BYTE settingResolveIp = 0; BOOL settingStatus[STATUS_COUNT]; -int settingFiltersCount=0; -BOOL settingDefaultAction=TRUE; -WORD settingStatusMask=0; +int settingFiltersCount = 0; +BOOL settingDefaultAction = TRUE; +WORD settingStatusMask = 0; -struct CONNECTION *first=NULL; -struct CONNECTION *connExceptions=NULL; +struct CONNECTION *first = NULL; +struct CONNECTION *connExceptions = NULL; struct CONNECTION *connCurrentEdit; -struct CONNECTION *connExceptionsTmp=NULL; -struct CONNECTION *connCurrentEditModal=NULL; -int currentStatus = ID_STATUS_OFFLINE,diffstat=0; -BOOL bOptionsOpen=FALSE; -TCHAR *tcpStates[]={_T("CLOSED"),_T("LISTEN"),_T("SYN_SENT"),_T("SYN_RCVD"),_T("ESTAB"),_T("FIN_WAIT1"),_T("FIN_WAIT2"),_T("CLOSE_WAIT"),_T("CLOSING"),_T("LAST_ACK"),_T("TIME_WAIT"),_T("DELETE_TCB")}; +struct CONNECTION *connExceptionsTmp = NULL; +struct CONNECTION *connCurrentEditModal = NULL; +int currentStatus = ID_STATUS_OFFLINE, diffstat = 0; +BOOL bOptionsOpen = FALSE; +TCHAR *tcpStates[] = { _T("CLOSED"), _T("LISTEN"), _T("SYN_SENT"), _T("SYN_RCVD"), _T("ESTAB"), _T("FIN_WAIT1"), _T("FIN_WAIT2"), _T("CLOSE_WAIT"), _T("CLOSING"), _T("LAST_ACK"), _T("TIME_WAIT"), _T("DELETE_TCB") }; -PLUGININFOEX pluginInfo={ +PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), PLUGINNAME, __VERSION_DWORD, @@ -51,7 +51,7 @@ PLUGININFOEX pluginInfo={ __AUTHORWEB, UNICODE_AWARE, //not transient // 4BB5B4AA-C364-4F23-9746-D5B708A286A5 - {0x4bb5b4aa, 0xc364, 0x4f23, { 0x97, 0x46, 0xd5, 0xb7, 0x8, 0xa2, 0x86, 0xa5 } } + { 0x4bb5b4aa, 0xc364, 0x4f23, { 0x97, 0x46, 0xd5, 0xb7, 0x8, 0xa2, 0x86, 0xa5 } } }; extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_CONNECTIONNOTIFY, MIID_PROTOCOL, MIID_LAST }; @@ -61,14 +61,14 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_CONNEC //========================================================================================= -BOOL strrep(TCHAR *src,TCHAR *needle,TCHAR *newstring) +BOOL strrep(TCHAR *src, TCHAR *needle, TCHAR *newstring) { TCHAR *found, begining[MAX_SETTING_STR], tail[MAX_SETTING_STR]; size_t pos = 0; //strset(begining, ' '); //strset(tail, ' '); - if (!(found=_tcsstr(src, needle))) + if (!(found = _tcsstr(src, needle))) return FALSE; pos = (found - src); @@ -83,7 +83,7 @@ BOOL strrep(TCHAR *src,TCHAR *needle,TCHAR *newstring) return TRUE; } -extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } @@ -91,84 +91,85 @@ extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD m void saveSettingsConnections(struct CONNECTION *connHead) { char buff[128]; - int i=0; - struct CONNECTION *tmp=connHead; - while(tmp!=NULL) + int i = 0; + struct CONNECTION *tmp = connHead; + while (tmp != NULL) { - mir_snprintf(buff,SIZEOF(buff), "%dFilterIntIp", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterIntIp", i); db_set_ts(NULL, PLUGINNAME, buff, tmp->strIntIp); - mir_snprintf(buff,SIZEOF(buff), "%dFilterExtIp", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterExtIp", i); db_set_ts(NULL, PLUGINNAME, buff, tmp->strExtIp); - mir_snprintf(buff,SIZEOF(buff), "%dFilterPName", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterPName", i); db_set_ws(NULL, PLUGINNAME, buff, tmp->PName); - mir_snprintf(buff,SIZEOF(buff), "%dFilterIntPort", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterIntPort", i); db_set_dw(NULL, PLUGINNAME, buff, tmp->intIntPort); - mir_snprintf(buff,SIZEOF(buff), "%dFilterExtPort", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterExtPort", i); db_set_dw(NULL, PLUGINNAME, buff, tmp->intExtPort); - mir_snprintf(buff,SIZEOF(buff), "%dFilterAction", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterAction", i); db_set_dw(NULL, PLUGINNAME, buff, tmp->Pid); i++; - tmp=tmp->next; + tmp = tmp->next; } - settingFiltersCount=i; - db_set_dw(NULL, PLUGINNAME, "FiltersCount", settingFiltersCount ); - + settingFiltersCount = i; + db_set_dw(NULL, PLUGINNAME, "FiltersCount", settingFiltersCount); + } + //load filters from db struct CONNECTION* LoadSettingsConnections() { - struct CONNECTION *connHead=NULL; + struct CONNECTION *connHead = NULL; DBVARIANT dbv; char buff[128]; - int i=0; - for(i=settingFiltersCount-1;i>=0;i--) + int i = 0; + for (i = settingFiltersCount - 1; i >= 0; i--) { - struct CONNECTION *conn=(struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); - mir_snprintf(buff,SIZEOF(buff), "%dFilterIntIp", i); + struct CONNECTION *conn = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); + mir_snprintf(buff, SIZEOF(buff), "%dFilterIntIp", i); if (!db_get_ts(NULL, PLUGINNAME, buff, &dbv)) - wcsncpy(conn->strIntIp,dbv.ptszVal,_countof(conn->strIntIp)); + wcsncpy(conn->strIntIp, dbv.ptszVal, _countof(conn->strIntIp)); db_free(&dbv); - mir_snprintf(buff,SIZEOF(buff), "%dFilterExtIp", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterExtIp", i); if (!db_get_ts(NULL, PLUGINNAME, buff, &dbv)) - wcsncpy(conn->strExtIp,dbv.ptszVal,_countof(conn->strExtIp)); + wcsncpy(conn->strExtIp, dbv.ptszVal, _countof(conn->strExtIp)); db_free(&dbv); - mir_snprintf(buff,SIZEOF(buff), "%dFilterPName", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterPName", i); if (!db_get_ts(NULL, PLUGINNAME, buff, &dbv)) - wcsncpy(conn->PName,dbv.ptszVal,_countof(conn->PName)); + wcsncpy(conn->PName, dbv.ptszVal, _countof(conn->PName)); db_free(&dbv); - - mir_snprintf(buff,SIZEOF(buff), "%dFilterIntPort", i); + + mir_snprintf(buff, SIZEOF(buff), "%dFilterIntPort", i); conn->intIntPort = db_get_dw(0, PLUGINNAME, buff, -1); - - mir_snprintf(buff,SIZEOF(buff), "%dFilterExtPort", i); + + mir_snprintf(buff, SIZEOF(buff), "%dFilterExtPort", i); conn->intExtPort = db_get_dw(0, PLUGINNAME, buff, -1); - mir_snprintf(buff,SIZEOF(buff), "%dFilterAction", i); + mir_snprintf(buff, SIZEOF(buff), "%dFilterAction", i); conn->Pid = db_get_dw(0, PLUGINNAME, buff, 0); conn->next = connHead; - connHead=conn; + connHead = conn; } return connHead; } //called to load settings from database void LoadSettings() { - settingInterval=(INT)db_get_dw(NULL, PLUGINNAME, "Interval", 500); - settingInterval1=(INT)db_get_dw (NULL, PLUGINNAME, "PopupInterval", 0); - settingResolveIp=db_get_b (NULL, PLUGINNAME, "ResolveIp",TRUE); - settingDefaultAction=db_get_b (NULL, PLUGINNAME, "FilterDefaultAction",TRUE); - - settingSetColours=db_get_b (NULL, PLUGINNAME, "PopupSetColours",0); + settingInterval = (INT)db_get_dw(NULL, PLUGINNAME, "Interval", 500); + settingInterval1 = (INT)db_get_dw(NULL, PLUGINNAME, "PopupInterval", 0); + settingResolveIp = db_get_b(NULL, PLUGINNAME, "ResolveIp", TRUE); + settingDefaultAction = db_get_b(NULL, PLUGINNAME, "FilterDefaultAction", TRUE); + + settingSetColours = db_get_b(NULL, PLUGINNAME, "PopupSetColours", 0); settingBgColor = (COLORREF)db_get_dw(NULL, PLUGINNAME, "PopupBgColor", (DWORD)0xFFFFFF); settingFgColor = (COLORREF)db_get_dw(NULL, PLUGINNAME, "PopupFgColor", (DWORD)0x000000); - settingFiltersCount=(INT)db_get_dw (NULL, PLUGINNAME, "FiltersCount", 0); - settingStatusMask=(WORD)db_get_w(NULL, PLUGINNAME, "StatusMask", 16); - for(int i = 0; i < STATUS_COUNT; i++) + settingFiltersCount = (INT)db_get_dw(NULL, PLUGINNAME, "FiltersCount", 0); + settingStatusMask = (WORD)db_get_w(NULL, PLUGINNAME, "StatusMask", 16); + for (int i = 0; i < STATUS_COUNT; i++) { char buff[128]; - mir_snprintf(buff,SIZEOF(buff), "Status%d", i); + mir_snprintf(buff, SIZEOF(buff), "Status%d", i); settingStatus[i] = (db_get_b(0, PLUGINNAME, buff, 0) == 1); } //lookupLotusDefaultSettings(); @@ -176,10 +177,10 @@ void LoadSettings() void fillExceptionsListView(HWND hwndDlg) { - LVITEM lvI={0}; + LVITEM lvI = { 0 }; - int i=0; - struct CONNECTION *tmp=connExceptionsTmp; + int i = 0; + struct CONNECTION *tmp = connExceptionsTmp; HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS); ListView_DeleteAllItems(hwndList); @@ -187,104 +188,104 @@ void fillExceptionsListView(HWND hwndDlg) // Initialize LVITEM members that are common to all // items. lvI.mask = LVIF_TEXT; - while(tmp) + while (tmp) { TCHAR tmpAddress[25]; - lvI.iItem=i++; - lvI.iSubItem=0; - lvI.pszText=tmp->PName; + lvI.iItem = i++; + lvI.iSubItem = 0; + lvI.pszText = tmp->PName; ListView_InsertItem(hwndList, &lvI); - lvI.iSubItem=1; - if (tmp->intIntPort==-1) + lvI.iSubItem = 1; + if (tmp->intIntPort == -1) mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:*"), tmp->strIntIp); else mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:%d"), tmp->strIntIp, tmp->intIntPort); - lvI.pszText=tmpAddress; + lvI.pszText = tmpAddress; ListView_SetItem(hwndList, &lvI); - lvI.iSubItem=2; - if (tmp->intExtPort==-1) + lvI.iSubItem = 2; + if (tmp->intExtPort == -1) mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:*"), tmp->strExtIp); else mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:%d"), tmp->strExtIp, tmp->intExtPort); - lvI.pszText=tmpAddress; + lvI.pszText = tmpAddress; ListView_SetItem(hwndList, &lvI); - lvI.iSubItem=3; - lvI.pszText=tmp->Pid? LPGENT("Show"):LPGENT("Hide"); + lvI.iSubItem = 3; + lvI.pszText = tmp->Pid ? LPGENT("Show") : LPGENT("Hide"); ListView_SetItem(hwndList, &lvI); - tmp=tmp->next; + tmp = tmp->next; } - + } //filter editor dialog box procedure opened modally from options dialog static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - switch(message) + switch (message) { - case WM_INITDIALOG: - { - struct CONNECTION *conn=(struct CONNECTION*)lParam; - TranslateDialogDefault(hWnd); - connCurrentEditModal=conn; - SetDlgItemText(hWnd, ID_TEXT_NAME,conn->PName); - SetDlgItemText(hWnd, ID_TXT_LOCAL_IP,conn->strIntIp); - SetDlgItemText(hWnd, ID_TXT_REMOTE_IP,conn->strExtIp); - - if (conn->intIntPort==-1) - SetDlgItemText(hWnd, ID_TXT_LOCAL_PORT,_T("*")); - else - SetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT,conn->intIntPort,FALSE); + case WM_INITDIALOG: + { + struct CONNECTION *conn = (struct CONNECTION*)lParam; + TranslateDialogDefault(hWnd); + connCurrentEditModal = conn; + SetDlgItemText(hWnd, ID_TEXT_NAME, conn->PName); + SetDlgItemText(hWnd, ID_TXT_LOCAL_IP, conn->strIntIp); + SetDlgItemText(hWnd, ID_TXT_REMOTE_IP, conn->strExtIp); + + if (conn->intIntPort == -1) + SetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, _T("*")); + else + SetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, conn->intIntPort, FALSE); + + if (conn->intExtPort == -1) + SetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, _T("*")); + else + SetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, conn->intExtPort, FALSE); - if (conn->intExtPort==-1) - SetDlgItemText(hWnd, ID_TXT_REMOTE_PORT,_T("*")); + SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Always show popup")); + SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Never show popup")); + SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_SETCURSEL, conn->Pid == 0 ? 1 : 0, 0); + return TRUE; + } + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case ID_OK: + { + TCHAR tmpPort[6]; + GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort)); + if (tmpPort[0] == '*') + connCurrentEditModal->intIntPort = -1; else - SetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT,conn->intExtPort,FALSE); + connCurrentEditModal->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE); + GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort)); + if (tmpPort[0] == '*') + connCurrentEditModal->intExtPort = -1; + else + connCurrentEditModal->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE); + + GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, SIZEOF(connCurrentEditModal->strIntIp)); + GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, SIZEOF(connCurrentEditModal->strExtIp)); + GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEditModal->PName, SIZEOF(connCurrentEditModal->PName)); - SendDlgItemMessage(hWnd, ID_CBO_ACTION , CB_ADDSTRING, 0, (LPARAM)TranslateT("Always show popup")); - SendDlgItemMessage(hWnd, ID_CBO_ACTION , CB_ADDSTRING, 0, (LPARAM)TranslateT("Never show popup")); - SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_SETCURSEL ,conn->Pid==0?1:0,0); + connCurrentEditModal->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0); + + connCurrentEditModal = NULL; + EndDialog(hWnd, IDOK); + return TRUE; + } + case ID_CANCEL: + connCurrentEditModal = NULL; + EndDialog(hWnd, IDCANCEL); return TRUE; - } - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case ID_OK: - { - TCHAR tmpPort[6]; - GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort)); - if (tmpPort[0]=='*') - connCurrentEditModal->intIntPort=-1; - else - connCurrentEditModal->intIntPort=GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE); - GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort)); - if (tmpPort[0]=='*') - connCurrentEditModal->intExtPort=-1; - else - connCurrentEditModal->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE); - - GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, SIZEOF(connCurrentEditModal->strIntIp)); - GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, SIZEOF(connCurrentEditModal->strExtIp)); - GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEditModal->PName, SIZEOF(connCurrentEditModal->PName)); - - connCurrentEditModal->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0); - - connCurrentEditModal=NULL; - EndDialog(hWnd,IDOK); - return TRUE; - } - case ID_CANCEL: - connCurrentEditModal=NULL; - EndDialog(hWnd,IDCANCEL); - return TRUE; - } - return FALSE; - break; - case WM_CLOSE: - { - connCurrentEditModal=NULL; - EndDialog(hWnd,IDCANCEL); - break; } + return FALSE; + break; + case WM_CLOSE: + { + connCurrentEditModal = NULL; + EndDialog(hWnd, IDCANCEL); + break; + } } return FALSE; } @@ -293,246 +294,245 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndList; - switch(msg) { + switch (msg) { case WM_INITDIALOG://initialize dialog, so set properties from db. - { - LVCOLUMN lvc={0}; - LVITEM lvI={0}; - TCHAR buff[256]; - struct CONNECTION *tmp=connExceptions; - bOptionsOpen=TRUE; - TranslateDialogDefault(hwndDlg);//translate miranda function + { + LVCOLUMN lvc = { 0 }; + LVITEM lvI = { 0 }; + TCHAR buff[256]; + bOptionsOpen = TRUE; + TranslateDialogDefault(hwndDlg);//translate miranda function #ifdef _WIN64 - mir_sntprintf(buff,SIZEOF(buff),_T("%d.%d.%d.%d/64"), HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version))); + mir_sntprintf(buff,SIZEOF(buff),_T("%d.%d.%d.%d/64"), HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version))); #else - mir_sntprintf(buff,SIZEOF(buff),_T("%d.%d.%d.%d/32"), HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version))); + mir_sntprintf(buff, SIZEOF(buff), _T("%d.%d.%d.%d/32"), HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version))); #endif - SetDlgItemText(hwndDlg, IDC_VERSION, buff); - LoadSettings(); - //connExceptionsTmp=LoadSettingsConnections(); - SetDlgItemInt(hwndDlg, IDC_INTERVAL , settingInterval,FALSE); - SetDlgItemInt(hwndDlg, IDC_INTERVAL1 , settingInterval1,TRUE); - CheckDlgButton(hwndDlg, IDC_SETCOLOURS, settingSetColours ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_RESOLVEIP, settingResolveIp ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, ID_CHK_DEFAULTACTION, settingDefaultAction ? BST_CHECKED : BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingBgColor); - SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingFgColor); - if (!settingSetColours) { - HWND hwnd = GetDlgItem(hwndDlg, IDC_BGCOLOR); - CheckDlgButton(hwndDlg, IDC_SETCOLOURS, BST_UNCHECKED); - EnableWindow(hwnd, FALSE); - hwnd = GetDlgItem(hwndDlg, IDC_FGCOLOR); - EnableWindow(hwnd, FALSE); + SetDlgItemText(hwndDlg, IDC_VERSION, buff); + LoadSettings(); + //connExceptionsTmp=LoadSettingsConnections(); + SetDlgItemInt(hwndDlg, IDC_INTERVAL, settingInterval, FALSE); + SetDlgItemInt(hwndDlg, IDC_INTERVAL1, settingInterval1, TRUE); + CheckDlgButton(hwndDlg, IDC_SETCOLOURS, settingSetColours ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RESOLVEIP, settingResolveIp ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, ID_CHK_DEFAULTACTION, settingDefaultAction ? BST_CHECKED : BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingBgColor); + SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingFgColor); + if (!settingSetColours) { + HWND hwnd = GetDlgItem(hwndDlg, IDC_BGCOLOR); + CheckDlgButton(hwndDlg, IDC_SETCOLOURS, BST_UNCHECKED); + EnableWindow(hwnd, FALSE); + hwnd = GetDlgItem(hwndDlg, IDC_FGCOLOR); + EnableWindow(hwnd, FALSE); + } + SendDlgItemMessage(hwndDlg, ID_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON6), IMAGE_ICON, 16, 16, 0)); + SendDlgItemMessage(hwndDlg, ID_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON3), IMAGE_ICON, 16, 16, 0)); + SendDlgItemMessage(hwndDlg, ID_DOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON4), IMAGE_ICON, 16, 16, 0)); + SendDlgItemMessage(hwndDlg, ID_UP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON5), IMAGE_ICON, 16, 16, 0)); + // initialise and fill listbox + hwndList = GetDlgItem(hwndDlg, IDC_STATUS); + ListView_DeleteAllItems(hwndList); + SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); + // Initialize the LVCOLUMN structure. + // The mask specifies that the format, width, text, and + // subitem members of the structure are valid. + lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + lvc.fmt = LVCFMT_LEFT; + lvc.iSubItem = 0; + lvc.pszText = TranslateT("Status"); + lvc.cx = 120; // width of column in pixels + ListView_InsertColumn(hwndList, 0, &lvc); + // Some code to create the list-view control. + // Initialize LVITEM members that are common to all + // items. + lvI.mask = LVIF_TEXT; + for (int i = 0; i < STATUS_COUNT; i++) { + lvI.pszText = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, ID_STATUS_ONLINE + i, GSMDF_TCHAR); + lvI.iItem = i; + ListView_InsertItem(hwndList, &lvI); + ListView_SetCheckState(hwndList, i, settingStatus[i]); + } + + connExceptionsTmp = LoadSettingsConnections(); + hwndList = GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS); + SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); + + lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + lvc.fmt = LVCFMT_LEFT; + lvc.iSubItem = 0; + lvc.cx = 120; // width of column in pixels + lvc.pszText = TranslateT("Application"); + ListView_InsertColumn(hwndList, 1, &lvc); + lvc.pszText = TranslateT("Internal socket"); + ListView_InsertColumn(hwndList, 2, &lvc); + lvc.pszText = TranslateT("External socket"); + ListView_InsertColumn(hwndList, 3, &lvc); + lvc.pszText = TranslateT("Action"); + lvc.cx = 50; + ListView_InsertColumn(hwndList, 4, &lvc); + + //fill exceptions list + fillExceptionsListView(hwndDlg); + } + break; + + case WM_COMMAND://user changed something, so get changes to variables + PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + switch (LOWORD(wParam)) { + case IDC_INTERVAL: settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE); break; + case IDC_INTERVAL1: settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE); break; + case IDC_RESOLVEIP: settingResolveIp = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RESOLVEIP); break; + case ID_CHK_DEFAULTACTION: settingDefaultAction = (BYTE)IsDlgButtonChecked(hwndDlg, ID_CHK_DEFAULTACTION); break; + case ID_ADD: + { + struct CONNECTION *cur = (struct CONNECTION *)mir_alloc(sizeof(struct CONNECTION)); + memset(cur, 0, sizeof(struct CONNECTION)); + cur->intExtPort = -1; + cur->intIntPort = -1; + cur->Pid = 0; + cur->PName[0] = '*'; + cur->strExtIp[0] = '*'; + cur->strIntIp[0] = '*'; + + if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) { + mir_free(cur); + cur = NULL; } - SendDlgItemMessage(hwndDlg, ID_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst,MAKEINTRESOURCE(IDI_ICON6),IMAGE_ICON,16,16,0)); - SendDlgItemMessage(hwndDlg, ID_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst,MAKEINTRESOURCE(IDI_ICON3),IMAGE_ICON,16,16,0)); - SendDlgItemMessage(hwndDlg, ID_DOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst,MAKEINTRESOURCE(IDI_ICON4),IMAGE_ICON,16,16,0)); - SendDlgItemMessage(hwndDlg, ID_UP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst,MAKEINTRESOURCE(IDI_ICON5),IMAGE_ICON,16,16,0)); - // initialise and fill listbox - hwndList = GetDlgItem(hwndDlg, IDC_STATUS); - ListView_DeleteAllItems(hwndList); - SendMessage(hwndList,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); - // Initialize the LVCOLUMN structure. - // The mask specifies that the format, width, text, and - // subitem members of the structure are valid. - lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; - lvc.fmt = LVCFMT_LEFT; - lvc.iSubItem = 0; - lvc.pszText = TranslateT("Status"); - lvc.cx = 120; // width of column in pixels - ListView_InsertColumn(hwndList, 0, &lvc); - // Some code to create the list-view control. - // Initialize LVITEM members that are common to all - // items. - lvI.mask = LVIF_TEXT; - for(int i = 0; i < STATUS_COUNT; i++) { - lvI.pszText = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, ID_STATUS_ONLINE+i, GSMDF_TCHAR); - lvI.iItem = i; - ListView_InsertItem(hwndList, &lvI); - ListView_SetCheckState(hwndList, i, settingStatus[i]); + else { + cur->next = connExceptionsTmp; + connExceptionsTmp = cur; } - connExceptionsTmp=LoadSettingsConnections(); - hwndList = GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS); - SendMessage(hwndList,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT); - - lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; - lvc.fmt = LVCFMT_LEFT; - lvc.iSubItem = 0; - lvc.cx = 120; // width of column in pixels - lvc.pszText = TranslateT("Application"); - ListView_InsertColumn(hwndList, 1, &lvc); - lvc.pszText = TranslateT("Internal socket"); - ListView_InsertColumn(hwndList, 2, &lvc); - lvc.pszText = TranslateT("External socket"); - ListView_InsertColumn(hwndList, 3, &lvc); - lvc.pszText = TranslateT("Action"); - lvc.cx = 50; - ListView_InsertColumn(hwndList, 4, &lvc); - - //fill exceptions list fillExceptionsListView(hwndDlg); + ListView_SetItemState(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), 0, LVNI_FOCUSED | LVIS_SELECTED, LVNI_FOCUSED | LVIS_SELECTED); + SetFocus(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS)); } break; - case WM_COMMAND://user changed something, so get changes to variables - PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - switch(LOWORD(wParam)) { - case IDC_INTERVAL: settingInterval =GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE); break; - case IDC_INTERVAL1: settingInterval1 =GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE); break; - case IDC_RESOLVEIP: settingResolveIp=(BYTE) IsDlgButtonChecked(hwndDlg, IDC_RESOLVEIP); break; - case ID_CHK_DEFAULTACTION: settingDefaultAction=(BYTE) IsDlgButtonChecked(hwndDlg, ID_CHK_DEFAULTACTION); break; - case ID_ADD: - { - struct CONNECTION *cur=(struct CONNECTION *)mir_alloc(sizeof(struct CONNECTION)); - memset(cur,0,sizeof(struct CONNECTION)); - cur->intExtPort=-1; - cur->intIntPort=-1; - cur->Pid=0; - cur->PName[0]='*'; - cur->strExtIp[0]='*'; - cur->strIntIp[0]='*'; - - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur)==IDCANCEL) { - mir_free(cur); - cur = NULL; - } - else { - cur->next = connExceptionsTmp; - connExceptionsTmp = cur; - } + case ID_DELETE: + { + int pos, pos1; + struct CONNECTION *cur = connExceptionsTmp, *pre = NULL; - fillExceptionsListView(hwndDlg); - ListView_SetItemState(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS),0,LVNI_FOCUSED|LVIS_SELECTED , LVNI_FOCUSED|LVIS_SELECTED ); - SetFocus(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS)); + pos = (int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), -1, LVNI_FOCUSED); + if (pos == -1)break; + pos1 = pos; + while (pos--) + { + pre = cur; + cur = cur->next; } + if (pre == NULL) + connExceptionsTmp = connExceptionsTmp->next; + else + (pre)->next = cur->next; + mir_free(cur); + fillExceptionsListView(hwndDlg); + ListView_SetItemState(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), pos1, LVNI_FOCUSED | LVIS_SELECTED, LVNI_FOCUSED | LVIS_SELECTED); + SetFocus(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS)); break; + } + case ID_UP: + { + int pos, pos1; + struct CONNECTION *cur = NULL, *pre = NULL, *prepre = NULL; - case ID_DELETE: - { - int pos,pos1; - struct CONNECTION *cur = connExceptionsTmp, *pre = NULL; + cur = connExceptionsTmp; - pos=(int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS),-1,LVNI_FOCUSED ); - if (pos==-1)break; - pos1=pos; - while(pos--) - { - pre=cur; - cur=cur->next; - } - if (pre==NULL) - connExceptionsTmp=connExceptionsTmp->next; - else - (pre)->next=cur->next; - mir_free(cur); - fillExceptionsListView(hwndDlg); - ListView_SetItemState(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS),pos1,LVNI_FOCUSED|LVIS_SELECTED , LVNI_FOCUSED|LVIS_SELECTED ); - SetFocus(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS)); - break; + pos = (int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), -1, LVNI_FOCUSED); + if (pos == -1)break; + pos1 = pos; + while (pos--) + { + prepre = pre; + pre = cur; + cur = cur->next; } - case ID_UP: + if (prepre != NULL) { - int pos,pos1; - struct CONNECTION *cur=NULL,*pre=NULL,*prepre=NULL; - - cur=connExceptionsTmp; - - pos=(int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS),-1,LVNI_FOCUSED ); - if (pos==-1)break; - pos1=pos; - while(pos--) - { - prepre=pre; - pre=cur; - cur=cur->next; - } - if (prepre!=NULL) - { - pre->next=cur->next; - cur->next=pre; - prepre->next=cur; - } - else if (pre!=NULL) - { - pre->next=cur->next; - cur->next=pre; - connExceptionsTmp=cur; - } - fillExceptionsListView(hwndDlg); - ListView_SetItemState(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS),pos1-1,LVNI_FOCUSED|LVIS_SELECTED , LVNI_FOCUSED|LVIS_SELECTED ); - SetFocus(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS)); - break; + pre->next = cur->next; + cur->next = pre; + prepre->next = cur; } - case ID_DOWN: + else if (pre != NULL) { - int pos,pos1; - struct CONNECTION *cur=NULL,*pre=NULL; + pre->next = cur->next; + cur->next = pre; + connExceptionsTmp = cur; + } + fillExceptionsListView(hwndDlg); + ListView_SetItemState(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), pos1 - 1, LVNI_FOCUSED | LVIS_SELECTED, LVNI_FOCUSED | LVIS_SELECTED); + SetFocus(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS)); + break; + } + case ID_DOWN: + { + int pos, pos1; + struct CONNECTION *cur = NULL, *pre = NULL; - cur=connExceptionsTmp; + cur = connExceptionsTmp; - pos=(int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS),-1,LVNI_FOCUSED ); - if (pos==-1)break; - pos1=pos; - while(pos--) - { - pre=cur; - cur=cur->next; - } - if (cur==connExceptionsTmp&&cur->next!=NULL) - { - connExceptionsTmp=cur->next; - cur->next=cur->next->next; - connExceptionsTmp->next=cur; - } - else if (cur->next!=NULL) - { - struct CONNECTION *tmp=cur->next->next; - pre->next=cur->next; - cur->next->next=cur; - cur->next=tmp; - } - fillExceptionsListView(hwndDlg); - ListView_SetItemState(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS),pos1+1,LVNI_FOCUSED|LVIS_SELECTED , LVNI_FOCUSED|LVIS_SELECTED ); - SetFocus(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS)); - break; - } - case IDC_SETCOLOURS: + pos = (int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), -1, LVNI_FOCUSED); + if (pos == -1)break; + pos1 = pos; + while (pos--) { - HWND hwnd = GetDlgItem(hwndDlg, IDC_BGCOLOR); - settingSetColours=IsDlgButtonChecked(hwndDlg, IDC_SETCOLOURS); - EnableWindow(hwnd,settingSetColours ); - hwnd = GetDlgItem(hwndDlg, IDC_FGCOLOR); - EnableWindow(hwnd, settingSetColours); - break; + pre = cur; + cur = cur->next; + } + if (cur == connExceptionsTmp&&cur->next != NULL) + { + connExceptionsTmp = cur->next; + cur->next = cur->next->next; + connExceptionsTmp->next = cur; } - case IDC_BGCOLOR: settingBgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0);break; - case IDC_FGCOLOR: settingFgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_GETCOLOUR, 0, 0);break; + else if (cur->next != NULL) + { + struct CONNECTION *tmp = cur->next->next; + pre->next = cur->next; + cur->next->next = cur; + cur->next = tmp; + } + fillExceptionsListView(hwndDlg); + ListView_SetItemState(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), pos1 + 1, LVNI_FOCUSED | LVIS_SELECTED, LVNI_FOCUSED | LVIS_SELECTED); + SetFocus(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS)); + break; + } + case IDC_SETCOLOURS: + { + HWND hwnd = GetDlgItem(hwndDlg, IDC_BGCOLOR); + settingSetColours = IsDlgButtonChecked(hwndDlg, IDC_SETCOLOURS); + EnableWindow(hwnd, settingSetColours); + hwnd = GetDlgItem(hwndDlg, IDC_FGCOLOR); + EnableWindow(hwnd, settingSetColours); + break; + } + case IDC_BGCOLOR: settingBgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0); break; + case IDC_FGCOLOR: settingFgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_GETCOLOUR, 0, 0); break; } break; case WM_NOTIFY://apply changes so write it to db - switch(((LPNMHDR)lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_RESET: LoadSettings(); deleteConnectionsTable(connExceptionsTmp); - connExceptionsTmp=LoadSettingsConnections(); + connExceptionsTmp = LoadSettingsConnections(); return TRUE; case PSN_APPLY: - db_set_dw (NULL, PLUGINNAME, "Interval", settingInterval ); - db_set_dw (NULL, PLUGINNAME, "PopupInterval", settingInterval1 ); + db_set_dw(NULL, PLUGINNAME, "Interval", settingInterval); + db_set_dw(NULL, PLUGINNAME, "PopupInterval", settingInterval1); db_set_b(NULL, PLUGINNAME, "PopupSetColours", settingSetColours); db_set_dw(NULL, PLUGINNAME, "PopupBgColor", (DWORD)settingBgColor); db_set_dw(NULL, PLUGINNAME, "PopupFgColor", (DWORD)settingFgColor); db_set_b(NULL, PLUGINNAME, "ResolveIp", settingResolveIp); db_set_b(NULL, PLUGINNAME, "FilterDefaultAction", settingDefaultAction); - for(int i = 0; i < STATUS_COUNT ; i++) { + for (int i = 0; i < STATUS_COUNT; i++) { char buff[128]; mir_snprintf(buff, SIZEOF(buff), "Status%d", i); settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE); @@ -550,135 +550,135 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar break; } - if (GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS)==((LPNMHDR) lParam)->hwndFrom) { - switch (((LPNMHDR) lParam)->code) { + if (GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS) == ((LPNMHDR)lParam)->hwndFrom) { + switch (((LPNMHDR)lParam)->code) { case NM_DBLCLK: - { - int pos,pos1; - struct CONNECTION *cur=NULL; + { + int pos, pos1; + struct CONNECTION *cur = NULL; - cur=connExceptionsTmp; + cur = connExceptionsTmp; - pos=(int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS),-1,LVNI_FOCUSED ); - if (pos==-1)break; - pos1=pos; - while(pos--) - { - cur=cur->next; - } - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur); - fillExceptionsListView(hwndDlg); - ListView_SetItemState(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS),pos1,LVNI_FOCUSED|LVIS_SELECTED , LVNI_FOCUSED|LVIS_SELECTED ); - SetFocus(GetDlgItem(hwndDlg,IDC_LIST_EXCEPTIONS)); - break; + pos = (int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), -1, LVNI_FOCUSED); + if (pos == -1)break; + pos1 = pos; + while (pos--) + { + cur = cur->next; } + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur); + fillExceptionsListView(hwndDlg); + ListView_SetItemState(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), pos1, LVNI_FOCUSED | LVIS_SELECTED, LVNI_FOCUSED | LVIS_SELECTED); + SetFocus(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS)); + break; + } } } - if (GetDlgItem(hwndDlg, IDC_STATUS) == ((LPNMHDR) lParam)->hwndFrom) { - switch (((LPNMHDR) lParam)->code) { + if (GetDlgItem(hwndDlg, IDC_STATUS) == ((LPNMHDR)lParam)->hwndFrom) { + switch (((LPNMHDR)lParam)->code) { case LVN_ITEMCHANGED: NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK) - SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } } break; case WM_DESTROY: - bOptionsOpen=FALSE; + bOptionsOpen = FALSE; deleteConnectionsTable(connExceptionsTmp); - connExceptionsTmp=NULL; + connExceptionsTmp = NULL; return TRUE; } return 0; } //options page on miranda called -int ConnectionNotifyOptInit(WPARAM wParam,LPARAM) +int ConnectionNotifyOptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG); odp.ptszTitle = _T(PLUGINNAME); odp.ptszGroup = LPGENT("Plugins"); - odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.pfnDlgProc = DlgProcConnectionNotifyOpts;//callback function name Options_AddPage(wParam, &odp); return 0; } //gives protocol avainable statuses -INT_PTR GetCaps(WPARAM wParam,LPARAM lParam) +INT_PTR GetCaps(WPARAM wParam, LPARAM) { - if (wParam==PFLAGNUM_1) + if (wParam == PFLAGNUM_1) return 0; - if (wParam==PFLAGNUM_2) + if (wParam == PFLAGNUM_2) return PF2_ONLINE; // add the possible statuses here. - if (wParam==PFLAGNUM_3) + if (wParam == PFLAGNUM_3) return 0; return 0; } //gives name to protocol module -INT_PTR GetName(WPARAM wParam,LPARAM lParam) +INT_PTR GetName(WPARAM wParam, LPARAM lParam) { - mir_strncpy((char*)lParam,PLUGINNAME,wParam); + mir_strncpy((char*)lParam, PLUGINNAME, wParam); return 0; } //gives icon for proto module -INT_PTR TMLoadIcon(WPARAM wParam,LPARAM lParam) +INT_PTR TMLoadIcon(WPARAM wParam, LPARAM) { UINT id; - switch(wParam & 0xFFFF) { - case PLI_ONLINE: - case PLI_PROTOCOL: id=IDI_ICON1; break; // IDI_TM is the main icon for the protocol - case PLI_OFFLINE: id=IDI_ICON2; break; - default: return 0; + switch (wParam & 0xFFFF) { + case PLI_ONLINE: + case PLI_PROTOCOL: id = IDI_ICON1; break; // IDI_TM is the main icon for the protocol + case PLI_OFFLINE: id = IDI_ICON2; break; + default: return 0; } - return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL?SM_CXSMICON:SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL?SM_CYSMICON:SM_CYICON), 0); + return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0); } //======================================================= //SetStatus //======================================================= -INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) +INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) { if (wParam == ID_STATUS_OFFLINE) { - diffstat=0; + diffstat = 0; //PostThreadMessage(ConnectionCheckThreadId,WM_QUIT ,0, 0); SetEvent(killCheckThreadEvent); } else if (wParam == ID_STATUS_ONLINE) { - diffstat=0; + diffstat = 0; ResetEvent(killCheckThreadEvent); if (!hConnectionCheckThread) hConnectionCheckThread = (HANDLE)mir_forkthreadex(checkthread, 0, (unsigned int*)&ConnectionCheckThreadId); } else { - int retv=0; - + int retv = 0; + if (settingStatus[wParam - ID_STATUS_ONLINE]) - retv= SetStatus(ID_STATUS_OFFLINE,lParam); + retv = SetStatus(ID_STATUS_OFFLINE, lParam); else - retv= SetStatus(ID_STATUS_ONLINE,lParam); + retv = SetStatus(ID_STATUS_ONLINE, lParam); //LNEnableMenuItem(hMenuHandle ,TRUE); - diffstat=wParam; + diffstat = wParam; return retv; // the status has been changed to unknown (maybe run some more code) } //broadcast the message - + //oldStatus = currentStatus; - if (currentStatus!=wParam) - ProtoBroadcastAck(PLUGINNAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)currentStatus,wParam); + if (currentStatus != (int)wParam) + ProtoBroadcastAck(PLUGINNAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)currentStatus, wParam); currentStatus = wParam; return 0; @@ -686,80 +686,75 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) //======================================================= //GetStatus //======================================================= -INT_PTR GetStatus(WPARAM,LPARAM) +INT_PTR GetStatus(WPARAM, LPARAM) { return currentStatus; - if (diffstat ) - return diffstat; - else - return currentStatus ; - } //thread function with connections check loop -static unsigned __stdcall checkthread(void *dummy) +static unsigned __stdcall checkthread(void *) { #ifdef _DEBUG _OutputDebugString(_T("check thread started")); #endif - while(1) + while (1) { - struct CONNECTION* conn=NULL,*connOld=first,*cur=NULL; + struct CONNECTION* conn = NULL, *connOld = first, *cur = NULL; #ifdef _DEBUG _OutputDebugString(_T("checking connections table...")); #endif - if (WAIT_OBJECT_0 == WaitForSingleObject(killCheckThreadEvent,100)) + if (WAIT_OBJECT_0 == WaitForSingleObject(killCheckThreadEvent, 100)) { - hConnectionCheckThread=NULL; + hConnectionCheckThread = NULL; return 0; } - conn=GetConnectionsTable(); - cur=conn; - while(cur!=NULL) { - if (searchConnection(first,cur->strIntIp,cur->strExtIp,cur->intIntPort,cur->intExtPort,cur->state)==NULL && (settingStatusMask & (1 << (cur->state-1)))) { + conn = GetConnectionsTable(); + cur = conn; + while (cur != NULL) { + if (searchConnection(first, cur->strIntIp, cur->strExtIp, cur->intIntPort, cur->intExtPort, cur->state) == NULL && (settingStatusMask & (1 << (cur->state - 1)))) { #ifdef _DEBUG TCHAR msg[1024]; mir_sntprintf(msg, SIZEOF(msg), _T("%s:%d\n%s:%d"), cur->strIntIp, cur->intIntPort, cur->strExtIp, cur->intExtPort); - _OutputDebugString(_T("New connection: %s"),msg); + _OutputDebugString(_T("New connection: %s"), msg); #endif pid2name(cur->Pid, cur->PName, SIZEOF(cur->PName)); - if ( WAIT_OBJECT_0 == WaitForSingleObject( hExceptionsMutex, 100 )) + if (WAIT_OBJECT_0 == WaitForSingleObject(hExceptionsMutex, 100)) { - if (checkFilter(connExceptions,cur)) + if (checkFilter(connExceptions, cur)) { - showMsg(cur->PName,cur->Pid,cur->strIntIp,cur->strExtIp,cur->intIntPort,cur->intExtPort,cur->state); + showMsg(cur->PName, cur->Pid, cur->strIntIp, cur->strExtIp, cur->intIntPort, cur->intExtPort, cur->state); SkinPlaySound(PLUGINNAME_NEWSOUND); } ReleaseMutex(hExceptionsMutex); } } - cur=cur->next; + cur = cur->next; } - first=conn; + first = conn; deleteConnectionsTable(connOld); Sleep(settingInterval); } - hConnectionCheckThread=NULL; + hConnectionCheckThread = NULL; return 1; } //popup reactions static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - switch(message) { + switch (message) { case WM_COMMAND: if (HIWORD(wParam) == STN_CLICKED)//client clicked on popup with left mouse button { struct CONNECTION *conn = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); - struct CONNECTION *mpd=(struct CONNECTION*) PUGetPluginData(hWnd); + struct CONNECTION *mpd = (struct CONNECTION*) PUGetPluginData(hWnd); - memcpy(conn,mpd,sizeof(struct CONNECTION)); + memcpy(conn, mpd, sizeof(struct CONNECTION)); PUDeletePopup(hWnd); - PostThreadMessage(FilterOptionsThreadId,WM_ADD_FILTER,0, (LPARAM)conn); + PostThreadMessage(FilterOptionsThreadId, WM_ADD_FILTER, 0, (LPARAM)conn); } break; @@ -774,7 +769,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA //PUDeletePopUp(hWnd); break; - case UM_FREEPLUGINDATA: + case UM_FREEPLUGINDATA: struct CONNECTION *mpd = (struct CONNECTION*)PUGetPluginData(hWnd); if (mpd > 0) mir_free(mpd); return TRUE; //TRUE or FALSE is the same, it gets ignored. @@ -784,7 +779,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA //show popup -void showMsg(TCHAR *pName, DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int extPort,int state) +void showMsg(TCHAR *pName, DWORD pid, TCHAR *intIp, TCHAR *extIp, int intPort, int extPort, int state) { POPUPDATAT ppd; @@ -808,10 +803,10 @@ void showMsg(TCHAR *pName, DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int e } else mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), _T("%s:%d\n%s:%d"), extIp, extPort, intIp, intPort); - mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), _T("%s (%s)"), pName, tcpStates[state-1]); + mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), _T("%s (%s)"), pName, tcpStates[state - 1]); if (settingSetColours) { - ppd.colorBack = settingBgColor; + ppd.colorBack = settingBgColor; ppd.colorText = settingFgColor; } ppd.PluginWindowProc = PopupDlgProc; @@ -834,81 +829,81 @@ void showMsg(TCHAR *pName, DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int e //called after all plugins loaded. //all Connection staff will be called, that will not hang miranda on startup -static int modulesloaded(WPARAM,LPARAM) +static int modulesloaded(WPARAM, LPARAM) { - + #ifdef _DEBUG _OutputDebugString(_T("Modules loaded, lets start TN...")); #endif -// hConnectionCheckThread = (HANDLE)mir_forkthreadex(checkthread, 0, 0, ConnectionCheckThreadId); + // hConnectionCheckThread = (HANDLE)mir_forkthreadex(checkthread, 0, 0, ConnectionCheckThreadId); -//#ifdef _DEBUG -// _OutputDebugString("started check thread %d",hConnectionCheckThread); -//#endif - killCheckThreadEvent=CreateEvent(NULL,FALSE,FALSE,_T("killCheckThreadEvent")); - hFilterOptionsThread=startFilterThread(); + //#ifdef _DEBUG + // _OutputDebugString("started check thread %d",hConnectionCheckThread); + //#endif + killCheckThreadEvent = CreateEvent(NULL, FALSE, FALSE, _T("killCheckThreadEvent")); + hFilterOptionsThread = startFilterThread(); //updaterRegister(); - + return 0; } //function hooks before unload -static int preshutdown(WPARAM,LPARAM) +static int preshutdown(WPARAM, LPARAM) { deleteConnectionsTable(first); deleteConnectionsTable(connExceptions); deleteConnectionsTable(connExceptionsTmp); - PostThreadMessage(ConnectionCheckThreadId,WM_QUIT ,0, 0); - PostThreadMessage(FilterOptionsThreadId,WM_QUIT ,0, 0); - + PostThreadMessage(ConnectionCheckThreadId, WM_QUIT, 0, 0); + PostThreadMessage(FilterOptionsThreadId, WM_QUIT, 0, 0); + return 0; } -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { - hInst=hinstDLL; + hInst = hinstDLL; return TRUE; } extern "C" int __declspec(dllexport) Load(void) { - char service[100]={""}; + char service[100] = { "" }; - PROTOCOLDESCRIPTOR pd={ PROTOCOLDESCRIPTOR_V3_SIZE }; + PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; #ifdef _DEBUG _OutputDebugString(_T("Entering Load dll")); #endif - mir_getLP( &pluginInfo ); + mir_getLP(&pluginInfo); //hCurrentEditMutex=CreateMutex(NULL,FALSE,_T("CurrentEditMutex")); - hExceptionsMutex=CreateMutex(NULL,FALSE,_T("ExceptionsMutex")); + hExceptionsMutex = CreateMutex(NULL, FALSE, _T("ExceptionsMutex")); LoadSettings(); - connExceptions=LoadSettingsConnections(); -//create protocol + connExceptions = LoadSettingsConnections(); + //create protocol //memset(&pd, 0, sizeof(pd)); //pd.cbSize=sizeof(pd); - pd.szName=PLUGINNAME; - pd.type=PROTOTYPE_PROTOCOL; - CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); + pd.szName = PLUGINNAME; + pd.type = PROTOTYPE_PROTOCOL; + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); //set all contacts to offline - for (MCONTACT hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact,PLUGINNAME)) - db_set_w(hContact,PLUGINNAME,"status",ID_STATUS_OFFLINE); + for (MCONTACT hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact, PLUGINNAME)) + db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); - mir_snprintf(service,SIZEOF(service), "%s%s", PLUGINNAME, PS_GETCAPS); + mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETCAPS); CreateServiceFunction(service, GetCaps); - mir_snprintf(service,SIZEOF(service), "%s%s", PLUGINNAME, PS_GETNAME); + mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETNAME); CreateServiceFunction(service, GetName); - mir_snprintf(service,SIZEOF(service), "%s%s", PLUGINNAME, PS_LOADICON); + mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_LOADICON); CreateServiceFunction(service, TMLoadIcon); - mir_snprintf(service,SIZEOF(service), "%s%s", PLUGINNAME, PS_SETSTATUS); + mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_SETSTATUS); CreateServiceFunction(service, SetStatus); - mir_snprintf(service,SIZEOF(service), "%s%s", PLUGINNAME, PS_GETSTATUS); + mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETSTATUS); CreateServiceFunction(service, GetStatus); - SkinAddNewSoundEx(PLUGINNAME_NEWSOUND,PLUGINNAME, LPGEN("New Connection Notification")); + SkinAddNewSoundEx(PLUGINNAME_NEWSOUND, PLUGINNAME, LPGEN("New Connection Notification")); hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call assert(hOptInit); hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded);//hook event that all plugins are loaded @@ -920,7 +915,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { WaitForSingleObjectEx(hConnectionCheckThread, INFINITE, FALSE); - if (hConnectionCheckThread )CloseHandle(hConnectionCheckThread); + if (hConnectionCheckThread)CloseHandle(hConnectionCheckThread); if (hCheckEvent)DestroyHookableEvent(hCheckEvent); if (hOptInit) UnhookEvent(hOptInit); if (hCheckHook)UnhookEvent(hCheckHook); diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.h b/plugins/ConnectionNotify/src/ConnectionNotify.h deleted file mode 100644 index 7480c5b38f..0000000000 --- a/plugins/ConnectionNotify/src/ConnectionNotify.h +++ /dev/null @@ -1,51 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS - -#include <windows.h> -#include <Commctrl.h> -#include <assert.h> -#include <iphlpapi.h> -#include <Tlhelp32.h> - -#include <newpluginapi.h> -#include <m_core.h> -#include <m_clist.h> -#include <m_skin.h> -#include <m_langpack.h> -#include <m_options.h> -#include <m_popup.h> -#include <m_utils.h> -#include <m_protomod.h> -#include <m_protosvc.h> -#include <m_system.h> - -#ifdef _DEBUG -#include "debug.h" -#endif -#include "resource.h" -#include "netstat.h" -#include "filter.h" -#include "version.h" -#include "pid2name.h" - -#define MAX_SETTING_STR 512 -#define PLUGINNAME "ConnectionNotify" -#define MAX_LENGTH 512 -#define STATUS_COUNT 9 - -#define PLUGINNAME_NEWSOUND PLUGINNAME "_new_sound" - -#if !defined(MIID_CONNECTIONNOTIFY) - #define MIID_CONNECTIONNOTIFY {0x4bb5b4aa, 0xc364, 0x4f23, { 0x97, 0x46, 0xd5, 0xb7, 0x8, 0xa2, 0x86, 0xa5 } } -#endif -// 4BB5B4AA-C364-4F23-9746-D5B708A286A5 - -// Note: could also use malloc() and free() -#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) -#define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) - -void showMsg(TCHAR *pName,DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int extPort,int state); -//int __declspec(dllexport) Load(PLUGINLINK *link); -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); -static unsigned __stdcall checkthread(void *dummy); -struct CONNECTION * LoadSettingsConnections(); -void saveSettingsConnections(struct CONNECTION *connHead); diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp index 2af13f218c..d20d46f314 100644 --- a/plugins/ConnectionNotify/src/debug.cpp +++ b/plugins/ConnectionNotify/src/debug.cpp @@ -1,17 +1,17 @@ -#include "ConnectionNotify.h" +#include "stdafx.h" -void _OutputDebugString(TCHAR* lpOutputString, ... ) +void _OutputDebugString(TCHAR* lpOutputString, ...) { TCHAR OutMsg[MAX_LENGTH]; TCHAR format[MAX_LENGTH]; - int i,j; - va_list argptr; + int i, j; + va_list argptr; - va_start( argptr, lpOutputString ); + va_start(argptr, lpOutputString); - for(i=0,j=0;lpOutputString[i] != '\0';i++) + for (i = 0, j = 0; lpOutputString[i] != '\0'; i++) { format[j++] = lpOutputString[i]; format[j] = '\0'; @@ -21,44 +21,44 @@ void _OutputDebugString(TCHAR* lpOutputString, ... ) format[j++] = lpOutputString[++i]; format[j] = '\0'; - switch(lpOutputString[i]) + switch (lpOutputString[i]) { // string case 's': - { - TCHAR* s = va_arg( argptr, TCHAR * ); - mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, s); - _tcsncpy(format,OutMsg,_countof(OutMsg)); - j = (int)_tcslen(format); - _tcscat(format,_T(" ")); - break; - } - // character + { + TCHAR* s = va_arg(argptr, TCHAR *); + mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, s); + _tcsncpy(format, OutMsg, _countof(OutMsg)); + j = (int)_tcslen(format); + _tcscat(format, _T(" ")); + break; + } + // character case 'c': - { - char c = (char) va_arg( argptr, int ); - mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, c); - _tcsncpy(format,OutMsg,_countof(OutMsg)); - j = (int)_tcslen(format); - _tcscat(format,_T(" ")); - break; - } - // integer + { + char c = (char)va_arg(argptr, int); + mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, c); + _tcsncpy(format, OutMsg, _countof(OutMsg)); + j = (int)_tcslen(format); + _tcscat(format, _T(" ")); + break; + } + // integer case 'd': - { - int d = va_arg( argptr, int ); - mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, d); - _tcsncpy(format,OutMsg,_countof(OutMsg)); - j = (int)_tcslen(format); - _tcscat(format,_T(" ")); - break; - } + { + int d = va_arg(argptr, int); + mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, d); + _tcsncpy(format, OutMsg, _countof(OutMsg)); + j = (int)_tcslen(format); + _tcscat(format, _T(" ")); + break; + } } - format[j+1] = '\0'; + format[j + 1] = '\0'; } - _tcscat(format,_T("\n")); + _tcscat(format, _T("\n")); OutputDebugString(format); - va_end( argptr ); + va_end(argptr); } diff --git a/plugins/ConnectionNotify/src/debug.h b/plugins/ConnectionNotify/src/debug.h index fd5b070c9e..90c46be0f5 100644 --- a/plugins/ConnectionNotify/src/debug.h +++ b/plugins/ConnectionNotify/src/debug.h @@ -6,5 +6,5 @@ #include <stdio.h> #include <tchar.h> -void _OutputDebugString(TCHAR* lpOutputString, ... ); +void _OutputDebugString(TCHAR* lpOutputString, ...); #endif \ No newline at end of file diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp index a3295c59b1..f825ac9dba 100644 --- a/plugins/ConnectionNotify/src/filter.cpp +++ b/plugins/ConnectionNotify/src/filter.cpp @@ -1,15 +1,6 @@ +#include "stdafx.h" -#include <Windows.h> -#include <newpluginapi.h> -#include <m_system.h> -#include <m_langpack.h> - -#include "resource.h" -#include "netstat.h" -#include "Filter.h" -#include "ConnectionNotify.h" - -HWND filterAddDlg=NULL; +HWND filterAddDlg = NULL; extern HINSTANCE hInst; extern struct CONNECTION *connExceptions; extern HANDLE hFilterOptionsThread; @@ -26,18 +17,18 @@ HANDLE startFilterThread() return (HANDLE)mir_forkthreadex(filterQueue, 0, (unsigned int*)&FilterOptionsThreadId); } -static unsigned __stdcall filterQueue(void *dummy) +static unsigned __stdcall filterQueue(void *) { BOOL bRet; MSG msg; //while(1) - while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) + while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) { - if (msg.message==WM_ADD_FILTER ) + if (msg.message == WM_ADD_FILTER) { - struct CONNECTION *conn=(struct CONNECTION *)msg.lParam; - filterAddDlg=CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), NULL, ConnectionFilterEditProc,(LPARAM)conn); - ShowWindow(filterAddDlg,SW_SHOW); + struct CONNECTION *conn = (struct CONNECTION *)msg.lParam; + filterAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), NULL, ConnectionFilterEditProc, (LPARAM)conn); + ShowWindow(filterAddDlg, SW_SHOW); } if (NULL == filterAddDlg || !IsDialogMessage(filterAddDlg, &msg)) { /* Wine fix. */ @@ -45,107 +36,107 @@ static unsigned __stdcall filterQueue(void *dummy) DispatchMessage(&msg); } } - hFilterOptionsThread=NULL; + hFilterOptionsThread = NULL; return TRUE; } static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - switch(message) + switch (message) + { + case WM_INITDIALOG: { - case WM_INITDIALOG: + struct CONNECTION *conn = (struct CONNECTION*)lParam; + TranslateDialogDefault(hWnd); + + SetDlgItemText(hWnd, ID_TEXT_NAME, conn->PName); + SetDlgItemText(hWnd, ID_TXT_LOCAL_IP, conn->strIntIp); + SetDlgItemText(hWnd, ID_TXT_REMOTE_IP, conn->strExtIp); + SetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, conn->intIntPort, FALSE); + SetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, conn->intExtPort, FALSE); + SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Always show popup")); + SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Never show popup")); + SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_SETCURSEL, 0, 0); + mir_free(conn); + return TRUE; + } + case WM_ACTIVATE: + if (0 == wParam) // becoming inactive + filterAddDlg = NULL; + else // becoming active + filterAddDlg = hWnd; + return FALSE; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case ID_OK: + { + TCHAR tmpPort[6]; + if (bOptionsOpen) { - struct CONNECTION *conn=(struct CONNECTION*)lParam; - TranslateDialogDefault(hWnd); - - SetDlgItemText(hWnd, ID_TEXT_NAME,conn->PName); - SetDlgItemText(hWnd, ID_TXT_LOCAL_IP,conn->strIntIp); - SetDlgItemText(hWnd, ID_TXT_REMOTE_IP,conn->strExtIp); - SetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT,conn->intIntPort,FALSE); - SetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT,conn->intExtPort,FALSE); - SendDlgItemMessage(hWnd, ID_CBO_ACTION , CB_ADDSTRING, 0, (LPARAM)TranslateT("Always show popup")); - SendDlgItemMessage(hWnd, ID_CBO_ACTION , CB_ADDSTRING, 0, (LPARAM)TranslateT("Never show popup")); - SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_SETCURSEL ,0,0); - mir_free(conn); - return TRUE; + MessageBox(hWnd, TranslateT("First close options window"), _T("ConnectionNotify"), MB_OK | MB_ICONSTOP); + break; } - case WM_ACTIVATE: - if (0 == wParam) // becoming inactive - filterAddDlg = NULL; - else // becoming active - filterAddDlg = hWnd; - return FALSE; - case WM_COMMAND: - switch(LOWORD(wParam)) + if (WAIT_OBJECT_0 == WaitForSingleObject(hExceptionsMutex, 100)) + { + if (connCurrentEdit == NULL) { - case ID_OK: - { - TCHAR tmpPort[6]; - if (bOptionsOpen) - { - MessageBox(hWnd,TranslateT("First close options window"),_T("ConnectionNotify"),MB_OK | MB_ICONSTOP); - break; - } - if ( WAIT_OBJECT_0 == WaitForSingleObject( hExceptionsMutex, 100 )) - { - if (connCurrentEdit==NULL) - { - connCurrentEdit=(struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); - connCurrentEdit->next=connExceptions; - connExceptions=connCurrentEdit; - } - GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort)); - if (tmpPort[0]=='*') - connCurrentEdit->intIntPort=-1; - else - connCurrentEdit->intIntPort=GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE); - GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort)); - if (tmpPort[0]=='*') - connCurrentEdit->intExtPort=-1; - else - connCurrentEdit->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE); - - GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEdit->strIntIp, SIZEOF(connCurrentEdit->strIntIp)); - GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEdit->strExtIp, SIZEOF(connCurrentEdit->strExtIp)); - GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEdit->PName, SIZEOF(connCurrentEdit->PName)); - - connCurrentEdit->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0); - connCurrentEdit = NULL; - saveSettingsConnections(connExceptions); - ReleaseMutex(hExceptionsMutex); - } - //EndDialog(hWnd,IDOK); - DestroyWindow(hWnd); - return TRUE; - } - case ID_CANCEL: - connCurrentEdit=NULL; - DestroyWindow(hWnd); - //EndDialog(hWnd,IDCANCEL); - return TRUE; + connCurrentEdit = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); + connCurrentEdit->next = connExceptions; + connExceptions = connCurrentEdit; } - return FALSE; + GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort)); + if (tmpPort[0] == '*') + connCurrentEdit->intIntPort = -1; + else + connCurrentEdit->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE); + GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort)); + if (tmpPort[0] == '*') + connCurrentEdit->intExtPort = -1; + else + connCurrentEdit->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE); - break; - case WM_CLOSE: + GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEdit->strIntIp, SIZEOF(connCurrentEdit->strIntIp)); + GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEdit->strExtIp, SIZEOF(connCurrentEdit->strExtIp)); + GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEdit->PName, SIZEOF(connCurrentEdit->PName)); + + connCurrentEdit->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0); + connCurrentEdit = NULL; + saveSettingsConnections(connExceptions); + ReleaseMutex(hExceptionsMutex); + } + //EndDialog(hWnd,IDOK); + DestroyWindow(hWnd); + return TRUE; + } + case ID_CANCEL: + connCurrentEdit = NULL; DestroyWindow(hWnd); - case WM_DESTROY: - filterAddDlg=NULL; - connCurrentEdit=NULL; - //DestroyWindow(hWnd); - //PostQuitMessage(0); - break; + //EndDialog(hWnd,IDCANCEL); + return TRUE; + } + return FALSE; + + break; + case WM_CLOSE: + DestroyWindow(hWnd); + case WM_DESTROY: + filterAddDlg = NULL; + connCurrentEdit = NULL; + //DestroyWindow(hWnd); + //PostQuitMessage(0); + break; } return FALSE; } -BOOL checkFilter(struct CONNECTION *head,struct CONNECTION *conn) +BOOL checkFilter(struct CONNECTION *head, struct CONNECTION *conn) { - for(struct CONNECTION *cur=head; cur!=NULL; cur=cur->next) - if (wildcmpt(conn->PName,cur->PName)&&wildcmpt(conn->strIntIp,cur->strIntIp)&&wildcmpt(conn->strExtIp,cur->strExtIp) - &&(cur->intIntPort==-1||cur->intIntPort==conn->intIntPort)&&(cur->intExtPort==-1||cur->intExtPort==conn->intExtPort)) + for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next) + if (wildcmpt(conn->PName, cur->PName) && wildcmpt(conn->strIntIp, cur->strIntIp) && wildcmpt(conn->strExtIp, cur->strExtIp) + && (cur->intIntPort == -1 || cur->intIntPort == conn->intIntPort) && (cur->intExtPort == -1 || cur->intExtPort == conn->intExtPort)) return cur->Pid; - + return settingDefaultAction; } diff --git a/plugins/ConnectionNotify/src/filter.h b/plugins/ConnectionNotify/src/filter.h index 0d40a4cf73..c415f7422e 100644 --- a/plugins/ConnectionNotify/src/filter.h +++ b/plugins/ConnectionNotify/src/filter.h @@ -3,7 +3,7 @@ #define _INC_FILTER HANDLE startFilterThread(); -BOOL checkFilter(struct CONNECTION *head,struct CONNECTION *conn); +BOOL checkFilter(struct CONNECTION *head, struct CONNECTION *conn); #define WM_ADD_FILTER (WM_APP + 1) #endif diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp index 8b7d5e75ee..14536477f4 100644 --- a/plugins/ConnectionNotify/src/netstat.cpp +++ b/plugins/ConnectionNotify/src/netstat.cpp @@ -1,21 +1,21 @@ -#include "ConnectionNotify.h" - +#include "stdafx.h" + struct CONNECTION *GetConnectionsTable() { // Declare and initialize variables - MIB_TCPTABLE_OWNER_PID *pTcpTable = (MIB_TCPTABLE_OWNER_PID *) MALLOC(sizeof (MIB_TCPTABLE_OWNER_PID)); + MIB_TCPTABLE_OWNER_PID *pTcpTable = (MIB_TCPTABLE_OWNER_PID *)MALLOC(sizeof(MIB_TCPTABLE_OWNER_PID)); if (pTcpTable == NULL) { //printf("Error allocating memory!\n"); return NULL; } - DWORD dwSize = sizeof (MIB_TCPTABLE_OWNER_PID); + DWORD dwSize = sizeof(MIB_TCPTABLE_OWNER_PID); // Make an initial call to GetTcpTable to // get the necessary size into the dwSize variable - DWORD dwRetVal = GetExtendedTcpTable(pTcpTable, &dwSize, TRUE,AF_INET,TCP_TABLE_OWNER_PID_ALL,0); - if (dwRetVal == ERROR_INSUFFICIENT_BUFFER) { + DWORD dwRetVal = GetExtendedTcpTable(pTcpTable, &dwSize, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0); + if (dwRetVal == ERROR_INSUFFICIENT_BUFFER) { FREE(pTcpTable); - pTcpTable = (MIB_TCPTABLE_OWNER_PID *) MALLOC(dwSize); + pTcpTable = (MIB_TCPTABLE_OWNER_PID *)MALLOC(dwSize); if (pTcpTable == NULL) { //printf("Error allocating memory\n"); return NULL; @@ -24,7 +24,7 @@ struct CONNECTION *GetConnectionsTable() // Make a second call to GetTcpTable to get // the actual data we require - if ((dwRetVal = GetExtendedTcpTable(pTcpTable, &dwSize, TRUE,AF_INET,TCP_TABLE_OWNER_PID_ALL,0)) != NO_ERROR) { + if ((dwRetVal = GetExtendedTcpTable(pTcpTable, &dwSize, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0)) != NO_ERROR) { //printf("\tGetTcpTable() failed with return value %d\n", dwRetVal); FREE(pTcpTable); return NULL; @@ -33,23 +33,23 @@ struct CONNECTION *GetConnectionsTable() //printf("Number of entries: %d\n", (int) pTcpTable->dwNumEntries); struct in_addr IpAddr; struct CONNECTION *connHead = NULL; - for (DWORD i = 0; i < pTcpTable->dwNumEntries; i ++) { + for (DWORD i = 0; i < pTcpTable->dwNumEntries; i++) { struct CONNECTION *newConn = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); memset(newConn, 0, sizeof(struct CONNECTION)); //pid2name(pTcpTable->table[i].dwOwningPid,&newConn->Pname); - + if (pTcpTable->table[i].dwLocalAddr) { - IpAddr.S_un.S_addr = (ULONG) pTcpTable->table[i].dwLocalAddr; + IpAddr.S_un.S_addr = (ULONG)pTcpTable->table[i].dwLocalAddr; //_snprintf(newConn->strIntIp,_countof(newConn->strIntIp),"%d.%d.%d.%d",IpAddr.S_un.S_un_b.s_b1,IpAddr.S_un.S_un_b.s_b2,IpAddr.S_un.S_un_b.s_b3,IpAddr.S_un.S_un_b.s_b4); TCHAR *strIntIp = mir_a2t(inet_ntoa(IpAddr)); - _tcsncpy(newConn->strIntIp, strIntIp, SIZEOF(newConn->strIntIp)-1); + _tcsncpy(newConn->strIntIp, strIntIp, SIZEOF(newConn->strIntIp) - 1); mir_free(strIntIp); } - + if (pTcpTable->table[i].dwRemoteAddr) { - IpAddr.S_un.S_addr = (u_long) pTcpTable->table[i].dwRemoteAddr; + IpAddr.S_un.S_addr = (u_long)pTcpTable->table[i].dwRemoteAddr; TCHAR *strExtIp = mir_a2t(inet_ntoa(IpAddr)); - _tcsncpy(newConn->strExtIp, strExtIp, SIZEOF(newConn->strExtIp)-1); + _tcsncpy(newConn->strExtIp, strExtIp, SIZEOF(newConn->strExtIp) - 1); mir_free(strExtIp); } newConn->state = pTcpTable->table[i].dwState; @@ -125,12 +125,12 @@ void deleteConnectionsTable(struct CONNECTION *head) struct CONNECTION *searchConnection(struct CONNECTION *head, TCHAR *intIp, TCHAR *extIp, int intPort, int extPort, int state) { - for(struct CONNECTION *cur = head; cur != NULL; cur = cur->next) { + for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next) { if (_tcscmp(cur->strIntIp, intIp) == 0 && - _tcscmp(cur->strExtIp, extIp) == 0 && - cur->intExtPort == extPort && - cur->intIntPort == intPort && - cur->state == state) + _tcscmp(cur->strExtIp, extIp) == 0 && + cur->intExtPort == extPort && + cur->intIntPort == intPort && + cur->state == state) return cur; } return NULL; diff --git a/plugins/ConnectionNotify/src/netstat.h b/plugins/ConnectionNotify/src/netstat.h index ccfff64a0c..8ea8ed564a 100644 --- a/plugins/ConnectionNotify/src/netstat.h +++ b/plugins/ConnectionNotify/src/netstat.h @@ -1,5 +1,5 @@ #pragma once - + struct CONNECTION @@ -16,5 +16,5 @@ struct CONNECTION struct CONNECTION* GetConnectionsTable(); void deleteConnectionsTable(struct CONNECTION* head); -struct CONNECTION* searchConnection(struct CONNECTION* head,TCHAR *intIp,TCHAR *extIp,int intPort,int extPort,int state); +struct CONNECTION* searchConnection(struct CONNECTION* head, TCHAR *intIp, TCHAR *extIp, int intPort, int extPort, int state); void getDnsName(TCHAR *strIp, TCHAR *strHostName, size_t len); \ No newline at end of file diff --git a/plugins/ConnectionNotify/src/pid2name.cpp b/plugins/ConnectionNotify/src/pid2name.cpp index 76d7b49441..e30b032bdd 100644 --- a/plugins/ConnectionNotify/src/pid2name.cpp +++ b/plugins/ConnectionNotify/src/pid2name.cpp @@ -1,4 +1,4 @@ -#include "ConnectionNotify.h" +#include "stdafx.h" void pid2name(DWORD procid, TCHAR *buffer, size_t bufLen) { @@ -15,8 +15,7 @@ void pid2name(DWORD procid, TCHAR *buffer, size_t bufLen) _tcsncpy_s(buffer, bufLen, ProcessStruct.szExeFile, _TRUNCATE); break; } - } - while( Process32Next( hSnap, &ProcessStruct )); + } while (Process32Next(hSnap, &ProcessStruct)); - CloseHandle( hSnap ); + CloseHandle(hSnap); } diff --git a/plugins/ConnectionNotify/src/stdafx.h b/plugins/ConnectionNotify/src/stdafx.h new file mode 100644 index 0000000000..75b64b0148 --- /dev/null +++ b/plugins/ConnectionNotify/src/stdafx.h @@ -0,0 +1,49 @@ +#include <windows.h> +#include <Commctrl.h> +#include <assert.h> +#include <iphlpapi.h> +#include <Tlhelp32.h> + +#include <newpluginapi.h> +#include <m_core.h> +#include <m_clist.h> +#include <m_skin.h> +#include <m_langpack.h> +#include <m_options.h> +#include <m_popup.h> +#include <m_utils.h> +#include <m_protomod.h> +#include <m_protosvc.h> +#include <m_system.h> + +#ifdef _DEBUG +#include "debug.h" +#endif +#include "resource.h" +#include "netstat.h" +#include "filter.h" +#include "version.h" +#include "pid2name.h" + +#define MAX_SETTING_STR 512 +#define PLUGINNAME "ConnectionNotify" +#define MAX_LENGTH 512 +#define STATUS_COUNT 9 + +#define PLUGINNAME_NEWSOUND PLUGINNAME "_new_sound" + +#if !defined(MIID_CONNECTIONNOTIFY) + #define MIID_CONNECTIONNOTIFY {0x4bb5b4aa, 0xc364, 0x4f23, { 0x97, 0x46, 0xd5, 0xb7, 0x8, 0xa2, 0x86, 0xa5 } } +#endif +// 4BB5B4AA-C364-4F23-9746-D5B708A286A5 + +// Note: could also use malloc() and free() +#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) +#define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) + +void showMsg(TCHAR *pName,DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int extPort,int state); +//int __declspec(dllexport) Load(PLUGINLINK *link); +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); +static unsigned __stdcall checkthread(void *dummy); +struct CONNECTION * LoadSettingsConnections(); +void saveSettingsConnections(struct CONNECTION *connHead); diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp index 6dd74a5390..c43a2b1d55 100644 --- a/plugins/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/src/dialogs.cpp @@ -745,7 +745,7 @@ unsigned int CALLBACK verify_context_thread(void *param) case IDYES: lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, "verified"); - otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename); + otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); lib_cs_unlock(); mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); @@ -754,7 +754,7 @@ unsigned int CALLBACK verify_context_thread(void *param) case IDNO: lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, NULL); - otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename); + otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); lib_cs_unlock(); mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index ca7e95b44c..07dadafd6b 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -3,42 +3,42 @@ extern "C"{ #include "otrlextensions.h" } -char g_private_key_filename[MAX_PATH]; -char g_fingerprint_store_filename[MAX_PATH]; -char g_instag_filename[MAX_PATH]; +TCHAR g_private_key_filename[MAX_PATH]; +TCHAR g_fingerprint_store_filename[MAX_PATH]; +TCHAR g_instag_filename[MAX_PATH]; HANDLE hPATH_MIROTR; Options options; -#define DATA_DIRECTORY MIRANDA_USERDATA "\\" MODULENAME +#define DATA_DIRECTORY MIRANDA_USERDATAT _T("\\") _T(MODULENAME) struct PROTOREGENKEYOPTIONS { HWND refresh; TCHAR proto[129]; }; -void SetFilenames(const char *path) +void SetFilenames(const TCHAR *path) { if (!path || !path[0]) return; - CreateDirectoryTree(path); + CreateDirectoryTreeT(path); - strcpy(g_private_key_filename, path); - strcat(g_private_key_filename, ("\\")); - strcat(g_private_key_filename, PRIVATE_KEY_FILENAME); + mir_tstrcpy(g_private_key_filename, path); + mir_tstrcat(g_private_key_filename, _T("\\")); + mir_tstrcat(g_private_key_filename, _T(PRIVATE_KEY_FILENAME)); - strcpy(g_fingerprint_store_filename, path); - strcat(g_fingerprint_store_filename, ("\\")); - strcat(g_fingerprint_store_filename, FINGERPRINT_STORE_FILENAME); + mir_tstrcpy(g_fingerprint_store_filename, path); + mir_tstrcat(g_fingerprint_store_filename, _T("\\")); + mir_tstrcat(g_fingerprint_store_filename, _T(FINGERPRINT_STORE_FILENAME)); - strcpy(g_instag_filename, path); - strcat(g_instag_filename, ("\\")); - strcat(g_instag_filename, INSTAG_FILENAME); + mir_tstrcpy(g_instag_filename, path); + mir_tstrcat(g_instag_filename, _T("\\")); + mir_tstrcat(g_instag_filename, _T(INSTAG_FILENAME)); } int FoldersChanged(WPARAM wParam, LPARAM lParam) { - char path[MAX_PATH]; - if ( FoldersGetCustomPath(hPATH_MIROTR, path, SIZEOF(path), "")) - SetFilenames( VARS(DATA_DIRECTORY)); + TCHAR path[MAX_PATH]; + if ( FoldersGetCustomPathT(hPATH_MIROTR, path, SIZEOF(path), _T(""))) + SetFilenames( VARST(DATA_DIRECTORY)); else SetFilenames(path); @@ -48,14 +48,14 @@ int FoldersChanged(WPARAM wParam, LPARAM lParam) void LoadFilenames() { - if (hPATH_MIROTR = FoldersRegisterCustomPath("OTR", LPGEN("Private Data"), DATA_DIRECTORY)) { + if (hPATH_MIROTR = FoldersRegisterCustomPathT("OTR", LPGEN("Private Data"), DATA_DIRECTORY)) { HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersChanged); // get the path - above are only defaults - there may be a different value in the db FoldersChanged(0, 0); } else { - SetFilenames( VARS(DATA_DIRECTORY)); + SetFilenames( VARST(DATA_DIRECTORY)); ReadPrivkeyFiles(); } } @@ -130,9 +130,9 @@ void ReadPrivkeyFiles() { DEBUGOUT_T("READ privkey"); lib_cs_lock(); - otrl_privkey_read(otr_user_state, g_private_key_filename); - otrl_privkey_read_fingerprints(otr_user_state, g_fingerprint_store_filename, set_context_contact, 0); - otrl_instag_read(otr_user_state, g_instag_filename); + otrl_privkey_read(otr_user_state, _T2A(g_private_key_filename)); + otrl_privkey_read_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename), set_context_contact, 0); + otrl_instag_read(otr_user_state, _T2A(g_instag_filename)); lib_cs_unlock(); } @@ -374,7 +374,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP OtrlPrivKey *key = otrl_privkey_find(otr_user_state, proto, proto); if (key) { otrl_privkey_forget(key); - otrl_privkey_write(otr_user_state, g_private_key_filename); + otrl_privkey_write(otr_user_state, _T2A(g_private_key_filename)); ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 2, _T("")); } } diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h index b291297596..d7f46344ea 100644 --- a/plugins/MirOTR/src/options.h +++ b/plugins/MirOTR/src/options.h @@ -5,9 +5,9 @@ #define FINGERPRINT_STORE_FILENAME "otr.fingerprints" #define INSTAG_FILENAME "otr.instag" -extern char g_fingerprint_store_filename[MAX_PATH]; -extern char g_private_key_filename[MAX_PATH]; -extern char g_instag_filename[MAX_PATH]; +extern TCHAR g_fingerprint_store_filename[MAX_PATH]; +extern TCHAR g_private_key_filename[MAX_PATH]; +extern TCHAR g_instag_filename[MAX_PATH]; #define CONTACT_DEFAULT_POLICY 0xFFFF diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index 0c988da819..d4f560573a 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -40,7 +40,7 @@ static unsigned int CALLBACK generate_key_thread(void* param) Thread_Push(0); GenKeyData *data = (GenKeyData *)param; //lib_cs_lock(); - otrl_privkey_generate(otr_user_state, g_private_key_filename, data->proto, data->proto); + otrl_privkey_generate(otr_user_state, _T2A(g_private_key_filename), data->proto, data->proto); //lib_cs_unlock(); PostMessage(data->dialog, WMU_ENDDIALOG, 0, 0); mir_free(data); @@ -165,14 +165,14 @@ extern "C" { //CloseHandle((HANDLE)_beginthreadex(0, 0, trust_fp_thread, (void *)fp, 0, 0)); otrl_context_set_trust(fp, NULL); - otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename); + otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); } /* The list of known fingerprints has changed. Write them to disk. */ void otr_gui_write_fingerprints(void *opdata) { DEBUGOUT_T("OTR_GUI_WRITE_FINGERPRINTS\n"); //if(MessageBox(0, Translate("Would you like to save the current fingerprint list?"), Translate(MODULE), MB_YESNO) == IDYES) - otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename); + otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); } /* A ConnContext has entered a secure state. */ @@ -389,7 +389,7 @@ extern "C" { void otr_create_instag(void *opdata, const char *accountname, const char *protocol){ DEBUGOUT_T("OTR_CREATE_INSTAG\n"); - FILE* instagf = fopen(g_instag_filename, "w+b"); + FILE* instagf = _tfopen(g_instag_filename, _T("w+b")); if(!instagf) return; otrl_instag_generate_FILEp(otr_user_state, instagf, accountname, protocol); diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index 2261b089a8..2b84202d52 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -75,7 +75,7 @@ TrustLevel otr_context_get_trust(ConnContext *context) void VerifyFingerprint(ConnContext *context, bool verify) { lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, (verify)?"verified":NULL); - otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename); + otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); lib_cs_unlock(); VerifyFingerprintMessage(context, verify); } -- cgit v1.2.3