From f1d95a21de0ecd8be2f139ff671f0782c142bd7f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 13 Nov 2018 20:06:34 +0300 Subject: Sessions -> g_plugin --- plugins/Sessions/Src/Main.cpp | 8 +++--- plugins/Sessions/Src/Utils.cpp | 60 +++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'plugins/Sessions/Src') diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 4498daeb9b..8a5ca2565b 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -320,7 +320,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case IDC_SESSDEL: if (session_list_recovered[0] && ses_count == 256) { for (int i = 0; session_list_recovered[i]; i++) - db_set_b(session_list_recovered[i], MODULENAME, "wasInLastSession", 0); + g_plugin.setByte(session_list_recovered[i], "wasInLastSession", 0); memset(session_list_recovered, 0, sizeof(session_list_recovered)); g_bIncompletedSave = 0; @@ -677,13 +677,13 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) if (MWeventdata->uType == MSG_WINDOW_EVT_OPEN) { AddToCurSession(MWeventdata->hContact, 0); if (g_bCrashRecovery) - db_set_b(MWeventdata->hContact, MODULENAME, "wasInLastSession", 1); + g_plugin.setByte(MWeventdata->hContact, "wasInLastSession", 1); } else if (MWeventdata->uType == MSG_WINDOW_EVT_CLOSE) { if (!DONT) DelFromCurSession(MWeventdata->hContact, 0); if (g_bCrashRecovery) - db_set_b(MWeventdata->hContact, MODULENAME, "wasInLastSession", 0); + g_plugin.setByte(MWeventdata->hContact, "wasInLastSession", 0); } return 0; @@ -830,7 +830,7 @@ int CMPlugin::Load() memset(session_list_recovered, 0, sizeof(session_list_recovered)); for (auto &hContact : Contacts()) - if (db_get_b(hContact, MODULENAME, "wasInLastSession", 0)) + if (g_plugin.getByte(hContact, "wasInLastSession")) session_list_recovered[i++] = hContact; } diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 4142bb80aa..5d82d590dd 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -22,7 +22,7 @@ along with this program. If not, see . void AddSessionMark(MCONTACT hContact, int mode, char bit) { if (mode == 0) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks")); + ptrA szValue(g_plugin.getStringA(hContact, "LastSessionsMarks")); if (szValue) { char temp_1 = szValue[0]; for (int i = 0; i < g_ses_limit; i++) { @@ -33,13 +33,13 @@ void AddSessionMark(MCONTACT hContact, int mode, char bit) for (int i = g_ses_limit; i < 10; i++) szValue[i] = '0'; szValue[0] = bit; - db_set_s(hContact, MODULENAME, "LastSessionsMarks", szValue); + g_plugin.setString(hContact, "LastSessionsMarks", szValue); } else if (bit == '1') - db_set_s(hContact, MODULENAME, "LastSessionsMarks", "10000000000"); + g_plugin.setString(hContact, "LastSessionsMarks", "10000000000"); } else if (mode == 1) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsMarks")); + ptrA szValue(g_plugin.getStringA(hContact, "UserSessionsMarks")); if (szValue) { char *pszBuffer; if (mir_strlen(szValue) < g_ses_count) { @@ -56,21 +56,21 @@ void AddSessionMark(MCONTACT hContact, int mode, char bit) temp_1 = temp_2; } pszBuffer[0] = bit; - db_set_s(hContact, MODULENAME, "UserSessionsMarks", pszBuffer); + g_plugin.setString(hContact, "UserSessionsMarks", pszBuffer); mir_free(pszBuffer); } else if (bit == '1') - db_set_s(hContact, MODULENAME, "UserSessionsMarks", "10000000000"); + g_plugin.setString(hContact, "UserSessionsMarks", "10000000000"); else - db_set_s(hContact, MODULENAME, "UserSessionsMarks", "00000000000"); + g_plugin.setString(hContact, "UserSessionsMarks", "00000000000"); } } void RemoveSessionMark(MCONTACT hContact, int mode, int marknum) { if (mode == 0) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks")); + ptrA szValue(g_plugin.getStringA(hContact, "LastSessionsMarks")); if (szValue) { for (int i = marknum; i < g_ses_limit; i++) szValue[i] = szValue[i + 1]; @@ -78,16 +78,16 @@ void RemoveSessionMark(MCONTACT hContact, int mode, int marknum) for (int i = g_ses_limit; i < 10; i++) szValue[i] = '0'; - db_set_s(hContact, MODULENAME, "LastSessionsMarks", szValue); + g_plugin.setString(hContact, "LastSessionsMarks", szValue); } } else if (mode == 1) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsMarks")); + ptrA szValue(g_plugin.getStringA(hContact, "UserSessionsMarks")); if (szValue) { for (int i = marknum; i < g_ses_limit; i++) szValue[i] = szValue[i + 1]; - db_set_s(hContact, MODULENAME, "UserSessionsMarks", szValue); + g_plugin.setString(hContact, "UserSessionsMarks", szValue); } } } @@ -95,17 +95,17 @@ void RemoveSessionMark(MCONTACT hContact, int mode, int marknum) void SetSessionMark(MCONTACT hContact, int mode, char bit, unsigned int marknum) { if (mode == 0) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks")); + ptrA szValue(g_plugin.getStringA(hContact, "LastSessionsMarks")); if (szValue) { szValue[marknum] = bit; - db_set_s(hContact, MODULENAME, "LastSessionsMarks", szValue); + g_plugin.setString(hContact, "LastSessionsMarks", szValue); } } else if (mode == 1) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsMarks")); + ptrA szValue(g_plugin.getStringA(hContact, "UserSessionsMarks")); if (szValue) { szValue[marknum] = bit; - db_set_s(hContact, MODULENAME, "UserSessionsMarks", szValue); + g_plugin.setString(hContact, "UserSessionsMarks", szValue); } } } @@ -114,9 +114,9 @@ bool LoadContactsFromMask(MCONTACT hContact, int mode, int count) { ptrA szValue; if (mode == 0) - szValue = db_get_sa(hContact, MODULENAME, "LastSessionsMarks"); + szValue = g_plugin.getStringA(hContact, "LastSessionsMarks"); else if (mode == 1) - szValue = db_get_sa(hContact, MODULENAME, "UserSessionsMarks"); + szValue = g_plugin.getStringA(hContact, "UserSessionsMarks"); if (szValue == NULL) return false; @@ -130,7 +130,7 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) mir_snprintf(szFormNumBuf, "%02u", ordernum); if (mode == 0) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsMarks")); + ptrA szValue(g_plugin.getStringA(hContact, "LastSessionsMarks")); if (szValue) { int len = (int)mir_strlen(szValue); if (!len) @@ -146,15 +146,15 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) for (int i = (g_ses_limit * 2); i < 20; i++) temp[i] = '0'; - db_set_s(hContact, MODULENAME, "LastSessionsOrder", temp); + g_plugin.setString(hContact, "LastSessionsOrder", temp); } else if (writemode == 1) { mir_snprintf(szFormNumBuf, "%02u%s", ordernum, "000000000000000000"); - db_set_s(hContact, MODULENAME, "LastSessionsOrder", szFormNumBuf); + g_plugin.setString(hContact, "LastSessionsOrder", szFormNumBuf); } } else if (mode == 1) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsOrder")); + ptrA szValue(g_plugin.getStringA(hContact, "UserSessionsOrder")); if (szValue) { char *pszBuffer; if (mir_strlen(szValue) < (g_ses_count * 2)) { @@ -169,13 +169,13 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) char *temp = (char*)_alloca(len + 1); mir_snprintf(temp, len + 1, "%02u%s", ordernum, szValue); - db_set_s(hContact, MODULENAME, "UserSessionsOrder", temp); + g_plugin.setString(hContact, "UserSessionsOrder", temp); mir_free(pszBuffer); } else if (writemode == 1) - db_set_s(hContact, MODULENAME, "UserSessionsOrder", szFormNumBuf); + g_plugin.setString(hContact, "UserSessionsOrder", szFormNumBuf); else - db_set_s(hContact, MODULENAME, "UserSessionsOrder", "00"); + g_plugin.setString(hContact, "UserSessionsOrder", "00"); } } @@ -183,14 +183,14 @@ int GetInSessionOrder(MCONTACT hContact, int mode, int count) { char szTemp[3]; if (mode == 0) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsOrder")); + ptrA szValue(g_plugin.getStringA(hContact, "LastSessionsOrder")); if (szValue) { strncpy_s(szTemp, &szValue[count * 2], 2); return atoi(szTemp); } } else if (mode == 1) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsOrder")); + ptrA szValue(g_plugin.getStringA(hContact, "UserSessionsOrder")); if (szValue) { strncpy_s(szTemp, &szValue[count * 2], 2); return atoi(szTemp); @@ -205,19 +205,19 @@ void SetInSessionOrder(MCONTACT hContact, int mode, int count, unsigned int orde mir_snprintf(szTemp, "%02u", ordernum); if (mode == 0) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "LastSessionsOrder")); + ptrA szValue(g_plugin.getStringA(hContact, "LastSessionsOrder")); if (szValue) { szValue[count * 2] = szTemp[0]; szValue[count * 2 + 1] = szTemp[1]; - db_set_s(hContact, MODULENAME, "LastSessionsOrder", szValue); + g_plugin.setString(hContact, "LastSessionsOrder", szValue); } } else if (mode == 1) { - ptrA szValue(db_get_sa(hContact, MODULENAME, "UserSessionsOrder")); + ptrA szValue(g_plugin.getStringA(hContact, "UserSessionsOrder")); if (szValue) { szValue[count * 2] = szTemp[0]; szValue[count * 2 + 1] = szTemp[1]; - db_set_s(hContact, MODULENAME, "UserSessionsOrder", szValue); + g_plugin.setString(hContact, "UserSessionsOrder", szValue); } } } -- cgit v1.2.3