diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/Nudge/src/nudge.cpp | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/Nudge/src/nudge.cpp')
-rw-r--r-- | plugins/Nudge/src/nudge.cpp | 85 |
1 files changed, 40 insertions, 45 deletions
diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp index 0fd8bf670f..dfac692132 100644 --- a/plugins/Nudge/src/nudge.cpp +++ b/plugins/Nudge/src/nudge.cpp @@ -4,97 +4,92 @@ void CNudge::Save(void) {
char SectionName[512];
mir_snprintf(SectionName, "useByProtocol");
- db_set_b(NULL, MODULENAME, SectionName, this->useByProtocol);
+ g_plugin.setByte(SectionName, this->useByProtocol);
mir_snprintf(SectionName, "RecvTimeSec");
- db_set_dw(NULL, MODULENAME, SectionName, this->recvTimeSec);
+ g_plugin.setDword(SectionName, this->recvTimeSec);
mir_snprintf(SectionName, "SendTimeSec");
- db_set_dw(NULL, MODULENAME, SectionName, this->sendTimeSec);
+ g_plugin.setDword(SectionName, this->sendTimeSec);
mir_snprintf(SectionName, "ResendDelaySec");
- db_set_dw(NULL, MODULENAME, SectionName, this->resendDelaySec);
+ g_plugin.setDword(SectionName, this->resendDelaySec);
}
void CNudge::Load(void)
{
char SectionName[512];
mir_snprintf(SectionName, "useByProtocol");
- this->useByProtocol = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
+ this->useByProtocol = g_plugin.getByte(SectionName, FALSE) != 0;
mir_snprintf(SectionName, "RecvTimeSec");
- this->recvTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
+ this->recvTimeSec = g_plugin.getDword(SectionName, 30);
mir_snprintf(SectionName, "SendTimeSec");
- this->sendTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
+ this->sendTimeSec = g_plugin.getDword(SectionName, 30);
mir_snprintf(SectionName, "ResendDelaySec");
- this->resendDelaySec = db_get_dw(NULL, MODULENAME, SectionName, 3);
+ this->resendDelaySec = g_plugin.getDword(SectionName, 3);
}
void CNudgeElement::Save(void)
{
char SectionName[512];
mir_snprintf(SectionName, "%s-openMessageWindow", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->openMessageWindow);
+ g_plugin.setByte(SectionName, this->openMessageWindow);
mir_snprintf(SectionName, "%s-openContactList", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->openContactList);
+ g_plugin.setByte(SectionName, this->openContactList);
mir_snprintf(SectionName, "%s-useIgnore", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->useIgnoreSettings);
+ g_plugin.setByte(SectionName, this->useIgnoreSettings);
mir_snprintf(SectionName, "%s-showStatus", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->showStatus);
+ g_plugin.setByte(SectionName, this->showStatus);
mir_snprintf(SectionName, "%s-showPopup", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->showPopup);
+ g_plugin.setByte(SectionName, this->showPopup);
mir_snprintf(SectionName, "%s-shakeClist", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->shakeClist);
+ g_plugin.setByte(SectionName, this->shakeClist);
mir_snprintf(SectionName, "%s-shakeChat", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->shakeChat);
+ g_plugin.setByte(SectionName, this->shakeChat);
mir_snprintf(SectionName, "%s-enabled", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->enabled);
+ g_plugin.setByte(SectionName, this->enabled);
mir_snprintf(SectionName, "%s-autoResend", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->autoResend);
+ g_plugin.setByte(SectionName, this->autoResend);
mir_snprintf(SectionName, "%s-statusFlags", ProtocolName);
- db_set_dw(NULL, MODULENAME, SectionName, this->statusFlags);
+ g_plugin.setDword(SectionName, this->statusFlags);
mir_snprintf(SectionName, "%s-recText", ProtocolName);
- db_set_ws(NULL, MODULENAME, SectionName, this->recText);
+ g_plugin.setWString(SectionName, this->recText);
mir_snprintf(SectionName, "%s-senText", ProtocolName);
- db_set_ws(NULL, MODULENAME, SectionName, this->senText);
+ g_plugin.setWString(SectionName, this->senText);
}
void CNudgeElement::Load(void)
{
- DBVARIANT dbv;
char SectionName[512];
mir_snprintf(SectionName, "%s-openMessageWindow", ProtocolName);
- this->openMessageWindow = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->openMessageWindow = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-openContactList", ProtocolName);
- this->openContactList = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->openContactList = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-useIgnore", ProtocolName);
- this->useIgnoreSettings = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->useIgnoreSettings = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-showStatus", ProtocolName);
- this->showStatus = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->showStatus = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-showPopup", ProtocolName);
- this->showPopup = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->showPopup = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-shakeClist", ProtocolName);
- this->shakeClist = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->shakeClist = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-shakeChat", ProtocolName);
- this->shakeChat = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->shakeChat = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-enabled", ProtocolName);
- this->enabled = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->enabled = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-autoResend", ProtocolName);
- this->autoResend = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
+ this->autoResend = g_plugin.getByte(SectionName, FALSE) != 0;
mir_snprintf(SectionName, "%s-statusFlags", ProtocolName);
- this->statusFlags = db_get_dw(NULL, MODULENAME, SectionName, 967);
+ this->statusFlags = g_plugin.getDword(SectionName, 967);
mir_snprintf(SectionName, "%s-recText", ProtocolName);
- if (!db_get_ws(NULL, MODULENAME, SectionName, &dbv)) {
- wcsncpy(this->recText, dbv.pwszVal, TEXT_LEN);
- if (wcslen(this->recText) < 1)
- wcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN);
- db_free(&dbv);
- }
- else wcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN);
+ 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);
- if (!db_get_ws(NULL, MODULENAME, SectionName, &dbv)) {
- wcsncpy(this->senText, dbv.pwszVal, TEXT_LEN);
- if (wcslen(this->senText) < 1)
- wcsncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN);
- db_free(&dbv);
- }
- else wcsncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN);
+ 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);
}
|