From 53fe3e46177d17b4941610de19f5cc6210700cb4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 21:44:56 +0300 Subject: db_* functions replaced with g_plugin calls --- plugins/Nudge/src/nudge.cpp | 85 +++++++++++++++++++++------------------------ plugins/Nudge/src/shake.cpp | 16 ++++----- 2 files changed, 48 insertions(+), 53 deletions(-) (limited to 'plugins/Nudge/src') 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); } diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index f9c9bc3e2e..eeb9851da9 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -4,17 +4,17 @@ void CShake::Load(void) { Shaking = false; ShakingChat = false; - nScaleClist = db_get_dw(NULL, MODULENAME, "ScaleClist", 5); - nScaleChat = db_get_dw(NULL, MODULENAME, "ScaleChat", 2); - nMoveClist = db_get_dw(NULL, MODULENAME, "MoveClist", 15); - nMoveChat = db_get_dw(NULL, MODULENAME, "MoveChat", 15); + nScaleClist = g_plugin.getDword("ScaleClist", 5); + nScaleChat = g_plugin.getDword("ScaleChat", 2); + nMoveClist = g_plugin.getDword("MoveClist", 15); + nMoveChat = g_plugin.getDword("MoveChat", 15); } void CShake::Save(void) { - db_set_dw(NULL, MODULENAME, "ScaleClist", this->nScaleClist); - db_set_dw(NULL, MODULENAME, "ScaleChat", this->nScaleChat); - db_set_dw(NULL, MODULENAME, "MoveClist", this->nMoveClist); - db_set_dw(NULL, MODULENAME, "MoveChat", this->nMoveChat); + g_plugin.setDword("ScaleClist", this->nScaleClist); + g_plugin.setDword("ScaleChat", this->nScaleChat); + g_plugin.setDword("MoveClist", this->nMoveClist); + g_plugin.setDword("MoveChat", this->nMoveChat); } void __cdecl ShakeChatWindow(void *Param) -- cgit v1.2.3