summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/KeepStatus/keepstatus.h
blob: 9df88b36bb60cd014e2ac04ebf593bddf1ee2e26 (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
/*
    KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
    Copyright 2003-2006 P. Boon

    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 __KEEPSTATUS_HEADER
#define __KEEPSTATUS_HEADER

#include <process.h>
#include <winsock.h>
#include <wininet.h>
#include <ipexport.h>
#include <Icmpapi.h>

#include <m_options.h>
#include <m_skin.h>
#include <m_utils.h>
#include "version.h"

#define __FILENAME                   "KeepStatus.dll"
#define MODULENAME                   "KeepStatus"
#define SETTING_CHECKCONNECTION      "CheckConnection"
#define SETTING_MAXRETRIES           "MaxRetries"
#define SETTING_INCREASEEXPONENTIAL  "IncreaseExponential"
#define SETTING_INITDELAY            "InitDelay"
#define SETTING_MAXDELAY             "MaxDelay"
#define SETTING_SHOWCONNECTIONPOPUPS "ShowConnectionPopups"
#define SETTING_CHKINET              "CheckInet"
#define SETTING_CNCOTHERLOC          "CancelIfOtherLocation"
#define SETTING_LOGINERR             "OnLoginErr"
#define SETTING_LOGINERR_DELAY       "OnLoginErrDelay"
#define SETTING_CONTCHECK            "ContinueslyCheck"
#define SETTING_BYPING               "ByPingingHost"
#define SETTING_PINGHOST             "HostToPing"
#define SETTING_CHECKAPMRESUME       "CheckAPMResume"
#define SETTING_FIRSTOFFLINE         "FirstOffline"
#define SETTING_NOLOCKED             "NoLocked"
#define SETTING_MAXCONNECTINGTIME    "MaxConnectingTime"
#define SETTING_PINGCOUNT            "PingCount"
#define DEFAULT_PINGCOUNT            1
#define SETTING_CNTDELAY             "CntDelay"
#define STATUSCHANGEDELAY            500 // ms
#define DEFAULT_MAXRETRIES           0
#define DEFAULT_INITDELAY            10 // s
#define DEFAULT_MAXDELAY             900 // s
#define AFTERCHECK_DELAY             10000 //ms (divided by 2)
#define CHECKCONTIN_DELAY            10 // s
#define SETTING_POPUP_DELAYTYPE      "PopupDelayType"
#define SETTING_POPUP_USEWINCOLORS   "PopupUseWinColors"
#define SETTING_POPUP_USEDEFCOLORS   "PopupUseDefColors"
#define SETTING_POPUP_BACKCOLOR      "PopupBackColor"
#define SETTING_POPUP_TEXTCOLOR      "PopupTextColor"
#define SETTING_POPUP_TIMEOUT        "PopupTimeout"
#define SETTING_POPUP_LEFTCLICK      "PopupLeftClickAction"
#define SETTING_POPUP_RIGHTCLICK     "PopupRightClickAction"
#define SETTING_PUOTHER              "PopupShowOther"
#define SETTING_PUCONNLOST           "PopupShowConnLost"
#define SETTING_PUCONNRETRY          "PopupShowConnRetry"
#define SETTING_PURESULT             "PopupShowResult"
#define SETTING_PUSHOWEXTRA          "PopupShowExtra"
#define POPUP_ACT_NOTHING            0
#define POPUP_ACT_CANCEL             1
#define POPUP_ACT_CLOSEPOPUP         2
#define POPUP_DELAYFROMPU            0
#define POPUP_DELAYCUSTOM            1
#define POPUP_DELAYPERMANENT         2
#define LOGINERR_NOTHING             0
#define LOGINERR_CANCEL              1
#define LOGINERR_SETDELAY            2

#define IDT_PROCESSACK               0x01
#define IDT_CHECKCONN                0x02
#define IDT_AFTERCHECK               0x04
#define IDT_CHECKCONTIN              0x08
#define IDT_CHECKCONNECTING          0x10

#define KS_ISENABLED                 WM_APP + 10
#define KS_ENABLEITEMS               WM_APP + 11

// action
#define SETTING_ENABLECHECKING       "EnableChecking"
// trigger
#define TRIGGERNAME                  "KeepStatus: Connection state change"
#define TRIGGER_CONNLOST             0x01
#define TRIGGER_LOGINERROR           0x02
#define TRIGGER_OTHERLOC             0x04
#define TRIGGER_CONNRETRY            0x08
#define TRIGGER_CONNSUCCESS          0x10
#define TRIGGER_CONNGIVEUP           0x20
#define SETTING_TRIGGERON            "TriggerOn"

struct TConnectionSettings : public PROTOCOLSETTINGEX
{
	TConnectionSettings( PROTOACCOUNT* pa );
	~TConnectionSettings();

	int lastStatusAckTime; // the time the last status ack was received
};

/* old; replaced by PROTOCOLSETTINGEX see m_statusplugins.h */
typedef struct {
	char *szName;	// pointer to protocol modulename
	WORD status;	// the status
	WORD lastStatus;// last status
} PROTOCOLSETTING;

/* old; replaced by ME_CS_STATUSCHANGE see m_statusplugins.h */
// wParam = PROTOCOLSETTING**
// lParam = 0
#define ME_CS_STATUSCHANGE				"CommonStatus/StatusChange"

/////////////////////////////////////////////////////////////////////////////////////////
// main.cpp

extern HINSTANCE hInst;
extern HANDLE hMainThread;
extern unsigned long mainThreadId;

/////////////////////////////////////////////////////////////////////////////////////////
// keepstatus.cpp

int LoadMainOptions();
LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

#endif //__KEEPSTATUS_HEADER