summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Mironov <mironych@googlemail.com>2012-09-20 12:00:44 +0000
committerVlad Mironov <mironych@googlemail.com>2012-09-20 12:00:44 +0000
commit9bd135eb5be03099a8cfbc81ac9903a97044ae0f (patch)
tree49f85c07edf86610f3b7d0e152dfb4e97b9a11f4
parent4ac4df14e007a71bf195183a92113e29f984e31c (diff)
Добавлен TrafficCounter
git-svn-id: http://svn.miranda-ng.org/main/trunk@1607 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/TrafficCounter/.cproject168
-rw-r--r--plugins/TrafficCounter/.project70
-rw-r--r--plugins/TrafficCounter/TrafficCounter.c1744
-rw-r--r--plugins/TrafficCounter/TrafficCounter.h85
-rw-r--r--plugins/TrafficCounter/TrafficCounter_10.vcxproj675
-rw-r--r--plugins/TrafficCounter/TrafficCounter_10.vcxproj.filters64
-rw-r--r--plugins/TrafficCounter/commonheaders.c1
-rw-r--r--plugins/TrafficCounter/commonheaders.h160
-rw-r--r--plugins/TrafficCounter/misc.c303
-rw-r--r--plugins/TrafficCounter/misc.h32
-rw-r--r--plugins/TrafficCounter/opttree.c416
-rw-r--r--plugins/TrafficCounter/opttree.h54
-rw-r--r--plugins/TrafficCounter/res/network.icobin0 -> 1150 bytes
-rw-r--r--plugins/TrafficCounter/resource.h457
-rw-r--r--plugins/TrafficCounter/resource.rc233
-rw-r--r--plugins/TrafficCounter/statistics.c751
-rw-r--r--plugins/TrafficCounter/statistics.h45
-rw-r--r--plugins/TrafficCounter/vars.c185
-rw-r--r--plugins/TrafficCounter/vars.h9
-rw-r--r--plugins/TrafficCounter/version.h3
20 files changed, 5455 insertions, 0 deletions
diff --git a/plugins/TrafficCounter/.cproject b/plugins/TrafficCounter/.cproject
new file mode 100644
index 0000000000..137e6305dc
--- /dev/null
+++ b/plugins/TrafficCounter/.cproject
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/tcounter"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/tcounter/DebugUnicode"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="TrafficCounter"/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="dll" artifactName="TrafficCounter" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" description="" id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408" name="Debug" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.msvc.toolchain.dll.debug.1990207893" name="org.eclipse.cdt.msvc.toolchain.dll.debug" superClass="org.eclipse.cdt.msvc.toolchain.dll.debug">
+ <targetPlatform id="org.eclipse.cdt.msvc.targetPlatform.dll.debug.835340158" superClass="org.eclipse.cdt.msvc.targetPlatform.dll.debug"/>
+ <builder buildPath="${workspace_loc:/tcounter/Debug}" id="org.eclipse.cdt.msvc.builder.806746442" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="CDT Internal Builder" superClass="org.eclipse.cdt.msvc.builder"/>
+ <tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="org.eclipse.cdt.msvc.cl.c.dll.debug.80264741" name="C Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.c.dll.debug">
+ <option id="org.eclipse.cdt.msvc.cl.option.includes.2096237909" name="Include Path (/I)" superClass="org.eclipse.cdt.msvc.cl.option.includes" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;..\..\..\Include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;..\..\ExternalAPI&quot;"/>
+ </option>
+ <option id="org.eclipse.cdt.msvc.cl.option.exceptions.1946066418" name="Enable C++ Exception Handling (/EHs)" superClass="org.eclipse.cdt.msvc.cl.option.exceptions" value="false" valueType="boolean"/>
+ <option id="org.eclipse.cdt.msvc.cl.option.debugFormat.794095692" name="Debug Information Format" superClass="org.eclipse.cdt.msvc.cl.option.debugFormat" value="org.eclipse.cdt.msvc.cl.option.debugFormat.complete" valueType="enumerated"/>
+ <option id="org.eclipse.cdt.msvc.cl.option.macros.1069593878" name="Defines (/D)" superClass="org.eclipse.cdt.msvc.cl.option.macros" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="UNICODE"/>
+ <listOptionValue builtIn="false" value="_UNICODE"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="_DEBUG"/>
+ </option>
+ <option id="org.eclipse.cdt.msvc.cl.option.optimization.420619238" name="Optimization" superClass="org.eclipse.cdt.msvc.cl.option.optimization" value="org.eclipse.cdt.msvc.cl.option.optimization.default" valueType="enumerated"/>
+ <option id="org.eclipse.cdt.msvc.cl.option.runtime.206907603" name="Run-Time Library" superClass="org.eclipse.cdt.msvc.cl.option.runtime" value="org.eclipse.cdt.msvc.cl.option.runtime.mdd" valueType="enumerated"/>
+ <inputType id="org.eclipse.cdt.msvc.cl.inputType.c.1358072339" superClass="org.eclipse.cdt.msvc.cl.inputType.c"/>
+ </tool>
+ <tool id="org.eclipse.cdt.msvc.cl.dll.debug.930330116" name="C++ Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.dll.debug"/>
+ <tool id="org.eclipse.cdt.msvc.rc.dll.debug.199663299" name="Resource Compiler (rc)" superClass="org.eclipse.cdt.msvc.rc.dll.debug">
+ <inputType id="org.eclipse.cdt.msvc.rc.inputType.134718322" superClass="org.eclipse.cdt.msvc.rc.inputType"/>
+ </tool>
+ <tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${BuildArtifactFileName} ${INPUTS}" id="org.eclipse.cdt.msvc.link.dll.debug.273142567" name="Linker (link)" superClass="org.eclipse.cdt.msvc.link.dll.debug">
+ <option defaultValue="true" id="org.eclipse.cdt.msvc.link.option.dll.593290687" name="Build a DLL" superClass="org.eclipse.cdt.msvc.link.option.dll" valueType="boolean"/>
+ <option id="org.eclipse.cdt.msvc.link.option.libraries.1030862196" name="Libraries" superClass="org.eclipse.cdt.msvc.link.option.libraries" valueType="libs">
+ <listOptionValue builtIn="false" value="msvcrtd.lib"/>
+ <listOptionValue builtIn="false" value="comctl32.lib"/>
+ <listOptionValue builtIn="false" value="msimg32.lib"/>
+ <listOptionValue builtIn="false" value="oleaut32.lib"/>
+ <listOptionValue builtIn="false" value="gdi32.lib"/>
+ <listOptionValue builtIn="false" value="user32.lib"/>
+ <listOptionValue builtIn="false" value="kernel32.lib"/>
+ <listOptionValue builtIn="false" value="shell32.lib"/>
+ <listOptionValue builtIn="false" value="mir_core.lib"/>
+ </option>
+ <option id="org.eclipse.cdt.msvc.link.option.libpath.1774647005" name="Additional Libpath (/libpath)" superClass="org.eclipse.cdt.msvc.link.option.libpath" valueType="stringList">
+ <listOptionValue builtIn="false" value="&quot;${WorkspaceDirPath}/lib&quot;"/>
+ </option>
+ <option id="org.eclipse.cdt.msvc.link.option.debug.1295398240" name="Generate Debug Info (/debug)" superClass="org.eclipse.cdt.msvc.link.option.debug" value="true" valueType="boolean"/>
+ <inputType id="org.eclipse.cdt.msvc.link.inputType.357088970" superClass="org.eclipse.cdt.msvc.link.inputType"/>
+ <outputType id="org.eclipse.cdt.msvc.link.outputType.1902556986" outputPrefix="${WorkspaceDirPath}/${ConfigName}/Plugins/" superClass="org.eclipse.cdt.msvc.link.outputType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.msvc.lib.797294379" name="Library Manager (lib)" superClass="org.eclipse.cdt.msvc.lib"/>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408.1959521771">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408.1959521771" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/tcounter"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/tcounter/ReleaseUnicode"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="TrafficCounter"/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="dll" artifactName="TrafficCounter" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" description="" id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408.1959521771" name="Release" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408.1959521771." name="/" resourcePath="">
+ <toolChain id="org.eclipse.cdt.msvc.toolchain.dll.debug.733328292" name="org.eclipse.cdt.msvc.toolchain.dll.debug" superClass="org.eclipse.cdt.msvc.toolchain.dll.debug">
+ <targetPlatform id="org.eclipse.cdt.msvc.targetPlatform.dll.debug.825043148" superClass="org.eclipse.cdt.msvc.targetPlatform.dll.debug"/>
+ <builder buildPath="${workspace_loc:/tcounter/Debug}" id="org.eclipse.cdt.msvc.builder.1565874418" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="CDT Internal Builder" superClass="org.eclipse.cdt.msvc.builder"/>
+ <tool command="cl /c" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="org.eclipse.cdt.msvc.cl.c.dll.debug.1520652355" name="C Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.c.dll.debug">
+ <option id="org.eclipse.cdt.msvc.cl.option.includes.929806530" name="Include Path (/I)" superClass="org.eclipse.cdt.msvc.cl.option.includes" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;..\..\..\Include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;..\..\ExternalAPI&quot;"/>
+ </option>
+ <option id="org.eclipse.cdt.msvc.cl.option.exceptions.550376509" name="Enable C++ Exception Handling (/EHs)" superClass="org.eclipse.cdt.msvc.cl.option.exceptions" value="false" valueType="boolean"/>
+ <option id="org.eclipse.cdt.msvc.cl.option.debugFormat.679811504" name="Debug Information Format" superClass="org.eclipse.cdt.msvc.cl.option.debugFormat" value="org.eclipse.cdt.msvc.cl.option.debugFormat.none" valueType="enumerated"/>
+ <option id="org.eclipse.cdt.msvc.cl.option.macros.1593240491" name="Defines (/D)" superClass="org.eclipse.cdt.msvc.cl.option.macros" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="UNICODE"/>
+ <listOptionValue builtIn="false" value="_UNICODE"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ </option>
+ <option id="org.eclipse.cdt.msvc.cl.option.rtti.1766753628" name="Enable Run-Time Type Information (/GR)" superClass="org.eclipse.cdt.msvc.cl.option.rtti" value="false" valueType="boolean"/>
+ <option id="org.eclipse.cdt.msvc.cl.option.others.1039051703" name="Other Options" superClass="org.eclipse.cdt.msvc.cl.option.others" valueType="stringList">
+ <listOptionValue builtIn="false" value="/Yucommonheaders.h"/>
+ </option>
+ <inputType id="org.eclipse.cdt.msvc.cl.inputType.c.1388236035" superClass="org.eclipse.cdt.msvc.cl.inputType.c"/>
+ </tool>
+ <tool id="org.eclipse.cdt.msvc.cl.dll.debug.680264934" name="C++ Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.dll.debug"/>
+ <tool id="org.eclipse.cdt.msvc.rc.dll.debug.1200811748" name="Resource Compiler (rc)" superClass="org.eclipse.cdt.msvc.rc.dll.debug">
+ <inputType id="org.eclipse.cdt.msvc.rc.inputType.2018864164" superClass="org.eclipse.cdt.msvc.rc.inputType"/>
+ </tool>
+ <tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${BuildArtifactFileName} ${INPUTS}" id="org.eclipse.cdt.msvc.link.dll.debug.249870992" name="Linker (link)" superClass="org.eclipse.cdt.msvc.link.dll.debug">
+ <option defaultValue="true" id="org.eclipse.cdt.msvc.link.option.dll.1576235798" name="Build a DLL" superClass="org.eclipse.cdt.msvc.link.option.dll" valueType="boolean"/>
+ <option id="org.eclipse.cdt.msvc.link.option.libraries.231104701" name="Libraries" superClass="org.eclipse.cdt.msvc.link.option.libraries" valueType="libs">
+ <listOptionValue builtIn="false" value="msvcrt.lib"/>
+ <listOptionValue builtIn="false" value="comctl32.lib"/>
+ <listOptionValue builtIn="false" value="msimg32.lib"/>
+ <listOptionValue builtIn="false" value="oleaut32.lib"/>
+ <listOptionValue builtIn="false" value="gdi32.lib"/>
+ <listOptionValue builtIn="false" value="user32.lib"/>
+ <listOptionValue builtIn="false" value="kernel32.lib"/>
+ <listOptionValue builtIn="false" value="shell32.lib"/>
+ <listOptionValue builtIn="false" value="mir_core.lib"/>
+ </option>
+ <option id="org.eclipse.cdt.msvc.link.option.libpath.1359544014" name="Additional Libpath (/libpath)" superClass="org.eclipse.cdt.msvc.link.option.libpath" valueType="stringList">
+ <listOptionValue builtIn="false" value="&quot;${WorkspaceDirPath}/lib&quot;"/>
+ </option>
+ <inputType id="org.eclipse.cdt.msvc.link.inputType.418103049" superClass="org.eclipse.cdt.msvc.link.inputType"/>
+ <outputType id="org.eclipse.cdt.msvc.link.outputType.601882109" outputPrefix="${WorkspaceDirPath}/${ConfigName}/Plugins/" superClass="org.eclipse.cdt.msvc.link.outputType"/>
+ </tool>
+ <tool id="org.eclipse.cdt.msvc.lib.908787836" name="Library Manager (lib)" superClass="org.eclipse.cdt.msvc.lib"/>
+ </toolChain>
+ </folderInfo>
+ <fileInfo id="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408.1959521771.1035699449" name="commonheaders.c" rcbsApplicability="disable" resourcePath="commonheaders.c" toolsToInvoke="org.eclipse.cdt.msvc.cl.c.dll.debug.1520652355.389499156">
+ <tool id="org.eclipse.cdt.msvc.cl.c.dll.debug.1520652355.389499156" name="C Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.c.dll.debug.1520652355">
+ <option id="org.eclipse.cdt.msvc.cl.option.others.1338336375" name="Other Options" superClass="org.eclipse.cdt.msvc.cl.option.others" valueType="stringList">
+ <listOptionValue builtIn="false" value="/Yccommonheaders.h"/>
+ </option>
+ <inputType id="org.eclipse.cdt.msvc.cl.inputType.c.1430939993" superClass="org.eclipse.cdt.msvc.cl.inputType.c"/>
+ </tool>
+ </fileInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="tcounter.null.444573245" name="tcounter"/>
+ </storageModule>
+ <storageModule moduleId="refreshScope" versionNumber="1">
+ <resource resourceType="PROJECT" workspacePath="/tcounter"/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408;org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1332487408.;org.eclipse.cdt.msvc.cl.c.dll.debug.80264741;org.eclipse.cdt.msvc.cl.inputType.c.1358072339">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141;org.eclipse.cdt.msvc.toolchain.dll.debug.1048693141.1504787373;org.eclipse.cdt.msvc.cl.c.dll.debug.1512155215;org.eclipse.cdt.msvc.cl.inputType.c.445125206">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
+</cproject>
diff --git a/plugins/TrafficCounter/.project b/plugins/TrafficCounter/.project
new file mode 100644
index 0000000000..9662d3935a
--- /dev/null
+++ b/plugins/TrafficCounter/.project
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>TrafficCounter</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>?name?</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildArguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildCommand</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildLocation</key>
+ <value>${workspace_loc:/tcounter/Debug}</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.contents</key>
+ <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/TrafficCounter/TrafficCounter.c b/plugins/TrafficCounter/TrafficCounter.c
new file mode 100644
index 0000000000..b0e4f3ee17
--- /dev/null
+++ b/plugins/TrafficCounter/TrafficCounter.c
@@ -0,0 +1,1744 @@
+/*
+Traffic Counter plugin for Miranda IM
+Copyright 2007-2012 Mironych.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+#include "m_skin_eng.h"
+
+/*-------------------------------------------------------------------------------------------------------------------*/
+//GLOBAL
+/*-------------------------------------------------------------------------------------------------------------------*/
+HINSTANCE hInst;
+
+int hLangpack = 0; // Ïîääåðæêà ïëàãèíîçàâèñèìîãî ïåðåâîäà.
+
+TCHAR* TRAFFIC_COUNTER_WINDOW_CLASS = _T("TrafficCounterWnd");
+
+/*-------------------------------------------------------------------------------------------------------------------*/
+//TRAFFIC COUNTER
+/*-------------------------------------------------------------------------------------------------------------------*/
+OPTTREE_OPTION *pOptions; // ×åðåç ýòîò óêàçàòåëü ìîäóëü opttree.c ìîæåò äîáðàòüñÿ äî ñïèñêà îïöèé.
+WORD notify_send_size = 0;
+WORD notify_recv_size = 0;
+//
+// Öâåò øðèôòà è ôîíà
+COLORREF Traffic_BkColor,Traffic_FontColor;
+
+//notify
+int Traffic_PopupBkColor;
+int Traffic_PopupFontColor;
+char Traffic_Notify_time_value;
+short int Traffic_Notify_size_value;
+char Traffic_PopupTimeoutDefault;
+char Traffic_PopupTimeoutValue;
+
+unsigned short int Traffic_LineHeight;
+//
+TCHAR Traffic_CounterFormat[512];
+TCHAR Traffic_TooltipFormat[512];
+//
+HANDLE Traffic_FrameID = NULL;
+
+char Traffic_AdditionSpace;
+
+HANDLE h_OptInit;
+HANDLE h_ModulesLoaded;
+HANDLE h_SystemShutDown;
+HANDLE h_OnRecv, h_OnSend;
+HANDLE h_OnAccListChange;
+HANDLE h_FontReload;
+
+HFONT Traffic_h_font = NULL;
+HMENU TrafficPopupMenu = NULL;
+HGENMENU hTrafficMainMenuItem = NULL;
+
+/*-------------------------------------------------------------------------------------------------------------------*/
+//TIME COUNTER
+/*-------------------------------------------------------------------------------------------------------------------*/
+static HANDLE h_AckHook;
+BYTE online_count = 0;
+
+/*-------------------------------------------------------------------------------------------------------------------*/
+//font service support
+/*-------------------------------------------------------------------------------------------------------------------*/
+int TrafficFontHeight = 0;
+FontIDT TrafficFontID;
+ColourIDT TrafficBackgroundColorID;
+
+//---------------------------------------------------------------------------------------------
+// Äëÿ ToolTip
+//---------------------------------------------------------------------------------------------
+BOOL TooltipShowing;
+POINT TooltipPosition;
+
+// Âñïîìîãàòåëüíûå ïåðåìåííûå ÷òîáû çàñòàâèòü ðàáîòàòü êëþ÷åâîé öâåò
+BOOL UseKeyColor;
+COLORREF KeyColor;
+
+// Âíóòðåííèå ôóíêöèè ìîäóëÿ.
+void Traffic_AddMainMenuItem(void);
+
+// {82181510-5DFA-49d7-B469-33871E2AE8B5}
+#define MIID_TRAFFICCOUNTER {0x82181510, 0x5dfa, 0x49d7, { 0xb4, 0x69, 0x33, 0x87, 0x1e, 0x2a, 0xe8, 0xb5}}
+
+PLUGININFOEX pluginInfoEx =
+{
+ sizeof(PLUGININFOEX),
+ "Traffic Counter",
+ 0, // Íà÷èíàÿ ñ âåðñèè ÿäðà 0.92.1.0 ïîëå ñ âåðñèåé íå èñïîëüçóåòñÿ.
+ "Adding traffic and time counters",
+ "Ghost, Mironych",
+ "",
+ "© 2002-2006 Ghost, © 2007-2012 Mironych ["__DATE__" "__TIME__"]",
+ "",
+ UNICODE_AWARE,
+ MIID_TRAFFICCOUNTER
+};
+
+__declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ mirandaVer = mirandaVersion;
+ return &pluginInfoEx;
+}
+
+static const MUUID interfaces[] = {MIID_TRAFFICCOUNTER, MIID_LAST};
+
+__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ return interfaces;
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+/* switch(fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:*/
+ hInst = hinstDLL;
+/* DisableThreadLibraryCalls(hInst);
+ break;
+
+ case DLL_PROCESS_DETACH:
+ PostMessage(TrafficHwnd,WM_USER+697,0,666);
+ //
+ break;
+ }*/
+ //
+ return TRUE;
+}
+
+int __declspec(dllexport) Load(void)
+{
+ if (mirandaVer < PLUGIN_MAKE_VERSION(0, 92, 2, 0)) return -1;
+
+ // Ïîëó÷àåì äåñêðèïòîð ÿçûêîâîãî ïàêåòà.
+ mir_getLP(&pluginInfoEx);
+
+ h_OptInit = HookEvent(ME_OPT_INITIALISE,TrafficCounterOptInitialise);
+ h_ModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,TrafficCounterModulesLoaded);
+ h_AckHook = HookEvent(ME_PROTO_ACK,ProtocolAckHook);
+ h_OnAccListChange = HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccountsListChange);
+ h_SystemShutDown = HookEvent(ME_SYSTEM_OKTOEXIT, TrafficCounterShutdown);
+
+ return 0;
+}
+
+int __declspec(dllexport) Unload(void)
+{
+ return 0;
+}
+
+int TrafficCounterShutdown(WPARAM wParam, LPARAM lParam)
+{
+ KillTimer(TrafficHwnd, TIMER_REDRAW);
+ KillTimer(TrafficHwnd, TIMER_NOTIFY_TICK);
+
+ // Îòêàçûâàåìñÿ îò îáðàáîòêè ñîáûòèé.
+ UnhookEvent(h_FontReload);
+ UnhookEvent(h_OnAccListChange);
+ UnhookEvent(h_AckHook);
+ UnhookEvent(h_ModulesLoaded);
+ UnhookEvent(h_OnRecv);
+ UnhookEvent(h_OnSend);
+ UnhookEvent(h_OptInit);
+ UnhookEvent(h_SystemShutDown);
+
+ SaveSettings(0);
+
+ // Óäàëÿåì ïóíêò ãëàâíîãî ìåíþ.
+ if (hTrafficMainMenuItem)
+ {
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hTrafficMainMenuItem, 0);
+ hTrafficMainMenuItem = NULL;
+ }
+ // Óäàëÿåì êîíòåêñòíîå ìåíþ.
+ if (TrafficPopupMenu)
+ {
+ DestroyMenu(TrafficPopupMenu);
+ TrafficPopupMenu = NULL;
+ }
+ // Ðàçðåãèñòðèðóåì ïðîöåäóðó îòðèñîâêè ôðåéìà.
+ CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)TrafficHwnd, (LPARAM)NULL);
+ // Óäàëÿåì ôðåéì.
+ if( (ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME)) && Traffic_FrameID )
+ {
+ CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)Traffic_FrameID, 0);
+ Traffic_FrameID = NULL;
+ }
+ // Ðàçðåãèñòðèðóåì ãîðÿ÷óþ êëàâèøó.
+ CallService(MS_HOTKEY_UNREGISTER, 0, (LPARAM)"TC_Show_Hide");
+ // Ðàçðåãèñòðèðóåì ôóíêöèþ ïåðåêëþ÷åíèÿ âèäèìîñòè îêíà.
+ DestroyServiceFunction(MenuCommand_TrafficShowHide);
+ // Óäàëÿåì øðèôò.
+ if (Traffic_h_font)
+ {
+ DeleteObject(Traffic_h_font);
+ Traffic_h_font = NULL;
+ }
+
+ // Óáèâàåì âñå ðàáî÷èå äàííûå.
+ DestroyProtocolList();
+
+ return 0;
+}
+
+int TrafficCounterModulesLoaded(WPARAM wParam,LPARAM lParam)
+{
+ DBVARIANT dbv;
+
+ CreateProtocolList();
+
+ // ×èòàåì ôëàãè
+ unOptions.Flags = DBGetContactSettingDword(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_WHAT_DRAW, 0x0882);
+ Stat_SelAcc = DBGetContactSettingWord(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_STAT_ACC_OPT, 0x01);
+
+ //settings for notification
+ Traffic_PopupBkColor = DBGetContactSettingDword(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_BKCOLOR,RGB(200,255,200));
+ Traffic_PopupFontColor = DBGetContactSettingDword(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_FONTCOLOR,RGB(0,0,0));
+ //
+ Traffic_Notify_time_value = DBGetContactSettingByte(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_NOTIFY_TIME_VALUE,10);
+ //
+ Traffic_Notify_size_value = DBGetContactSettingWord(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_NOTIFY_SIZE_VALUE,100);
+ //
+ //popup timeout
+ Traffic_PopupTimeoutDefault = DBGetContactSettingByte(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_TIMEOUT_DEFAULT,1);
+ Traffic_PopupTimeoutValue = DBGetContactSettingByte(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_TIMEOUT_VALUE,5);
+
+ // Ôîðìàò ñ÷¸ò÷èêà äëÿ êàæäîãî àêòèâíîãî ïðîòîêîëà
+ if (DBGetContactSettingTString(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, &dbv) == 0)
+ {
+ if(lstrlen(dbv.ptszVal) > 0)
+ lstrcpyn(Traffic_CounterFormat, dbv.ptszVal, SIZEOF(Traffic_CounterFormat));
+ //
+ DBFreeVariant(&dbv);
+ }
+ else //defaults here
+ {
+ _tcscpy(Traffic_CounterFormat, _T("{I4}\x0D\x0A\x0A\
+{R65}?tc_GetTraffic(%extratext%,now,sent,d)\x0D\x0A\x0A\
+{R115}?tc_GetTraffic(%extratext%,now,received,d)\x0D\x0A\x0A\
+{R165}?tc_GetTraffic(%extratext%,total,both,d)\x0D\x0A\x0A\
+{L180}?if3(?tc_GetTime(%extratext%,now,hh:mm:ss),)\x0D\x0A\x0A\
+{L230}?if3(?tc_GetTime(%extratext%,total,d hh:mm),)"));
+ }
+
+ // Ôîðìàò âñïëûâàþùèõ ïîäñêàçîê
+ if (DBGetContactSettingTString(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, &dbv) == 0)
+ {
+ if(lstrlen(dbv.ptszVal) > 0)
+ lstrcpyn(Traffic_TooltipFormat, dbv.ptszVal, SIZEOF(Traffic_TooltipFormat));
+ //
+ DBFreeVariant(&dbv);
+ }
+ else //defaults here
+ {
+ _tcscpy(Traffic_TooltipFormat, _T("Traffic Counter"));
+ }
+
+ Traffic_AdditionSpace = DBGetContactSettingByte(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_ADDITION_SPACE, 0);
+
+ // Ñ÷¸ò÷èê âðåìåíè îíëàéíà
+ OverallInfo.Total.Timer = DBGetContactSettingDword(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOTAL_ONLINE_TIME, 0);
+
+ //register traffic font
+ TrafficFontID.cbSize = sizeof(FontIDT);
+ _tcscpy(TrafficFontID.group, LPGENT("Traffic counter"));
+ _tcscpy(TrafficFontID.name, LPGENT("Font"));
+ strcpy(TrafficFontID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
+ strcpy(TrafficFontID.prefix, "Font");
+ TrafficFontID.flags = FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
+ TrafficFontID.deffontsettings.charset = DEFAULT_CHARSET;
+ TrafficFontID.deffontsettings.colour = GetSysColor(COLOR_BTNTEXT);
+ TrafficFontID.deffontsettings.size = 12;
+ TrafficFontID.deffontsettings.style = 0;
+ _tcscpy(TrafficFontID.deffontsettings.szFace, _T("Arial"));
+ TrafficFontID.order = 0;
+ FontRegisterT(&TrafficFontID);
+
+ // Ðåãèñòðèðóåì öâåò ôîíà
+ TrafficBackgroundColorID.cbSize = sizeof(ColourIDT);
+ _tcscpy(TrafficBackgroundColorID.group, LPGENT("Traffic counter"));
+ _tcscpy(TrafficBackgroundColorID.name, LPGENT("Font"));
+ strcpy(TrafficBackgroundColorID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
+ strcpy(TrafficBackgroundColorID.setting, "FontBkColor");
+ TrafficBackgroundColorID.defcolour = GetSysColor(COLOR_BTNFACE);
+ ColourRegisterT(&TrafficBackgroundColorID);
+
+ h_FontReload = HookEvent(ME_FONT_RELOAD, UpdateFonts);
+
+ // Äîáàâëÿåì ïîääåðæêó ïëàãèíà Variables
+ RegisterVariablesTokens();
+
+ CreateServiceFunction("TrafficCounter/ShowHide", MenuCommand_TrafficShowHide);
+ // Ðåãèñòðèðóåì ãîðÿ÷óþ êëàâèøó äëÿ ïîêàçà/ñêðûòèÿ ôðåéìà
+ {
+ HOTKEYDESC hkd = {0};
+ hkd.cbSize = sizeof(hkd);
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT,'T');
+ hkd.pszSection = "Traffic Counter";
+ hkd.pszDescription = "Show/Hide frame";
+ hkd.pszName = "TC_Show_Hide";
+ hkd.pszService = "TrafficCounter/ShowHide";
+ Hotkey_Register(&hkd);
+ }
+
+ // Äîáàâëÿåì ïóíêò â ãëàâíîå ìåíþ.
+ if (unOptions.ShowMainMenuItem)
+ Traffic_AddMainMenuItem();
+
+ // Ñîçäà¸ì êîíòåêñòíîå ìåíþ.
+ if (TrafficPopupMenu = CreatePopupMenu())
+ {
+ AppendMenu(TrafficPopupMenu,MF_STRING,POPUPMENU_HIDE,TranslateT("Hide traffic window"));
+ AppendMenu(TrafficPopupMenu,MF_STRING,POPUPMENU_CLEAR_NOW,TranslateT("Clear the current (Now:) value"));
+ }
+
+ // Ðåãèñòðèðóåì îáðàáîò÷èêè ñîáûòèé Netlib
+ h_OnRecv = HookEvent(ME_NETLIB_FASTRECV, TrafficRecv);
+ h_OnSend = HookEvent(ME_NETLIB_FASTSEND, TrafficSend);
+
+ CreateTrafficWindow((HWND)CallService(MS_CLUI_GETHWND, 0, 0));
+ UpdateFonts(0, 0); //Load and create fonts here
+
+ return 0;
+}
+
+static BOOL CALLBACK DlgProcPopupsTraffic(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ //
+ CheckDlgButton(hwndDlg,IDC_NOTIFYSIZE,(unOptions.NotifyBySize) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg,IDC_ENOTIFYSIZE,Traffic_Notify_size_value,0);
+ SendDlgItemMessage(hwndDlg,IDC_ENOTIFYSIZE,EM_LIMITTEXT,4,0);
+ if (!unOptions.NotifyBySize) EnableWindow(GetDlgItem(hwndDlg,IDC_ENOTIFYSIZE),0);
+ CheckDlgButton(hwndDlg,IDC_NOTIFYTIME,(unOptions.NotifyByTime) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg,IDC_ENOTIFYTIME,Traffic_Notify_time_value,0);
+ SendDlgItemMessage(hwndDlg,IDC_ENOTIFYTIME,EM_LIMITTEXT,2,0);
+ if (!unOptions.NotifyByTime) EnableWindow(GetDlgItem(hwndDlg,IDC_ENOTIFYTIME),0);
+ //colors
+ SendDlgItemMessage(hwndDlg,IDC_COLOR1,CPM_SETDEFAULTCOLOUR,0,RGB(200,255,200));
+ SendDlgItemMessage(hwndDlg,IDC_COLOR1,CPM_SETCOLOUR,0,Traffic_PopupBkColor);
+ SendDlgItemMessage(hwndDlg,IDC_COLOR2,CPM_SETDEFAULTCOLOUR,0,RGB(0,0,0));
+ SendDlgItemMessage(hwndDlg,IDC_COLOR2,CPM_SETCOLOUR,0,Traffic_PopupFontColor);
+ //timeout
+ CheckDlgButton(hwndDlg,IDC_RADIO_FROMPOPUP,(Traffic_PopupTimeoutDefault != 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,IDC_RADIO_CUSTOM,(Traffic_PopupTimeoutDefault == 0) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_POPUP_TIMEOUT),Traffic_PopupTimeoutDefault == 0);
+ SetDlgItemInt(hwndDlg,IDC_POPUP_TIMEOUT,Traffic_PopupTimeoutValue,0);
+ SendDlgItemMessage(hwndDlg,IDC_POPUP_TIMEOUT,EM_LIMITTEXT,2,0);
+
+ return 0;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_NOTIFYSIZE:
+ EnableWindow(GetDlgItem(hwndDlg,IDC_ENOTIFYSIZE),IsDlgButtonChecked(hwndDlg,IDC_NOTIFYSIZE));
+ break;
+
+ case IDC_ENOTIFYSIZE:
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ break;
+
+ case IDC_NOTIFYTIME:
+ EnableWindow(GetDlgItem(hwndDlg,IDC_ENOTIFYTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTIFYTIME));
+ break;
+
+ case IDC_ENOTIFYTIME:
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ break;
+
+ case IDC_RESETCOLORS:
+ SendDlgItemMessage(hwndDlg,IDC_COLOR1,CPM_SETDEFAULTCOLOUR,0,RGB(200,255,200));
+ SendDlgItemMessage(hwndDlg,IDC_COLOR1,CPM_SETCOLOUR,0,RGB(200,255,200));
+ SendDlgItemMessage(hwndDlg,IDC_COLOR2,CPM_SETDEFAULTCOLOUR,0,RGB(0,0,0));
+ SendDlgItemMessage(hwndDlg,IDC_COLOR2,CPM_SETCOLOUR,0,RGB(0,0,0));
+ break;
+
+ case IDC_RADIO_FROMPOPUP:
+ case IDC_RADIO_CUSTOM:
+ EnableWindow(GetDlgItem(hwndDlg,IDC_POPUP_TIMEOUT),IsDlgButtonChecked(hwndDlg,IDC_RADIO_CUSTOM));
+ break;
+
+ case IDC_TEST:
+ NotifyOnRecv();
+ NotifyOnSend();
+ return 0;
+
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return 0;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom)
+ {
+ case 0:
+ if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
+ unOptions.NotifyBySize = IsDlgButtonChecked(hwndDlg,IDC_NOTIFYSIZE);
+ Traffic_Notify_size_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYSIZE,NULL,0);
+ unOptions.NotifyByTime = IsDlgButtonChecked(hwndDlg,IDC_NOTIFYTIME);
+ Traffic_Notify_time_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYTIME,NULL,0);
+ //
+ Traffic_PopupBkColor = SendDlgItemMessage(hwndDlg,IDC_COLOR1,CPM_GETCOLOUR,0,0);
+ Traffic_PopupFontColor = SendDlgItemMessage(hwndDlg,IDC_COLOR2,CPM_GETCOLOUR,0,0);
+ //
+ Traffic_PopupTimeoutDefault = IsDlgButtonChecked(hwndDlg,IDC_RADIO_FROMPOPUP);
+ if (Traffic_PopupTimeoutDefault == 0) Traffic_PopupTimeoutValue = GetDlgItemInt(hwndDlg,IDC_POPUP_TIMEOUT,NULL,0);
+ //
+ UpdateNotifyTimer();
+ return TRUE;
+ }
+ break;
+ }
+ break;
+ }
+ return 0;
+}
+
+static BOOL CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ WORD i, j, l;
+ BOOL result;
+ static BYTE Initialized = 0;
+ static WORD optionCount = 0;
+ static OPTTREE_OPTION options[] =
+ {
+ {0, LPGENT("Display/") LPGENT("Icon"),
+ OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoIcon"},
+ {0, LPGENT("Display/") LPGENT("Account name"),
+ OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoName"},
+ {0, LPGENT("Display/") LPGENT("Current traffic"),
+ OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTraffic"},
+ {0, LPGENT("Display/") LPGENT("Total traffic"),
+ OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTraffic"},
+ {0, LPGENT("Display/") LPGENT("Current online"),
+ OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTime"},
+ {0, LPGENT("Display/") LPGENT("Total online"),
+ OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTime"},
+ {0, LPGENT("General/") LPGENT("Draw frame as skin element"),
+ OPTTREE_CHECK, 1, NULL, "DrawFrmAsSkin"},
+ {0, LPGENT("General/") LPGENT("Show tooltip in traffic window"),
+ OPTTREE_CHECK, 1, NULL, "ShowTooltip"},
+ {0, LPGENT("General/") LPGENT("\"Toggle traffic counter\" in main menu"),
+ OPTTREE_CHECK, 1, NULL, "ShowMainMenuItem"},
+ // Ðåçåðâèðóåì ìåñòî ïîä àêòèâíûå è âèäèìûå ïðîòîêîëû
+ // Ìàêñèìóì 16 ïîçèöèé âèäèìûõ è 16 àêòèâíûõ
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
+ {0, LPGENT("Visible accounts/") LPGENT("Summary traffic for visible accounts"),
+ OPTTREE_CHECK, 1, NULL, "ShowSummary"},
+ {0, LPGENT("Visible accounts/") LPGENT("Overall traffic"),
+ OPTTREE_CHECK, 1, NULL, "ShowOverall"},
+ };
+
+ if (!Initialized)
+ {
+ pOptions = options;
+ optionCount = SIZEOF(options);
+ // Åñëè íåò Variables, àêòèâèðóåì ãàëî÷êè äëÿ ñòàðîãî ìåòîäà ðèñîâàíèÿ
+ if (!ServiceExists(MS_VARS_FORMATSTRING))
+ {
+ for (i = 0; i < 8; i++) options[i].dwFlag = 1;
+ }
+
+ // Ôëàæêè äëÿ âèäèìîñòè àêêàóíòîâ ñîçäàþòñÿ â ëþáîì ñëó÷àå.
+ for (i = j = 0; (j < NumberOfAccounts) && (i < optionCount) ; i++)
+ if ((options[i].dwFlag & OPTTREE_INVISIBLE) && !options[i].szSettingName)
+ {
+ options[i].szSettingName = (char*)mir_alloc(1 + strlen(ProtoList[j].name));
+ strcpy(options[i].szSettingName, ProtoList[j].name);
+ l = 20 + _tcslen(ProtoList[j].tszAccountName);
+ options[i].szOptionName = (TCHAR*)mir_alloc(sizeof(TCHAR) * l);
+ mir_sntprintf(options[i].szOptionName,
+ l,
+ _T("Visible accounts/%s"),
+ ProtoList[j].tszAccountName);
+ options[i].dwFlag = (ProtoList[j++].Enabled ? 1 : OPTTREE_INVISIBLE)
+ | OPTTREE_NOTRANSLATE;
+ }
+ Initialized = 1;
+ }
+
+ if (OptTree_ProcessMessage(hwndDlg, msg, wParam, lParam, &result, IDC_APPEARANCEOPTIONS, options, optionCount))
+ return result;
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(15, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, NULL, FALSE));
+
+ //show/hide button
+ SetDlgItemText(hwndDlg,IDC_BSHOWHIDE,(IsWindowVisible(TrafficHwnd) != 0)? TranslateT("Hide now") : TranslateT("Show now"));
+
+ // Ñòðîêè ôîðìàòà äëÿ ñ÷¸ò÷èêîâ
+ EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_COUNTER_FORMAT),ServiceExists(MS_VARS_FORMATSTRING));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_COUNTER_FORMAT), Traffic_CounterFormat);
+
+ // Ôîðìàò âñïëûâàþùåé ïîäñêàçêè
+ EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_TOOLTIP_FORMAT),
+ ServiceExists("mToolTip/ShowTipW") || ServiceExists("mToolTip/ShowTip"));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_TOOLTIP_FORMAT), Traffic_TooltipFormat);
+
+ // Display traffic for current...
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_AUTO_CLEAR, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Day"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_AUTO_CLEAR, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Week"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_AUTO_CLEAR, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Month"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_AUTO_CLEAR, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Year"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_AUTO_CLEAR, CB_SETCURSEL, unOptions.PeriodForShow, 0);
+
+ // Èíòåðâàë ìåæäó ñòðîêàìè
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, Traffic_AdditionSpace, 0);
+ SendDlgItemMessage(hwndDlg, IDC_EDIT_SPACE, EM_LIMITTEXT, 2, 0);
+
+ // Appearance
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.DrawProtoIcon, "DrawProtoIcon");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.DrawProtoName, "DrawProtoName");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.DrawCurrentTraffic, "DrawCurrentTraffic");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.DrawTotalTraffic, "DrawTotalTraffic");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.DrawCurrentTimeCounter, "DrawCurrentTime");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.DrawTotalTimeCounter, "DrawTotalTime");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.DrawFrmAsSkin, "DrawFrmAsSkin");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.ShowSummary , "ShowSummary");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.ShowTooltip, "ShowTooltip");
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.ShowMainMenuItem, "ShowMainMenuItem");
+
+ // Íàñòðîéêè âèäèìîñòè ïðîòîêîëîâ
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ char buffer[32];
+ strcpy(buffer, ProtoList[i].name);
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, ProtoList[i].Visible, buffer);
+ }
+ OptTree_SetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, unOptions.ShowOverall, "ShowOverall");
+
+ EnableWindow(GetDlgItem(GetParent(hwndDlg),IDC_APPLY),FALSE);
+ return 0;
+
+ case WM_COMMAND:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_BSHOWHIDE:
+ MenuCommand_TrafficShowHide(0, 0);
+ SetDlgItemText(hwndDlg,IDC_BSHOWHIDE,IsWindowVisible(TrafficHwnd)? TranslateT("Hide now") : TranslateT("Show now"));
+ return 0;
+
+ case IDC_EDIT_SPACE:
+ case IDC_EDIT_COUNTER_FORMAT:
+ case IDC_EDIT_OVERALL_COUNTER_FORMAT:
+ case IDC_EDIT_TOOLTIP_FORMAT:
+ if (HIWORD(wParam) == EN_CHANGE)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_COMBO_AUTO_CLEAR:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+
+ switch (lpnmhdr->code)
+ {
+ case PSN_APPLY:
+ {
+ unOptions.PeriodForShow = (char)SendDlgItemMessage(hwndDlg,IDC_COMBO_AUTO_CLEAR,CB_GETCURSEL,0,0);
+
+ // Èíòåðâàë ìåæäó ñòðîêàìè
+ Traffic_AdditionSpace = GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, NULL, 0);
+ // Íàñòðîéêè Appearance
+ unOptions.DrawProtoIcon = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawProtoIcon");
+ unOptions.DrawProtoName = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawProtoName");
+ unOptions.DrawCurrentTraffic = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawCurrentTraffic");
+ unOptions.DrawTotalTraffic = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawTotalTraffic");
+ unOptions.DrawTotalTimeCounter = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawTotalTime");
+ unOptions.DrawCurrentTimeCounter = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawCurrentTime");
+ unOptions.DrawTotalTimeCounter = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawTotalTime");
+ unOptions.DrawFrmAsSkin = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawFrmAsSkin");
+ unOptions.ShowSummary = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "ShowSummary");
+ unOptions.ShowTooltip = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "ShowTooltip");
+ unOptions.ShowMainMenuItem = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "ShowMainMenuItem");
+
+ // Íàñòðîéêè âèäèìîñòè ïðîòîêîëîâ
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ char buffer[32];
+ strcpy(buffer, ProtoList[i].name);
+ ProtoList[i].Visible = (BYTE)OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, buffer);
+ }
+ unOptions.ShowOverall = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "ShowOverall");
+
+ // Ôîðìàò ñ÷¸ò÷èêîâ
+ GetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_COUNTER_FORMAT), Traffic_CounterFormat, 512);
+ // Ôîðìàò âñïëûâàþùåé ïîäñêàçêè
+ GetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_TOOLTIP_FORMAT), Traffic_TooltipFormat, 512);
+
+ // Êëþ÷åâîé öâåò
+ UseKeyColor = DBGetContactSettingByte(NULL, "ModernSettings", "UseKeyColor", 1);
+ KeyColor = DBGetContactSettingDword(NULL, "ModernSettings", "KeyColor", 0);
+
+ // Ïåðåðèñîâûâàåì ôðåéì
+ UpdateTrafficWindowSize();
+
+ // Åñëè îòêëþ÷àåòñÿ ïîêàç ïóíêòà ãëàâíîãî ìåíþ, òî óäàëÿåì åãî.
+ if (!unOptions.ShowMainMenuItem && hTrafficMainMenuItem)
+ {
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hTrafficMainMenuItem, 0);
+ hTrafficMainMenuItem = NULL;
+ }
+ // Åñëè âêëþ÷àåòñÿ, òî ñîçäà¸ì.
+ if (unOptions.ShowMainMenuItem && !hTrafficMainMenuItem)
+ Traffic_AddMainMenuItem();
+
+ SaveSettings(0);
+ //
+ return TRUE;
+ } // case PSN_APPLY
+ } // switch
+ }
+
+ case WM_DESTROY:
+ return FALSE;
+ }
+ return 0;
+}
+
+int TrafficCounterOptInitialise(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp={0};
+ // Main options page
+ odp.cbSize=sizeof(odp);
+ odp.position=900000000;
+ odp.groupPosition = 1;
+ odp.hInstance=hInst;
+ odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_TRAFFIC);
+ odp.pszGroup = LPGEN("Services");
+ odp.pszTab = LPGEN("Options");
+ odp.pszTitle = LPGEN("Traffic counter");
+ odp.pfnDlgProc=DlgProcTCOptions;
+ odp.flags=ODPF_BOLDGROUPS;
+ odp.expertOnlyControls=0;
+ odp.nExpertOnlyControls=0;
+ Options_AddPage(wParam, &odp);
+
+ // Statistics options page
+ odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_STATS);
+ odp.pszTab = LPGEN("Statistics");
+ odp.pfnDlgProc = DlgProcOptStatistics;
+ Options_AddPage(wParam, &odp);
+
+ // Popups option page
+ if (ServiceExists(MS_POPUP_ADDPOPUP))
+ {
+ odp.groupPosition = 100;
+ odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_TRAFFIC_POPUPS);
+ odp.pszGroup=LPGEN("PopUps");
+ odp.pszTitle=LPGEN("Traffic counter");
+ odp.pfnDlgProc=DlgProcPopupsTraffic;
+ odp.flags=ODPF_BOLDGROUPS;
+ Options_AddPage(wParam, &odp);
+ }
+
+ return 0;
+}
+
+void SaveSettings(BYTE OnlyCnt)
+{
+ unsigned short int i;
+
+ // Ñîõðàíÿåì ñ÷¸ò÷èê âðåìåíè îíëàéíà
+ DBWriteContactSettingDword(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOTAL_ONLINE_TIME, OverallInfo.Total.Timer);
+
+ if (OnlyCnt) return;
+
+ // Äëÿ êàæäîãî ïðîòîêîëà ñîõðàíÿåì ôëàãè
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ if (!ProtoList[i].name) continue;
+ DBWriteContactSettingByte(NULL, ProtoList[i].name, SETTINGS_PROTO_FLAGS, ProtoList[i].Flags);
+ }
+
+ //settings for notification
+ DBWriteContactSettingDword(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_BKCOLOR,Traffic_PopupBkColor);
+ DBWriteContactSettingDword(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_FONTCOLOR,Traffic_PopupFontColor);
+ //
+ DBWriteContactSettingByte(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_NOTIFY_TIME_VALUE,Traffic_Notify_time_value);
+ //
+ DBWriteContactSettingWord(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_NOTIFY_SIZE_VALUE,Traffic_Notify_size_value);
+ //
+ //popup timeout
+ DBWriteContactSettingByte(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_TIMEOUT_DEFAULT,Traffic_PopupTimeoutDefault);
+ DBWriteContactSettingByte(NULL,TRAFFIC_SETTINGS_GROUP,SETTINGS_POPUP_TIMEOUT_VALUE,Traffic_PopupTimeoutValue);
+ //
+ // Ôîðìàò ñ÷¸ò÷èêîâ
+ DBWriteContactSettingTString(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, Traffic_CounterFormat);
+
+ DBWriteContactSettingTString(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, Traffic_TooltipFormat);
+
+ DBWriteContactSettingByte(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_ADDITION_SPACE, Traffic_AdditionSpace);
+ // Ñîõðàíÿåì ôëàãè
+ DBWriteContactSettingDword(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_WHAT_DRAW, unOptions.Flags);
+ DBWriteContactSettingWord(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_STAT_ACC_OPT, Stat_SelAcc);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+int TrafficRecv(WPARAM wParam,LPARAM lParam)
+{
+ NETLIBNOTIFY *nln = (NETLIBNOTIFY*)wParam;
+ NETLIBUSER *nlu = (NETLIBUSER*)lParam;
+ int i;
+
+ if (nln->result > 0)
+ for (i = 0; i < NumberOfAccounts; i++)
+ if (!strcmp(ProtoList[i].name, nlu->szSettingsModule))
+ InterlockedExchangeAdd(&ProtoList[i].AllStatistics[ProtoList[i].NumberOfRecords-1].Incoming, nln->result);
+ return 0;
+}
+
+int TrafficSend(WPARAM wParam,LPARAM lParam)
+{
+ NETLIBNOTIFY *nln = (NETLIBNOTIFY*)wParam;
+ NETLIBUSER *nlu = (NETLIBUSER*)lParam;
+ int i;
+
+ if (nln->result > 0)
+ for (i = 0; i < NumberOfAccounts; i++)
+ if (!strcmp(ProtoList[i].name, nlu->szSettingsModule))
+ InterlockedExchangeAdd(&ProtoList[i].AllStatistics[ProtoList[i].NumberOfRecords-1].Outgoing, nln->result);
+ return 0;
+}
+
+int TrafficCounter_PaintCallbackProc(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData)
+{
+ return TrafficCounter_Draw(hWnd,hDC);
+}
+
+int TrafficCounter_Draw(HWND hwnd, HDC hDC)
+{
+ if (hwnd==(HWND)-1) return 0;
+ if (GetParent(hwnd) == (HWND)CallService(MS_CLUI_GETHWND, 0, 0))
+ return PaintTrafficCounterWindow(hwnd, hDC);
+ else
+ InvalidateRect(hwnd,NULL,FALSE);
+ return 0;
+}
+
+static void TC_AlphaText(HDC hDC, LPCTSTR lpString, RECT* lpRect, UINT format, BYTE ClistModernPresent)
+{
+ int nCount = lstrlen( lpString );
+
+ if (ClistModernPresent)
+ AlphaText(hDC, lpString, nCount, lpRect, format, Traffic_FontColor);
+ else
+ DrawText( hDC, lpString, nCount, lpRect, format );
+}
+
+static void TC_DrawIconEx( HDC hdc,int xLeft,int yTop,HICON hIcon, HBRUSH hbrFlickerFreeDraw, BYTE ClistModernPresent)
+{
+ if (ClistModernPresent)
+ mod_DrawIconEx_helper( hdc, xLeft, yTop, hIcon, 16, 16, 0, hbrFlickerFreeDraw, DI_NORMAL );
+ else
+ DrawIconEx( hdc, xLeft, yTop, hIcon, 16, 16, 0, hbrFlickerFreeDraw, DI_NORMAL );
+}
+
+int PaintTrafficCounterWindow(HWND hwnd, HDC hDC)
+{
+ RECT rect, rect2;
+ HFONT old_font;
+ int i, dx, height, width;
+ HBRUSH b, t;
+ HDC hdc;
+ HBITMAP hbmp, oldbmp;
+ BITMAPINFO RGB32BitsBITMAPINFO = {0};
+ BLENDFUNCTION aga = {AC_SRC_OVER, 0, 0xFF, AC_SRC_ALPHA};
+ DWORD SummarySession, SummaryTotal;
+
+ BYTE ClistModernPresent = (GetModuleHandleA("clist_modern.dll") || GetModuleHandleA("clist_modern_dora.dll"))
+ && !DBGetContactSettingByte(NULL, "ModernData", "DisableEngine", 0)
+ && DBGetContactSettingByte(NULL, "ModernData", "EnableLayering", 1);
+
+ GetClientRect (hwnd, &rect);
+ height = rect.bottom - rect.top;
+ width = rect.right - rect.left;
+
+ // Ñâîé êîíòåêñò óñòðîéñòâà.
+ hdc = CreateCompatibleDC(hDC);
+ //
+ RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ RGB32BitsBITMAPINFO.bmiHeader.biWidth = width;
+ RGB32BitsBITMAPINFO.bmiHeader.biHeight = height;
+ RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
+ RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
+ RGB32BitsBITMAPINFO.bmiHeader.biCompression = BI_RGB;
+ hbmp = CreateDIBSection(NULL,
+ &RGB32BitsBITMAPINFO,
+ DIB_RGB_COLORS,
+ NULL,
+ NULL, 0);
+ oldbmp = (HBITMAP)SelectObject(hdc, hbmp);
+
+ b = CreateSolidBrush(Traffic_BkColor);
+ t = CreateSolidBrush(KeyColor);
+
+ if ( ClistModernPresent
+ && unOptions.DrawFrmAsSkin)
+ {
+ SKINDRAWREQUEST rq;
+
+ rq.hDC = hdc;
+ rq.rcDestRect = rect;
+ rq.rcClipRect = rect;
+ strncpy(rq.szObjectID, "Main,ID=EventArea", sizeof(rq.szObjectID));
+ if (CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0))
+ {
+ strncpy(rq.szObjectID, "Main,ID=StatusBar", sizeof(rq.szObjectID));
+ CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0);
+ }
+ }
+ else
+ {
+ SetTextColor(hdc, Traffic_FontColor);
+ SetBkColor(hdc, Traffic_BkColor);
+ FillRect(hdc, &rect, b);
+ AlphaBlend(hdc, 0, 0, width, height, hdc, 0, 0, width, height, aga);
+ }
+
+ old_font = (HFONT)SelectObject(hdc, Traffic_h_font);
+
+ // Îãðàíè÷èâàåì îáëàñòü ðèñîâàíèÿ
+ rect.top += 2;
+ rect.left += 3;
+ rect.bottom -= 2;
+ rect.right -= 3;
+
+//-------------------
+// Åñëè íåò ïëàãèíà Variables, ðèñóåì óïðîù¸ííî.
+//-------------------
+ if (!ServiceExists(MS_VARS_FORMATSTRING))
+ {
+ SummarySession = SummaryTotal = 0;
+ // Äëÿ êàæäîãî àêêàóíòà
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ // Òîëüêî åñëè ðàçðåøåíî åãî îòîáðàæåíèå.
+ if (ProtoList[i].Visible && ProtoList[i].Enabled)
+ {
+ dx = 0;
+ // Èçîáðàæàåì èêîíêó àêêàóíòà.
+ if (unOptions.DrawProtoIcon)
+ {
+ TC_DrawIconEx(hdc, rect.left, rect.top,
+ LoadSkinnedProtoIcon(ProtoList[i].name, CallProtoService(ProtoList[i].name,PS_GETSTATUS,0,0)), b, ClistModernPresent);
+ dx = 19;
+ }
+ // Èçîáðàæàåì èìÿ àêêàóíòà
+ if (unOptions.DrawProtoName)
+ {
+ rect.left += dx;
+ TC_AlphaText(hdc, ProtoList[i].tszAccountName, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent);
+ rect.left -= dx;
+ }
+ // Ñëåäóþùèå ïîçèöèè ñòðîÿòñÿ îò ïðàâîãî êðàÿ.
+ // Îáùåå âðåìÿ.
+ if (unOptions.DrawTotalTimeCounter)
+ {
+ TCHAR bu[32];
+
+ GetDurationFormatM(ProtoList[i].Total.Timer, _T("h:mm:ss"), bu, 32);
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ }
+ // Òåêóùåå âðåìÿ.
+ if (unOptions.DrawCurrentTimeCounter)
+ {
+ TCHAR bu[32];
+
+ GetDurationFormatM(ProtoList[i].Session.Timer, _T("h:mm:ss"), bu, 32);
+ rect.right -= 50;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 50;
+ }
+ // Èçîáðàæàåì îáùèé òðàôèê.
+ if (unOptions.DrawTotalTraffic)
+ {
+ TCHAR bu[32];
+
+ GetFormattedTraffic(ProtoList[i].TotalSentTraffic + ProtoList[i].TotalRecvTraffic, 3, bu, 32);
+ rect.right -= 100;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 100;
+
+ if (ProtoList[i].Visible)
+ SummaryTotal += ProtoList[i].TotalRecvTraffic + ProtoList[i].TotalSentTraffic;
+ }
+ // Èçîáðàæàåì òåêóùèé òðàôèê.
+ if (unOptions.DrawCurrentTraffic)
+ {
+ TCHAR bu[32];
+
+ GetFormattedTraffic(ProtoList[i].CurrentRecvTraffic + ProtoList[i].CurrentSentTraffic, 3, bu, 32);
+ rect.right -= 150;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 150;
+
+ if (ProtoList[i].Visible)
+ SummarySession += ProtoList[i].CurrentRecvTraffic + ProtoList[i].CurrentSentTraffic;
+ }
+
+ rect.top += Traffic_LineHeight + Traffic_AdditionSpace;
+ }
+ }
+ // Ðèñóåì ñóììàðíûé òðàôèê âûáðàííûõ àêêàóíòîâ.
+ if (unOptions.ShowSummary)
+ {
+ // Èçîáðàæàåì èêîíêó.
+ dx = 0;
+ if (unOptions.DrawProtoIcon)
+ {
+ TC_DrawIconEx(hdc, rect.left, rect.top,
+ LoadSkinnedIcon(SKINICON_OTHER_MIRANDA), b, ClistModernPresent);
+ dx = 19;
+ }
+ // Âûâîäèì òåêñò
+ // Èçîáðàæàåì èìÿ
+ if (unOptions.DrawProtoName)
+ {
+ TCHAR *bu = mir_a2t("Summary");
+
+ rect.left += dx;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent);
+ rect.left -= dx;
+ mir_free(bu);
+ }
+ // Îáùåå âðåìÿ.
+ if (unOptions.DrawTotalTimeCounter)
+ {
+ TCHAR bu[32];
+
+ GetDurationFormatM(OverallInfo.Total.Timer, _T("h:mm:ss"), bu, 32);
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ }
+ // Òåêóùåå âðåìÿ.
+ if (unOptions.DrawCurrentTimeCounter)
+ {
+ TCHAR bu[32];
+
+ GetDurationFormatM(OverallInfo.Session.Timer, _T("h:mm:ss"), bu, 32);
+ rect.right -= 50;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 50;
+ }
+ // Èçîáðàæàåì îáùèé òðàôèê.
+ if (unOptions.DrawTotalTraffic)
+ {
+ TCHAR bu[32];
+
+ GetFormattedTraffic(SummaryTotal, 3, bu, 32);
+ rect.right -= 100;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 100;
+ }
+ // Èçîáðàæàåì òåêóùèé òðàôèê.
+ if (unOptions.DrawCurrentTraffic)
+ {
+ TCHAR bu[32];
+
+ GetFormattedTraffic(SummarySession, 3, bu, 32);
+ rect.right -= 150;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 150;
+ }
+ }
+ rect.top += Traffic_LineHeight + Traffic_AdditionSpace;
+ // Ðèñóåì âñåîáùèé òðàôèê.
+ if (unOptions.ShowOverall)
+ {
+ // Èçîáðàæàåì èêîíêó.
+ dx = 0;
+ if (unOptions.DrawProtoIcon)
+ {
+ TC_DrawIconEx(hdc, rect.left, rect.top,
+ LoadSkinnedIcon(SKINICON_OTHER_MIRANDA), b, ClistModernPresent);
+ dx = 19;
+ }
+ // Âûâîäèì òåêñò
+ // Èçîáðàæàåì èìÿ
+ if (unOptions.DrawProtoName)
+ {
+ TCHAR *bu = mir_a2t("Overall");
+
+ rect.left += dx;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent);
+ rect.left -= dx;
+ mir_free(bu);
+ }
+ // Ñëåäóþùèå ïîçèöèè ñòðîÿòñÿ îò ïðàâîãî êðàÿ.
+ // Èçîáðàæàåì îáùèé òðàôèê.
+ if (unOptions.DrawTotalTraffic)
+ {
+ TCHAR bu[32];
+
+ GetFormattedTraffic(OverallInfo.TotalSentTraffic + OverallInfo.TotalRecvTraffic, 3, bu, 32);
+ rect.right -= 100;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 100;
+ }
+ // Èçîáðàæàåì òåêóùèé òðàôèê.
+ if (unOptions.DrawCurrentTraffic)
+ {
+ TCHAR bu[32];
+
+ GetFormattedTraffic(OverallInfo.CurrentRecvTraffic + OverallInfo.CurrentSentTraffic, 3, bu, 32);
+ rect.right -= 150;
+ TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
+ rect.right += 150;
+ }
+ }
+ }
+ else
+//-------------
+// Åñëè åñòü Variables - ðèñóåì ïî-íîâîìó
+//-------------
+ {
+ RowItemInfo *ItemsList;
+ WORD ItemsNumber, RowsNumber;
+ TCHAR **ExtraText;
+ HICON *ahIcon;
+
+ // Ãîòîâèì ñïèñîê ñòðîê äëÿ Variables è èêîíîê.
+ ExtraText = (TCHAR**)mir_alloc(sizeof(TCHAR*));
+ ahIcon = (HICON*)mir_alloc(sizeof(HICON));
+ RowsNumber = 0;
+ // Öèêë ïî àêêàóíòàì.
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ if (ProtoList[i].Visible && ProtoList[i].Enabled)
+ {
+ ExtraText = (TCHAR**)mir_realloc(ExtraText, sizeof(TCHAR*) * (RowsNumber + 1));
+ ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1));
+
+ ExtraText[RowsNumber] = mir_a2t(ProtoList[i].name);
+ ahIcon[RowsNumber++] = LoadSkinnedProtoIcon(ProtoList[i].name, CallProtoService(ProtoList[i].name, PS_GETSTATUS, 0, 0));
+ }
+ }
+ // Åù¸ 2 îñîáûõ ýëåìåíòà.
+ if (unOptions.ShowSummary)
+ {
+ ExtraText = (TCHAR**)mir_realloc(ExtraText, sizeof(TCHAR*) * (RowsNumber + 1));
+ ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1));
+
+ ExtraText[RowsNumber] = mir_a2t("summary");
+ ahIcon[RowsNumber++] = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ }
+ if (unOptions.ShowOverall)
+ {
+ ExtraText = (TCHAR**)mir_realloc(ExtraText, sizeof(TCHAR*) * (RowsNumber + 1));
+ ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1));
+
+ ExtraText[RowsNumber] = mir_a2t("overall");
+ ahIcon[RowsNumber++] = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ }
+
+ // Ðèñóåì ñâîé ñ÷¸ò÷èê äëÿ êàæäîãî èç âûáðàííûõ ïðîòîêîëîâ
+ for (i = 0; i < RowsNumber; i++)
+ {
+ TCHAR *buf;
+
+ buf = variables_parse(Traffic_CounterFormat, ExtraText[i], NULL);
+ if (ItemsNumber = GetRowItems(buf, &ItemsList))
+ {
+ // Ðèñóåì òåêñò.
+ for (dx = 0; dx < ItemsNumber; dx++)
+ {
+ // Äåëàåì êîïèþ ïðÿìîóãîëüíèêà äëÿ ðèñîâàíèÿ.
+ memcpy(&rect2, &rect, sizeof(RECT));
+ rect2.bottom = rect2.top + Traffic_LineHeight;
+ // ×òî çà òåã?
+ switch (ItemsList[dx].Alignment)
+ {
+ case 'I':
+ TC_DrawIconEx(hdc, ItemsList[dx].Interval, rect2.top, ahIcon[i], b, ClistModernPresent);
+ break;
+ case 'i':
+ TC_DrawIconEx(hdc, width - 16 - ItemsList[dx].Interval, rect2.top, ahIcon[i], b, ClistModernPresent);
+ break;
+ case 'L':
+ rect2.left = ItemsList[dx].Interval;
+ TC_AlphaText(hdc, ItemsList[dx].String, &rect2, DT_SINGLELINE | DT_LEFT | DT_VCENTER, ClistModernPresent);
+ break;
+ case 'R':
+ rect2.right = width - ItemsList[dx].Interval;
+ TC_AlphaText(hdc, ItemsList[dx].String, &rect2, DT_SINGLELINE | DT_RIGHT | DT_VCENTER, ClistModernPresent);
+ break;
+ default:
+ continue;
+ }
+
+ }
+
+ // Íóæíî îñâîáîäèòü ïàìÿòü.
+ for (; ItemsNumber--; )
+ {
+ mir_free(ItemsList[ItemsNumber].String);
+ }
+ mir_free(ItemsList);
+ }
+ dx = CallService(MS_VARS_FREEMEMORY, (WPARAM)(void*)buf, 0);
+ rect.top += Traffic_LineHeight + Traffic_AdditionSpace;
+ }
+
+ // Óäàëÿåì ñïèñîê ñòðîê.
+ for (; RowsNumber--; )
+ mir_free(ExtraText[RowsNumber]);
+ mir_free(ExtraText);
+ }
+
+ DeleteObject(b);
+ DeleteObject(t);
+ SelectObject(hdc, old_font);
+
+ if (ClistModernPresent)
+ {
+ AlphaBlend(hDC, 0, 0, width, height, hdc, 0, 0, width, height, aga);
+ }
+ else
+ {
+ BitBlt(hDC, 0, 0, width, height, hdc, 0, 0, SRCCOPY);
+ }
+
+ SelectObject(hdc, oldbmp);
+ DeleteObject(hbmp);
+ DeleteDC(hdc);
+
+ return 0;
+}
+
+void ProtocolIsOnLine(int num)
+{
+ DWORD CurrentTimeMs;
+
+ if (ProtoList[num].State) return;
+
+ online_count++;
+ CurrentTimeMs = GetTickCount();
+
+ ProtoList[num].State = 1;
+ ProtoList[num].Session.TimeAtStart = CurrentTimeMs;
+ ProtoList[num].Total.TimeAtStart = CurrentTimeMs
+ - 1000 * ProtoList[num].AllStatistics[ProtoList[num].NumberOfRecords - 1].Time;
+ ProtoList[num].Session.Timer = 0;
+
+ if (online_count == 1) // Õîòÿ áû îäèí àêêàóíò ïåðåø¸ë â îíëàéí - ãîòîâèìñÿ ñ÷èòàòü ñóììàðíîå âðåìÿ.
+ {
+ OverallInfo.Session.TimeAtStart = CurrentTimeMs - 1000 * OverallInfo.Session.Timer;
+ OverallInfo.Total.TimeAtStart = CurrentTimeMs - 1000 * OverallInfo.Total.Timer;
+ }
+}
+
+void ProtocolIsOffLine(int num)
+{
+ if (!ProtoList[num].State) return;
+
+ online_count--;
+ ProtoList[num].State = 0;
+}
+
+static POINT ptMouse = {0};
+
+LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ POINT p;
+ int i;
+ //
+ switch (msg)
+ {
+ case (WM_USER+697):
+ if (lParam == 666)
+ DestroyWindow(hwnd);
+ break;
+
+ case WM_PAINT:
+ {
+ if ( !DBGetContactSettingByte(NULL, "ModernData", "DisableEngine", 0)
+ && DBGetContactSettingByte(NULL, "ModernData", "EnableLayering", 1)
+ && ServiceExists(MS_SKINENG_INVALIDATEFRAMEIMAGE))
+ CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, (WPARAM)TrafficHwnd, 0);
+ else
+ {
+ HDC hdc;
+ hdc = GetDC(hwnd);
+ PaintTrafficCounterWindow(hwnd, hdc);
+ ReleaseDC(hwnd, hdc);
+ }
+ }
+ break;
+
+ case WM_ERASEBKGND:
+ return 1;
+
+ case WM_LBUTTONDOWN :
+ if (DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT))
+ {
+ ClientToScreen(GetParent(hwnd),&p);
+ return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE|HTCAPTION,MAKELPARAM(p.x,p.y));
+ }
+ break;
+
+ case WM_RBUTTONDOWN :
+ p.x = GET_X_LPARAM(lParam);
+ p.y = GET_Y_LPARAM(lParam);
+ ClientToScreen(hwnd,&p);
+ TrackPopupMenu(TrafficPopupMenu,TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,p.x,p.y,0,hwnd,NULL);
+ break;
+
+ case WM_COMMAND :
+ switch (wParam)
+ {
+ case POPUPMENU_HIDE:
+ MenuCommand_TrafficShowHide(0, 0);
+ break;
+
+ case POPUPMENU_CLEAR_NOW:
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ ProtoList[i].StartIncoming =
+ ProtoList[i].AllStatistics[ProtoList[i].NumberOfRecords - 1].Incoming;
+ ProtoList[i].StartOutgoing =
+ ProtoList[i].AllStatistics[ProtoList[i].NumberOfRecords - 1].Outgoing;
+ ProtoList[i].Session.TimeAtStart = GetTickCount();
+ }
+ OverallInfo.CurrentRecvTraffic = OverallInfo.CurrentSentTraffic = 0;
+ }
+ break;
+
+ case WM_SETCURSOR:
+ {
+ POINT pt;
+
+ GetCursorPos(&pt);
+ if ( (abs(pt.x - ptMouse.x) < 20)
+ && (abs(pt.y - ptMouse.y) < 20) )
+ return 1;
+
+ if (TooltipShowing)
+ {
+ KillTimer(TrafficHwnd, TIMER_TOOLTIP);
+ CallService("mToolTip/HideTip", 0, 0);
+ TooltipShowing = FALSE;
+ }
+ KillTimer(TrafficHwnd, TIMER_TOOLTIP);
+ SetTimer(TrafficHwnd, TIMER_TOOLTIP, CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0), 0);
+ break;
+ }
+
+ case WM_TIMER :
+ switch(wParam)
+ {
+ case TIMER_NOTIFY_TICK:
+ NotifyOnRecv();
+ NotifyOnSend();
+ break;
+
+ case TIMER_REDRAW: // Ïåðåðèñîâêà ðàç â ïîëñåêóíäû.
+ {
+ DWORD CurrentTimeMs;
+ SYSTEMTIME stNow;
+
+ SaveSettings(1);
+ // Ïåðåä ïîäñ÷¸òîì ñóììàðíîãî òðàôèêà îáíóëÿåì ñ÷¸ò÷èêè.
+ OverallInfo.CurrentRecvTraffic =
+ OverallInfo.CurrentSentTraffic =
+ OverallInfo.TotalRecvTraffic =
+ OverallInfo.TotalSentTraffic = 0;
+
+ CurrentTimeMs = GetTickCount();
+
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ if (ProtoList[i].State)
+ {
+ ProtoList[i].AllStatistics[ProtoList[i].NumberOfRecords-1].Time =
+ (CurrentTimeMs - ProtoList[i].Total.TimeAtStart) / 1000;
+ ProtoList[i].Session.Timer =
+ (CurrentTimeMs - ProtoList[i].Session.TimeAtStart) / 1000;
+ }
+
+ Stat_CheckStatistics(i);
+
+ { // Çäåñü íà îñíîâàíèè ñòàòèñòèêè âû÷èñëÿþòñÿ çíà÷åíèÿ âñåõ òðàôèêîâ è âðåìåíè.
+ DWORD Sum1, Sum2;
+ unsigned long int j;
+
+ // Çíà÷åíèÿ äëÿ òåêóùåé ñåññèè.
+ for (Sum1 = Sum2 = 0, j = ProtoList[i].StartIndex; j < ProtoList[i].NumberOfRecords; j++)
+ {
+ Sum1 += ProtoList[i].AllStatistics[j].Incoming;
+ Sum2 += ProtoList[i].AllStatistics[j].Outgoing;
+ }
+ ProtoList[i].CurrentRecvTraffic = Sum1 - ProtoList[i].StartIncoming;
+ ProtoList[i].CurrentSentTraffic = Sum2 - ProtoList[i].StartOutgoing;
+ OverallInfo.CurrentRecvTraffic += ProtoList[i].CurrentRecvTraffic;
+ OverallInfo.CurrentSentTraffic += ProtoList[i].CurrentSentTraffic;
+ // Çíà÷åíèÿ äëÿ âûáðàííîãî ïåðèîäà.
+ ProtoList[i].TotalRecvTraffic =
+ Stat_GetItemValue(1 << i,
+ unOptions.PeriodForShow + 1,
+ Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1,
+ 1);
+ ProtoList[i].TotalSentTraffic =
+ Stat_GetItemValue(1 << i,
+ unOptions.PeriodForShow + 1,
+ Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1,
+ 2);
+ ProtoList[i].Total.Timer =
+ Stat_GetItemValue(1 << i,
+ unOptions.PeriodForShow + 1,
+ Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1,
+ 4);
+ OverallInfo.TotalRecvTraffic += ProtoList[i].TotalRecvTraffic;
+ OverallInfo.TotalSentTraffic += ProtoList[i].TotalSentTraffic;
+ }
+ }
+ // Íå ïîðà ëè óâåäîìèòü?
+ if (unOptions.NotifyBySize && Traffic_Notify_size_value)
+ {
+ if (!((OverallInfo.CurrentRecvTraffic >> 10) % Traffic_Notify_size_value)
+ && notify_recv_size != OverallInfo.CurrentRecvTraffic >> 10 )
+ NotifyOnRecv();
+
+ if (!((OverallInfo.CurrentSentTraffic >> 10) % Traffic_Notify_size_value)
+ && notify_send_size != OverallInfo.CurrentSentTraffic >> 10)
+ NotifyOnSend();
+ }
+
+ // Ñ÷¸ò÷èêè ñóììàðíîãî âðåìåíè.
+ GetLocalTime(&stNow);
+
+ // Íå ïîðà ëè ñáðîñèòü îáùèé ñ÷¸ò÷èê?
+ if ( (unOptions.PeriodForShow == 0
+ && stNow.wHour == 0
+ && stNow.wMinute == 0
+ && stNow.wSecond == 0)
+ || (unOptions.PeriodForShow == 1
+ && DayOfWeek(stNow.wDay, stNow.wMonth, stNow.wYear) == 1
+ && stNow.wHour == 0
+ && stNow.wMinute == 0
+ && stNow.wSecond == 0)
+ || (unOptions.PeriodForShow == 2
+ && stNow.wDay == 1
+ && stNow.wHour == 0
+ && stNow.wMinute == 0
+ && stNow.wSecond == 0)
+ || (unOptions.PeriodForShow == 3
+ && stNow.wMonth == 1
+ && stNow.wDay == 1
+ && stNow.wHour == 0
+ && stNow.wMinute == 0
+ && stNow.wSecond == 0) )
+ OverallInfo.Total.TimeAtStart = CurrentTimeMs;
+
+ if (online_count > 0)
+ {
+ OverallInfo.Session.Timer =
+ (CurrentTimeMs - OverallInfo.Session.TimeAtStart) / 1000;
+ OverallInfo.Total.Timer =
+ (CurrentTimeMs - OverallInfo.Total.TimeAtStart) / 1000;
+ }
+
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)Traffic_FrameID, FU_FMREDRAW);
+ }
+ break;
+
+ case TIMER_TOOLTIP:
+ {
+ TCHAR *TooltipText;
+ CLCINFOTIP ti = {0};
+ RECT rt;
+
+ GetCursorPos(&TooltipPosition);
+ if (!TooltipShowing && unOptions.ShowTooltip )
+ {
+ KillTimer(TrafficHwnd, TIMER_TOOLTIP);
+ ScreenToClient(TrafficHwnd, &TooltipPosition);
+ GetClientRect(TrafficHwnd, &rt);
+ if (PtInRect(&rt, TooltipPosition))
+ {
+ GetCursorPos(&ptMouse);
+ ti.rcItem.left = TooltipPosition.x - 10;
+ ti.rcItem.right = TooltipPosition.x + 10;
+ ti.rcItem.top = TooltipPosition.y - 10;
+ ti.rcItem.bottom = TooltipPosition.y + 10;
+ ti.cbSize = sizeof( ti );
+ TooltipText = variables_parsedup(Traffic_TooltipFormat, NULL, NULL);
+#ifdef _UNICODE
+ CallService("mToolTip/ShowTipW", (WPARAM)TooltipText, (LPARAM)&ti);
+#else
+ CallService("mToolTip/ShowTip", (WPARAM)TooltipText, (LPARAM)&ti);
+#endif
+ TooltipShowing = TRUE;
+ free(TooltipText);
+ }
+ }
+ }
+ break;
+ }
+ break;
+
+ default:
+ return DefWindowProc(hwnd,msg,wParam,lParam);
+ }
+ //
+ return DefWindowProc(hwnd,msg,wParam,lParam);
+}
+
+void CreateTrafficWindow(HWND hCluiWnd)
+{
+ WNDCLASSEX wcx = {0};
+ CLISTFrame f;
+
+ wcx.cbSize = sizeof( WNDCLASSEX );
+ wcx.style = 0;
+ wcx.lpfnWndProc = TrafficCounterWndProc_MW;
+ wcx.cbClsExtra = 0;
+ wcx.cbWndExtra = 0;
+ wcx.hInstance = hInst;
+ wcx.hIcon = NULL;
+ wcx.hCursor = LoadCursor(hInst,IDC_ARROW);
+ wcx.hbrBackground = 0;
+ wcx.lpszMenuName = NULL;
+ wcx.lpszClassName = TRAFFIC_COUNTER_WINDOW_CLASS;
+ wcx.hIconSm = NULL;
+ RegisterClassEx( &wcx );
+ TrafficHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, TRAFFIC_COUNTER_WINDOW_CLASS,
+ TRAFFIC_COUNTER_WINDOW_CLASS,
+ WS_CHILDWINDOW | WS_CLIPCHILDREN,
+ 0, 0, 0, 0, hCluiWnd, NULL, hInst, NULL);
+
+ if ( ServiceExists(MS_CLIST_FRAMES_ADDFRAME) )
+ {
+ // Ãîòîâèìñÿ ñîçäàâàòü ôðåéì
+ ZeroMemory( &f, sizeof(CLISTFrame) );
+ f.align = alBottom;
+ f.cbSize = sizeof(CLISTFrame);
+ f.height = TrafficWindowHeight();
+ f.Flags= unOptions.FrameIsVisible | F_LOCKED | F_NOBORDER | F_NO_SUBCONTAINER;
+ f.hWnd = TrafficHwnd;
+ f.TBname = ("Traffic counter");
+ f.name = ("Traffic counter");
+ // Ñîçäà¸ì ôðåéì
+ Traffic_FrameID = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&f,(LPARAM)0);
+ CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)f.hWnd,(LPARAM)TrafficCounter_PaintCallbackProc);
+ }
+
+ // Ñîçäà¸ì òàéìåðû.
+ SetTimer(TrafficHwnd, TIMER_REDRAW, 500, NULL);
+ UpdateNotifyTimer();
+}
+
+int MenuCommand_TrafficShowHide(WPARAM wParam,LPARAM lParam)
+{
+ unOptions.FrameIsVisible = !unOptions.FrameIsVisible;
+ if (Traffic_FrameID == NULL)
+ ShowWindow(TrafficHwnd, unOptions.FrameIsVisible ? SW_SHOW : SW_HIDE);
+ else
+ CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)Traffic_FrameID, 0);
+ DBWriteContactSettingDword(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_WHAT_DRAW, unOptions.Flags);
+ //
+ return 0;
+}
+
+void Traffic_AddMainMenuItem(void)
+{
+ CLISTMENUITEM mi;
+
+ ZeroMemory(&mi,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = -0x7FFFFFFF;
+ mi.flags = 0;
+ mi.hIcon = NULL;
+ mi.pszName = Translate("Toggle traffic counter");
+ mi.pszService="TrafficCounter/ShowHide";
+
+ hTrafficMainMenuItem = Menu_AddMainMenuItem(&mi);
+}
+
+/*-------------------------------------------------------------------------------------------------------------------*/
+void UpdateNotifyTimer(void)
+{
+ if (!ServiceExists(MS_POPUP_ADDPOPUP)) return;
+
+ if (Traffic_Notify_time_value && unOptions.NotifyByTime)
+ SetTimer(TrafficHwnd, TIMER_NOTIFY_TICK, Traffic_Notify_time_value * 1000 * 60, NULL);
+ else
+ KillTimer(TrafficHwnd, TIMER_NOTIFY_TICK);
+}
+
+void NotifyOnSend(void)
+{
+ POPUPDATAT ppd;
+
+ ZeroMemory(&ppd, sizeof(ppd));
+ ppd.lchContact = NULL;
+ ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
+ _tcscpy(ppd.lptzContactName, TranslateT("Traffic counter notification"));
+ //
+ _stprintf(ppd.lptzText, TranslateT("%d kilobytes sent"),
+ notify_send_size = OverallInfo.CurrentSentTraffic >> 10);
+ //
+ ppd.colorBack = Traffic_PopupBkColor;
+ ppd.colorText = Traffic_PopupFontColor;
+ ppd.PluginWindowProc = NULL;
+ if (Traffic_PopupTimeoutDefault) ppd.iSeconds = 0;
+ else ppd.iSeconds = Traffic_PopupTimeoutValue;
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
+}
+
+void NotifyOnRecv(void)
+{
+ POPUPDATAT ppd;
+
+ ZeroMemory(&ppd, sizeof(ppd));
+ ppd.lchContact = NULL;
+ ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
+ _tcscpy(ppd.lptzContactName, TranslateT("Traffic counter notification"));
+ //
+ _stprintf(ppd.lptzText,TranslateT("%d kilobytes received"),
+ notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10);
+ //
+ ppd.colorBack = Traffic_PopupBkColor;
+ ppd.colorText = Traffic_PopupFontColor;
+ ppd.PluginWindowProc = NULL;
+ if (Traffic_PopupTimeoutDefault) ppd.iSeconds = 0;
+ else ppd.iSeconds = Traffic_PopupTimeoutValue;
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
+}
+
+void CreateProtocolList(void)
+{
+ int i;
+ PROTOACCOUNT **acc;
+ //
+ CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)(int*)&NumberOfAccounts, (LPARAM)(PROTOACCOUNT***)&acc);
+ //
+ ProtoList = (PROTOLIST*)mir_alloc(sizeof(PROTOLIST)*(NumberOfAccounts));
+ //
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ ProtoList[i].name = (char*)mir_alloc(strlen(acc[i]->szModuleName) + 1);
+ strcpy(ProtoList[i].name, acc[i]->szModuleName);
+ ProtoList[i].tszAccountName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (1 + _tcslen(acc[i]->tszAccountName)));
+ _tcscpy(ProtoList[i].tszAccountName, acc[i]->tszAccountName);
+ //
+ ProtoList[i].Flags = DBGetContactSettingByte(NULL, ProtoList[i].name, SETTINGS_PROTO_FLAGS, 3);
+ ProtoList[i].CurrentRecvTraffic =
+ ProtoList[i].CurrentSentTraffic =
+ ProtoList[i].Session.Timer = 0;
+ //
+ ProtoList[i].Enabled = acc[i]->bIsEnabled;
+ ProtoList[i].State = 0;
+
+ Stat_ReadFile(i);
+ ProtoList[i].StartIndex = ProtoList[i].NumberOfRecords - 1;
+ ProtoList[i].StartIncoming = ProtoList[i].AllStatistics[ProtoList[i].StartIndex].Incoming;
+ ProtoList[i].StartOutgoing = ProtoList[i].AllStatistics[ProtoList[i].StartIndex].Outgoing;
+ } // öèêë ïî àêêàóíòàì
+ // Íà÷àëüíûå çíà÷åíèÿ äëÿ ñóììàðíîé èíôîðìàöèè.
+ OverallInfo.Session.Timer = OverallInfo.Total.Timer = 0;
+}
+
+void DestroyProtocolList(void)
+{
+ int i;
+ //
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ Stat_CheckStatistics(i);
+ CloseHandle(ProtoList[i].hFile);
+ mir_free(ProtoList[i].name);
+ mir_free(ProtoList[i].AllStatistics);
+ }
+ //
+ mir_free(ProtoList);
+}
+
+int ProtocolAckHook(WPARAM wParam,LPARAM lParam)
+{
+ ACKDATA* pAck=(ACKDATA*)lParam;
+ WORD i;
+
+ if (ACKTYPE_STATUS == pAck->type)
+ {
+ if(ID_STATUS_OFFLINE == pAck->lParam)
+ {
+ for (i = 0; i < NumberOfAccounts; i++)
+ {
+ if (!ProtoList[i].name) continue;
+ if (!strcmp(ProtoList[i].name, pAck->szModule))
+ {
+ ProtocolIsOffLine(i);
+ break;
+ }
+ }
+ }
+ else
+ {
+ if ((pAck->lParam >= ID_STATUS_ONLINE) && (pAck->lParam <= ID_STATUS_OUTTOLUNCH))
+ {
+ for (i = 0; i < NumberOfAccounts; i++)
+ if (!strcmp(ProtoList[i].name, pAck->szModule))
+ {
+ ProtocolIsOnLine(i);
+ break;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+int UpdateFonts(WPARAM wParam, LPARAM lParam)
+{
+ LOGFONT logfont;
+ //if no font service
+ if (!ServiceExists(MS_FONT_GETT)) return 0;
+ //update traffic font
+ if (Traffic_h_font) DeleteObject(Traffic_h_font);
+ Traffic_FontColor = CallService(MS_FONT_GETT, (WPARAM)&TrafficFontID, (LPARAM)&logfont);
+ Traffic_h_font = CreateFontIndirect(&logfont);
+ //
+ TrafficFontHeight = abs(logfont.lfHeight) + 1;
+ Traffic_BkColor = CallService(MS_COLOUR_GETT, (WPARAM)&TrafficBackgroundColorID, 0);
+
+ // Êëþ÷åâîé öâåò
+ UseKeyColor = DBGetContactSettingByte(NULL, "ModernSettings", "UseKeyColor", 1);
+ KeyColor = DBGetContactSettingDword(NULL, "ModernSettings", "KeyColor", 0);
+
+ UpdateTrafficWindowSize();
+ return 0;
+}
+
+void UpdateTrafficWindowSize(void)
+{
+ if (Traffic_FrameID != NULL)
+ {
+ CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, Traffic_FrameID), TrafficWindowHeight());
+ }
+}
+
+unsigned short int TrafficWindowHeight(void)
+{
+ BYTE HeightLineTime = (unOptions.DrawProtoIcon) ? 16 : TrafficFontHeight,
+ i, ActProto;
+ WORD MaxWndHeight;
+
+ for (i = 0, ActProto = unOptions.ShowOverall + unOptions.ShowSummary; i < NumberOfAccounts; i++)
+ ActProto += ProtoList[i].Visible && ProtoList[i].Enabled;
+
+ // Âûñîòà ñòðîêè ìèíèìóì 16 ïèêñåëåé (äëÿ èêîíêè).
+ Traffic_LineHeight = TrafficFontHeight > 16 ? TrafficFontHeight: 16;
+
+ // Âûñîòà ôðåéìà ðàâíà êîëè÷åñòâó ñòðîê.
+ MaxWndHeight = ActProto * Traffic_LineHeight
+ + Traffic_AdditionSpace * (ActProto - 1)
+ + 4;
+
+ return (MaxWndHeight < TrafficFontHeight) ? 0 : MaxWndHeight;
+}
+
+// Ôóíêöèÿ âíîñèò èçìåíåíèÿ â ProtoList ïðè êîììóòàöèè àêêàóíòîâ
+int OnAccountsListChange(WPARAM wParam, LPARAM lParam)
+{
+ BYTE i;
+ PROTOACCOUNT *acc = (PROTOACCOUNT*)lParam;
+
+ switch (wParam)
+ {
+ case PRAC_ADDED:
+ case PRAC_REMOVED:
+ DestroyProtocolList();
+ CreateProtocolList();
+ break;
+ case PRAC_CHANGED:
+ case PRAC_CHECKED:
+ for (i = 0; i < NumberOfAccounts; i++)
+ if (!strcmp(acc->szModuleName, ProtoList[i].name))
+ ProtoList[i].Enabled = acc->bIsEnabled;
+ break;
+ }
+ UpdateTrafficWindowSize();
+ return 0;
+}
diff --git a/plugins/TrafficCounter/TrafficCounter.h b/plugins/TrafficCounter/TrafficCounter.h
new file mode 100644
index 0000000000..2ce9267e84
--- /dev/null
+++ b/plugins/TrafficCounter/TrafficCounter.h
@@ -0,0 +1,85 @@
+/*
+Traffic Counter plugin for Miranda IM
+Copyright 2007-2011 Mironych.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _TrafficCounter_H
+#define _TrafficCounter_H
+
+int TrafficRecv(WPARAM wParam,LPARAM lParam);
+int TrafficSend(WPARAM wParam,LPARAM lParam);
+
+//---------------------------------------------------------------------------------------------
+// Èìåíà ïàðàìåòðîâ ñ íàñòðîéêàìè â áàçå
+//---------------------------------------------------------------------------------------------
+#define TRAFFIC_SETTINGS_GROUP "TrafficCounter"
+
+#define SETTINGS_COUNTER_FORMAT "CounterFormat"
+#define SETTINGS_TOOLTIP_FORMAT "TooltipFormat"
+#define SETTINGS_STAT_ACC_OPT "Stat_SelAcc"
+#define SETTINGS_ADDITION_SPACE "traffic_addition_space"
+//
+//notify
+#define SETTINGS_POPUP_BKCOLOR "popup_bkcolor"
+#define SETTINGS_POPUP_FONTCOLOR "popup_font_color"
+#define SETTINGS_POPUP_NOTIFY_SIZE_VALUE "popup_size_value"
+#define SETTINGS_POPUP_NOTIFY_TIME_VALUE "popup_time_value"
+#define SETTINGS_POPUP_TIMEOUT_DEFAULT "popup_timeout_default"
+#define SETTINGS_POPUP_TIMEOUT_VALUE "popup_timeout_value"
+//timer notify
+#define TIMER_SAVE_TICK (3001 + 1)
+#define TIMER_NOTIFY_TICK (3001 + 2)
+//popup menu
+#define POPUPMENU_HIDE (3001 + 4)
+#define POPUPMENU_ONTOP (3001 + 5)
+#define POPUPMENU_CLEAR_NOW (3001 + 8)
+//time counter
+#define TIMER_REDRAW 3300
+#define TIMER_TOOLTIP 3301
+#define SETTINGS_TOTAL_ONLINE_TIME "TotalOnlineTime"
+// Ðàçíûå ôëàæêè
+#define SETTINGS_WHAT_DRAW "WhatDraw"
+
+// Íàñòðîéêè äëÿ ïðîòîêîëîâ - ñîõðàíÿþòñÿ â âåòêå ïðîòîêîëà
+#define SETTINGS_PROTO_FLAGS "tc_Flags"
+
+/*====== ÔÓÍÊÖÈÈ ÌÎÄÓËß =====*/
+int TrafficCounterOptInitialise(WPARAM wParam,LPARAM lParam);
+int TrafficCounterModulesLoaded(WPARAM wParam,LPARAM lParam);
+int TrafficCounterShutdown(WPARAM wParam,LPARAM lParam);
+void SaveSettings(BYTE);
+void CreateTrafficWindow(HWND);
+//popup
+void UpdateNotifyTimer(void);
+void NotifyOnSend(void);
+void NotifyOnRecv(void);
+//time counter
+int ProtocolAckHook(WPARAM wParam,LPARAM lParam);
+void CreateProtocolList(void);
+void DestroyProtocolList(void);
+int OnAccountsListChange(WPARAM wParam, LPARAM lParam);
+//font service suppot
+int UpdateFonts(WPARAM wParam, LPARAM lParam);
+void UpdateTrafficWindowSize(void);
+unsigned short int TrafficWindowHeight(void);
+// Ðèñîâàíèå
+int TrafficCounter_Draw(HWND, HDC);
+int PaintTrafficCounterWindow(HWND, HDC);
+// Âñïîìîãàòåëüíûå ôóíêöèè
+int MenuCommand_TrafficShowHide(WPARAM, LPARAM);
+
+#endif;
diff --git a/plugins/TrafficCounter/TrafficCounter_10.vcxproj b/plugins/TrafficCounter/TrafficCounter_10.vcxproj
new file mode 100644
index 0000000000..fbbab8aa4d
--- /dev/null
+++ b/plugins/TrafficCounter/TrafficCounter_10.vcxproj
@@ -0,0 +1,675 @@
+<?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 Unicode|Win32">
+ <Configuration>Debug Unicode</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug Unicode|Win32">
+ <Configuration>Debug Unicode</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug Unicode|x64">
+ <Configuration>Debug Unicode</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug Unicode|x64">
+ <Configuration>Debug Unicode</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode Static|Win32">
+ <Configuration>Release Unicode Static</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode Static|x64">
+ <Configuration>Release Unicode Static</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode|Win32">
+ <Configuration>Release Unicode</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode|Win32">
+ <Configuration>Release Unicode</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode|x64">
+ <Configuration>Release Unicode</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode|x64">
+ <Configuration>Release Unicode</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>TrafficCounter</ProjectName>
+ <ProjectGUID>{885010EA-D008-4E38-85D4-487693F0BA00}</ProjectGUID>
+ <RootNamespace>TrafficCounter</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <CLRSupport>false</CLRSupport>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|X64'">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release Unicode|X64'">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|X64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets">
+ <Import Project="$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</IgnoreImportLibrary>
+ <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</EmbedManifest>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">true</IgnoreImportLibrary>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(SolutionDir)$(Configuration)64/Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|X64'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(SolutionDir)$(Configuration)64/Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|X64'">$(SolutionDir)$(Configuration)64/Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|X64'">$(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|X64'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|X64'">$(SolutionDir)$(Configuration)64/Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|X64'">$(SolutionDir)$(Configuration)64/Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|X64'">$(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|X64'">$(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode|X64'">true</IgnoreImportLibrary>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|X64'">true</IgnoreImportLibrary>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">..\..\..\..\VC\atlmfc\include;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'">..\..\..\..\VC\atlmfc\include;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">..\..\..\..\VC\atlmfc\include;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\VC\atlmfc\include;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\VC\atlmfc\include;$(IncludePath)</IncludePath>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</GenerateManifest>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <GenerateManifest>false</GenerateManifest>
+ <ManifestFile>
+ </ManifestFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <GenerateManifest>false</GenerateManifest>
+ <ManifestFile>
+ </ManifestFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>
+ </BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <BrowseInformation>true</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateManifest>false</GenerateManifest>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AssemblyDebug>true</AssemblyDebug>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ManifestFile>$(IntDir)$(TargetName)$(TargetExt).intermediate.manifest</ManifestFile>
+ </Link>
+ <Manifest>
+ <OutputManifestFile>
+ </OutputManifestFile>
+ </Manifest>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateManifest>false</GenerateManifest>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ManifestFile>$(IntDir)$(TargetName)$(TargetExt).intermediate.manifest</ManifestFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateManifest>false</GenerateManifest>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ManifestFile>$(IntDir)$(TargetName)$(TargetExt).intermediate.manifest</ManifestFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\Release/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\Debug/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|X64'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\Debug/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|X64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\Release/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|X64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\Release/TrafficCounter.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TRAFFICCOUNTER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="misc.c">
+ <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">All</AssemblerOutput>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">Default</CompileAs>
+ </ClCompile>
+ <ClCompile Include="opttree.c">
+ <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">All</AssemblerOutput>
+ </ClCompile>
+ <ClCompile Include="statistics.c">
+ <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">All</AssemblerOutput>
+ </ClCompile>
+ <ClCompile Include="TrafficCounter.c">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">Create</PrecompiledHeader>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|Win32'">Create</PrecompiledHeader>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|X64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|X64'">Create</PrecompiledHeader>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">Create</PrecompiledHeader>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|X64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|X64'">Create</PrecompiledHeader>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|X64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|X64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|X64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode Static|X64'">Create</PrecompiledHeader>
+ <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">All</AssemblerOutput>
+ </ClCompile>
+ <ClCompile Include="vars.c">
+ <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">All</AssemblerOutput>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\network.ico" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="resource.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="commonheaders.h" />
+ <ClInclude Include="misc.h" />
+ <ClInclude Include="opttree.h" />
+ <ClInclude Include="resource.h" />
+ <ClInclude Include="statistics.h" />
+ <ClInclude Include="TrafficCounter.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/plugins/TrafficCounter/TrafficCounter_10.vcxproj.filters b/plugins/TrafficCounter/TrafficCounter_10.vcxproj.filters
new file mode 100644
index 0000000000..8cb96f67ad
--- /dev/null
+++ b/plugins/TrafficCounter/TrafficCounter_10.vcxproj.filters
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{7248dd69-8a94-4e9f-81c4-1883723a61f6}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{7a03a86b-8068-47d0-bc10-07e824854944}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{379f9a87-c54b-4f64-ae10-cddbc3c96dbf}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="opttree.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="statistics.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="TrafficCounter.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="vars.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="misc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\network.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="commonheaders.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="misc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="opttree.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="statistics.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="TrafficCounter.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/plugins/TrafficCounter/commonheaders.c b/plugins/TrafficCounter/commonheaders.c
new file mode 100644
index 0000000000..c9fe1b2686
--- /dev/null
+++ b/plugins/TrafficCounter/commonheaders.c
@@ -0,0 +1 @@
+#include "commonheaders.h" \ No newline at end of file
diff --git a/plugins/TrafficCounter/commonheaders.h b/plugins/TrafficCounter/commonheaders.h
new file mode 100644
index 0000000000..8939a53249
--- /dev/null
+++ b/plugins/TrafficCounter/commonheaders.h
@@ -0,0 +1,160 @@
+#ifndef commonheaders_h__
+#define commonheaders_h__
+
+/*
+Traffic Counter plugin for Miranda IM
+Copyright 2007-2011 Mironych.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#define MIRANDA_VER 0x0900
+#define MIRANDA_CUSTOM_LP
+#define _USE_32BIT_TIME_T 1
+
+// Standart includes
+#include <windows.h>
+#include <windowsx.h>
+#include <commctrl.h>
+#include <time.h>
+#include <tchar.h>
+
+#include <win2k.h>
+
+#include "resource.h"
+
+// Miranda SDK includes
+#include <newpluginapi.h>
+#include <m_system.h>
+#include <m_netlib.h>
+#include <m_langpack.h>
+#include <m_clist.h>
+//#include <m_clistint.h>
+#include <m_clui.h>
+#include <m_clc.h>
+#include <m_options.h>
+#include <m_protocols.h>
+#include <m_protosvc.h>
+#include <m_cluiframes.h>
+#include <m_database.h>
+#include <m_fontservice.h>
+#include <m_popup.h>
+#include <m_skin.h>
+#include <m_hotkeys.h>
+#include <m_variables.h>
+
+#pragma pack(push)
+#pragma pack(1)
+typedef struct
+{
+ BYTE Hour, Day, Month;
+ WORD Year;
+ DWORD Incoming, Outgoing;
+ WORD Time;
+} HOURLYSTATS;
+#pragma pack(pop)
+
+typedef struct tagTimer
+{
+ DWORD TimeAtStart; // Âðåìÿ â ìîìåíò çàïóñêà òàéìåðà - â ìèëëèñåêóíäàõ.
+ DWORD Timer; // Êîëè÷åñòâî ñåêóíä ñî âðåìåíè çàïóñêà òàéìåðà.
+} TIMER;
+
+typedef struct
+{
+ char *name; // Èìÿ àêêàóíòà.
+
+ TIMER Session; // Òàéìåð òåêóùåé ñåññèè (ïðîòîêîë â îíëàéíå).
+ TIMER Total; // Òàéìåð îáùèé.
+
+ DWORD TotalRecvTraffic, // Îáùèé òðàôèê ïðîòîêîëà (çà âûáðàííûé ïåðèîä)
+ TotalSentTraffic,
+ CurrentRecvTraffic, // Òåêóùèé òðàôèê ïðîòîêîëà (çà ñåññèþ)
+ CurrentSentTraffic;
+ union
+ {
+ BYTE Flags;
+ struct
+ {
+ unsigned int Reserv0:1; // Àêòèâíîñòü ïîòåðÿëà ñìûñë - ñòàòèñòèêà âåä¸òñÿ ïî âñåì àêêàóíòàì.
+ unsigned int Visible:1; // = 1 - àêêàóíò áóäåò ïîêàçûâàòüñÿ âî ôðåéìå ñ÷¸ò÷èêîâ
+ unsigned int Enabled:1; // = 1 - àêêàóíò âêëþ÷åí è íå ïðÿ÷åòñÿ
+ unsigned int State:1; // = 1 - àêêàóíò ñåé÷àñ îíëàéí
+ unsigned int Reserv1:3;
+ };
+ };
+
+ // Äîáàâëåíî â âåðñèè 0.1.1.0.
+ DWORD NumberOfRecords; // Êîëè÷åñòâî ÷àñîâ â îáùåé ñòàòèñòèêå.
+ HOURLYSTATS *AllStatistics; // Ïîëíàÿ ñòàòèñòèêà âìåñòå ñî ñòàòèñòèêîé îíëàéíà.
+ HANDLE hFile; // Ôàéë ñ ñîõðàí¸ííîé ñòàòèñòèêîé äàííîãî ïðîòîêîëà.
+
+ DWORD StartIndex; // Íîìåð çàïèñè â ñòàòèñòèêå, áûâøèé àêòóàëüíûì íà ìîìåíò çàïóñêà.
+ DWORD StartIncoming; // Çíà÷åíèå âõîäÿùåãî òðàôèêà íà ìîìåíò çàïóñêà.
+ DWORD StartOutgoing; // Çíà÷åíèå èñõîäÿùåãî òðàôèêà íà ìîìåíò çàïóñêà.
+
+ // 0.1.1.5.
+ DWORD Shift; // Íîìåð çàïèñè â ñòàòèñòèêå ñòàðåéøåãî âûáðàííîãî àêêàóíòà,
+ // äàòà êîòîðîé ñîîòâåòñòâóåò íà÷àëó ñòàòèñòèêè äàííîãî àêêàóíòà.
+
+ // 0.1.1.6
+ TCHAR *tszAccountName; // ×åëîâå÷åñêîå èìÿ àêêàóíòà äëÿ èñïîëüçîâàíèÿ â ãðàôè÷åñêîì èíòåðôåéñå.
+} PROTOLIST;
+
+//---------------------------------------------------------------------------------------------
+// Ðàçëè÷íûå ôëàãè
+//---------------------------------------------------------------------------------------------
+union
+{
+ DWORD Flags;
+ struct
+ {
+ unsigned int NotifyBySize:1; //0
+ unsigned int DrawCurrentTraffic:1; //1
+ unsigned int DrawTotalTraffic:1; //2
+ unsigned int DrawCurrentTimeCounter:1; //3
+ unsigned int DrawProtoIcon:1; //4
+ unsigned int Reserv0:1; //5
+ unsigned int DrawProtoName:1; //6
+ unsigned int DrawFrmAsSkin:1; //7
+ unsigned int ShowSummary:1; //8
+ unsigned int ShowTooltip:1; //9
+ unsigned int ShowMainMenuItem:1; //10
+ unsigned int ShowOverall:1; //11
+ unsigned int Stat_Units:2; //12,13
+ unsigned int Stat_Tab:3; //14,15,16
+ unsigned int NotifyByTime:1; //17
+ unsigned int Reserv2:1; //18
+ unsigned int PeriodForShow:2; //19,20
+ unsigned int FrameIsVisible:1; //21
+ unsigned int Reserv1:1; //22
+ unsigned int DrawTotalTimeCounter:1; //23
+ };
+} unOptions;
+
+PROTOLIST *ProtoList; // Äàííûå îáî âñåõ àêêàóíòàõ.
+PROTOLIST OverallInfo; // Ñóììàðíûå äàííûå ïî âèäèìûì àêêàóíòàì.
+BYTE NumberOfAccounts;
+WORD Stat_SelAcc; // Âûáðàííûå àêêàóíòû â îêíå ñòàòèñòèêè
+HWND TrafficHwnd;
+DWORD mirandaVer;
+
+#include "misc.h"
+#include "opttree.h"
+#include "vars.h"
+#include "statistics.h"
+#include "TrafficCounter.h"
+
+#endif
diff --git a/plugins/TrafficCounter/misc.c b/plugins/TrafficCounter/misc.c
new file mode 100644
index 0000000000..6320117246
--- /dev/null
+++ b/plugins/TrafficCounter/misc.c
@@ -0,0 +1,303 @@
+/*
+Traffic Counter plugin for Miranda IM
+Copyright 2007-2011 Mironych.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+
+/* Ôóíêöèÿ ðàçáèðàåò ñòðîêó è âîçâðàùàåò ñïèñîê òåãîâ è ñîîòâåòñòâóþùèõ èì ñòðîê.
+Àðãóìåíòû:
+InputString - ñòðîêà äëÿ ðàçáîðà;
+RowItemsList - ñïèñîê íàéäåííûõ ýëåìåíòîâ.
+Âîçâðàùàåìîå çíà÷åíèå - êîëè÷åñòâî ýëåìåíòîâ â ñïèñêàõ. */
+WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList)
+{
+ TCHAR *begin, *end;
+ WORD c = 0;
+
+ // Èùåì ñëåâà îòêðûâàþùóþ ñêîáêó.
+ begin = _tcschr(InputString, '{');
+ // Åñëè ñêîáêà íàéäåíà...
+ if (begin)
+ {
+ // Âûäåëÿåì ïàìÿòü ïîä óêàçàòåëè
+ *RowItemsList = (RowItemInfo*)mir_alloc(sizeof(RowItemInfo));
+ }
+ else return 0;
+
+ do
+ {
+ // Ñðàçó âñëåä çà íåé èùåì çàêðûâàþùóþ.
+ end = _tcschr(begin, '}');
+
+ // Âûäåëÿåì ïàìÿòü ïîä óêàçàòåëè
+ *RowItemsList = (RowItemInfo*)mir_realloc(*RowItemsList, sizeof(RowItemInfo) * (c + 1));
+
+ // Ðàçáèðàåì òåã.
+ _stscanf(begin + 1, _T("%c%d"),
+ &((*RowItemsList)[c].Alignment),
+ &((*RowItemsList)[c].Interval));
+
+ // Èùåì äàëåå îòêðûâàþùóþ ñêîáêó - ýòî êîíåö ñòðîêè, ñîîòâåòñòâóþùåé òåãó.
+ begin = _tcschr(end, '{');
+
+ if (begin)
+ {
+ // Âûäåëÿåì ïàìÿòü ïîä ñòðîêó.
+ (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * (begin - end));
+ // Êîïèðóåì ñòðîêó.
+ _tcsncpy((*RowItemsList)[c].String, end + 1, begin - end - 1);
+ (*RowItemsList)[c].String[begin - end - 1] = 0;
+ }
+ else
+ {
+ // Âûäåëÿåì ïàìÿòü ïîä ñòðîêó.
+ (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * _tcslen(end));
+ // Êîïèðóåì ñòðîêó.
+ _tcsncpy((*RowItemsList)[c].String, end + 1, _tcslen(end));
+ }
+
+ c++;
+ } while (begin);
+
+ return c;
+}
+
+/* Ôóíêöèÿ âîçâðàùàåò êîëè÷åñòâî äíåé â óêàçàííîì ìåñÿöå óêàçàííîãî ãîäà. */
+BYTE DaysInMonth(BYTE Month, WORD Year)
+{
+ switch (Month)
+ {
+ case 1:
+ case 3:
+ case 5:
+ case 7:
+ case 8:
+ case 10:
+ case 12: return 31;
+ case 4:
+ case 6:
+ case 9:
+ case 11: return 30;
+ case 2: return 28 + (BYTE)!((Year % 4) && ( (Year % 100) || !(Year % 400) ));
+ }
+ return 0;
+}
+
+// Ôóíêöèÿ îïðåäåëÿåò äåíü íåäåëè ïî äàòå
+// 7 - ÂÑ, 1 - ÏÍ è ò. ä.
+BYTE DayOfWeek(BYTE Day, BYTE Month, WORD Year)
+{
+ WORD a, y, m;
+
+ a = (14 - Month) / 12;
+ y = Year - a;
+ m = Month + 12 * a - 2;
+
+ a = (7000 + (Day + y + (y >> 2) - y / 100 + y / 400 + (31 * m) / 12)) % 7;
+ if (!a) a = 7;
+
+ return a;
+}
+
+/*
+Àðãóìåíòû:
+ Value - êîëè÷åñòâî áàéò;
+ Unit - åäèíèöû èçìåðåíèÿ (0 - áàéòû, 1 - êèëîáàéòû, 2 - ìåãàáàéòû, 3 - àâòîìàòè÷åñêè);
+ Buffer - àäðåñ ñòðîêè äëÿ çàïèñè ðåçóëüòàòà;
+ Size - ðàçìåð áóôåðà.
+Âîçâðàùàåìîå çíà÷åíèå: òðåáóåìûé ðàçìåð áóôåðà.
+*/
+WORD GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, WORD Size)
+{
+ TCHAR Str1[32], szUnit[4] = {' ', 0};
+ DWORD Divider;
+ NUMBERFMT nf = {0, 1, 3, _T(","), _T(" "), 0};
+ TCHAR *Res; // Ïðîìåæóòî÷íûé ðåçóëüòàò.
+ WORD l;
+
+ switch (Unit)
+ {
+ case 0: //bytes
+ Divider = 1;
+ nf.NumDigits = 0;
+ szUnit[0] = 0;
+ break;
+ case 1: // KB
+ Divider = 0x400;
+ nf.NumDigits = 2;
+ break;
+ case 2: // MB
+ Divider = 0x100000;
+ nf.NumDigits = 2;
+ break;
+ case 3: // Adaptive
+ nf.NumDigits = 2;
+ if (Value < 0x100000) { Divider = 0x400; szUnit[1] = 'K'; szUnit[2] = 'B'; }
+ else { Divider = 0x100000; szUnit[1] = 'M'; szUnit[2] = 'B'; }
+ break;
+ }
+
+ mir_sntprintf(Str1, 32, _T("%d.%d"), Value / Divider, Value % Divider);
+ l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0);
+ if (!l) return 0;
+ l += _tcslen(szUnit) + 1;
+ Res = (TCHAR*)malloc(l * sizeof(TCHAR));
+ if (!Res) return 0;
+ GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, Res, l);
+ _tcscat(Res, szUnit);
+
+ if (Size && Buffer)
+ {
+ _tcscpy(Buffer, Res);
+ l = _tcslen(Buffer);
+ }
+ else
+ {
+ l = _tcslen(Res) + 1;
+ }
+
+ free(Res);
+ return l;
+}
+
+/* Ïðåîáðàçîâàíèå èíòåðâàëà âðåìåíè â åãî ñòðîêîâîå ïðåäñòàâëåíèå
+Àðãóìåíòû:
+Duration: èíòåðâàë âðåìåíè â ñåêóíäàõ;
+Format: ñòðîêà ôîðìàòà;
+Buffer: àäðåñ áóôåðà, êóäà ôóíêöèÿ ïîìåùàåò ðåçóëüòàò.
+Size - ðàçìåð áóôåðà. */
+WORD GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Size)
+{
+ DWORD q;
+ WORD TokenIndex, FormatIndex, Length;
+ TCHAR Token[256], // Àêêóìóëÿòîð.
+ *Res; // Ïðîìåæóòî÷íûé ðåçóëüòàò.
+
+ Res = (TCHAR*)malloc(sizeof(TCHAR)); // Âûäåëÿåì ÷óòü-÷óòü ïàìÿòè ïîä ðåçóëüòàò, íî ýòî òîëüêî íà÷àëî.
+ SecureZeroMemory(Res, sizeof(TCHAR));
+
+ for (FormatIndex = 0; Format[FormatIndex];)
+ {
+ // Èùåì òîêåíû. Ñ÷èòàåòñÿ, ÷òî òîêåí - òîëüêî áóêâû.
+ TokenIndex = 0;
+ q = _istalpha(Format[FormatIndex]);
+ // Êîïèðóåì ñèìâîëû â àêêóìóëÿòîð äî ñìåíû ôëàãà.
+ do
+ {
+ Token[TokenIndex++] = Format[FormatIndex++];
+ } while (q == _istalpha(Format[FormatIndex]));
+ Token[TokenIndex] = 0;
+
+ // ×òî ïîëó÷èëè â àêêóìóëÿòîðå?
+ if (!_tcscmp(Token, _T("d")))
+ {
+ q = Duration / (60 * 60 * 24);
+ mir_sntprintf(Token, 256, _T("%d"), q);
+ Duration -= q * 60 * 60 * 24;
+ }
+ else
+ if (!_tcscmp(Token, _T("h")))
+ {
+ q = Duration / (60 * 60);
+ mir_sntprintf(Token, 256, _T("%d"), q);
+ Duration -= q * 60 * 60;
+ }
+ else
+ if (!_tcscmp(Token, _T("hh")))
+ {
+ q = Duration / (60 * 60);
+ mir_sntprintf(Token, 256, _T("%02d"), q);
+ Duration -= q * 60 * 60;
+ }
+ else
+ if (!_tcscmp(Token, _T("m")))
+ {
+ q = Duration / 60;
+ mir_sntprintf(Token, 256, _T("%d"), q);
+ Duration -= q * 60;
+ }
+ else
+ if (!_tcscmp(Token, _T("mm")))
+ {
+ q = Duration / 60;
+ mir_sntprintf(Token, 256, _T("%02d"), q);
+ Duration -= q * 60;
+ }
+ else
+ if (!_tcscmp(Token, _T("s")))
+ {
+ q = Duration;
+ mir_sntprintf(Token, 256, _T("%d"), q);
+ Duration -= q;
+ }
+ else
+ if (!_tcscmp(Token, _T("ss")))
+ {
+ q = Duration;
+ mir_sntprintf(Token, 256, _T("%02d"), q);
+ Duration -= q;
+ }
+
+ // Äîáàâèì ïàìÿòè, åñëè íóæíî.
+ Length = _tcslen(Res) + _tcslen(Token) + 1;
+ Res = (TCHAR*)realloc(Res, Length * sizeof(TCHAR));
+ _tcscat(Res, Token);
+ }
+
+ if (Size && Buffer)
+ {
+ _tcsncpy(Buffer, Res, Size);
+ Length = _tcslen(Buffer);
+ }
+ else
+ {
+ Length = _tcslen(Res) + 1;
+ }
+
+ free(Res);
+ return Length;
+}
+
+/* Ðåçóëüòàò:
+-1 - st1 < st2
+ 0 - st1 = st2
++1 - st1 > st2
+*/
+signed short int TimeCompare(SYSTEMTIME st1, SYSTEMTIME st2)
+{
+ signed short int a, b, c, d;
+
+ a = st1.wYear - st2.wYear;
+ b = st1.wMonth - st2.wMonth;
+ c = st1.wDay - st2.wDay;
+ d = st1.wHour - st2.wHour;
+
+ if (a < 0) return -1;
+ if (a > 0) return +1;
+
+ if (b < 0) return -1;
+ if (b > 0) return +1;
+
+ if (c < 0) return -1;
+ if (c > 0) return +1;
+
+ if (d < 0) return -1;
+ if (d > 0) return +1;
+
+ return 0;
+}
diff --git a/plugins/TrafficCounter/misc.h b/plugins/TrafficCounter/misc.h
new file mode 100644
index 0000000000..e8ac6c10ea
--- /dev/null
+++ b/plugins/TrafficCounter/misc.h
@@ -0,0 +1,32 @@
+typedef struct
+{
+ TCHAR Alignment; // Âûðàâíèâàíèå. L - ê ëåâîé ãðàíèöå, R - ê ïðàâîé.
+ WORD Interval; // Ðàññòîÿíèå, íà êîòîðîå ãðàíèöà ñòðîêè îòñòîèò îò ëåâîãî êðàÿ ôðåéìà.
+ TCHAR *String; // Ñîáñòâåííî ñòðîêà.
+} RowItemInfo;
+
+/* Ôóíêöèÿ ðàçáèðàåò ñòðîêó è âîçâðàùàåò ñïèñîê òåãîâ è ñîîòâåòñòâóþùèõ èì ñòðîê.
+Àðãóìåíòû:
+InputString - ñòðîêà äëÿ ðàçáîðà;
+RowItemsList - ñïèñîê íàéäåííûõ ýëåìåíòîâ.
+Âîçâðàùàåìîå çíà÷åíèå - êîëè÷åñòâî ýëåìåíòîâ â ñïèñêàõ. */
+WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList);
+
+/* Ôóíêöèÿ âîçâðàùàåò êîëè÷åñòâî äíåé â óêàçàííîì ìåñÿöå óêàçàííîãî ãîäà. */
+BYTE DaysInMonth(BYTE Month, WORD Year);
+
+// Ôóíêöèÿ îïðåäåëÿåò äåíü íåäåëè ïî äàòå
+// 7 - ÂÑ, 1 - ÏÍ è ò. ä.
+BYTE DayOfWeek(BYTE Day, BYTE Month, WORD Year);
+
+/* Àðãóìåíòû:
+ Value - êîëè÷åñòâî áàéò;
+ Unit - åäèíèöû èçìåðåíèÿ (0 - áàéòû, 1 - êèëîáàéòû, 2 - ìåãàáàéòû, 3 - àâòîìàòè÷åñêè);
+ Buffer - àäðåñ ñòðîêè äëÿ çàïèñè ðåçóëüòàòà;
+ Size - ðàçìåð áóôåðà.
+Âîçâðàùàåìîå çíà÷åíèå: òðåáóåìûé ðàçìåð áóôåðà. */
+WORD GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, WORD Size);
+
+WORD GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Size);
+
+signed short int TimeCompare(SYSTEMTIME st1, SYSTEMTIME st2); \ No newline at end of file
diff --git a/plugins/TrafficCounter/opttree.c b/plugins/TrafficCounter/opttree.c
new file mode 100644
index 0000000000..573a04cc8b
--- /dev/null
+++ b/plugins/TrafficCounter/opttree.c
@@ -0,0 +1,416 @@
+/*
+
+Jabber Protocol Plugin for Miranda IM
+Copyright ( C ) 2002-04 Santithorn Bunchua
+Copyright ( C ) 2005-07 George Hazan
+Copyright ( C ) 2007 Maxim Mluhov
+Copyright ( C ) 2007 Victor Pavlychko
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or ( at your option ) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+File name : $Source: $
+Revision : $Revision: $
+Last change on : $Date: $
+Last change by : $Author: $
+
+*/
+
+#include "commonheaders.h"
+
+HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name);
+HTREEITEM OptTree_AddItem(HWND hwndTree, TCHAR *name, LPARAM lParam, int iconIndex);
+extern OPTTREE_OPTION *pOptions; // Îáúÿâëåíî â ìîäóëå TrafficCounter.c.
+
+static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem)
+{
+ TCHAR buf[128];
+
+ TVITEM tvi = {0};
+ tvi.mask = TVIF_HANDLE|TVIF_TEXT;
+ tvi.hItem = hItem;
+ tvi.pszText = buf;
+ tvi.cchTextMax = SIZEOF(buf);
+ SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
+ // Ïðîâåðèì, íàäî ëè ïåðåâîäèòü.
+ if ((tvi.lParam != -1) && (pOptions[tvi.lParam].dwFlag & OPTTREE_NOTRANSLATE)) return;
+ tvi.pszText = TranslateTS(tvi.pszText);
+ tvi.cchTextMax = lstrlen(tvi.pszText);
+ SendMessage(hwndTree, TVM_SETITEM, 0, (LPARAM)&tvi);
+}
+
+void OptTree_Translate(HWND hwndTree)
+{
+ HTREEITEM hItem = TreeView_GetRoot(hwndTree);
+ while (hItem)
+ {
+ HTREEITEM hItemTmp = 0;
+
+ OptTree_TranslateItem(hwndTree, hItem);
+ if (hItemTmp = TreeView_GetChild(hwndTree, hItem))
+ {
+ hItem = hItemTmp;
+ } else
+ if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem))
+ {
+ hItem = hItemTmp;
+ } else
+ {
+ while (1)
+ {
+ if (!(hItem = TreeView_GetParent(hwndTree, hItem))) break;
+ if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem))
+ {
+ hItem = hItemTmp;
+ break;
+ }
+ }
+ }
+ }
+}
+
+HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name)
+{
+ TVITEM tvi = {0};
+ TCHAR str[MAX_PATH];
+
+ if (hItem)
+ tvi.hItem = TreeView_GetChild(hwndTree, hItem);
+ else
+ tvi.hItem = TreeView_GetRoot(hwndTree);
+
+ if (!name)
+ return tvi.hItem;
+
+ tvi.mask = TVIF_TEXT;
+ tvi.pszText = str;
+ tvi.cchTextMax = MAX_PATH;
+
+ while (tvi.hItem)
+ {
+ TreeView_GetItem(hwndTree, &tvi);
+
+ if (!lstrcmp(tvi.pszText, name))
+ return tvi.hItem;
+
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
+ }
+ return NULL;
+}
+
+HTREEITEM OptTree_AddItem(HWND hwndTree, TCHAR *name, LPARAM lParam, int iconIndex)
+{
+ TCHAR itemName[1024];
+
+ TCHAR* sectionName;
+ int sectionLevel = 0;
+
+ HTREEITEM hSection = NULL, result = NULL;
+ lstrcpy(itemName, name);
+ sectionName = itemName;
+
+ while (sectionName)
+ {
+ // allow multi-level tree
+ TCHAR* pItemName = sectionName;
+ HTREEITEM hItem;
+
+ if (sectionName = _tcschr(sectionName, '/'))
+ {
+ // one level deeper
+ *sectionName = 0;
+ sectionName++;
+ }
+
+ hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName);
+ if (!sectionName || !hItem)
+ {
+ if (!hItem)
+ {
+ TVINSERTSTRUCT tvis = {0};
+
+ tvis.hParent = hSection;
+ tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
+ tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE;
+ tvis.item.pszText = pItemName;
+ tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
+ if (sectionName)
+ {
+ tvis.item.lParam = 0;
+ tvis.item.iImage = tvis.item.iSelectedImage = -1;
+ } else
+ {
+ tvis.item.lParam = lParam;
+ tvis.item.iImage = tvis.item.iSelectedImage = iconIndex;
+ tvis.item.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ }
+ hItem = TreeView_InsertItem(hwndTree, &tvis);
+ if (!sectionName)
+ result = hItem;
+ }
+ }
+ sectionLevel++;
+ hSection = hItem;
+ }
+
+ return result;
+}
+
+BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL *result, int idcTree, OPTTREE_OPTION *options, int optionCount)
+{
+ enum { IMG_GROUP, IMG_CHECK, IMG_NOCHECK, IMG_RCHECK, IMG_NORCHECK, IMG_GRPOPEN, IMG_GRPCLOSED };
+
+ HWND hwndTree = GetDlgItem(hwnd, idcTree);
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ int indx;
+ TCHAR itemName[1024];
+ HIMAGELIST hImgLst;
+
+ TreeView_SelectItem(hwndTree, NULL);
+ TreeView_DeleteAllItems(hwndTree);
+
+ hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR|ILC_COLOR32|ILC_MASK, 5, 1);
+ ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
+ ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_TICK)); // check on
+ ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_NOTICK)); // check off
+ ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_TICK)); // radio on
+ ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_NOTICK)); // radio on
+ ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN));
+ ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT));
+ TreeView_SetImageList(hwndTree, hImgLst, TVSIL_NORMAL);
+
+ /* build options tree. based on code from IcoLib */
+ for (indx = 0; indx < optionCount; indx++)
+ {
+ TCHAR* sectionName;
+ int sectionLevel = 0;
+
+ HTREEITEM hSection = NULL;
+ if (options[indx].szOptionName)
+ lstrcpy(itemName, options[indx].szOptionName);
+ else
+ itemName[0] = 0;
+
+ sectionName = itemName;
+
+ while (sectionName)
+ {
+ // allow multi-level tree
+ TCHAR* pItemName = sectionName;
+ HTREEITEM hItem;
+
+ if (sectionName = _tcschr(sectionName, '/'))
+ {
+ // one level deeper
+ *sectionName = 0;
+ sectionName++;
+ }
+
+ hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName);
+ //if (!sectionName || !hItem)
+ if ((!sectionName || !hItem) && !(options[indx].dwFlag & OPTTREE_INVISIBLE))
+ {
+ if (!hItem)
+ {
+ TVINSERTSTRUCT tvis = {0};
+
+ tvis.hParent = hSection;
+ tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
+ tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvis.item.pszText = pItemName;
+ tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
+ if (sectionName)
+ {
+ tvis.item.lParam = -1;
+ tvis.item.state |= TVIS_BOLD;
+ tvis.item.stateMask |= TVIS_BOLD;
+ tvis.item.iImage = tvis.item.iSelectedImage = IMG_GRPOPEN;
+ } else
+ {
+ tvis.item.lParam = indx;
+ if (options[indx].groupId == OPTTREE_CHECK)
+ {
+ tvis.item.iImage = tvis.item.iSelectedImage = IMG_NOCHECK;
+ } else
+ {
+ tvis.item.iImage = tvis.item.iSelectedImage = IMG_NORCHECK;
+ }
+ }
+ hItem = TreeView_InsertItem(hwndTree, &tvis);
+ if (!sectionName)
+ options[indx].hItem = hItem;
+ }
+ }
+ sectionLevel++;
+ hSection = hItem;
+ }
+ }
+
+ OptTree_Translate(hwndTree);
+ ShowWindow(hwndTree, SW_SHOW);
+ TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, 0, NULL));
+ break;
+ }
+
+ case WM_DESTROY:
+ {
+ ImageList_Destroy(TreeView_GetImageList(hwndTree, TVSIL_NORMAL));
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lparam;
+ if (lpnmhdr->idFrom != idcTree) break;
+ switch (lpnmhdr->code)
+ {
+ case NM_CLICK:
+ {
+ TVHITTESTINFO hti;
+ hti.pt.x=(short)LOWORD(GetMessagePos());
+ hti.pt.y=(short)HIWORD(GetMessagePos());
+ ScreenToClient(lpnmhdr->hwndFrom,&hti.pt);
+ if(TreeView_HitTest(lpnmhdr->hwndFrom,&hti))
+ {
+ if(hti.flags&TVHT_ONITEMICON)
+ {
+ TVITEM tvi;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvi.hItem=hti.hItem;
+ TreeView_GetItem(lpnmhdr->hwndFrom,&tvi);
+ switch (tvi.iImage)
+ {
+ case IMG_GRPOPEN:
+ tvi.iImage = tvi.iSelectedImage = IMG_GRPCLOSED;
+ TreeView_Expand(lpnmhdr->hwndFrom, tvi.hItem, TVE_COLLAPSE);
+ break;
+ case IMG_GRPCLOSED:
+ tvi.iImage = tvi.iSelectedImage = IMG_GRPOPEN;
+ TreeView_Expand(lpnmhdr->hwndFrom, tvi.hItem, TVE_EXPAND);
+ break;
+
+ case IMG_CHECK:
+ tvi.iImage = tvi.iSelectedImage = IMG_NOCHECK;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+ case IMG_NOCHECK:
+ tvi.iImage = tvi.iSelectedImage = IMG_CHECK;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+ case IMG_NORCHECK:
+ {
+ int i;
+ for (i = 0; i < optionCount; ++i)
+ {
+ if (options[i].groupId == options[tvi.lParam].groupId)
+ {
+ TVITEM tvi_tmp;
+ tvi_tmp.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvi_tmp.hItem = options[i].hItem;
+ tvi_tmp.iImage = tvi_tmp.iSelectedImage = IMG_NORCHECK;
+ TreeView_SetItem(lpnmhdr->hwndFrom, &tvi_tmp);
+ }
+ }
+ tvi.iImage = tvi.iSelectedImage = IMG_RCHECK;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+ }
+ }
+ TreeView_SetItem(lpnmhdr->hwndFrom,&tvi);
+ }
+ }
+ break;
+ }
+
+ case TVN_ITEMEXPANDEDW:
+ {
+ LPNMTREEVIEWW lpnmtv = (LPNMTREEVIEWW)lparam;
+ TVITEM tvi;
+ tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvi.hItem = lpnmtv->itemNew.hItem;
+ tvi.iImage = tvi.iSelectedImage =
+ (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED;
+ SendMessageW(lpnmhdr->hwndFrom, TVM_SETITEMW, 0, (LPARAM)&tvi);
+ break;
+ }
+
+ case TVN_ITEMEXPANDEDA:
+ {
+ LPNMTREEVIEWA lpnmtv = (LPNMTREEVIEWA)lparam;
+ TVITEM tvi;
+ tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvi.hItem = lpnmtv->itemNew.hItem;
+ tvi.iImage = tvi.iSelectedImage =
+ (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED;
+ SendMessageA(lpnmhdr->hwndFrom, TVM_SETITEMA, 0, (LPARAM)&tvi);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ return FALSE;
+}
+
+DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, char *szSettingName)
+{
+ enum { IMG_GROUP, IMG_CHECK, IMG_NOCHECK, IMG_RCHECK, IMG_NORCHECK, IMG_GRPOPEN, IMG_GRPCLOSED };
+
+ HWND hwndTree = GetDlgItem(hwnd, idcTree);
+ DWORD result = 0;
+ int i;
+ for (i = 0; i < optionCount; ++i)
+ {
+ if ((!options[i].szSettingName && !szSettingName) ||
+ (options[i].szSettingName && szSettingName && !lstrcmpA(options[i].szSettingName, szSettingName)))
+ {
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE|TVIF_IMAGE;
+ tvi.hItem = options[i].hItem;
+ TreeView_GetItem(hwndTree, &tvi);
+ if ((tvi.iImage == IMG_CHECK) || (tvi.iImage == IMG_RCHECK))
+ result |= options[i].dwFlag;
+ }
+ }
+ return result;
+}
+
+void OptTree_SetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, DWORD dwOptions, char *szSettingName)
+{
+ enum { IMG_GROUP, IMG_CHECK, IMG_NOCHECK, IMG_RCHECK, IMG_NORCHECK, IMG_GRPOPEN, IMG_GRPCLOSED };
+
+ HWND hwndTree = GetDlgItem(hwnd, idcTree);
+ int i;
+ for (i = 0; i < optionCount; ++i)
+ {
+ if ((!options[i].szSettingName && !szSettingName) ||
+ (options[i].szSettingName && szSettingName && !lstrcmpA(options[i].szSettingName, szSettingName)))
+ {
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvi.hItem = options[i].hItem;
+ if (options[i].groupId == OPTTREE_CHECK)
+ {
+ tvi.iImage = tvi.iSelectedImage = (dwOptions & options[i].dwFlag) ? IMG_CHECK : IMG_NOCHECK;
+ } else
+ {
+ tvi.iImage = tvi.iSelectedImage = (dwOptions & options[i].dwFlag) ? IMG_RCHECK : IMG_NORCHECK;
+ }
+ TreeView_SetItem(hwndTree, &tvi);
+ }
+ }
+}
diff --git a/plugins/TrafficCounter/opttree.h b/plugins/TrafficCounter/opttree.h
new file mode 100644
index 0000000000..968a0d28d7
--- /dev/null
+++ b/plugins/TrafficCounter/opttree.h
@@ -0,0 +1,54 @@
+/*
+
+Jabber Protocol Plugin for Miranda IM
+Copyright ( C ) 2002-04 Santithorn Bunchua
+Copyright ( C ) 2005-07 George Hazan
+Copyright ( C ) 2007 Maxim Mluhov
+Copyright ( C ) 2007 Victor Pavlychko
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or ( at your option ) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+File name : $Source: $
+Revision : $Revision: $
+Last change on : $Date: $
+Last change by : $Author: $
+
+*/
+
+#ifndef __opttree_h__
+#define __opttree_h__
+
+// Ôëàãè
+#define OPTTREE_CHECK 0
+#define OPTTREE_INVISIBLE 2
+#define OPTTREE_NOTRANSLATE 4
+
+typedef struct {
+ int iconIndex;
+ TCHAR *szOptionName;
+ int groupId;
+ DWORD dwFlag;
+ HTREEITEM hItem;
+ char *szSettingName;
+} OPTTREE_OPTION;
+
+BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL *result, int idcTree, OPTTREE_OPTION *options, int optionCount);
+
+DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, char *szSettingName);
+void OptTree_SetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, DWORD dwOptions, char *szSettingName);
+
+void OptTree_Translate(HWND hwndTree);
+
+#endif // __opttree_h__
diff --git a/plugins/TrafficCounter/res/network.ico b/plugins/TrafficCounter/res/network.ico
new file mode 100644
index 0000000000..97c301be4d
--- /dev/null
+++ b/plugins/TrafficCounter/res/network.ico
Binary files differ
diff --git a/plugins/TrafficCounter/resource.h b/plugins/TrafficCounter/resource.h
new file mode 100644
index 0000000000..63b8bdd055
--- /dev/null
+++ b/plugins/TrafficCounter/resource.h
@@ -0,0 +1,457 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by resource.rc
+//
+#define IDC_AUTHICON 1
+#define IDC_NOTOALL 3
+#define IDC_APPLY 3
+#define IDI_MIRANDA 102
+#define IDD_OPT_TRAFFIC_POPUPS 103
+#define IDD_ABOUT 103
+#define IDI_SMS 103
+#define IDI_ONLINE 104
+#define IDI_OFFLINE 105
+#define IDD_CUSTOM_FONT 106
+#define IDD_OPT_FONTS 107
+#define IDD_OPT_GENMENU 108
+#define IDD_OPT_PROTOCOLORDER 109
+#define IDD_OPT_ICOLIB 110
+#define IDD_ICOLIB_IMPORT 111
+#define IDD_ADDED 115
+#define IDD_URLSEND 119
+#define IDD_URLRECV 120
+#define IDD_AUTHREQ 121
+#define IDD_DETAILS 125
+#define IDD_HISTORY 127
+#define IDI_AWAY 128
+#define IDI_FREE4CHAT 129
+#define IDI_INVISIBLE 130
+#define IDI_NA 131
+#define IDI_LOAD 132
+#define IDD_OPT_SOUND 134
+#define IDI_RECVMSG 136
+#define IDI_URL 138
+#define IDI_DND 158
+#define IDI_OCCUPIED 159
+#define IDI_USERDETAILS 160
+#define IDI_FINDUSER 161
+#define IDI_HELP 162
+#define IDI_OPTIONS 163
+#define IDI_MIRANDAWEBSITE 172
+#define IDI_RENAME 173
+#define IDI_HISTORY 174
+#define IDI_DELETE 175
+#define IDR_CONTEXT 180
+#define IDR_ICOLIB_CONTEXT 181
+#define IDC_DROP 183
+#define IDD_HISTORY_FIND 192
+#define IDI_SENDEMAIL 193
+#define IDD_FILERECV 194
+#define IDD_PROFILEMANAGER 197
+#define IDR_CLISTMENU 199
+#define IDI_BLANK 200
+#define IDD_FINDADD 201
+#define IDI_USERONLINE 201
+#define IDI_GROUPSHUT 202
+#define IDD_OPTIONS 203
+#define IDI_GROUPOPEN 203
+#define IDD_FILESEND 205
+#define IDI_NOTICK 205
+#define IDD_OPT_PLUGINS 206
+#define IDI_TICK 206
+#define IDD_OPT_ICONS 207
+#define IDI_FILE 207
+#define IDI_ADDCONTACT 210
+#define IDI_SMALLDOT 211
+#define IDI_FILLEDBLOB 212
+#define IDD_READAWAYMSG 213
+#define IDI_EMPTYBLOB 213
+#define IDD_OPT_IGNORE 214
+#define IDC_HYPERLINKHAND 214
+#define IDD_OPT_VISIBILITY 215
+#define IDC_DROPUSER 215
+#define IDD_SETAWAYMSG 216
+#define IDI_DETAILSLOGO 216
+#define IDD_OPT_AWAYMSG 217
+#define IDI_UNICODE 218
+#define IDI_ANSI 219
+#define IDD_INFO_SUMMARY 220
+#define IDI_LOADED 220
+#define IDD_INFO_CONTACT 221
+#define IDR_CREDITS 221
+#define IDI_NOTLOADED 221
+#define IDD_INFO_BACKGROUND 222
+#define IDD_INFO_NOTES 223
+#define IDD_ADDEMAIL 226
+#define IDD_ICONINDEX 227
+#define IDD_INFO_LOCATION 231
+#define IDD_INFO_WORK 232
+#define IDD_ADDPHONE 233
+#define IDD_INSTALLINI 235
+#define IDD_WARNINICHANGE 236
+#define IDD_INIIMPORTDONE 237
+#define IDB_SORTCOLUP 239
+#define IDB_SORTCOLDOWN 240
+#define IDD_OPT_TRAFFIC 248
+#define IDD_FILETRANSFERINFO 249
+#define IDD_OPT_FILETRANSFER 250
+#define IDD_FILEEXISTS 251
+#define IDD_DELETECONTACT 254
+#define IDD_DENYREASON 256
+#define IDD_ADDCONTACT 257
+#define IDD_OPT_CONTACT 261
+#define IDI_DOWNARROW 264
+#define IDD_OPT_IDLE 268
+#define IDD_PROFILE_SELECTION 269
+#define IDD_PROFILE_NEW 270
+#define IDI_TYPING 274
+#define IDD_UPDATE_NOTIFY 275
+#define IDD_OPT_UPDATENOTIFY 276
+#define IDI_GROUP_ICON 286
+#define IDI_UNINSTALL_ICON 287
+#define IDD_OPT_STATS 295
+#define IDI_ONTHEPHONE 1002
+#define IDC_MESSAGE 1002
+#define IDI_OUTTOLUNCH 1003
+#define IDC_AUTOCLOSE 1004
+#define IDC_FROM 1005
+#define IDC_AUTOMIN 1005
+#define IDC_DATE 1006
+#define IDC_MSG 1008
+#define IDC_NAME 1009
+#define IDC_NAMEVAL 1010
+#define IDC_ST_ENTERMSG 1013
+#define IDC_ST_ENTERURL 1014
+#define IDC_ENABLEUPNP 1015
+#define IDC_ABOUT 1032
+#define IDC_MYNOTES 1033
+#define IDC_URLS 1037
+#define IDC_REPLY 1039
+#define IDC_URL 1041
+#define IDC_FONTGROUP 1042
+#define IDC_COLOURLIST 1043
+#define IDC_STAT_RESTART 1044
+#define IDC_BTN_RESET 1045
+#define IDC_REASON 1046
+#define IDC_BTN_UNDO 1047
+#define IDC_EMAIL 1048
+#define IDC_NAMENICK 1049
+#define IDC_NAMEFIRST 1050
+#define IDC_NAMELAST 1051
+#define IDC_NICK 1053
+#define IDC_BTN_EXPORT 1054
+#define IDC_FONTLIST 1056
+#define IDC_CHOOSEFONT 1057
+#define IDC_GENDER 1060
+#define IDC_CITY 1061
+#define IDC_STATE 1062
+#define IDC_COUNTRY 1063
+#define IDC_AGE 1064
+#define IDC_ZIP 1064
+#define IDC_PHONE 1065
+#define IDC_STREET 1065
+#define IDC_COMPANY 1066
+#define IDC_LANGUAGE1 1066
+#define IDC_TIMEZONE 1067
+#define IDC_DEPARTMENT 1067
+#define IDC_LOCALTIME 1068
+#define IDC_DETAILS 1069
+#define IDC_POSITION 1069
+#define IDC_LANGUAGE2 1069
+#define IDC_ADD 1070
+#define IDC_LANGUAGE3 1070
+#define IDC_MOREOPTIONS 1071
+#define IDC_USERMENU 1071
+#define IDC_EDIT 1078
+#define IDC_LIST 1079
+#define IDC_HISTORY 1080
+#define IDC_MENUOBJECTS 1081
+#define IDC_MENUITEMS 1082
+#define IDC_NOTSUPPORTWARNING 1083
+#define IDC_INSERTSEPARATOR 1084
+#define IDC_GENMENU_SERVICE 1085
+#define IDC_GENMENU_CUSTOMNAME 1086
+#define IDC_GENMENU_SET 1087
+#define IDC_GENMENU_SET2 1088
+#define IDC_GENMENU_DEFAULT 1089
+#define IDC_BUILDTIME 1108
+#define IDC_CREDITSFILE 1109
+#define IDC_NUMBER 1113
+#define IDC_UIN 1123
+#define IDC_FINDWHAT 1131
+#define IDC_FIND 1132
+#define IDC_FILE 1133
+#define IDC_PROFILELIST 1134
+#define IDC_TABS 1141
+#define IDC_RESULTS 1142
+#define IDC_STATUS 1144
+#define IDC_CHANGE 1164
+#define IDC_PREVIEW 1165
+#define IDC_CHOOSE 1169
+#define IDC_TO 1170
+#define IDC_VERSION 1179
+#define IDC_ICONSET 1183
+#define IDC_BROWSE 1184
+#define IDC_PAGETREE 1186
+#define IDC_RETRIEVING 1193
+#define IDC_GETMORE 1200
+#define IDC_VISIBLEICON 1204
+#define IDC_INVISIBLEICON 1205
+#define IDC_FILEICON 1206
+#define IDC_ONLINEICON 1207
+#define IDC_FILENAMES 1208
+#define IDC_ALLICON 1208
+#define IDC_DONTREPLY 1209
+#define IDC_NONEICON 1209
+#define IDC_USEPREVIOUS 1210
+#define IDC_TYPINGICON 1210
+#define IDC_NODIALOG 1211
+#define IDC_USESPECIFIC 1212
+#define IDC_FILEDIR 1213
+#define IDC_ALLFILESPROGRESS 1217
+#define IDC_CURRENTSPEED 1219
+#define IDC_WHITERECT 1221
+#define IDC_ALLSPEED 1221
+#define IDC_CURRENTFILEPROGRESS 1222
+#define IDC_CURRENTFILEGROUP 1223
+#define IDC_FIRSTNAME 1224
+#define IDC_LASTNAME 1225
+#define IDC_CURRENTTRANSFERRED 1225
+#define IDC_DOBDAY 1226
+#define IDC_DOBMONTH 1227
+#define IDC_WEBPAGE 1228
+#define IDC_DOBYEAR 1228
+#define IDC_UPDATING 1231
+#define IDC_NAMEORDER 1234
+#define IDC_IMPORT 1241
+#define IDC_TOMAIN 1243
+#define IDC_TOPROTO 1244
+#define IDC_PROTOLIST 1245
+#define IDC_TODEFICON 1246
+#define IDC_IMPORTMULTI 1247
+#define IDC_BKGCOLOUR 1269
+#define IDC_FONTCOLOUR 1282
+#define IDC_INTERESTS 1305
+#define IDC_EMAILS 1306
+#define IDC_PAST 1307
+#define IDC_PHONES 1308
+#define IDC_SMS 1310
+#define IDC_AREA 1312
+#define IDC_UPDATE 1313
+#define IDC_ININAME 1333
+#define IDC_VIEWINI 1334
+#define IDC_SECURITYINFO 1335
+#define IDC_SETTINGNAME 1336
+#define IDC_NEWVALUE 1337
+#define IDC_WARNNOMORE 1338
+#define IDC_DELETE 1339
+#define IDC_RECYCLE 1340
+#define IDC_NEWNAME 1341
+#define IDC_MOVE 1342
+#define IDC_LEAVE 1343
+#define IDC_EXPERT 1346
+#define IDC_CATEGORYLIST 1366
+#define IDC_LOADICONS 1369
+#define IDC_STICONSGROUP 1371
+#define IDC_MSGICON 1375
+#define IDC_URLICON 1376
+#define IDC_STNOPAGE 1377
+#define IDC_STCHECKMARKS 1380
+#define IDC_MIRANDA 1388
+#define IDC_STATUSBAR 1389
+#define IDC_PROTOIDGROUP 1392
+#define IDC_BYPROTOID 1393
+#define IDC_PROTOID 1394
+#define IDC_EMAILGROUP 1395
+#define IDC_BYEMAIL 1396
+#define IDC_STNAMENICK 1397
+#define IDC_NAMEGROUP 1398
+#define IDC_BYNAME 1399
+#define IDC_STNAMEFIRST 1400
+#define IDC_STNAMELAST 1401
+#define IDC_ADVANCEDGROUP 1402
+#define IDC_BYADVANCED 1403
+#define IDC_ADVANCED 1404
+#define IDC_PROTOCOLORDER 1405
+#define IDC_TINYEXTENDEDGROUP 1406
+#define IDC_RESETPROTOCOLDATA 1407
+#define IDC_BYCUSTOM 1408
+#define IDC_PROTOCOLORDERWARNING 1409
+#define IDC_STSIMPLERIGHT 1440
+#define IDC_STATIC54 1453
+#define IDC_FILEDIRBROWSE 1475
+#define IDC_ALLFILESGROUP 1476
+#define IDC_SCANCMDLINEBROWSE 1476
+#define IDC_ALLTRANSFERRED 1477
+#define IDC_OPENFOLDER 1478
+#define IDC_OPENFILE 1479
+#define IDC_TOTALSIZE 1480
+#define IDC_AUTOACCEPT 1484
+#define IDC_SCANCMDLINE 1485
+#define IDC_WARNBEFOREOPENING 1488
+#define IDC_SCANDURINGDL 1489
+#define IDC_SCANAFTERDL 1490
+#define IDC_NOSCANNER 1491
+#define IDC_ST_CMDLINE 1492
+#define IDC_ST_CMDLINEHELP 1493
+#define IDC_PROPERTIES 1496
+#define IDC_RESUME 1497
+#define IDC_EXISTINGICON 1499
+#define IDC_RESUMEALL 1500
+#define IDC_OVERWRITE 1501
+#define IDC_OVERWRITEALL 1502
+#define IDC_SKIP 1503
+#define IDC_EXISTINGSIZE 1506
+#define IDC_EXISTINGDATE 1507
+#define IDC_EXISTINGTYPE 1508
+#define IDC_NEWICON 1509
+#define IDC_NEWSIZE 1510
+#define IDC_NEWDATE 1511
+#define IDC_NEWTYPE 1512
+#define IDC_SAVEAS 1513
+#define IDC_ASK 1516
+#define IDC_RENAME 1519
+#define IDC_VIRUSSCANNERGROUP 1520
+#define IDC_HIDE 1534
+#define IDC_TOPLINE 1535
+#define IDC_MAIL 1536
+#define IDC_DESCRIPTION 1538
+#define IDC_MYHANDLE 1540
+#define IDC_GROUP 1541
+#define IDC_ADDED 1542
+#define IDC_AUTH 1543
+#define IDC_DELETEHISTORY 1560
+#define IDC_AUTHREQ 1577
+#define IDC_AUTHGB 1578
+#define IDC_PROTOCOL 1580
+#define IDC_CONTRIBLINK 1586
+#define IDC_DEVS 1589
+#define IDC_LOGO 1591
+#define IDC_BUTTON_TSHOW 1597
+#define IDC_BUTTON_TSHOWHIDE 1598
+#define IDC_BUTTON_THIDE 1599
+#define IDC_CHECK1 1600
+#define IDC_DRAWKB 1601
+#define IDC_CHECK2 1604
+#define IDC_LAST_CLEAR 1609
+#define IDC_SAVETIMER 1612
+#define IDC_ESAVETIMER 1613
+#define IDC_BSHOWHIDE 1614
+#define IDC_NEED_RESTART 1615
+#define IDC_COLOR1 1617
+#define IDC_USESNAPPING 1618
+#define IDC_RESETCOLORS 1619
+#define IDC_COLOR2 1620
+#define IDC_DRAWCLEARDATE 1621
+#define IDC_NOTIFYSIZE 1622
+#define IDC_ENOTIFYSIZE 1623
+#define IDC_NOTIFYTIME 1624
+#define IDC_ENOTIFYTIME 1625
+#define IDC_TTRANSPARENT 1627
+#define IDC_TEST 1628
+#define IDC_TSTATIC 1633
+#define IDC_MAINTAB 1636
+#define IDC_IDLEONWINDOWS 1637
+#define IDC_POPUP_TIMEOUT 1638
+#define IDC_IDLEONMIRANDA 1638
+#define IDC_RADIO_FROMPOPUP 1639
+#define IDC_RADIO_CUSTOM 1640
+#define IDC_SELECT_PROTOCOLS 1641
+#define IDC_SCREENSAVER 1642
+#define IDC_LOCKED 1643
+#define IDC_IDLESHORT 1644
+#define IDC_COMBO_AUTO_CLEAR 1645
+#define IDC_IDLE1STTIME 1646
+#define IDC_IDLEPRIVATE 1649
+#define IDC_AASTATUS 1650
+#define IDC_AUTO_HIDE 1651
+#define IDC_AASHORTIDLE 1651
+#define IDC_CHECK3 1653
+#define IDC_CHECK_FIXED_HEIGHT 1655
+#define IDC_FORMAT 1656
+#define IDC_EDIT_DATEFORMAT 1657
+#define IDC_LINE_HEIGHT 1658
+#define IDC_CHECK_DATELINE 1659
+#define IDC_LOCATION 1659
+#define IDC_EDIT_ 1659
+#define IDC_SGROUP 1660
+#define IDC_COMBO_DATE_ALLIGN 1661
+#define IDC_SLOC 1661
+#define IDC_EDIT_COUNTER_FORMAT2 1661
+#define IDC_EDIT_COUNTER_FORMAT 1661
+#define IDC_EDIT_COUNTER_FORMAT3 1662
+#define IDC_EDIT_OVERALL_COUNTER_FORMAT 1662
+#define IDC_PROFILENAME 1673
+#define IDC_PROFILEDRIVERS 1674
+#define IDC_PLUGLIST 1676
+#define IDC_PLUGINLONGINFO 1677
+#define IDC_PLUGINAUTHOR 1679
+#define IDC_PLUGININFOFRAME 1680
+#define IDC_PLUGINCPYR 1681
+#define IDC_PLUGINURL 1682
+#define IDC_PLUGINPID 1683
+#define IDC_PLUGINEMAIL 1684
+#define IDC_IDLESPIN 1687
+#define IDC_NODBDRIVERS 1690
+#define IDC_IDLESTATUSLOCK 1691
+#define IDC_RESTART 1692
+#define IDC_TAB 1693
+#define IDC_IDLETERMINAL 1694
+#define IDC_ENABLESOUNDS 1695
+#define IDC_NEWVERSIONLABEL 1696
+#define IDC_CURRENTVERSION 1697
+#define IDC_DOWNLOAD 1699
+#define IDC_ENABLEUPDATES 1700
+#define IDC_ENABLEALPHA 1701
+#define IDC_RESETMENU 1702
+#define IDC_MODULES 1704
+#define IDC_STATIC_FILTERCAPTION 1705
+#define IDC_APPEARANCEOPTIONS 1715
+#define IDC_SPIN1 1716
+#define IDC_TOOLTIP_FORMAT 1718
+#define IDC_EDIT_TOOLTIP_FORMAT 1718
+#define IDC_TAB_STATS 1721
+#define IDC_COMBO1 1722
+#define IDC_COMBO_UNITS 1722
+#define IDC_LIST_DATA 1725
+#define IDC_STATIC_DNL 1726
+#define IDC_STATIC_UPL 1727
+#define IDC_STATIC_SUMM 1728
+#define IDC_BUTTON_CLEAR 1730
+#define IDC_EDIT_SPACE 21660
+#define IDC_EDIT_SPACE2 21661
+#define IDI_SEARCHALL 32548
+#define ID_ICQ_EXIT 40001
+#define IDM_COPY 40001
+#define ID_RESET 40002
+#define POPUP_HIDEEMPTYGROUPS 40003
+#define POPUP_NEWSUBGROUP 40004
+#define POPUP_HIDEOFFLINE 40005
+#define POPUP_GROUPHIDEOFFLINE 40006
+#define POPUP_HIDEOFFLINEROOT 40007
+#define POPUP_DISABLEGROUPS 40008
+#define IDC_SENDMESSAGE 40009
+#define IDM_COPYALL 40011
+#define IDM_SELECTALL 40012
+#define IDM_CLEAR 40013
+#define IDM_OPENNEW 40014
+#define IDM_OPENEXISTING 40015
+#define IDM_COPYLINK 40016
+#define POPUP_HIDEMIRANDA 40017
+#define ID_CANCELCHANGE 40018
+#define ID_TRAY_HIDE 40038
+#define ID_TRAY_EXIT 40040
+#define POPUP_NEWGROUP 40050
+#define POPUP_RENAMEGROUP 40052
+#define POPUP_DELETEGROUP 40053
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 297
+#define _APS_NEXT_COMMAND_VALUE 40018
+#define _APS_NEXT_CONTROL_VALUE 1731
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/plugins/TrafficCounter/resource.rc b/plugins/TrafficCounter/resource.rc
new file mode 100644
index 0000000000..1b7687a641
--- /dev/null
+++ b/plugins/TrafficCounter/resource.rc
@@ -0,0 +1,233 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include <windows.h>
+#include <winres.h>
+#include "..\..\Include\statusmodes.h"
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1251)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_UNINSTALL_ICON ICON "res\\network.ico"
+#endif // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Russian (Russia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT_STATS DIALOGEX 0, 0, 305, 240
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ COMBOBOX IDC_COMBO_UNITS,243,69,62,90,CBS_DROPDOWNLIST | WS_TABSTOP
+ CONTROL "",IDC_TAB_STATS,"SysTabControl32",0x0,0,84,305,149
+ LTEXT "Selected totals",IDC_STATIC,7,220,69,8,0,WS_EX_TRANSPARENT
+ LTEXT "Accounts",IDC_STATIC,5,4,30,8
+ RTEXT "Units",IDC_STATIC,167,71,75,8
+ LTEXT "0",IDC_STATIC_DNL,103,220,35,8,0,WS_EX_TRANSPARENT | WS_EX_RIGHT
+ LTEXT "0",IDC_STATIC_UPL,147,220,39,8,0,WS_EX_TRANSPARENT | WS_EX_RIGHT
+ LTEXT "0",IDC_STATIC_SUMM,195,220,39,8,0,WS_EX_TRANSPARENT | WS_EX_RIGHT
+ CONTROL "",IDC_LIST_DATA,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,3,99,298,118
+ PUSHBUTTON "Clear statistics",IDC_BUTTON_CLEAR,243,13,62,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPT_STATS, DIALOG
+ BEGIN
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 233
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // Russian (Russia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT_TRAFFIC_POPUPS DIALOG 0, 0, 313, 233
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Notification",IDC_STATIC,4,5,302,104
+ CONTROL "Notify me on every",IDC_NOTIFYSIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,15,86,10
+ EDITTEXT IDC_ENOTIFYSIZE,96,13,29,14,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "kilobytes",IDC_STATIC,128,15,45,8
+ CONTROL "Notify me on every",IDC_NOTIFYTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,30,85,10
+ EDITTEXT IDC_ENOTIFYTIME,96,28,29,14,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "minutes",IDC_STATIC,129,30,44,8
+ LTEXT "Background colour:",IDC_STATIC,178,17,63,8
+ CONTROL "",IDC_COLOR1,"ColourPicker",WS_TABSTOP,242,14,33,12
+ LTEXT "Text colour:",IDC_STATIC,178,30,60,8
+ CONTROL "",IDC_COLOR2,"ColourPicker",WS_TABSTOP,242,28,33,12
+ PUSHBUTTON "Reset to default",IDC_RESETCOLORS,178,44,97,14
+ GROUPBOX "Popup timeout",IDC_STATIC,10,62,110,41
+ CONTROL "From PopUp plugin",IDC_RADIO_FROMPOPUP,"Button",BS_AUTORADIOBUTTON,14,73,101,10
+ CONTROL "Custom",IDC_RADIO_CUSTOM,"Button",BS_AUTORADIOBUTTON,14,88,73,10
+ EDITTEXT IDC_POPUP_TIMEOUT,90,85,24,14,ES_AUTOHSCROLL | ES_NUMBER
+ PUSHBUTTON "Test",IDC_TEST,251,93,50,11
+END
+
+IDD_OPT_TRAFFIC DIALOGEX 0, 0, 305, 245
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ COMBOBOX IDC_COMBO_AUTO_CLEAR,259,3,42,88,CBS_DROPDOWNLIST | WS_TABSTOP
+ PUSHBUTTON "Show now",IDC_BSHOWHIDE,221,43,80,14
+ LTEXT "Space between lines:",IDC_STATIC,190,25,70,8
+ CONTROL "",IDC_APPEARANCEOPTIONS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,3,3,161,153
+ EDITTEXT IDC_EDIT_SPACE,259,23,30,12,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_TABSTOP,287,25,9,12
+ LTEXT "Counters format string:",IDC_STATIC,6,160,136,8
+ EDITTEXT IDC_EDIT_COUNTER_FORMAT,3,168,298,38,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL
+ EDITTEXT IDC_EDIT_TOOLTIP_FORMAT,3,217,297,13,ES_MULTILINE | ES_AUTOHSCROLL
+ LTEXT "Tooltip format string:",IDC_STATIC,5,208,81,8
+ LTEXT "Display traffic for current",IDC_LAST_CLEAR,177,6,81,8
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPT_TRAFFIC, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 233
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include <windows.h>\r\n"
+ "#include <winres.h>\r\n"
+ "#include ""..\\..\\Include\\statusmodes.h""\r\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+#include "version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "Comments", "Licensed under the terms of the GNU General Public License"
+ VALUE "CompanyName", " "
+ VALUE "FileDescription", "TrafficCounter"
+ VALUE "FileVersion", __VERSION_STRING
+ VALUE "InternalName", "TrafficCounter"
+ VALUE "LegalCopyright", "© 2002-2006 Ghost, © 2007-2012 Mironych"
+ VALUE "OriginalFilename", "TrafficCounter.dll"
+ VALUE "ProductName", "TrafficCounter"
+ VALUE "ProductVersion", __VERSION_STRING
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/TrafficCounter/statistics.c b/plugins/TrafficCounter/statistics.c
new file mode 100644
index 0000000000..e202edd3fd
--- /dev/null
+++ b/plugins/TrafficCounter/statistics.c
@@ -0,0 +1,751 @@
+/*
+Traffic Counter plugin for Miranda IM
+Copyright 2007-2011 Mironych.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+/* ======================================================================================
+Çäåñü ñîäåðæàòñÿ ïåðåìåííûå è ôóíêöèè äëÿ ðàáîòû ñî ñòàòèñòèêîé
+Àâòîð: Mironych
+=======================================================================================*/
+
+#include "commonheaders.h"
+#include <math.h>
+
+HWND hListAccs;
+
+BOOL CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ WORD i;
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ // Ñîçäà¸ì ListBox c ïåðå÷íåì àêêàóíòîâ.
+ hListAccs = CreateWindowEx(WS_EX_CLIENTEDGE,
+ _T("ListBox"),
+ NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NOTIFY,
+ 2, 20, 246, 112,
+ hwndDlg, NULL, NULL, NULL);
+ SendMessage(hListAccs, WM_SETFONT, (WPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT), 0);
+ for (i = NumberOfAccounts; i--; )
+ {
+ // Ãîòîâèì ñïèñîê àêêàóíòîâ
+ if (ProtoList[i].tszAccountName)
+ SendMessage(hListAccs, LB_ADDSTRING, 0, (LPARAM)ProtoList[i].tszAccountName);
+ }
+ for (i = NumberOfAccounts; i--; )
+ SendMessage(hListAccs, LB_SETSEL, (WPARAM)0x01&(Stat_SelAcc>>i), (LPARAM)i);
+ // Ãîòîâèì ñïèñîê åäèíèö èçìåðåíèÿ
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_UNITS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bytes"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_UNITS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("KB"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_UNITS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("MB"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_UNITS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Adaptive"));
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_UNITS, CB_SETCURSEL, unOptions.Stat_Units, 0);
+ // Ãîòîâèì çàêëàäêè
+ {
+ TCITEM tci;
+ tci.mask = TCIF_TEXT;
+ tci.cchTextMax = 32;
+ tci.pszText = TranslateT("Hourly");
+ SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_INSERTITEM, 0, (LPARAM)&tci);
+ tci.pszText = TranslateT("Daily");
+ SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_INSERTITEM, 1, (LPARAM)&tci);
+ tci.pszText = TranslateT("Weekly");
+ SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_INSERTITEM, 2, (LPARAM)&tci);
+ tci.pszText = TranslateT("Monthly");
+ SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_INSERTITEM, 3, (LPARAM)&tci);
+ tci.pszText = TranslateT("Yearly");
+ SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_INSERTITEM, 4, (LPARAM)&tci);
+ SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_SETCURSEL, unOptions.Stat_Tab, 0);
+ }
+ // Ãîòîâèì ListView - êîëîíêè è ñòèëè
+ {
+ LVCOLUMN lvc ={0};
+
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
+#ifdef UNICODE
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_SETUNICODEFORMAT, 1, 0);
+#else
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_SETUNICODEFORMAT, 0, 0);
+#endif
+
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+ lvc.fmt = LVCFMT_LEFT;
+ lvc.cchTextMax = 32;
+ lvc.pszText = TranslateT("Period");
+ lvc.cx = 135;
+ lvc.iSubItem = 0;
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_INSERTCOLUMN, 0, (LPARAM)&lvc);
+ lvc.fmt = LVCFMT_RIGHT;
+ lvc.pszText = TranslateT("Incoming");
+ lvc.iSubItem = 1;
+ lvc.cx = 72;
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_INSERTCOLUMN, 1, (LPARAM)&lvc);
+ lvc.pszText = TranslateT("Outgoing");
+ lvc.iSubItem = 2;
+ lvc.cx = 72;
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_INSERTCOLUMN, 2, (LPARAM)&lvc);
+ lvc.pszText = TranslateT("Sum");
+ lvc.iSubItem = 3;
+ lvc.cx = 72;
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_INSERTCOLUMN, 3, (LPARAM)&lvc);
+ lvc.pszText = TranslateT("Online");
+ lvc.iSubItem = 4;
+ lvc.cx = 72;
+ SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_INSERTCOLUMN, 4, (LPARAM)&lvc);
+ }
+ Stat_Show(hwndDlg);
+ break; // WM_INITDIALOG
+ case WM_COMMAND:
+ if ((HWND)lParam == hListAccs)
+ {
+ DWORD SelItems[16];
+ BYTE SelItemsCount;
+ if (HIWORD(wParam) == LBN_SELCHANGE)
+ {
+ SelItemsCount = SendMessage(hListAccs, LB_GETSELCOUNT, 0, 0);
+ SendMessage(hListAccs,
+ LB_GETSELITEMS,
+ SelItemsCount,
+ (LPARAM)SelItems);
+ for (Stat_SelAcc = i = 0; i < SelItemsCount; i++)
+ Stat_SelAcc |= 1 << SelItems[i];
+ Stat_Show(hwndDlg);
+ }
+ }
+ switch (LOWORD(wParam))
+ {
+ case IDC_COMBO_UNITS:
+ if (HIWORD(wParam) != CBN_SELCHANGE) break;
+ unOptions.Stat_Units = SendDlgItemMessage(hwndDlg, IDC_COMBO_UNITS, CB_GETCURSEL, 0, 0);
+ Stat_Show(hwndDlg);
+ break;
+ case IDC_BUTTON_CLEAR:
+ {
+ SYSTEMTIME stNow;
+
+ if (IDOK != MessageBox(hwndDlg,
+ TranslateT("Now traffic statistics for selected accounts will be cleared.\nContinue?"),
+ _T("Traffic counter"),
+ MB_OKCANCEL | MB_ICONWARNING))
+ break;
+ GetLocalTime(&stNow);
+ for (i = NumberOfAccounts; i--;)
+ if (0x01&(Stat_SelAcc>>i))
+ {
+ SetFilePointer(ProtoList[i].hFile, sizeof(HOURLYSTATS), NULL, FILE_BEGIN);
+ SetEndOfFile(ProtoList[i].hFile); // Óñåêàåì ôàéë äî îäíîé çàïèñè.
+ ProtoList[i].NumberOfRecords = 1;
+ ProtoList[i].AllStatistics = (HOURLYSTATS*)mir_realloc(ProtoList[i].AllStatistics, sizeof(HOURLYSTATS));
+ ProtoList[i].AllStatistics[0].Hour = stNow.wHour;
+ ProtoList[i].AllStatistics[0].Day = stNow.wDay;
+ ProtoList[i].AllStatistics[0].Month = stNow.wMonth;
+ ProtoList[i].AllStatistics[0].Year = stNow.wYear;
+ ProtoList[i].AllStatistics[0].Incoming = 0;
+ ProtoList[i].AllStatistics[0].Outgoing = 0;
+ ProtoList[i].StartIncoming = 0;
+ ProtoList[i].StartOutgoing = 0;
+ ProtoList[i].AllStatistics[0].Time = 0;
+ ProtoList[i].Total.TimeAtStart = GetTickCount();
+ Stat_CheckStatistics(i);
+ }
+ Stat_Show(hwndDlg);
+ }
+ break;
+ }
+ break; // WM_COMMAND
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+
+ switch(lpnmhdr->idFrom)
+ {
+ case IDC_TAB_STATS:
+ if (lpnmhdr->code != TCN_SELCHANGE) break;
+ unOptions.Stat_Tab = SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_GETCURSEL, 0, 0);
+ Stat_Show(hwndDlg);
+ break;
+ case IDC_LIST_DATA:
+ switch (lpnmhdr->code)
+ {
+ case LVN_GETDISPINFO:
+ {
+ NMLVDISPINFO* pdi = (NMLVDISPINFO*)lParam;
+ SYSTEMTIME st = {0};
+ DWORD Index, Value;
+ double vartime;
+ TCHAR szBufW[64];
+ BYTE EldestAcc;
+
+ if (!(pdi->item.mask & LVIF_TEXT)) return 0;
+
+ // Åñëè íóæíà íàäïèñü.
+ if (!pdi->item.iSubItem)
+ {
+ EldestAcc = Stat_GetEldestAcc(Stat_SelAcc);
+ // Èíäåêñ ïðèìåíèì òîëüêî äëÿ ñàìîãî ñòàðîãî àêêàóíòà!
+ Index = Stat_GetStartIndex(EldestAcc, unOptions.Stat_Tab, pdi->item.iItem, &st);
+ switch (unOptions.Stat_Tab)
+ {
+ case 0: // Hourly
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
+ mir_sntprintf(pdi->item.pszText, 32, _T("%s %02d:00 - %02d:59"),
+ szBufW,
+ ProtoList[EldestAcc].AllStatistics[Index].Hour,
+ ProtoList[EldestAcc].AllStatistics[Index].Hour);
+ break;
+ case 1: // Dayly
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pdi->item.pszText, 32);
+ break;
+ case 2: // Weekly
+ // Óõîäèì ê ïåðâîìó ïîíåäåëüíèêó ñëåâà.
+ SystemTimeToVariantTime(&st, &vartime);
+ vartime -= DayOfWeek(st.wDay, st.wMonth, st.wYear) - 1;
+ VariantTimeToSystemTime(vartime, &st);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pdi->item.pszText, 32);
+ // Òåïåðü ê âîñêðåñåíüþ.
+ SystemTimeToVariantTime(&st, &vartime);
+ vartime += 6;
+ VariantTimeToSystemTime(vartime, &st);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
+ mir_sntprintf(pdi->item.pszText, 32, _T("%s - %s"), pdi->item.pszText, szBufW);
+ break;
+ case 3: // Monthly
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_YEARMONTH, &st, NULL, pdi->item.pszText, 32);
+ break;
+ case 4: // Yearly
+ mir_sntprintf(pdi->item.pszText, 32, _T("%d"), st.wYear);
+ break;
+ }
+ return 0;
+ }
+
+ Value = Stat_GetItemValue(Stat_SelAcc, unOptions.Stat_Tab, pdi->item.iItem, pdi->item.iSubItem);
+
+ // Òåïåðü ìîæíî çàïèñàòü â ListView öèôåðêè.
+ switch (pdi->item.iSubItem)
+ {
+ case 1: // Âõîäÿùèé
+ case 2: // Èñõîäÿùèé
+ case 3: // Ñóììà
+ GetFormattedTraffic(Value, unOptions.Stat_Units, pdi->item.pszText, 32);
+ break;
+ case 4: // Âðåìÿ
+ {
+ TCHAR *Fmt[5] = {_T("m:ss"), _T("h:mm:ss"), _T("h:mm:ss"), _T("d hh:mm:ss"), _T("d hh:mm:ss")};
+ GetDurationFormatM(Value, Fmt[unOptions.Stat_Tab], pdi->item.pszText, 32);
+ }
+ break;
+ }
+ }
+ break;
+
+ case NM_CLICK:
+ case LVN_ITEMCHANGED:
+ {
+ DWORD i, j = -1, dwTotalIncoming = 0, dwTotalOutgoing = 0;
+
+ i = SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_GETSELECTEDCOUNT, 0, 0);
+ for ( ; i--;)
+ {
+ j = SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_GETNEXTITEM, j, LVNI_SELECTED);
+ dwTotalIncoming += Stat_GetItemValue(Stat_SelAcc, unOptions.Stat_Tab, j, 1);
+ dwTotalOutgoing += Stat_GetItemValue(Stat_SelAcc, unOptions.Stat_Tab, j, 2);
+ }
+ Stat_UpdateTotalTraffic(hwndDlg, dwTotalIncoming, dwTotalOutgoing);
+ }
+ break;
+
+ case NM_CUSTOMDRAW:
+ {
+ LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam;
+
+ switch (lplvcd->nmcd.dwDrawStage)
+ {
+ case CDDS_PREPAINT: // Ïåðåä íà÷àëîì ðèñîâàíèÿ âñåãî ListView.
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, CDRF_NOTIFYITEMDRAW);
+ return TRUE;
+ case CDDS_ITEMPREPAINT: // Ïåðåä íà÷àëîì ðèñîâàíèÿ ñòðîêè.
+ {
+ COLORREF Color;
+ BYTE r, g, b;
+
+ if (lplvcd->nmcd.dwItemSpec & 0x01)
+ {
+ Color = SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_GETBKCOLOR, 0, 0);
+ r = GetRValue(Color);
+ g = GetGValue(Color);
+ b = GetBValue(Color);
+ r += r > 0x80 ? -40 : 40;
+ g += g > 0x80 ? -40 : 40;
+ b += b > 0x80 ? -40 : 40;
+ lplvcd->clrTextBk = RGB(r, g, b);;
+ }
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, CDRF_NEWFONT);
+ return TRUE;
+ }
+ }
+ }
+ break;
+ }
+ break;
+ }
+ }
+ break; // WM_NOTIFY
+ }
+ return 0;
+}
+
+/*
+Ôóíêöèÿ ÷èòàåò ñòàòèñòèêó èç ôàéëà äëÿ àêêàóíòà ñ íîìåðîì n.
+*/
+void Stat_ReadFile(BYTE n)
+{
+ LARGE_INTEGER Size;
+ DWORD BytesRead;
+ TCHAR FileName[MAX_PATH], *pszPath;
+ SYSTEMTIME stNow, stLast = {0};
+
+ pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\statistics"));
+ CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszPath);
+ mir_sntprintf(FileName, MAX_PATH, _T("%s\\%S.stat"), pszPath, ProtoList[n].name);
+ mir_free(pszPath);
+ GetLocalTime(&stNow);
+ ProtoList[n].hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ GetFileSizeEx(ProtoList[n].hFile, &Size);
+ if (Size.QuadPart != 0) // Åñëè ôàéë ñî ñòàòèñòèêîé ñóùåñòâóåò è èìååò íåíóëåâîé ðàçìåð...
+ {
+ // ...òî ÷èòàåì ñòàòèñòèêó èç ôàéëà
+ ProtoList[n].NumberOfRecords = Size.QuadPart/sizeof(HOURLYSTATS);
+ ProtoList[n].AllStatistics = (HOURLYSTATS*)mir_alloc(sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords);
+ ReadFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[0], sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords, &BytesRead, NULL);
+ if (!BytesRead)
+ {
+ MessageBox(TrafficHwnd, TranslateT("Couldn't read statistics file"), _T("Traffic Counter"), MB_OK);
+ return;
+ }
+ }
+ else
+ {
+ // Íåîáõîäèìî ñîçäàòü íîâûé ôàéë.
+ ProtoList[n].NumberOfRecords = 1;
+ ProtoList[n].AllStatistics = (HOURLYSTATS*)mir_alloc(sizeof(HOURLYSTATS));
+ ProtoList[n].AllStatistics[0].Hour = stNow.wHour;
+ ProtoList[n].AllStatistics[0].Day = stNow.wDay;
+ ProtoList[n].AllStatistics[0].Month = stNow.wMonth;
+ ProtoList[n].AllStatistics[0].Year = stNow.wYear;
+ ProtoList[n].AllStatistics[0].Incoming =
+ ProtoList[n].AllStatistics[0].Outgoing =
+ ProtoList[n].AllStatistics[0].Time = 0;
+ }
+ Stat_CheckStatistics(n);
+}
+
+/* Ôóíêöèÿ ãîòîâèò âûâîä â ListView ñòàòèñòèêè.
+Àðãóìåíòû: hwndDialog - õýíäë îêíà äèàëîãà. */
+void Stat_Show(HWND hwndDialog)
+{
+ DWORD MaxRecords;
+
+ // Íóæíî óçíàòü êîëè÷åñòâî çàïèñåé.
+ MaxRecords = Stat_GetRecordsNumber(Stat_GetEldestAcc(Stat_SelAcc), unOptions.Stat_Tab);
+ // Óñòàíîâèì òàêîå æå êîëè÷åñòâî ñòðîê â ListView.
+ SendDlgItemMessage(hwndDialog, IDC_LIST_DATA, LVM_SETITEMCOUNT, MaxRecords, 0);
+ // Íàäî ïîêàçàòü ñàìûå ñâåæèå çàïèñè.
+ SendDlgItemMessage(hwndDialog, IDC_LIST_DATA, LVM_ENSUREVISIBLE, (WPARAM)(MaxRecords - 1), 0);
+}
+
+void Stat_UpdateTotalTraffic(HWND hwndDialog, DWORD Incoming, DWORD Outgoing)
+{
+ TCHAR tmp[32];
+
+ GetFormattedTraffic(Incoming, unOptions.Stat_Units, tmp, 32);
+ SetDlgItemText(hwndDialog, IDC_STATIC_DNL, tmp);
+ GetFormattedTraffic(Outgoing, unOptions.Stat_Units, tmp, 32);
+ SetDlgItemText(hwndDialog, IDC_STATIC_UPL, tmp);
+ GetFormattedTraffic(Incoming + Outgoing, unOptions.Stat_Units, tmp, 32);
+ SetDlgItemText(hwndDialog, IDC_STATIC_SUMM, tmp);
+}
+
+/*
+Ôóíêöèÿ ñðàâíèâàåò ñ òåêóùèì âðåìÿ ïîñëåäíåé çàïèñè â ñòàòèñòèêå äëÿ àêêàóíòà ñ íîìåðîì n.
+Åñëè îíè ñîâïàäàþò, íè÷åãî íå ïðîèñõîäèò.
+Åñëè òåêóùåå âðåìÿ ìåíüøå âðåìåíè ïîñëåäíåé çàïèñè (÷àñû ïåðåâåëè íàçàä),
+ êîëè÷åñòâî çàïèñåé óìåíüøàåòñÿ íà ñîîòâåòñòâóþùåå êîëè÷åñòâî ÷àñîâ.
+Åñëè òåêóùåå âðåìÿ áîëüøå, â ñòàòèñòèêó âêëþ÷àåòñÿ íåîáõîäèìîå êîëè÷åñòâî ïóñòûõ çàïèñåé.
+*/
+void Stat_CheckStatistics(BYTE n)
+{
+ SYSTEMTIME stNow, stLast = {0};
+ HOURLYSTATS htTmp = {0};
+ signed short int d;//, i;
+ DWORD q;
+
+ stLast.wHour = ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords-1].Hour;
+ stLast.wDay = ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords-1].Day;
+ stLast.wMonth = ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords-1].Month;
+ stLast.wYear = ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords-1].Year;
+
+ GetLocalTime(&stNow);
+ d = TimeCompare(stNow, stLast);
+ // Åñëè òåêóùåå âðåìÿ ñîâïàäàåò ñî âðåìåíåì ïîñëåäíåé çàïèñè...
+ if (!d)
+ {
+ // ...ñîõðàíÿåì çàïèñü â ôàéë è óõîäèì.
+ SetFilePointer(ProtoList[n].hFile, 0-sizeof(HOURLYSTATS), NULL, FILE_END);
+ WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords-1], sizeof(HOURLYSTATS), &q, NULL);
+ return;
+ }
+
+ // Åñëè ÷àñû ïåðåâåëè íàçàä.
+ if (d < 0)
+ {
+ do
+ {
+ stLast.wHour--;
+ if (stLast.wHour == 0xFFFF)
+ {
+ stLast.wDay--;
+ if (!stLast.wDay)
+ {
+ stLast.wMonth--;
+ if (!stLast.wMonth)
+ {
+ stLast.wMonth = 12;
+ stLast.wYear--;
+ }
+ stLast.wDay = DaysInMonth(htTmp.Month, htTmp.Year);
+ }
+ }
+
+ ProtoList[n].NumberOfRecords--;
+ } while (TimeCompare(stNow, stLast));
+ return;
+ }
+
+ if (d > 0)
+ {
+ // Ñîõðàíÿåì.
+ SetFilePointer(ProtoList[n].hFile, 0-sizeof(HOURLYSTATS), NULL, FILE_END);
+ WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords-1], sizeof(HOURLYSTATS), &q, NULL);
+
+ // Ïîñëåäíÿÿ çàïèñü èç ñòàòèñòèêè ïîíàäîáèòñÿ äëÿ âû÷èñëåíèÿ íîâûõ çàïèñåé, ïîýòîìó êîïèðóåì å¸ (êðîìå òðàôèêà è âðåìåíè).
+ memcpy(&htTmp, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1],
+ sizeof(HOURLYSTATS) - 2 * sizeof(DWORD) - sizeof(WORD));
+ // Ñ÷¸ò÷èê âðåìåíè êàæäûé ÷àñ äîëæåí íà÷èíàòü ñ÷èòàòü ñ íóëÿ.
+ ProtoList[n].Total.TimeAtStart = GetTickCount() - stNow.wMilliseconds;
+
+ do
+ {
+ ProtoList[n].AllStatistics =
+ (HOURLYSTATS*)mir_realloc(ProtoList[n].AllStatistics, sizeof(HOURLYSTATS) * ++ProtoList[n].NumberOfRecords);
+
+ htTmp.Hour++;
+ if (htTmp.Hour > 23)
+ {
+ htTmp.Hour = 0; htTmp.Day++;
+ if (htTmp.Day > DaysInMonth(htTmp.Month, htTmp.Year))
+ {
+ htTmp.Day = 1; htTmp.Month++;
+ if (htTmp.Month > 12)
+ {
+ htTmp.Month = 1; htTmp.Year++;
+ }
+ }
+ }
+
+ stLast.wHour = htTmp.Hour;
+ stLast.wDay = htTmp.Day;
+ stLast.wMonth = htTmp.Month;
+ stLast.wYear = htTmp.Year;
+
+ // Äîáàâëÿåì çàïèñè îäíîâðåìåííî â ÎÇÓ è â ôàéë.
+ WriteFile(ProtoList[n].hFile, &htTmp, sizeof(HOURLYSTATS), &q, NULL);
+ memcpy(&ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], &htTmp, sizeof(HOURLYSTATS));
+
+ } while (TimeCompare(stNow, stLast));
+ }
+}
+
+/* Ôóíêöèÿ âîçðàùàåò èíäåêñ ïåðâîé çàïèñè â ñòàòèñòèêå, îòíîñÿùåéñÿ ê âûáðàííîìó èíòåðâàëó.
+Ïðè âû÷èñëåíèè ó÷èòûâàåòñÿ âûáðàííûé èíòåðâàë è àêêàóíòû.
+Àðãóìåíòû:
+ItemNumber - íîìåð ñòðîêè â ListView (íîìåð ïåðèîäà).
+stReq - äàòà, ñîîòâåòñòâóþùàÿ âû÷èñëåííîìó èíäåêñó.
+*/
+DWORD Stat_GetStartIndex(BYTE AccNum, BYTE Interval, DWORD ItemNumber, SYSTEMTIME *stReq)
+{
+ DWORD Left, Right, Probe; // Ãðàíèöû èíòåðâàëà äëÿ ïîèñêà (èíäåêñû ñòàòèñòèêè).
+ SYSTEMTIME stProbe = {0}; // Âðåìÿ òûêà.
+ signed short int d = 1;
+
+ if (!ItemNumber)
+ {
+ stReq->wHour = ProtoList[AccNum].AllStatistics[0].Hour;
+ stReq->wDay = ProtoList[AccNum].AllStatistics[0].Day;
+ stReq->wMonth = ProtoList[AccNum].AllStatistics[0].Month;
+ stReq->wYear = ProtoList[AccNum].AllStatistics[0].Year;
+ return 0;
+ }
+
+ // Âû÷èñëÿåì âðåìÿ, ñîîòâåòñòâóþùåå íà÷àëó èíòåðâàëà.
+ for (Probe = 0, Left = 1; Left < ProtoList[AccNum].NumberOfRecords; Left++)
+ {
+ switch(Interval)
+ {
+ case STAT_INTERVAL_HOUR:
+ stReq->wHour = ProtoList[AccNum].AllStatistics[ItemNumber].Hour;
+ stReq->wDay = ProtoList[AccNum].AllStatistics[ItemNumber].Day;
+ stReq->wMonth = ProtoList[AccNum].AllStatistics[ItemNumber].Month;
+ stReq->wYear = ProtoList[AccNum].AllStatistics[ItemNumber].Year;
+ return ItemNumber;
+ break;
+ case STAT_INTERVAL_DAY:
+ if (ProtoList[AccNum].AllStatistics[Left].Day != ProtoList[AccNum].AllStatistics[Left - 1].Day)
+ Probe++;
+ break;
+ case STAT_INTERVAL_WEEK:
+ if ( !ProtoList[AccNum].AllStatistics[Left].Hour
+ && DayOfWeek(ProtoList[AccNum].AllStatistics[Left].Day,
+ ProtoList[AccNum].AllStatistics[Left].Month,
+ ProtoList[AccNum].AllStatistics[Left].Year) == 1)
+ Probe++;
+ break;
+ case STAT_INTERVAL_MONTH:
+ if (ProtoList[AccNum].AllStatistics[Left].Month != ProtoList[AccNum].AllStatistics[Left - 1].Month)
+ Probe++;
+ break;
+ case STAT_INTERVAL_YEAR:
+ if (ProtoList[AccNum].AllStatistics[Left].Year != ProtoList[AccNum].AllStatistics[Left - 1].Year)
+ Probe++;
+ break;
+ }
+ if (Probe == ItemNumber) break;
+ }
+
+ stReq->wHour = ProtoList[AccNum].AllStatistics[Left].Hour;
+ stReq->wDay = ProtoList[AccNum].AllStatistics[Left].Day;
+ stReq->wMonth = ProtoList[AccNum].AllStatistics[Left].Month;
+ stReq->wYear = ProtoList[AccNum].AllStatistics[Left].Year;
+
+ Left = 0; Right = ProtoList[AccNum].NumberOfRecords - 1;
+
+ // Âû÷èñëÿåì èíäåêñ íà÷àëà èíòåðâàëà.
+ while (TRUE)
+ {
+ if (Right - Left == 1) return Right;
+ Probe = (Left + Right) >> 1;
+ stProbe.wYear = ProtoList[AccNum].AllStatistics[Probe].Year;
+ stProbe.wMonth = ProtoList[AccNum].AllStatistics[Probe].Month;
+ stProbe.wDay = ProtoList[AccNum].AllStatistics[Probe].Day;
+ stProbe.wHour = ProtoList[AccNum].AllStatistics[Probe].Hour;
+ d = TimeCompare(*stReq, stProbe);
+ if (!d) break;
+ if (d < 0) Right = Probe;
+ if (d > 0) Left = Probe;
+ }
+ return Probe;
+}
+
+/* Ôóíêöèÿ óñòàíàâëèâàåò âåëè÷èíó ñäâèãà äëÿ çàäàííîãî àêêàóíòà,
+òî åñòü íîìåð çàïèñè â ñòàòèñòèêå ñòàðåéøåãî èç âûáðàííûõ àêêàóíòîâ,
+äàòà êîòîðîé ñîîòâåòñòâóåò íà÷àëó ñòàòèñòèêè óêàçàííîãî àêêàóíòà. */
+void Stat_SetAccShift(BYTE AccNum, BYTE EldestAccount)
+{
+ DWORD Left, Right, Probe; // Ãðàíèöû èíòåðâàëà äëÿ ïîèñêà (èíäåêñû ñòàòèñòèêè).
+ SYSTEMTIME stReq = {0}, stProbe;
+ signed short int d = 1;
+
+ if (AccNum == EldestAccount)
+ {
+ ProtoList[AccNum].Shift = 0;
+ return;
+ }
+
+ stReq.wHour = ProtoList[AccNum].AllStatistics[0].Hour;
+ stReq.wDay = ProtoList[AccNum].AllStatistics[0].Day;
+ stReq.wMonth = ProtoList[AccNum].AllStatistics[0].Month;
+ stReq.wYear = ProtoList[AccNum].AllStatistics[0].Year;
+
+ // Âû÷èñëÿåì èíäåêñ íà÷àëà èíòåðâàëà.
+ Left = 0; Right = ProtoList[EldestAccount].NumberOfRecords - 1;
+ while (TRUE)
+ {
+ if (Right - Left == 1)
+ {
+ ProtoList[AccNum].Shift = Probe + d;
+ return;
+ }
+ Probe = (Left + Right) >> 1;
+ stProbe.wYear = ProtoList[EldestAccount].AllStatistics[Probe].Year;
+ stProbe.wMonth = ProtoList[EldestAccount].AllStatistics[Probe].Month;
+ stProbe.wDay = ProtoList[EldestAccount].AllStatistics[Probe].Day;
+ stProbe.wHour = ProtoList[EldestAccount].AllStatistics[Probe].Hour;
+ d = TimeCompare(stReq, stProbe);
+ if (!d) break;
+ if (d < 0) Right = Probe;
+ if (d > 0) Left = Probe;
+ }
+ ProtoList[AccNum].Shift = Probe;
+}
+
+/* Ôóíêöèÿ âû÷èñëÿåò çíà÷åíèå, ñîîòâåòñòâóþùåå óêàçàííîìó ïîäýëåìåíòó
+óêàçàííîé ñòðîêè ListView.
+Àðãóìåíòû:
+SelectedAccs - ñëîâî, â êîòîðîì åäèíè÷íûå áèòû ñîîòâåòñòâóþò âûáðàííûì àêêàóíòàì;
+Interval - âûáðàííûé èíòåðâàë;
+ItemNum - íîìåð ñòðîêè â ListVew;
+SubitemNum - íîìåð êîëîíêè, îïðåäåëÿåò âèä èíôîðìàöèè. */
+DWORD Stat_GetItemValue(WORD SelectedAccs, BYTE Interval, DWORD ItemNum, BYTE SubItemNum)
+{
+ DWORD Result = 0;
+ SYSTEMTIME st = {0};
+ DWORD Index, IndexP, i;
+ signed long int IndexM;
+ BYTE a, EldestAcc;
+
+ EldestAcc = Stat_GetEldestAcc(SelectedAccs);
+ Index = Stat_GetStartIndex(EldestAcc, Interval, ItemNum, &st);
+
+ for (a = NumberOfAccounts; a--; )
+ {
+ if (!((1 << a) & SelectedAccs)) continue;
+ Stat_SetAccShift(a, EldestAcc);
+ IndexM = Index - ProtoList[a].Shift;
+ IndexP = Index;
+
+ for (i = 0; ; )
+ {
+ if (IndexM >= 0)
+ switch (SubItemNum)
+ {
+ case 1: // Âõîäÿùèé
+ Result += ProtoList[a].AllStatistics[IndexM].Incoming;
+ break;
+ case 2: // Èñõîäÿùèé
+ Result += ProtoList[a].AllStatistics[IndexM].Outgoing;
+ break;
+ case 3: // Ñóììà
+ Result += ProtoList[a].AllStatistics[IndexM].Incoming
+ + ProtoList[a].AllStatistics[IndexM].Outgoing;
+ break;
+ case 4: // Âðåìÿ
+ Result += ProtoList[a].AllStatistics[IndexM].Time;
+ break;
+ }
+
+ IndexM++; IndexP++; // Ïåðåõîäèì ê ñëåäóþùåé çàïèñè.
+ if (IndexM == ProtoList[a].NumberOfRecords) break;
+
+ // Êîãäà îñòàíîâèòüñÿ?
+ switch (Interval)
+ {
+ case STAT_INTERVAL_HOUR:
+ i = 1; // Íîâûé ÷àñ íà÷èíàåòñÿ êàæäûé ÷àñ.
+ break;
+ case STAT_INTERVAL_DAY:
+ i = (0 == ProtoList[EldestAcc].AllStatistics[IndexP].Hour);
+ break;
+ case STAT_INTERVAL_WEEK:
+ i = (1 == DayOfWeek(ProtoList[EldestAcc].AllStatistics[IndexP].Day,
+ ProtoList[EldestAcc].AllStatistics[IndexP].Month,
+ ProtoList[EldestAcc].AllStatistics[IndexP].Year))
+ && (0 == ProtoList[EldestAcc].AllStatistics[IndexP].Hour);
+ break;
+ case STAT_INTERVAL_MONTH:
+ i = (1 == ProtoList[EldestAcc].AllStatistics[IndexP].Day)
+ && (0 == ProtoList[EldestAcc].AllStatistics[IndexP].Hour);
+ break;
+ case STAT_INTERVAL_YEAR:
+ i = (1 == ProtoList[EldestAcc].AllStatistics[IndexP].Month)
+ && (1 == ProtoList[EldestAcc].AllStatistics[IndexP].Day)
+ && (0 == ProtoList[EldestAcc].AllStatistics[IndexP].Hour);
+ break;
+ }
+
+ if (i) break;
+ }
+ }
+
+ return Result;
+}
+
+/* Ôóíêöèÿ âîçâðàùàåò êîëè÷åñòâî çàïèñåé â ñòàòèñòèêå äëÿ
+çàäàííîãî àêêàóíòà è çàäàííîãî èíòåðâàëà. */
+DWORD Stat_GetRecordsNumber(BYTE AccNum, BYTE Interval)
+{
+ DWORD Result, i;
+
+ // Íóæíî óçíàòü êîëè÷åñòâî çàïèñåé.
+ switch (Interval)
+ {
+ case STAT_INTERVAL_HOUR:
+ Result = ProtoList[AccNum].NumberOfRecords; // Äëÿ ïî÷àñîâîé ñòàòèñòèêè ñîâïàäàåò.
+ break;
+ case STAT_INTERVAL_DAY:
+ for (Result = 1, i = ProtoList[AccNum].NumberOfRecords - 1; i--; )
+ if (ProtoList[AccNum].AllStatistics[i].Day != ProtoList[AccNum].AllStatistics[i+1].Day)
+ Result++;
+ break;
+ case STAT_INTERVAL_WEEK:
+ for (Result = 1, i = ProtoList[AccNum].NumberOfRecords; i--; )
+ if ( ProtoList[AccNum].AllStatistics[i].Hour == 23
+ && DayOfWeek(ProtoList[AccNum].AllStatistics[i].Day,
+ ProtoList[AccNum].AllStatistics[i].Month,
+ ProtoList[AccNum].AllStatistics[i].Year) == 7)
+ Result++;
+ break;
+ case STAT_INTERVAL_MONTH:
+ for (Result = 1, i = ProtoList[AccNum].NumberOfRecords - 1; i--; )
+ if (ProtoList[AccNum].AllStatistics[i].Month != ProtoList[AccNum].AllStatistics[i+1].Month)
+ Result++;
+ break;
+ case STAT_INTERVAL_YEAR:
+ for (Result = 1, i = ProtoList[AccNum].NumberOfRecords - 1; i--; )
+ if (ProtoList[AccNum].AllStatistics[i].Year != ProtoList[AccNum].AllStatistics[i+1].Year)
+ Result++;
+ break;
+ }
+
+ return Result;
+}
+
+BYTE Stat_GetEldestAcc(WORD SelectedAccs)
+{
+ BYTE Result, i;
+
+ // Óçíà¸ì íîìåð àêêàóíòà èç ÷èñëà âûáðàííûõ, èìåþùåãî ñàìóþ ñòàðóþ ïåðâóþ çàïèñü.
+ // (Ýòî àêêàóíò ñ ìàêñèìàëüíûì êîëè÷åñòâîì çàïèñåé.)
+ for (Result = i = 0; i < NumberOfAccounts; i++)
+ {
+ // Íàäî ñ ÷åãî-òî íà÷àòü ïîèñê.
+ if ( 0x01 & (SelectedAccs >> i))
+ {
+ Result = i;
+ break;
+ }
+ }
+ // Ïðîäîëæàåì ïîèñê.
+ for (; ++i < NumberOfAccounts; )
+ {
+ if ( 0x01 & (SelectedAccs >> i) && (ProtoList[i].NumberOfRecords > ProtoList[Result].NumberOfRecords) )
+ Result = i;
+ }
+
+ return Result;
+} \ No newline at end of file
diff --git a/plugins/TrafficCounter/statistics.h b/plugins/TrafficCounter/statistics.h
new file mode 100644
index 0000000000..2fcff8520b
--- /dev/null
+++ b/plugins/TrafficCounter/statistics.h
@@ -0,0 +1,45 @@
+#ifndef _statistics_h
+#define _statistics_h
+
+/*
+Traffic Counter plugin for Miranda IM
+Copyright 2007-2011 Mironych.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#define STAT_INTERVAL_HOUR 0
+#define STAT_INTERVAL_DAY 1
+#define STAT_INTERVAL_WEEK 2
+#define STAT_INTERVAL_MONTH 3
+#define STAT_INTERVAL_YEAR 4
+
+#define STAT_UNITS_BYTES 0
+#define STAT_UNITS_KB 1
+#define STAT_UNITS_MB 2
+#define STAT_UNITS_ADAPTIVE 3
+
+BOOL CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+void Stat_ReadFile(BYTE);
+void Stat_Show(HWND);
+void Stat_UpdateTotalTraffic(HWND, DWORD, DWORD);
+void Stat_CheckStatistics(BYTE);
+DWORD Stat_GetStartIndex(BYTE AccNum, BYTE Interval, DWORD ItemNumber, SYSTEMTIME *st);
+void Stat_SetAccShift(BYTE AccNum, BYTE EldestAccount);
+DWORD Stat_GetItemValue(WORD SelectedAccs, BYTE Interval, DWORD ItemNum, BYTE SubitemNum);
+DWORD Stat_GetRecordsNumber(BYTE AccNum, BYTE Interval);
+BYTE Stat_GetEldestAcc(WORD SelectedAccs);
+
+#endif _statistics_h \ No newline at end of file
diff --git a/plugins/TrafficCounter/vars.c b/plugins/TrafficCounter/vars.c
new file mode 100644
index 0000000000..bc2cda965f
--- /dev/null
+++ b/plugins/TrafficCounter/vars.c
@@ -0,0 +1,185 @@
+/*
+Traffic Counter plugin for Miranda IM
+Copyright 2007-2011 Mironych.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+/* ======================================================================================
+Çäåñü ñîäåðæàòñÿ ôóíêöèè äëÿ ïîääåðæêè ïëàãèíà Variables
+Àâòîð: Mironych
+=======================================================================================*/
+
+#include "commonheaders.h"
+
+static TCHAR* GetTraffic(ARGUMENTSINFO *ai)
+{
+ DWORD tmp, tmpsn = 0, tmprn = 0, tmpst = 0, tmprt = 0;
+ BYTE ed;
+ WORD l;
+ TCHAR *res;
+
+ if (ai->argc != 5) return NULL;
+
+ if (!_tcscmp(ai->targv[1], _T("overall")))
+ {
+ tmpsn = OverallInfo.CurrentSentTraffic;
+ tmprn = OverallInfo.CurrentRecvTraffic;
+ tmpst = OverallInfo.TotalSentTraffic;
+ tmprt = OverallInfo.TotalRecvTraffic;
+ }
+ else
+ if (!_tcscmp(ai->targv[1], _T("summary")))
+ {
+ for (ed = 0; ed < NumberOfAccounts; ed++)
+ if (ProtoList[ed].Visible)
+ {
+ tmpsn += ProtoList[ed].CurrentSentTraffic;
+ tmprn += ProtoList[ed].CurrentRecvTraffic;
+ tmpst += ProtoList[ed].TotalSentTraffic;
+ tmprt += ProtoList[ed].TotalRecvTraffic;
+ }
+ }
+ else
+ { // Èùåì èíäåêñ ïðîòîêîëà, ïåðåäàííîãî ïåðâûì àðãóìåíòîì
+ for (tmp = ed = 0; ed < NumberOfAccounts; ed++)
+ {
+ TCHAR *buf;
+ if (!ProtoList[ed].name) continue;
+ buf = mir_a2t(ProtoList[ed].name);
+ if (!_tcscmp(buf, ai->targv[1]))
+ {
+ tmpsn = ProtoList[ed].CurrentSentTraffic;
+ tmprn = ProtoList[ed].CurrentRecvTraffic;
+ tmpst = ProtoList[ed].TotalSentTraffic;
+ tmprt = ProtoList[ed].TotalRecvTraffic;
+ tmp = 0xAA; // Ïðèçíàê òîãî, ÷òî ïðîòîêîë áûë íàéäåí
+ }
+ mir_free(buf);
+ }
+ if (tmp != 0xAA) return NULL;
+ }
+
+ if (!_tcscmp(ai->targv[2], _T("now")))
+ {
+ if (!_tcscmp(ai->targv[3], _T("sent"))) tmp = tmpsn;
+ else
+ if (!_tcscmp(ai->targv[3], _T("received"))) tmp = tmprn;
+ else
+ if (!_tcscmp(ai->targv[3], _T("both"))) tmp = tmprn + tmpsn;
+ else return NULL;
+ }
+ else
+ if (!_tcscmp(ai->targv[2], _T("total")))
+ {
+ if (!_tcscmp(ai->targv[3], _T("sent"))) tmp = tmpst;
+ else
+ if (!_tcscmp(ai->targv[3], _T("received"))) tmp = tmprt;
+ else
+ if (!_tcscmp(ai->targv[3], _T("both"))) tmp = tmprt + tmpst;
+ else return NULL;
+ }
+ else return NULL;
+
+ if (!_tcscmp(ai->targv[4], _T("b"))) ed = 0;
+ else
+ if (!_tcscmp(ai->targv[4], _T("k"))) ed = 1;
+ else
+ if (!_tcscmp(ai->targv[4], _T("m"))) ed = 2;
+ else
+ if (!_tcscmp(ai->targv[4], _T("d"))) ed = 3;
+ else return NULL;
+
+ // Ïîëó÷àåì ôîðìàòèðîâàííóþ ñòðîêó è âîçâðàùàåì óêàçàòåëü íà íå¸.
+ // Ñíà÷àëà óçíàåì ðàçìåð áóôåðà.
+ l = GetFormattedTraffic(tmp, ed, NULL, 0);
+ res = (TCHAR*)mir_alloc(l * sizeof(TCHAR));
+ if (!res) return NULL;
+ if (GetFormattedTraffic(tmp, ed, res, l))
+ return res;
+
+ return NULL;
+}
+
+static TCHAR* GetTime(ARGUMENTSINFO *ai)
+{
+ BYTE ed, flag;
+ TCHAR *res = NULL;
+ WORD l;
+ DWORD Duration;
+
+ if (ai->argc != 4) return NULL;
+
+ // Èùåì èíäåêñ ïðîòîêîëà, ïåðåäàííîãî ïåðâûì àðãóìåíòîì
+ for (flag = ed = 0; ed < NumberOfAccounts; ed++)
+ {
+ TCHAR *buf;
+ if (!ProtoList[ed].name) continue;
+ buf = mir_a2t(ProtoList[ed].name);
+ if (!_tcscmp(buf, ai->targv[1]))
+ {
+ flag = 0xAA;
+ if (!_tcscmp(ai->targv[2], _T("now")))
+ Duration = ProtoList[ed].Session.Timer;
+ else if (!_tcscmp(ai->targv[2], _T("total")))
+ Duration = ProtoList[ed].Total.Timer;
+ else flag = 0;
+ break;
+ }
+ mir_free(buf);
+ }
+ if ( (flag != 0xAA) && !_tcscmp(ai->targv[1], _T("summary")) )
+ {
+ flag = 0xAA;
+ if (!_tcscmp(ai->targv[2], _T("now")))
+ Duration = OverallInfo.Session.Timer;
+ else if (!_tcscmp(ai->targv[2], _T("total")))
+ Duration = OverallInfo.Total.Timer;
+ else flag = 0;
+ }
+
+ if (flag != 0xAA) return NULL;
+
+ // Ïîëó÷àåì ôîðìàòèðîâàííóþ ñòðîêó è âîçâðàùàåì óêàçàòåëü íà íå¸.
+ // Ñíà÷àëà óçíàåì ðàçìåð áóôåðà.
+ l = GetDurationFormatM(Duration, ai->targv[3], NULL, 0);
+ res = (TCHAR*)mir_alloc(l * sizeof(TCHAR));
+ if (!res) return NULL;
+ GetDurationFormatM(Duration, ai->targv[3], res, l);
+
+ return res;
+}
+
+void RegisterVariablesTokens(void)
+{
+ TOKENREGISTER trs;
+
+ if (!ServiceExists(MS_VARS_REGISTERTOKEN)) return;
+
+ ZeroMemory(&trs, sizeof(trs));
+ trs.cbSize = sizeof(TOKENREGISTER);
+
+ // Ôóíêöèÿ, âîçâðàùàþùàÿ òðàôèê
+ trs.tszTokenString = _T("tc_GetTraffic");
+ trs.parseFunctionT = GetTraffic;
+ trs.szHelpText = "Traffic counter\t(A,B,C,D)\tGet traffic counter value. A: <ProtocolName> OR overall OR summary; B: now OR total; C: sent OR received OR both; D: b - in bytes, k - in kilobytes, m - in megabytes, d - dynamic";
+ trs.flags = TRF_TCHAR | TRF_PARSEFUNC | TRF_FUNCTION | TRF_FREEMEM;
+ trs.memType = TR_MEM_MIRANDA;
+ CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&trs);
+ // Ôóíêöèÿ, âîçâðàùàþùàÿ âðåìÿ
+ trs.tszTokenString = _T("tc_GetTime");
+ trs.parseFunctionT = GetTime;
+ trs.szHelpText = "Traffic counter\t(A,B,C)\tGet time counter value. A: <ProtocolName> OR summary; B: now OR total; C: format";
+ CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&trs);
+}
diff --git a/plugins/TrafficCounter/vars.h b/plugins/TrafficCounter/vars.h
new file mode 100644
index 0000000000..9c18990911
--- /dev/null
+++ b/plugins/TrafficCounter/vars.h
@@ -0,0 +1,9 @@
+#ifndef _vars_h
+#define _vars_h
+
+//extern BYTE numProto;
+extern BYTE NumberOfAccounts;
+//extern PROTOLIST *ProtoList;
+void RegisterVariablesTokens(void);
+
+#endif _vars_h \ No newline at end of file
diff --git a/plugins/TrafficCounter/version.h b/plugins/TrafficCounter/version.h
new file mode 100644
index 0000000000..d90dc2ec3e
--- /dev/null
+++ b/plugins/TrafficCounter/version.h
@@ -0,0 +1,3 @@
+#define __FILEVERSION_STRING 0,1,1,8
+#define __VERSION_STRING "0.1.1.8"
+#define __VERSION_DWORD 0x00010108