summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h
blob: 70118e0e38c89dc003023726afc6c27c646838bc (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
/*
    AdvancedAutoAway 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 __ADVANCED_AUTOAWAY_HEADER
#define __ADVANCED_AUTOAWAY_HEADER

#define AAAMODULENAME        "AdvancedAutoAway"
#define SETTING_IGNLOCK      "IgnoreLockKeys"
#define SETTING_IGNSYSKEYS   "IgnoreSysKeys"
#define SETTING_IGNALTCOMBO  "IgnoreAltCombo"
#define SETTING_SAMESETTINGS "SameAutoAwaySettings"
#define SETTING_ALL          "ALLPROTOS"
#define SETTING_MSGCUSTOM    "Custom"
#define SETTING_STATUSMSG    "Msg"
#define SETTING_CONFIRMDELAY "ConfirmTimeout"

#define SETTING_AWAYTIME_DEFAULT 5
#define SETTING_NATIME_DEFAULT  20
#define SETTING_AWAYCHECKTIMEINSECS "CheckInterval"

#define STATUS_RESET    1
#define STATUS_AUTOAWAY 2
#define STATUS_AUTONA   3

#define SETTING_MONITORMOUSE    "MonitorMouse"
#define SETTING_MONITORKEYBOARD "MonitorKeyboard"

#define FLAG_ONSAVER        0x0001 // db: set lv1 status on screensaver ?
#define FLAG_ONMOUSE        0x0002 // db: set after inactivity ?
#define FLAG_SETNA          0x0004 // db: set NA after xx of away time ?
#define FLAG_CONFIRM        0x0008 // db: show confirm dialog ?
#define FLAG_RESET          0x0010 // db: restore status ?
#define FLAG_LV2ONINACTIVE  0x0020 // db: set lv2 only on inactivity
#define FLAG_MONITORMIRANDA 0x0040 // db: monitor miranda activity only
#define FLAG_ONLOCK         0x0080 // db: on work station lock
#define FLAG_FULLSCREEN     0x0100 // db: on full screen

struct TAAAProtoSetting : public PROTOCOLSETTINGEX, public MZeroedObject
{
	TAAAProtoSetting(PROTOACCOUNT *pa);
	~TAAAProtoSetting();

	int originalStatusMode;
	STATES
		oldState,
		curState;
	BOOL statusChanged; // AAA changed the status, don't update mStatus
	BOOL mStatus; // status changed manually or not ?
	int optionFlags, // db: see above
		 awayTime, // db: time to wait for inactivity
		 naTime, // db: time to wait after away is set
		 statusFlags; // db: set lv1 status if this is original status
	WORD lv1Status, // db
		  lv2Status; // db
	unsigned int sts1setTimer;
};

static int AAACompareSettings(const TAAAProtoSetting *p1, const TAAAProtoSetting *p2)
{
	return mir_strcmp(p1->szName, p2->szName);
}

struct AAMSGSETTING
{
	short useCustom;
	int   status;
	char* msg;
};

void AdvancedAutoAwayLoad();
void AdvancedAutoAwayUnload();

typedef OBJLIST<TAAAProtoSetting> TAAAProtoSettingList;
extern TAAAProtoSettingList autoAwaySettings;

int  LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char *protoName);
void AAALoadOptions(TAAAProtoSettingList &settings, BOOL override);

#endif