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/SimpleStatusMsg | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/SimpleStatusMsg')
-rw-r--r-- | plugins/SimpleStatusMsg/src/main.cpp | 120 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/msgbox.cpp | 104 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/options.cpp | 150 | ||||
-rw-r--r-- | plugins/SimpleStatusMsg/src/utils.cpp | 8 |
4 files changed, 191 insertions, 191 deletions
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 95fc4dcff0..d67efcbb51 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -113,7 +113,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) wchar_t substituteStr[1024], *msg = mir_wstrdup(in);
for (int i = 0; msg[i]; i++) {
- if (msg[i] == 0x0D && db_get_b(NULL, MODULENAME, "RemoveCR", 0)) {
+ if (msg[i] == 0x0D && g_plugin.getByte("RemoveCR", 0)) {
wchar_t *p = msg + i;
if (i + 1 <= 1024 && msg[i + 1]) {
if (msg[i + 1] == 0x0A) {
@@ -140,7 +140,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
}
else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME))
- && db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1)) {
+ && g_plugin.getByte("AmpLeaveTitle", 1)) {
ptszWinampTitle = mir_wstrdup(g_ptszWinampSong);
}
else
@@ -219,7 +219,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) BOOL rmark[25];
for (k = 0; k < _countof(rmark); k++) rmark[k] = FALSE;
- int maxk = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ int maxk = g_plugin.getByte("MaxHist", 10);
if (maxk == 0) rmark[0] = TRUE;
while (!rmark[0]) {
@@ -231,7 +231,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) mir_snprintf(buff, "SMsg%d", k);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(buff);
if (tszStatusMsg == nullptr)
continue;
@@ -261,7 +261,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) BOOL rmark[25];
for (k = 0; k < _countof(rmark); k++) rmark[k] = FALSE;
- int maxk = db_get_w(NULL, MODULENAME, "DefMsgCount", 0);
+ int maxk = g_plugin.getWord("DefMsgCount", 0);
if (maxk == 0) rmark[0] = TRUE;
while (!rmark[0]) {
@@ -273,7 +273,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) mir_snprintf(buff, "DefMsg%d", k);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(buff);
if (tszStatusMsg == nullptr)
continue;
@@ -305,7 +305,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (szProto) {
char szSetting[80];
mir_snprintf(szSetting, "Proto%sMaxLen", szProto);
- size_t len = db_get_w(NULL, MODULENAME, szSetting, 1024);
+ size_t len = g_plugin.getWord(szSetting, 1024);
if (len < mir_wstrlen(msg)) {
msg = (wchar_t *)mir_realloc(msg, len * sizeof(wchar_t));
msg[len] = 0;
@@ -317,7 +317,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) wchar_t* InsertVarsIntoMsg(wchar_t *tszMsg, const char *szProto, int iStatus, MCONTACT hContact)
{
- if (ServiceExists(MS_VARS_FORMATSTRING) && db_get_b(NULL, MODULENAME, "EnableVariables", 1)) {
+ if (ServiceExists(MS_VARS_FORMATSTRING) && g_plugin.getByte("EnableVariables", 1)) {
wchar_t *tszVarsMsg = variables_parse(tszMsg, nullptr, hContact);
if (tszVarsMsg != nullptr) {
wchar_t *format = InsertBuiltinVarsIntoMsg(tszVarsMsg, szProto, iStatus);
@@ -335,7 +335,7 @@ static wchar_t* GetAwayMessageFormat(int iStatus, const char *szProto) wchar_t *format;
mir_snprintf(szSetting, "%sFlags", szProto ? szProto : "");
- int flags = db_get_b(NULL, MODULENAME, StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
+ int flags = g_plugin.getByte(StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
if (flags & STATUS_EMPTY_MSG) {
return mir_wstrdup(L"");
@@ -354,11 +354,11 @@ static wchar_t* GetAwayMessageFormat(int iStatus, const char *szProto) else
mir_snprintf(szSetting, "LastMsg");
- char *szLastMsg = db_get_sa(NULL, MODULENAME, szSetting);
+ char *szLastMsg = g_plugin.getStringA(szSetting);
if (szLastMsg == nullptr)
return nullptr; //mir_wstrdup(L"");
- format = db_get_wsa(NULL, MODULENAME, szLastMsg);
+ format = g_plugin.getWStringA(szLastMsg);
mir_free(szLastMsg);
}
else if (flags & STATUS_THIS_MSG) {
@@ -380,9 +380,9 @@ static wchar_t* GetAwayMessageFormat(int iStatus, const char *szProto) void DBWriteMessage(char *szSetting, wchar_t *tszMsg)
{
if (tszMsg && mir_wstrlen(tszMsg))
- db_set_ws(NULL, MODULENAME, szSetting, tszMsg);
+ g_plugin.setWString(szSetting, tszMsg);
else
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(szSetting);
}
void SaveMessageToDB(const char *szProto, wchar_t *tszMsg, BOOL bIsFormat)
@@ -430,7 +430,7 @@ void SaveStatusAsCurrent(const char *szProto, int iStatus) {
char szSetting[80];
mir_snprintf(szSetting, "Cur%sStatus", szProto);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)iStatus);
+ g_plugin.setWord(szSetting, (WORD)iStatus);
}
static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, MCONTACT hContact)
@@ -440,7 +440,7 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar if ((!iStatus || iStatus == ID_STATUS_CURRENT) && szProto) {
mir_snprintf(szSetting, "FCur%sMsg", szProto);
- format = db_get_wsa(NULL, MODULENAME, szSetting);
+ format = g_plugin.getWStringA(szSetting);
}
else {
if (!iStatus || iStatus == ID_STATUS_CURRENT)
@@ -450,17 +450,17 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar return nullptr;
mir_snprintf(szSetting, "Proto%sFlags", szProto ? szProto : "");
- int flags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int flags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (flags & PROTO_THIS_MSG) {
mir_snprintf(szSetting, "Proto%sDefault", szProto);
- format = db_get_wsa(NULL, MODULENAME, szSetting);
+ format = g_plugin.getWStringA(szSetting);
if (format == nullptr)
format = mir_wstrdup(L"");
}
else if (flags & PROTO_NOCHANGE && szProto) {
mir_snprintf(szSetting, "FCur%sMsg", szProto);
- format = db_get_wsa(NULL, MODULENAME, szSetting);
+ format = g_plugin.getWStringA(szSetting);
}
else if (flags & PROTO_POPUPDLG)
format = GetAwayMessageFormat(iStatus, szProto);
@@ -482,10 +482,10 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar int CheckProtoSettings(const char *szProto, int iInitialStatus)
{
- int iSetting = db_get_w(NULL, szProto, "LeaveStatus", -1); //GG settings
+ int iSetting = db_get_w(0, szProto, "LeaveStatus", -1); //GG settings
if (iSetting != -1)
return iSetting ? iSetting : iInitialStatus;
- iSetting = db_get_w(NULL, szProto, "OfflineMessageOption", -1); //TLEN settings
+ iSetting = db_get_w(0, szProto, "OfflineMessageOption", -1); //TLEN settings
if (iSetting != -1) {
switch (iSetting) {
case 1: return ID_STATUS_ONLINE;
@@ -530,7 +530,7 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus {
char szSetting[80];
mir_snprintf(szSetting, "Proto%sFlags", szProto);
- int flags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int flags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG) {
Proto_SetStatus(szProto, iInitialStatus, iStatus, nullptr);
@@ -540,7 +540,7 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus }
else if (flags & PROTO_THIS_MSG) {
mir_snprintf(szSetting, "Proto%sDefault", szProto);
- wchar_t *szSimpleStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *szSimpleStatusMsg = g_plugin.getWStringA(szSetting);
if (szSimpleStatusMsg != nullptr) {
SaveMessageToDB(szProto, szSimpleStatusMsg, TRUE);
wchar_t *msg = InsertVarsIntoMsg(szSimpleStatusMsg, szProto, iStatus, NULL);
@@ -574,7 +574,7 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam) if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
if (wParam == ID_STATUS_CURRENT || wParam == 0)
@@ -663,18 +663,18 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, wcha if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (!bOnStartup && db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (!bOnStartup && db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
if (iProfileStatus) {
int iProfileNumber = iStatus - 40083;
char szSetting[128];
mir_snprintf(szSetting, "%d_%s", iProfileNumber, pa->szModuleName);
- iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
+ iStatus = db_get_w(0, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
if (iStatus == ID_STATUS_IDLE) // the same as ID_STATUS_LAST in StartupStatus
{
mir_snprintf(szSetting, "last_%s", pa->szModuleName);
- iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
+ iStatus = db_get_w(0, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
}
else if (iStatus == ID_STATUS_CURRENT)
iStatus = GetCurrentStatus(pa->szModuleName);
@@ -877,7 +877,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) char szSetting[80];
mir_snprintf(szSetting, "%sFlags", szProto ? szProto : "");
- int iDlgFlags = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
+ int iDlgFlags = g_plugin.getByte((char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
BOOL bShowDlg = iDlgFlags & STATUS_SHOW_DLG || bOnStartup;
BOOL bScreenSaverRunning = IsScreenSaverRunning();
@@ -902,14 +902,14 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) }
mir_snprintf(szSetting, "Proto%sFlags", szProto);
- iProtoFlags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ iProtoFlags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG) {
if (HasProtoStaticStatusMsg(szProto, iStatus, iStatus))
return 1;
}
else if (iProtoFlags & PROTO_NOCHANGE && !bOnStartup) {
mir_snprintf(szSetting, "FCur%sMsg", szProto);
- wchar_t *msg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *msg = g_plugin.getWStringA(szSetting);
#ifdef _DEBUG
g_plugin.debugLogA("ChangeStatusMessage(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), msg, szProto);
@@ -954,7 +954,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (iStatus == ID_STATUS_OFFLINE || (!(accounts->statusMsgFlags & Proto_Status2Flag(iStatus)) && iStatus != ID_STATUS_CURRENT))
return 0;
- int iProtoFlags = db_get_b(NULL, MODULENAME, "ProtoFlags", PROTO_DEFAULT);
+ int iProtoFlags = g_plugin.getByte("ProtoFlags", PROTO_DEFAULT);
if (!bShowDlg || bScreenSaverRunning || (iProtoFlags & PROTO_NOCHANGE && !bOnStartup)) {
for (int i = 0; i < accounts->count; ++i) {
auto *pa = accounts->pa[i];
@@ -964,7 +964,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)) ||
@@ -974,7 +974,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) wchar_t *msg;
if (iProtoFlags & PROTO_NOCHANGE) {
mir_snprintf(szSetting, "FCur%sMsg", pa->szModuleName);
- msg = db_get_wsa(NULL, MODULENAME, szSetting);
+ msg = g_plugin.getWStringA(szSetting);
}
else
msg = GetAwayMessageFormat(iStatus, nullptr);
@@ -1047,7 +1047,7 @@ int SetStartupStatus(int i) }
mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
- int flags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int flags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG || flags & PROTO_THIS_MSG) {
if (HasProtoStaticStatusMsg(pa->szModuleName, ID_STATUS_OFFLINE, iStatus))
return 0;
@@ -1056,7 +1056,7 @@ int SetStartupStatus(int i) }
else if (flags & PROTO_NOCHANGE) {
mir_snprintf(szSetting, "FCur%sMsg", pa->szModuleName);
- fmsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ fmsg = g_plugin.getWStringA(szSetting);
}
else
fmsg = GetAwayMessageFormat(iStatus, pa->szModuleName);
@@ -1110,12 +1110,12 @@ VOID CALLBACK SetStartupStatusGlobal(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) }
// popup status msg dialog at startup?
- if (db_get_b(NULL, MODULENAME, "StartupPopupDlg", 1) && accounts->statusMsgFlags) {
+ if (g_plugin.getByte("StartupPopupDlg", 1) && accounts->statusMsgFlags) {
if (globalstatus)
ChangeStatusMessage(status_mode, (LPARAM)"SimpleStatusMsgGlobalStartupStatus");
else {
// pseudo-currentDesiredStatusMode ;-)
- db_set_w(NULL, MODULENAME, "StartupStatus", (WORD)temp_status_mode);
+ g_plugin.setWord("StartupStatus", (WORD)temp_status_mode);
ChangeStatusMessage(ID_STATUS_CURRENT, (LPARAM)"SimpleStatusMsgGlobalStartupStatus");
}
return;
@@ -1164,7 +1164,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) {
MIRANDA_IDLE_INFO mii;
Idle_GetInfo(mii);
- if (db_get_b(NULL, MODULENAME, "NoUpdateOnIdle", 1) && mii.idleType)
+ if (g_plugin.getByte("NoUpdateOnIdle", 1) && mii.idleType)
return;
if (!hwndSAMsgDialog) {
@@ -1188,7 +1188,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) continue;
mir_snprintf(szBuffer, "FCur%sMsg", pa->szModuleName);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szBuffer);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szBuffer);
if (tszStatusMsg == nullptr)
continue;
@@ -1197,7 +1197,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) mir_snprintf(szBuffer, "Cur%sMsg", pa->szModuleName);
- tszStatusMsg = db_get_wsa(NULL, MODULENAME, szBuffer);
+ tszStatusMsg = g_plugin.getWStringA(szBuffer);
if ((tszMsg && tszStatusMsg && !mir_wstrcmp(tszMsg, tszStatusMsg)) || (!tszMsg && !tszStatusMsg)) {
mir_free(tszStatusMsg);
mir_free(tszMsg);
@@ -1268,7 +1268,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
- if (!db_get_b(NULL, MODULENAME, "ShowStatusMenuItem", 1))
+ if (!g_plugin.getByte("ShowStatusMenuItem", 1))
mi.flags |= CMIF_HIDDEN;
mi.hIcolibItem = GetIconHandle(IDI_CSMSG);
mi.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
@@ -1295,7 +1295,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) char szSetting[80];
mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
- int iProtoFlags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int iProtoFlags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG)
continue;
@@ -1335,7 +1335,7 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) if (!pa->IsEnabled())
continue;
- if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
int iStatusBits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
@@ -1351,7 +1351,7 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) if (iCurrentStatus < ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_INVISIBLE)
continue;
- if ((lParam & IDF_ISIDLE && (db_get_b(NULL, "AutoAway", pa->szModuleName, 0) ||
+ if ((lParam & IDF_ISIDLE && (db_get_b(0, "AutoAway", pa->szModuleName, 0) ||
iCurrentStatus == ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_FREECHAT)) ||
(!(lParam & IDF_ISIDLE) && !mii.aaLock)) {
if (!(lParam & IDF_ISIDLE))
@@ -1400,15 +1400,15 @@ static int CSStatusChange(WPARAM wParam, LPARAM iCount) #ifdef _DEBUG
g_plugin.debugLogA("CSStatusChange(): Set \"%s\" status message for %s.", ps[i]->m_szMsg, ps[i]->m_szName);
#endif
- int max_hist_msgs = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ int max_hist_msgs = g_plugin.getByte("MaxHist", 10);
for (int j = 1; j <= max_hist_msgs; j++) {
mir_snprintf(buff, "SMsg%d", j);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(buff);
if (tszStatusMsg != nullptr) {
if (!mir_wstrcmp(tszStatusMsg, szMsgW)) {
found = true;
mir_snprintf(szSetting, "Last%sMsg", ps[i]->m_szName);
- db_set_s(NULL, MODULENAME, szSetting, buff);
+ g_plugin.setString(szSetting, buff);
mir_free(tszStatusMsg);
break;
}
@@ -1420,12 +1420,12 @@ static int CSStatusChange(WPARAM wParam, LPARAM iCount) if (!found) {
mir_snprintf(buff, "FCur%sMsg", ps[i]->m_szName);
mir_snprintf(szSetting, "Last%sMsg", ps[i]->m_szName);
- db_set_s(NULL, MODULENAME, szSetting, buff);
+ g_plugin.setString(szSetting, buff);
}
mir_snprintf(szSetting, "%sMsg", ps[i]->m_szName);
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
msg = InsertVarsIntoMsg(szMsgW, ps[i]->m_szName, status_mode, NULL);
SaveMessageToDB(ps[i]->m_szName, szMsgW, TRUE);
mir_free(szMsgW);
@@ -1450,7 +1450,7 @@ static wchar_t *ParseWinampSong(ARGUMENTSINFO *ai) mir_free(g_ptszWinampSong);
g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
}
- else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) && db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1))
+ else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) && g_plugin.getByte("AmpLeaveTitle", 1))
ptszWinampTitle = mir_wstrdup(g_ptszWinampSong);
return ptszWinampTitle;
@@ -1487,7 +1487,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam) g_plugin.debugLogA("OnICQStatusMsgRequest(): UIN: %d on %s", (int)lParam, (char *)lMirParam);
#endif
- if (db_get_b(NULL, MODULENAME, "NoUpdateOnICQReq", 1))
+ if (g_plugin.getByte("NoUpdateOnICQReq", 1))
return 0;
char *szProto = (char *)lMirParam;
@@ -1579,7 +1579,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) tr.szHelpText = LPGEN("External Applications") "\t" LPGEN("retrieves song name of the song currently playing in Winamp (Simple Status Message compatible)");
CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
- if (db_get_b(NULL, MODULENAME, "ExclDateToken", 0) != 0) {
+ if (g_plugin.getByte("ExclDateToken", 0) != 0) {
tr.szTokenString.w = L"date";
tr.parseFunctionW = ParseDate;
tr.szHelpText = LPGEN("Miranda Related") "\t" LPGEN("get the date (Simple Status Message compatible)");
@@ -1587,12 +1587,12 @@ static int OnModulesLoaded(WPARAM, LPARAM) }
}
- g_ptszWinampSong = db_get_wsa(NULL, MODULENAME, "AmpLastTitle");
+ g_ptszWinampSong = g_plugin.getWStringA("AmpLastTitle");
if (g_ptszWinampSong == nullptr)
g_ptszWinampSong = mir_wstrdup(TEXT(MODULENAME));
- if (db_get_b(NULL, MODULENAME, "UpdateMsgOn", 1))
- g_uUpdateMsgTimer = SetTimer(nullptr, 0, db_get_w(NULL, MODULENAME, "UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc);
+ if (g_plugin.getByte("UpdateMsgOn", 1))
+ g_uUpdateMsgTimer = SetTimer(nullptr, 0, g_plugin.getWord("UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc);
HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange);
@@ -1600,8 +1600,8 @@ static int OnModulesLoaded(WPARAM, LPARAM) return 0;
if (!ServiceExists(MS_SS_GETPROFILECOUNT)) {
- if (db_get_b(NULL, MODULENAME, "GlobalStatusDelay", 1))
- SetTimer(nullptr, 0, db_get_w(NULL, MODULENAME, "SetStatusDelay", 300), SetStartupStatusGlobal);
+ if (g_plugin.getByte("GlobalStatusDelay", 1))
+ SetTimer(nullptr, 0, g_plugin.getWord("SetStatusDelay", 300), SetStartupStatusGlobal);
else {
g_uSetStatusTimer = (UINT_PTR *)mir_alloc(sizeof(UINT_PTR) * accounts->count);
for (int i = 0; i < accounts->count; ++i) {
@@ -1614,7 +1614,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) char szSetting[80];
mir_snprintf(szSetting, "Set%sStatusDelay", pa->szModuleName);
- g_uSetStatusTimer[i] = SetTimer(nullptr, 0, db_get_w(NULL, MODULENAME, szSetting, 300), SetStartupStatusProc);
+ g_uSetStatusTimer[i] = SetTimer(nullptr, 0, g_plugin.getWord(szSetting, 300), SetStartupStatusProc);
}
}
}
@@ -1636,10 +1636,10 @@ static int OnOkToExit(WPARAM, LPARAM) continue;
mir_snprintf(szSetting, "Last%sStatus", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, Proto_GetStatus(pa->szModuleName));
+ g_plugin.setWord(szSetting, Proto_GetStatus(pa->szModuleName));
}
- if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) /*&& db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1)*/)
+ if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) /*&& g_plugin.getByte("AmpLeaveTitle", 1)*/)
DBWriteMessage("AmpLastTitle", g_ptszWinampSong);
}
@@ -1674,7 +1674,7 @@ int CMPlugin::Load() hwndSAMsgDialog = nullptr;
accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS));
- db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
+ db_set_w(0, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
HookEvent(ME_OPT_INITIALISE, InitOptions);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 70a53b2bd5..b47581c636 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -229,7 +229,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) else cbei.mask = CBEIF_LPARAM | CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE; - int j = db_get_w(NULL, MODULENAME, "LMMsg", 1); + int j = g_plugin.getWord("LMMsg", 1); for (int i = 1; i <= data->max_hist_msgs; ++i) { // history messages @@ -238,7 +238,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) mir_snprintf(buff, "SMsg%d", j); j--; - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff); + wchar_t *tszStatusMsg = g_plugin.getWStringA(buff); if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { found = TRUE; @@ -332,7 +332,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) for (int i = 1; i <= data->num_def_msgs; ++i) { // predefined messages mir_snprintf(buff, "DefMsg%d", i); - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff); + wchar_t *tszStatusMsg = g_plugin.getWStringA(buff); if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { cbei.iItem = -1; @@ -353,7 +353,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) } } - if (db_get_b(NULL, MODULENAME, "PutDefInList", 0)) { + if (g_plugin.getByte("PutDefInList", 0)) { cbei.iItem = -1; cbei.pszText = (LPTSTR)GetDefaultMessage(data->m_iStatus); if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { @@ -640,9 +640,9 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel) for (i = 1; i <= data->max_hist_msgs; i++) { mir_snprintf(text, "SMsg%d", i); - db_set_ws(NULL, MODULENAME, text, L""); + g_plugin.setWString(text, L""); } - db_set_s(NULL, MODULENAME, "LastMsg", ""); + g_plugin.setString("LastMsg", ""); for (i = 0; i < accounts->count; i++) { auto *pa = accounts->pa[i]; if (!pa->IsEnabled()) @@ -655,9 +655,9 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel) continue; mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, buff2, ""); + g_plugin.setString(buff2, ""); } - db_set_w(NULL, MODULENAME, "LMMsg", (WORD)data->max_hist_msgs); + g_plugin.setWord("LMMsg", (WORD)data->max_hist_msgs); SendMessage(data->recent_cbex, CB_SETCURSEL, -1, 0); num_items = SendMessage(data->recent_cbex, CB_GETCOUNT, 0, 0); if (num_items == CB_ERR) @@ -685,7 +685,7 @@ void DisplayCharsCount(struct MsgBoxData *dlg_data, HWND hwndDlg) return; len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg)); - if (db_get_b(NULL, MODULENAME, "RemoveCR", 0)) { + if (g_plugin.getByte("RemoveCR", 0)) { int index, num_lines = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_GETLINECOUNT, 0, 0); for (int i = 1; i < num_lines; ++i) { index = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_LINEINDEX, (WPARAM)i, 0); @@ -706,7 +706,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) num_start -= data->num_def_msgs + 1; mir_snprintf(setting, "%sFlags", data->m_szProto ? data->m_szProto : ""); - flags = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(iStatus, setting), STATUS_DEFAULT); + flags = g_plugin.getByte((char *)StatusModeToDbSetting(iStatus, setting), STATUS_DEFAULT); if (flags & STATUS_LAST_MSG) { if (data->m_szProto) @@ -714,10 +714,10 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) else mir_snprintf(setting, "LastMsg"); - char *szSetting = db_get_sa(NULL, MODULENAME, setting); + char *szSetting = g_plugin.getStringA(setting); if (szSetting != nullptr) { if (*szSetting != '\0') { - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting); + wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting); if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg); @@ -734,7 +734,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) else if (flags & STATUS_DEFAULT_MSG) { SetDlgItemText(hwndDlg, IDC_EDIT1, GetDefaultMessage(iStatus)); - if (db_get_b(NULL, MODULENAME, "PutDefInList", 0)) { + if (g_plugin.getByte("PutDefInList", 0)) { fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)GetDefaultMessage(iStatus)); if (fcursel != CB_ERR) SendMessage(data->recent_cbex, CB_SETCURSEL, (WPARAM)fcursel, 0); @@ -932,9 +932,9 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, DM_SIMPAWAY_SHUTDOWN); HookEventMessage(ME_SKIN2_ICONSCHANGED, hwndDlg, DM_SIMPAWAY_CHANGEICONS); - copy_init_data->num_def_msgs = db_get_w(NULL, MODULENAME, "DefMsgCount", 0); - copy_init_data->max_hist_msgs = db_get_b(NULL, MODULENAME, "MaxHist", 10); - copy_init_data->m_iDlgFlags = db_get_b(NULL, MODULENAME, "DlgFlags", DLG_SHOW_DEFAULT); + copy_init_data->num_def_msgs = g_plugin.getWord("DefMsgCount", 0); + copy_init_data->max_hist_msgs = g_plugin.getByte("MaxHist", 10); + copy_init_data->m_iDlgFlags = g_plugin.getByte("DlgFlags", DLG_SHOW_DEFAULT); copy_init_data->m_szProto = init_data->m_szProto; copy_init_data->m_iStatus = init_data->m_iStatus; copy_init_data->m_iStatusModes = init_data->m_iStatusModes; @@ -1045,8 +1045,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } } - if (db_get_b(NULL, MODULENAME, "AutoClose", 1) && init_data->m_bOnEvent) { - copy_init_data->m_iCountdown = db_get_b(NULL, MODULENAME, "DlgTime", 5); + if (g_plugin.getByte("AutoClose", 1) && init_data->m_bOnEvent) { + copy_init_data->m_iCountdown = g_plugin.getByte("DlgTime", 5); SendMessage(hwndDlg, WM_TIMER, 0, 0); SetTimer(hwndDlg, 1, 1000, nullptr); } @@ -1068,15 +1068,15 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA mir_free(init_data); - if (!db_get_b(NULL, MODULENAME, "WinCentered", 1)) { + if (!g_plugin.getByte("WinCentered", 1)) { WINDOWPLACEMENT wp; int x, y; wp.length = sizeof(wp); GetWindowPlacement(hwndDlg, &wp); - x = (int)db_get_dw(NULL, MODULENAME, "Winx", -1); - y = (int)db_get_dw(NULL, MODULENAME, "Winy", -1); + x = (int)g_plugin.getDword("Winx", -1); + y = (int)g_plugin.getDword("Winy", -1); if (x != -1) { OffsetRect(&wp.rcNormalPosition, x - wp.rcNormalPosition.left, y - wp.rcNormalPosition.top); @@ -1127,13 +1127,13 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA char szSetting[80]; if (msgbox_data->m_szProto) { mir_snprintf(szSetting, "Last%sMsg", msgbox_data->m_szProto); - db_set_s(NULL, MODULENAME, szSetting, ""); + g_plugin.setString(szSetting, ""); mir_snprintf(szSetting, "%sMsg", msgbox_data->m_szProto); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, szSetting), L""); + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, szSetting), L""); } else { - db_set_s(NULL, MODULENAME, "LastMsg", ""); + g_plugin.setString("LastMsg", ""); for (int j = 0; j < accounts->count; j++) { auto *pa = accounts->pa[j]; if (!pa->IsEnabled()) @@ -1142,21 +1142,21 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) + if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) continue; if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; mir_snprintf(szSetting, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, szSetting, ""); + g_plugin.setString(szSetting, ""); mir_snprintf(szSetting, "%sMsg", pa->szModuleName); iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), L""); + db_set_ws(0, "SRAway", StatusModeToDbSetting(iStatus, szSetting), L""); } - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), L""); // for compatibility with some plugins + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), L""); // for compatibility with some plugins } if (bCurrentStatus) @@ -1172,19 +1172,19 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA for (int i = 1; i <= msgbox_data->max_hist_msgs; i++) { mir_snprintf(buff, "SMsg%d", i); - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff); + wchar_t *tszStatusMsg = g_plugin.getWStringA(buff); if (tszStatusMsg != nullptr) { if (!mir_wstrcmp(tszStatusMsg, tszMsg)) { found = true; if (msgbox_data->m_szProto) { mir_snprintf(buff2, "Last%sMsg", msgbox_data->m_szProto); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", msgbox_data->m_szProto); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); } else { - db_set_s(NULL, MODULENAME, "LastMsg", buff); + g_plugin.setString("LastMsg", buff); for (int j = 0; j < accounts->count; j++) { auto *pa = accounts->pa[j]; if (!pa->IsEnabled()) @@ -1193,18 +1193,18 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) + if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) continue; if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", pa->szModuleName); iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); } } mir_free(tszStatusMsg); @@ -1215,7 +1215,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } if (!found) { - int last_modified_msg = db_get_w(NULL, MODULENAME, "LMMsg", msgbox_data->max_hist_msgs); + int last_modified_msg = g_plugin.getWord("LMMsg", msgbox_data->max_hist_msgs); if (last_modified_msg == msgbox_data->max_hist_msgs) last_modified_msg = 1; @@ -1223,17 +1223,17 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA last_modified_msg++; mir_snprintf(buff, "SMsg%d", last_modified_msg); - db_set_ws(NULL, MODULENAME, buff, tszMsg); + g_plugin.setWString(buff, tszMsg); if (msgbox_data->m_szProto) { mir_snprintf(buff2, "Last%sMsg", msgbox_data->m_szProto); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", msgbox_data->m_szProto); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); } else { - db_set_s(NULL, MODULENAME, "LastMsg", buff); + g_plugin.setString("LastMsg", buff); for (int j = 0; j < accounts->count; j++) { auto *pa = accounts->pa[j]; if (!pa->IsEnabled()) @@ -1242,25 +1242,25 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) + if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) continue; if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", pa->szModuleName); iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); } } - db_set_w(NULL, MODULENAME, "LMMsg", (WORD)last_modified_msg); + g_plugin.setWord("LMMsg", (WORD)last_modified_msg); } if (!msgbox_data->m_szProto) - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), tszMsg); // for compatibility with some plugins + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), tszMsg); // for compatibility with some plugins if (bCurrentStatus) SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, ID_STATUS_CURRENT, tszMsg, msgbox_data->m_bOnStartup); @@ -1387,7 +1387,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (LOWORD(histitem.lParam) == HISTORY_MSG) { char szSetting[16]; mir_snprintf(szSetting, "SMsg%d", (int)HIWORD(histitem.lParam)); - db_set_ws(NULL, MODULENAME, szSetting, L""); + g_plugin.setWString(szSetting, L""); SendMessage(msgbox_data->recent_cbex, CBEM_DELETEITEM, (WPARAM)msgbox_data->curr_sel_msg, 0); } if (LOWORD(histitem.lParam) == PREDEFINED_MSG) { @@ -1499,7 +1499,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (LOWORD(histitem.lParam) == HISTORY_MSG) { mir_snprintf(buff, "SMsg%d", (int)HIWORD(histitem.lParam)); - db_set_ws(NULL, MODULENAME, buff, L""); + g_plugin.setWString(buff, L""); } else if (LOWORD(histitem.lParam) == PREDEFINED_MSG) msgbox_data->m_bPredefChanged = TRUE; @@ -1570,8 +1570,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA WINDOWPLACEMENT wp; wp.length = sizeof(wp); GetWindowPlacement(hwndDlg, &wp); - db_set_dw(NULL, MODULENAME, "Winx", wp.rcNormalPosition.left); - db_set_dw(NULL, MODULENAME, "Winy", wp.rcNormalPosition.top); + g_plugin.setDword("Winx", wp.rcNormalPosition.left); + g_plugin.setDword("Winy", wp.rcNormalPosition.top); if (msgbox_data->m_bPredefChanged) { int i, num_items, new_num_def_msgs = 0; @@ -1591,13 +1591,13 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA mir_snprintf(buff, "DefMsg%d", i); if (LOWORD(cbitem.lParam) == PREDEFINED_MSG) { new_num_def_msgs++; - db_set_ws(NULL, MODULENAME, buff, text); + g_plugin.setWString(buff, text); } else - db_unset(NULL, MODULENAME, buff); + g_plugin.delSetting(buff); num_items--; } - db_set_w(NULL, MODULENAME, "DefMsgCount", (WORD)new_num_def_msgs); + g_plugin.setWord("DefMsgCount", (WORD)new_num_def_msgs); } ImageList_Destroy(msgbox_data->status_icons); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 1652e32181..e208c19ca8 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -131,7 +131,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i - ID_STATUS_ONLINE);
- val = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
+ val = g_plugin.getByte((char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
data->status_msg[0].flags[i - ID_STATUS_ONLINE] = val;
ptrW text(db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default")));
mir_wstrncpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
@@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l continue;
mir_snprintf(setting, "%sFlags", pa->szModuleName);
- val = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
+ val = g_plugin.getByte((char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE] = val;
mir_snprintf(setting, "%sDefault", pa->szModuleName);
text = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(i, setting));
@@ -174,7 +174,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (index != CB_ERR && index != CB_ERRSPACE) {
data->proto_msg[0].msg = nullptr;
- val = db_get_b(NULL, MODULENAME, "ProtoFlags", PROTO_DEFAULT);
+ val = g_plugin.getByte("ProtoFlags", PROTO_DEFAULT);
data->proto_msg[0].flags = val;
data->proto_msg[0].max_length = 0;
SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, (WPARAM)index, 0);
@@ -193,14 +193,14 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, index, (LPARAM)i + 1);
if (index != CB_ERR && index != CB_ERRSPACE) {
mir_snprintf(setting, "Proto%sDefault", pa->szModuleName);
- data->proto_msg[i + 1].msg = db_get_wsa(NULL, MODULENAME, setting);
+ data->proto_msg[i + 1].msg = g_plugin.getWStringA(setting);
mir_snprintf(setting, "Proto%sFlags", pa->szModuleName);
- val = db_get_b(NULL, MODULENAME, setting, PROTO_DEFAULT);
+ val = g_plugin.getByte(setting, PROTO_DEFAULT);
data->proto_msg[i + 1].flags = val;
mir_snprintf(setting, "Proto%sMaxLen", pa->szModuleName);
- val = db_get_w(NULL, MODULENAME, setting, 1024);
+ val = g_plugin.getWord(setting, 1024);
data->proto_msg[i + 1].max_length = val;
SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i + 1);
}
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CBOPTPROTO, CBN_SELCHANGE), (LPARAM)GetDlgItem(hwndDlg, IDC_CBOPTPROTO));
}
- if (db_get_b(NULL, MODULENAME, "PutDefInList", 0))
+ if (g_plugin.getByte("PutDefInList", 0))
CheckDlgButton(hwndDlg, IDC_COPTMSG2, BST_CHECKED);
if (ServiceExists(MS_VARS_FORMATSTRING)) {
@@ -417,9 +417,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg && mir_wstrlen(tszStatusMsg)) {
if (tszStatusMsg && mir_wstrlen(tszStatusMsg))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -554,9 +554,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting != nullptr) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg) {
if (tszStatusMsg[0])
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -639,9 +639,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting != nullptr) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg) {
if (tszStatusMsg[0])
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -741,9 +741,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting != nullptr) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg) {
if (tszStatusMsg[0])
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -907,8 +907,8 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l char szSetting[80];
for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
if (accounts->statusMsgFlags & Proto_Status2Flag(i)) {
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
- db_set_b(NULL, MODULENAME, StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
+ g_plugin.setByte(StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
for (int j = 0; j < accounts->count; j++) {
auto *pa = accounts->pa[j];
@@ -920,19 +920,19 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i)) {
mir_snprintf(szSetting, "%sDefault", pa->szModuleName);
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
mir_snprintf(szSetting, "%sFlags", pa->szModuleName);
- db_set_b(NULL, MODULENAME, StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
+ g_plugin.setByte(StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
}
}
}
}
- db_set_b(NULL, MODULENAME, "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
+ g_plugin.setByte("PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
if (data->proto_ok) {
- db_set_b(NULL, MODULENAME, "ProtoFlags", (BYTE)data->proto_msg[0].flags);
+ g_plugin.setByte("ProtoFlags", (BYTE)data->proto_msg[0].flags);
for (int i = 0; i < accounts->count; i++) {
auto *pa = accounts->pa[i];
@@ -947,15 +947,15 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(szSetting, "Proto%sDefault", pa->szModuleName);
if (data->proto_msg[i + 1].msg && (data->proto_msg[i + 1].flags & PROTO_THIS_MSG))
- db_set_ws(NULL, MODULENAME, szSetting, data->proto_msg[i + 1].msg);
+ g_plugin.setWString(szSetting, data->proto_msg[i + 1].msg);
// else
- // db_unset(NULL, MODULENAME, szSetting);
+ // g_plugin.delSetting(szSetting);
mir_snprintf(szSetting, "Proto%sMaxLen", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)data->proto_msg[i + 1].max_length);
+ g_plugin.setWord(szSetting, (WORD)data->proto_msg[i + 1].max_length);
mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
- db_set_b(NULL, MODULENAME, szSetting, (BYTE)data->proto_msg[i + 1].flags);
+ g_plugin.setByte(szSetting, (BYTE)data->proto_msg[i + 1].flags);
}
}
RebuildStatusMenu();
@@ -987,16 +987,16 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ESECUPDTMSG), 0);
SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETRANGE32, 1, 999);
- SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)db_get_w(NULL, MODULENAME, "UpdateMsgInt", 10), 0));
+ SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)g_plugin.getWord("UpdateMsgInt", 10), 0));
SendDlgItemMessage(hwndDlg, IDC_ESECUPDTMSG, EM_LIMITTEXT, 3, 0);
- CheckDlgButton(hwndDlg, IDC_CUPDATEMSG, db_get_b(NULL, MODULENAME, "UpdateMsgOn", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNOIDLE, db_get_b(NULL, MODULENAME, "NoUpdateOnIdle", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNOICQREQ, db_get_b(NULL, MODULENAME, "NoUpdateOnICQReq", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLEAVEWINAMP, db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CUPDATEMSG, g_plugin.getByte("UpdateMsgOn", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNOIDLE, g_plugin.getByte("NoUpdateOnIdle", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNOICQREQ, g_plugin.getByte("NoUpdateOnICQReq", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLEAVEWINAMP, g_plugin.getByte("AmpLeaveTitle", 1) ? BST_CHECKED : BST_UNCHECKED);
if (ServiceExists(MS_VARS_FORMATSTRING)) {
- CheckDlgButton(hwndDlg, IDC_CVARIABLES, db_get_b(NULL, MODULENAME, "EnableVariables", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CDATEPARSING, db_get_b(NULL, MODULENAME, "ExclDateToken", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CVARIABLES, g_plugin.getByte("EnableVariables", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CDATEPARSING, g_plugin.getByte("ExclDateToken", 0) ? BST_CHECKED : BST_UNCHECKED);
}
else {
EnableWindow(GetDlgItem(hwndDlg, IDC_CVARIABLES), FALSE);
@@ -1046,22 +1046,22 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM KillTimer(nullptr, g_uUpdateMsgTimer);
int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
- db_set_w(NULL, MODULENAME, "UpdateMsgInt", (WORD)val);
+ g_plugin.setWord("UpdateMsgInt", (WORD)val);
if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val) {
- db_set_b(NULL, MODULENAME, "UpdateMsgOn", (BYTE)1);
+ g_plugin.setByte("UpdateMsgOn", (BYTE)1);
g_uUpdateMsgTimer = SetTimer(nullptr, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
}
else {
- db_set_b(NULL, MODULENAME, "UpdateMsgOn", (BYTE)0);
+ g_plugin.setByte("UpdateMsgOn", (BYTE)0);
}
- db_set_b(NULL, MODULENAME, "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
+ g_plugin.setByte("NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
+ g_plugin.setByte("NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
+ g_plugin.setByte("AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
if (ServiceExists(MS_VARS_FORMATSTRING)) {
- db_set_b(NULL, MODULENAME, "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
+ g_plugin.setByte("EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
+ g_plugin.setByte("ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
}
return TRUE;
}
@@ -1073,12 +1073,12 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM static bool IsHistoryMsgsFound(HWND, int histMax)
{
char szSetting[16];
- int j = db_get_w(NULL, MODULENAME, "LMMsg", 1);
+ int j = g_plugin.getWord("LMMsg", 1);
for (int i = 1; i <= histMax; ++i, --j) {
if (j < 1)
j = histMax;
mir_snprintf(szSetting, "SMsg%d", j);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg != nullptr) {
if (*tszStatusMsg != '\0') {
mir_free(tszStatusMsg);
@@ -1110,7 +1110,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w SendDlgItemMessage(hwndDlg, IDC_CBOPTBUTTONS, CB_SETITEMDATA, (WPARAM)i_btndownflat, DLG_SHOW_BUTTONS_FLAT);
SendDlgItemMessage(hwndDlg, IDC_CBOPTBUTTONS, CB_SETITEMDATA, (WPARAM)i_btnlist, DLG_SHOW_BUTTONS_INLIST);
- settingValue = db_get_b(NULL, MODULENAME, "DlgFlags", DLG_SHOW_DEFAULT);
+ settingValue = g_plugin.getByte("DlgFlags", DLG_SHOW_DEFAULT);
CheckDlgButton(hwndDlg, IDC_CSTATUSLIST, settingValue & DLG_SHOW_STATUS ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CPROFILES, settingValue & DLG_SHOW_STATUS_PROFILES ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CICONS1, settingValue & DLG_SHOW_STATUS_ICONS ? BST_CHECKED : BST_UNCHECKED);
@@ -1139,7 +1139,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w }
// Misc.
- settingValue = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ settingValue = g_plugin.getByte("MaxHist", 10);
SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_EMAXHIST), 0);
SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETRANGE32, 0, 25);
@@ -1150,17 +1150,17 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), IsHistoryMsgsFound(hwndDlg, settingValue));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), db_get_w(NULL, MODULENAME, "DefMsgCount", 0) != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), g_plugin.getWord("DefMsgCount", 0) != 0);
SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ETIMEOUT), 0);
SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETRANGE32, 1, 60);
- SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)db_get_b(NULL, MODULENAME, "DlgTime", 5), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)g_plugin.getByte("DlgTime", 5), 0));
SendDlgItemMessage(hwndDlg, IDC_ETIMEOUT, EM_LIMITTEXT, 2, 0);
- CheckDlgButton(hwndDlg, IDC_CCLOSEWND, db_get_b(NULL, MODULENAME, "AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CRPOSWND, !db_get_b(NULL, MODULENAME, "WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CREMOVECR, db_get_b(NULL, MODULENAME, "RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, db_get_b(NULL, MODULENAME, "ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CCLOSEWND, g_plugin.getByte("AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CRPOSWND, !g_plugin.getByte("WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CREMOVECR, g_plugin.getByte("RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, g_plugin.getByte("ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, WM_USER + 2, 0, 0);
return TRUE;
@@ -1222,14 +1222,14 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- int max_hist_msgs = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ int max_hist_msgs = g_plugin.getByte("MaxHist", 10);
for (int i = 1; i <= max_hist_msgs; i++) {
char text[8];
mir_snprintf(text, "SMsg%d", i);
- db_set_ws(NULL, MODULENAME, text, L"");
+ g_plugin.setWString(text, L"");
}
- db_set_s(NULL, MODULENAME, "LastMsg", "");
+ g_plugin.setString("LastMsg", "");
for (int i = 0; i < accounts->count; i++) {
auto *pa = accounts->pa[i];
@@ -1244,9 +1244,9 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w char setting[80];
mir_snprintf(setting, "Last%sMsg", pa->szModuleName);
- db_set_s(NULL, MODULENAME, setting, "");
+ g_plugin.setString(setting, "");
}
- db_set_w(NULL, MODULENAME, "LMMsg", (WORD)max_hist_msgs);
+ g_plugin.setWord("LMMsg", (WORD)max_hist_msgs);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), FALSE);
}
return 0;
@@ -1256,13 +1256,13 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- int nDefMSgCount = db_get_w(NULL, MODULENAME, "DefMsgCount", 0);
+ int nDefMSgCount = g_plugin.getWord("DefMsgCount", 0);
for (int i = 1; i <= nDefMSgCount; i++) {
char szSetting[16];
mir_snprintf(szSetting, "DefMsg%d", i);
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(szSetting);
}
- db_set_w(NULL, MODULENAME, "DefMsgCount", 0);
+ g_plugin.setWord("DefMsgCount", 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), FALSE);
}
return 0;
@@ -1288,15 +1288,15 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (curSel != CB_ERR)
flags |= SendDlgItemMessage(hwndDlg, IDC_CBOPTBUTTONS, CB_GETITEMDATA, (WPARAM)curSel, 0);
- db_set_b(NULL, MODULENAME, "DlgFlags", (BYTE)flags);
+ g_plugin.setByte("DlgFlags", (BYTE)flags);
// Misc.
- db_set_b(NULL, MODULENAME, "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
- db_set_b(NULL, MODULENAME, "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
+ g_plugin.setByte("MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, nullptr, FALSE));
+ g_plugin.setByte("AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
+ g_plugin.setByte("DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, nullptr, FALSE));
+ g_plugin.setByte("WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
+ g_plugin.setByte("RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
+ g_plugin.setByte("ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
RebuildStatusMenu();
return TRUE;
@@ -1335,22 +1335,22 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa if (index != LB_ERR && index != LB_ERRSPACE) {
char setting[80];
mir_snprintf(setting, "Startup%sStatus", pa->szModuleName);
- data->status[i] = db_get_w(NULL, MODULENAME, setting, ID_STATUS_CURRENT);
+ data->status[i] = g_plugin.getWord(setting, ID_STATUS_CURRENT);
mir_snprintf(setting, "Set%sStatusDelay", pa->szModuleName);
- data->setdelay[i] = db_get_w(NULL, MODULENAME, setting, 300);
+ data->setdelay[i] = g_plugin.getWord(setting, 300);
SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
}
SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_SETCURSEL, 0, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LISTPROTO, LBN_SELCHANGE), (LPARAM)GetDlgItem(hwndDlg, IDC_LISTPROTO));
- data->setglobaldelay = db_get_w(NULL, MODULENAME, "SetStatusDelay", 300);
+ data->setglobaldelay = g_plugin.getWord("SetStatusDelay", 300);
SendDlgItemMessage(hwndDlg, IDC_SSETSTATUS, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ESETSTATUS), 0);
SendDlgItemMessage(hwndDlg, IDC_SSETSTATUS, UDM_SETRANGE32, 0, 9000);
SendDlgItemMessage(hwndDlg, IDC_ESETSTATUS, EM_LIMITTEXT, 4, 0);
- if (!db_get_b(NULL, MODULENAME, "GlobalStatusDelay", 1)) {
+ if (!g_plugin.getByte("GlobalStatusDelay", 1)) {
CheckDlgButton(hwndDlg, IDC_SPECSET, BST_CHECKED);
int i = SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_GETCURSEL, 0, 0), 0);
SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
@@ -1360,7 +1360,7 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
}
- if (db_get_b(NULL, MODULENAME, "StartupPopupDlg", 1)) {
+ if (g_plugin.getByte("StartupPopupDlg", 1)) {
CheckDlgButton(hwndDlg, IDC_POPUPDLG, BST_CHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED) {
CheckDlgButton(hwndDlg, IDC_SPECSET, BST_UNCHECKED);
@@ -1499,14 +1499,14 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa char szSetting[80];
mir_snprintf(szSetting, "Startup%sStatus", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)data->status[i]);
+ g_plugin.setWord(szSetting, (WORD)data->status[i]);
mir_snprintf(szSetting, "Set%sStatusDelay", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)data->setdelay[i]);
+ g_plugin.setWord(szSetting, (WORD)data->setdelay[i]);
}
- db_set_w(NULL, MODULENAME, "SetStatusDelay", (WORD)data->setglobaldelay);
- db_set_b(NULL, MODULENAME, "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
- db_set_b(NULL, MODULENAME, "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
+ g_plugin.setWord("SetStatusDelay", (WORD)data->setglobaldelay);
+ g_plugin.setByte("GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
+ g_plugin.setByte("StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
return TRUE;
}
break;
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index aaeaf1eb47..00e507f834 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -135,7 +135,7 @@ int GetCurrentStatus(const char *szProto) if (szProto) {
char szSetting[80];
mir_snprintf(szSetting, "Cur%sStatus", szProto);
- return (int)db_get_w(NULL, MODULENAME, szSetting, ID_STATUS_OFFLINE);
+ return (int)g_plugin.getWord(szSetting, ID_STATUS_OFFLINE);
}
return CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
@@ -148,13 +148,13 @@ int GetStartupStatus(const char *szProto) char szSetting[80];
mir_snprintf(szSetting, "Startup%sStatus", szProto);
- status_mode = db_get_w(NULL, MODULENAME, szSetting, ID_STATUS_CURRENT);
+ status_mode = g_plugin.getWord(szSetting, ID_STATUS_CURRENT);
if (status_mode == ID_STATUS_CURRENT) {
// load status used for this proto last time
mir_snprintf(szSetting, "Last%sStatus", szProto);
- status_mode = db_get_w(NULL, MODULENAME, szSetting, ID_STATUS_OFFLINE);
+ status_mode = g_plugin.getWord(szSetting, ID_STATUS_OFFLINE);
}
return status_mode;
}
- return (int)db_get_w(NULL, MODULENAME, "StartupStatus", ID_STATUS_OFFLINE);
+ return (int)g_plugin.getWord("StartupStatus", ID_STATUS_OFFLINE);
}
|