summaryrefslogtreecommitdiff
path: root/plugins/Nudge/src/nudge.cpp
blob: 5c83b6cfe928405f31168100cf8b78f3515ba32d (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
#include "headers.h"

void CNudge::Save(void)
{
	char SectionName[512];
	mir_snprintf(SectionName,512,"useByProtocol"); 
	db_set_b(NULL, "Nudge", SectionName, this->useByProtocol);
	mir_snprintf(SectionName,512,"RecvTimeSec");
	db_set_dw(NULL, "Nudge", SectionName, this->recvTimeSec);
	mir_snprintf(SectionName,512,"SendTimeSec");
	db_set_dw(NULL, "Nudge", SectionName, this->sendTimeSec);
	mir_snprintf(SectionName,512,"ResendDelaySec");
	db_set_dw(NULL, "Nudge", SectionName, this->resendDelaySec);
}


void CNudge::Load(void)
{
	char SectionName[512];
	mir_snprintf(SectionName,512,"useByProtocol"); 
	this->useByProtocol = db_get_b(NULL, "Nudge", SectionName, FALSE) != 0;
	mir_snprintf(SectionName,512,"RecvTimeSec");
	this->recvTimeSec = db_get_dw(NULL, "Nudge", SectionName, 30);
	mir_snprintf(SectionName,512,"SendTimeSec");
	this->sendTimeSec = db_get_dw(NULL, "Nudge", SectionName, 30);
	mir_snprintf(SectionName,512,"ResendDelaySec");
	this->resendDelaySec = db_get_dw(NULL, "Nudge", SectionName, 3);
}

void CNudgeElement::Save(void)
{
	char SectionName[512];
	mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName); 
	db_set_b(NULL, "Nudge", SectionName, this->openMessageWindow);
	mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName);
	db_set_b(NULL, "Nudge", SectionName, this->openContactList);
	mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName);
	db_set_b(NULL, "Nudge", SectionName, this->useIgnoreSettings);
	mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName); 
	db_set_b(NULL, "Nudge", SectionName, this->showStatus); 
	mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName); 
	db_set_b(NULL, "Nudge", SectionName, this->showPopup); 
	mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName); 
	db_set_b(NULL, "Nudge", SectionName, this->shakeClist); 
	mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName); 
	db_set_b(NULL, "Nudge", SectionName, this->shakeChat); 
	mir_snprintf(SectionName,512,"%s-enabled", ProtocolName); 
	db_set_b(NULL, "Nudge", SectionName, this->enabled);
	mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName); 
	db_set_b(NULL, "Nudge", SectionName, this->autoResend);
	mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName);
	db_set_dw(NULL, "Nudge", SectionName, this->statusFlags);
	mir_snprintf(SectionName,512,"%s-recText", ProtocolName);
	db_set_ts(NULL, "Nudge", SectionName, this->recText);
	mir_snprintf(SectionName,512,"%s-senText", ProtocolName);
	db_set_ts(NULL, "Nudge", SectionName, this->senText);
}


void CNudgeElement::Load(void)
{
	DBVARIANT dbv;
	char SectionName[512];
	mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName); 
	this->openMessageWindow = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
	mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName); 
	this->openContactList = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
	mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName); 
	this->useIgnoreSettings = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
	mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName); 
	this->showStatus = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0; 
	mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName); 
	this->showPopup = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0; 
	mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName); 
	this->shakeClist = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;  
	mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName); 
	this->shakeChat = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0; 
	mir_snprintf(SectionName,512,"%s-enabled", ProtocolName); 
	this->enabled = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
	mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName); 
	this->autoResend = db_get_b(NULL, "Nudge", SectionName, FALSE) != 0;
	mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName);
	this->statusFlags = db_get_dw(NULL, "Nudge", SectionName, 967);
	mir_snprintf(SectionName,512,"%s-recText", ProtocolName);
	if (!db_get_ts(NULL,"Nudge",SectionName,&dbv)) 
	{
		_tcsncpy(this->recText,dbv.ptszVal,TEXT_LEN);
		if(_tcsclen(this->recText) < 1)
			_tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN);
		db_free(&dbv);
	}
	else
		_tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN);
	mir_snprintf(SectionName,512,"%s-senText", ProtocolName);
	if (!db_get_ts(NULL,"Nudge",SectionName,&dbv)) 
	{
		_tcsncpy(this->senText,dbv.ptszVal,TEXT_LEN);
		if(_tcsclen(this->senText) < 1)
			_tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN);
		db_free(&dbv);
	}
	else
		_tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN);
}