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

void CNudge::Save(void)
{
	char SectionName[512];
	mir_snprintf(SectionName, "useByProtocol");
	g_plugin.setByte(SectionName, this->useByProtocol);
	mir_snprintf(SectionName, "RecvTimeSec");
	g_plugin.setDword(SectionName, this->recvTimeSec);
	mir_snprintf(SectionName, "SendTimeSec");
	g_plugin.setDword(SectionName, this->sendTimeSec);
	mir_snprintf(SectionName, "ResendDelaySec");
	g_plugin.setDword(SectionName, this->resendDelaySec);
}

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

void CNudgeElement::Save(void)
{
	char SectionName[512];
	mir_snprintf(SectionName, "%s-openMessageWindow", ProtocolName);
	g_plugin.setByte(SectionName, this->openMessageWindow);
	mir_snprintf(SectionName, "%s-openContactList", ProtocolName);
	g_plugin.setByte(SectionName, this->openContactList);
	mir_snprintf(SectionName, "%s-useIgnore", ProtocolName);
	g_plugin.setByte(SectionName, this->useIgnoreSettings);
	mir_snprintf(SectionName, "%s-showStatus", ProtocolName);
	g_plugin.setByte(SectionName, this->showStatus);
	mir_snprintf(SectionName, "%s-showPopup", ProtocolName);
	g_plugin.setByte(SectionName, this->showPopup);
	mir_snprintf(SectionName, "%s-shakeClist", ProtocolName);
	g_plugin.setByte(SectionName, this->shakeClist);
	mir_snprintf(SectionName, "%s-shakeChat", ProtocolName);
	g_plugin.setByte(SectionName, this->shakeChat);
	mir_snprintf(SectionName, "%s-enabled", ProtocolName);
	g_plugin.setByte(SectionName, this->enabled);
	mir_snprintf(SectionName, "%s-autoResend", ProtocolName);
	g_plugin.setByte(SectionName, this->autoResend);
	mir_snprintf(SectionName, "%s-statusFlags", ProtocolName);
	g_plugin.setDword(SectionName, this->statusFlags);
	mir_snprintf(SectionName, "%s-recText", ProtocolName);
	g_plugin.setWString(SectionName, this->recText);
	mir_snprintf(SectionName, "%s-senText", ProtocolName);
	g_plugin.setWString(SectionName, this->senText);
}

void CNudgeElement::Load(void)
{
	char SectionName[512];
	mir_snprintf(SectionName, "%s-openMessageWindow", ProtocolName);
	this->openMessageWindow = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-openContactList", ProtocolName);
	this->openContactList = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-useIgnore", ProtocolName);
	this->useIgnoreSettings = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-showStatus", ProtocolName);
	this->showStatus = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-showPopup", ProtocolName);
	this->showPopup = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-shakeClist", ProtocolName);
	this->shakeClist = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-shakeChat", ProtocolName);
	this->shakeChat = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-enabled", ProtocolName);
	this->enabled = g_plugin.getByte(SectionName, TRUE) != 0;
	mir_snprintf(SectionName, "%s-autoResend", ProtocolName);
	this->autoResend = g_plugin.getByte(SectionName, FALSE) != 0;
	mir_snprintf(SectionName, "%s-statusFlags", ProtocolName);
	this->statusFlags = g_plugin.getDword(SectionName, 967);

	mir_snprintf(SectionName, "%s-recText", ProtocolName);
	ptrW wszRecvText(g_plugin.getWStringA(SectionName));
	if (mir_wstrlen(wszRecvText) > 0)
		wcsncpy_s(this->recText, wszRecvText, _TRUNCATE);
	else
		wcsncpy_s(this->recText, TranslateT("You received a nudge"), _TRUNCATE);

	mir_snprintf(SectionName, "%s-senText", ProtocolName);
	ptrW wszSendText(g_plugin.getWStringA(SectionName));
	if (mir_wstrlen(wszSendText) > 0)
		wcsncpy_s(this->senText, wszSendText, _TRUNCATE);
	else
		wcsncpy_s(this->senText, TranslateT("You sent a nudge"), _TRUNCATE);
}