1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
#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
#ifndef _WIN64
#define _USE_32BIT_TIME_T
#endif
// 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
|