From ed9e9297ad8ae631d8856ba8917c92b545be4ebf Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 1 Aug 2015 19:49:12 +0000 Subject: TrafficCounter: common project git-svn-id: http://svn.miranda-ng.org/main/trunk@14792 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TrafficCounter/src/TrafficCounter.cpp | 2 +- plugins/TrafficCounter/src/commonheaders.cpp | 1 - plugins/TrafficCounter/src/commonheaders.h | 175 -------------------------- plugins/TrafficCounter/src/misc.cpp | 2 +- plugins/TrafficCounter/src/options.cpp | 2 +- plugins/TrafficCounter/src/opttree.cpp | 2 +- plugins/TrafficCounter/src/statistics.cpp | 2 +- plugins/TrafficCounter/src/stdafx.cxx | 18 +++ plugins/TrafficCounter/src/stdafx.h | 173 +++++++++++++++++++++++++ plugins/TrafficCounter/src/vars.cpp | 2 +- 10 files changed, 197 insertions(+), 182 deletions(-) delete mode 100644 plugins/TrafficCounter/src/commonheaders.cpp delete mode 100644 plugins/TrafficCounter/src/commonheaders.h create mode 100644 plugins/TrafficCounter/src/stdafx.cxx create mode 100644 plugins/TrafficCounter/src/stdafx.h (limited to 'plugins/TrafficCounter/src') diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 8e04d461c6..511e6d5266 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -17,7 +17,7 @@ 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 "stdafx.h" /*-------------------------------------------------------------------------------------------------------------------*/ //GLOBAL diff --git a/plugins/TrafficCounter/src/commonheaders.cpp b/plugins/TrafficCounter/src/commonheaders.cpp deleted file mode 100644 index 14f99f7d71..0000000000 --- a/plugins/TrafficCounter/src/commonheaders.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "commonheaders.h" diff --git a/plugins/TrafficCounter/src/commonheaders.h b/plugins/TrafficCounter/src/commonheaders.h deleted file mode 100644 index 4a2a56be57..0000000000 --- a/plugins/TrafficCounter/src/commonheaders.h +++ /dev/null @@ -1,175 +0,0 @@ -#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 _CRT_SECURE_NO_WARNINGS - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "resource.h" -#include "version.h" -#include "misc.h" -#include "opttree.h" -#include "vars.h" -#include "statistics.h" -#include "TrafficCounter.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; - -//--------------------------------------------------------------------------------------------- -// Различные флаги -//--------------------------------------------------------------------------------------------- -typedef 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 - }; -} uTCFLAGS; - -extern HINSTANCE hInst; - -extern HWND TrafficHwnd; -extern PROTOLIST *ProtoList; -extern uTCFLAGS unOptions; - -extern int Traffic_PopupBkColor; -extern int Traffic_PopupFontColor; -extern char Traffic_Notify_time_value; -extern int Traffic_Notify_size_value; -extern char Traffic_PopupTimeoutDefault; -extern char Traffic_PopupTimeoutValue; -extern char Traffic_AdditionSpace; - -extern TCHAR Traffic_CounterFormat[512]; -extern TCHAR Traffic_TooltipFormat[512]; - -extern BOOL bPopupExists, bVariablesExists, bTooltipExists; - -extern BOOL UseKeyColor; -extern COLORREF KeyColor; - -extern HGENMENU hTrafficMainMenuItem; - -extern WORD Stat_SelAcc; -extern OPTTREE_OPTION *pOptions; // Объявлено в модуле TrafficCounter.c. -extern PROTOLIST OverallInfo; - -#endif diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index ebc9c515f6..c798f14add 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -17,7 +17,7 @@ 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 "stdafx.h" /* Функция разбирает строку и возвращает список тегов и соответствующих им строк. Аргументы: diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index 3d383cb86d..449ef3b315 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Автор: Mironych =======================================================================================*/ -#include "commonheaders.h" +#include "stdafx.h" OPTTREE_OPTION *pOptions; // Через этот указатель модуль opttree.c может добраться до списка опций. diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp index 846e9fef93..8189b5d7f5 100644 --- a/plugins/TrafficCounter/src/opttree.cpp +++ b/plugins/TrafficCounter/src/opttree.cpp @@ -21,7 +21,7 @@ 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 "stdafx.h" HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name); HTREEITEM OptTree_AddItem(HWND hwndTree, TCHAR *name, LPARAM lParam, int iconIndex); diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index 511560baa3..d8ef8fac80 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Автор: Mironych =======================================================================================*/ -#include "commonheaders.h" +#include "stdafx.h" WORD Stat_SelAcc; // Выбранные аккаунты в окне статистики diff --git a/plugins/TrafficCounter/src/stdafx.cxx b/plugins/TrafficCounter/src/stdafx.cxx new file mode 100644 index 0000000000..6fb37564b7 --- /dev/null +++ b/plugins/TrafficCounter/src/stdafx.cxx @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) + +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 version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" \ No newline at end of file diff --git a/plugins/TrafficCounter/src/stdafx.h b/plugins/TrafficCounter/src/stdafx.h new file mode 100644 index 0000000000..b8e8bb1618 --- /dev/null +++ b/plugins/TrafficCounter/src/stdafx.h @@ -0,0 +1,173 @@ +#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. +*/ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "resource.h" +#include "version.h" +#include "misc.h" +#include "opttree.h" +#include "vars.h" +#include "statistics.h" +#include "TrafficCounter.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; + +//--------------------------------------------------------------------------------------------- +// Различные флаги +//--------------------------------------------------------------------------------------------- +typedef 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 + }; +} uTCFLAGS; + +extern HINSTANCE hInst; + +extern HWND TrafficHwnd; +extern PROTOLIST *ProtoList; +extern uTCFLAGS unOptions; + +extern int Traffic_PopupBkColor; +extern int Traffic_PopupFontColor; +extern char Traffic_Notify_time_value; +extern int Traffic_Notify_size_value; +extern char Traffic_PopupTimeoutDefault; +extern char Traffic_PopupTimeoutValue; +extern char Traffic_AdditionSpace; + +extern TCHAR Traffic_CounterFormat[512]; +extern TCHAR Traffic_TooltipFormat[512]; + +extern BOOL bPopupExists, bVariablesExists, bTooltipExists; + +extern BOOL UseKeyColor; +extern COLORREF KeyColor; + +extern HGENMENU hTrafficMainMenuItem; + +extern WORD Stat_SelAcc; +extern OPTTREE_OPTION *pOptions; // Объявлено в модуле TrafficCounter.c. +extern PROTOLIST OverallInfo; + +#endif diff --git a/plugins/TrafficCounter/src/vars.cpp b/plugins/TrafficCounter/src/vars.cpp index 769685f1fc..5f55778802 100644 --- a/plugins/TrafficCounter/src/vars.cpp +++ b/plugins/TrafficCounter/src/vars.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Автор: Mironych =======================================================================================*/ -#include "commonheaders.h" +#include "stdafx.h" static TCHAR* GetTraffic(ARGUMENTSINFO *ai) { -- cgit v1.2.3