summaryrefslogtreecommitdiff
path: root/plugins/TrafficCounter/src/TrafficCounter.h
blob: 428a8376a605f346526946b8bb2c18fc5a615b35 (plain)
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
/*
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);
int ModuleLoad(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_PTR MenuCommand_TrafficShowHide(WPARAM, LPARAM);
void Traffic_AddMainMenuItem(void);

typedef	struct
{
	BYTE Hour, Day, Month;
	WORD Year;
	DWORD Incoming, Outgoing;
	WORD Time;
} HOURLYSTATS;

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;


#endif;