summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-12 23:30:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-12 23:30:49 +0300
commita7cd863ba1661b1ccae541bee86bae297bfe9336 (patch)
tree434f85b5c4d87d41ff0e4bd69d9f3728c8302bb1
parent06f988c03397110b08fd04573894ccff53265e6d (diff)
NewStatusNotify -> g_plugin
-rw-r--r--plugins/NewXstatusNotify/src/indsnd.cpp56
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp122
-rw-r--r--plugins/NewXstatusNotify/src/options.cpp276
-rw-r--r--plugins/NewXstatusNotify/src/popup.cpp2
-rw-r--r--plugins/NewXstatusNotify/src/stdafx.h2
-rw-r--r--plugins/NewXstatusNotify/src/utils.cpp8
-rw-r--r--plugins/NewXstatusNotify/src/utils.h2
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.cpp28
8 files changed, 248 insertions, 248 deletions
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp
index 8213441bc2..e1805da337 100644
--- a/plugins/NewXstatusNotify/src/indsnd.cpp
+++ b/plugins/NewXstatusNotify/src/indsnd.cpp
@@ -149,7 +149,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
lvi.pszText = TranslateW(StatusList[Index(i)].lpzSkinSoundDesc);
lvi.iItem = ListView_InsertItem(hList, &lvi);
- if (!db_get_ws(hContact, MODULE, StatusList[Index(i)].lpzSkinSoundName, &dbv)) {
+ if (!g_plugin.getWString(hContact, StatusList[Index(i)].lpzSkinSoundName, &dbv)) {
mir_wstrcpy(buff, dbv.pwszVal);
db_free(&dbv);
}
@@ -169,7 +169,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
lvi.pszText = TranslateW(StatusListEx[i].lpzSkinSoundDesc);
lvi.iItem = ListView_InsertItem(hList, &lvi);
- if (!db_get_ws(hContact, MODULE, StatusList[i].lpzSkinSoundName, &dbv)) {
+ if (!g_plugin.getWString(hContact, StatusList[i].lpzSkinSoundName, &dbv)) {
wcsncpy(buff, dbv.pwszVal, _countof(buff)-1);
db_free(&dbv);
}
@@ -179,8 +179,8 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
}
- CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYSOUNDS, db_get_b(hContact, MODULE, "EnableSounds", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYPOPUPS, db_get_b(hContact, MODULE, "EnablePopups", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYSOUNDS, g_plugin.getByte(hContact, "EnableSounds", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYPOPUPS, g_plugin.getByte(hContact, "EnablePopups", 1) ? BST_CHECKED : BST_UNCHECKED);
ShowWindow(GetDlgItem(hwndDlg, IDC_INDSNDLIST), opt.UseIndSnd ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_TEXT_ENABLE_IS), opt.UseIndSnd ? SW_HIDE : SW_SHOW);
@@ -217,10 +217,10 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_CHECK_NOTIFYSOUNDS:
- db_set_b(hContact, MODULE, "EnableSounds", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYSOUNDS) ? 1 : 0);
+ g_plugin.setByte(hContact, "EnableSounds", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYSOUNDS) ? 1 : 0);
break;
case IDC_CHECK_NOTIFYPOPUPS:
- db_set_b(hContact, MODULE, "EnablePopups", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYPOPUPS) ? 1 : 0);
+ g_plugin.setByte(hContact, "EnablePopups", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYPOPUPS) ? 1 : 0);
break;
}
break;
@@ -238,17 +238,17 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (!mir_wstrcmp(buff, TranslateW(DEFAULT_SOUND))) {
if (lvi.lParam < ID_STATUS_MIN)
- db_unset(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName);
+ g_plugin.delSetting(hContact, StatusListEx[lvi.lParam].lpzSkinSoundName);
else
- db_unset(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName);
+ g_plugin.delSetting(hContact, StatusList[Index(lvi.lParam)].lpzSkinSoundName);
}
else {
wchar_t stzSoundPath[MAX_PATH] = { 0 };
PathToRelativeW(buff, stzSoundPath);
if (lvi.lParam < ID_STATUS_MIN)
- db_set_ws(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName, stzSoundPath);
+ g_plugin.setWString(hContact, StatusListEx[lvi.lParam].lpzSkinSoundName, stzSoundPath);
else
- db_set_ws(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName, stzSoundPath);
+ g_plugin.setWString(hContact, StatusList[Index(lvi.lParam)].lpzSkinSoundName, stzSoundPath);
}
}
@@ -306,12 +306,12 @@ void SetAllContactsIcons(HWND hwndList)
if (hItem) {
char *szProto = GetContactProto(hContact);
if (szProto) {
- EnableSounds = db_get_b(hContact, MODULE, "EnableSounds", 1);
- EnablePopups = db_get_b(hContact, MODULE, "EnablePopups", 1);
- EnableXStatus = db_get_b(hContact, MODULE, "EnableXStatusNotify", 1);
- EnableXLogging = db_get_b(hContact, MODULE, "EnableXLogging", 1);
- EnableStatusMsg = db_get_b(hContact, MODULE, "EnableSMsgNotify", 1);
- EnableSMsgLogging = db_get_b(hContact, MODULE, "EnableSMsgLogging", 1);
+ EnableSounds = g_plugin.getByte(hContact, "EnableSounds", 1);
+ EnablePopups = g_plugin.getByte(hContact, "EnablePopups", 1);
+ EnableXStatus = g_plugin.getByte(hContact, "EnableXStatusNotify", 1);
+ EnableXLogging = g_plugin.getByte(hContact, "EnableXLogging", 1);
+ EnableStatusMsg = g_plugin.getByte(hContact, "EnableSMsgNotify", 1);
+ EnableSMsgLogging = g_plugin.getByte(hContact, "EnableSMsgLogging", 1);
}
else
EnableSounds = EnablePopups = EnableXStatus = EnableXLogging = EnableStatusMsg = EnableSMsgLogging = 0;
@@ -546,34 +546,34 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, hContact, 0);
if (hItem) {
if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SOUND) == EXTRA_IMAGE_SOUND)
- db_unset(hContact, MODULE, "EnableSounds");
+ g_plugin.delSetting(hContact, "EnableSounds");
else
- db_set_b(hContact, MODULE, "EnableSounds", 0);
+ g_plugin.setByte(hContact, "EnableSounds", 0);
if (GetExtraImage(hList, hItem, EXTRA_IMAGE_POPUP) == EXTRA_IMAGE_POPUP)
- db_unset(hContact, MODULE, "EnablePopups");
+ g_plugin.delSetting(hContact, "EnablePopups");
else
- db_set_b(hContact, MODULE, "EnablePopups", 0);
+ g_plugin.setByte(hContact, "EnablePopups", 0);
if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XSTATUS) == EXTRA_IMAGE_XSTATUS)
- db_unset(hContact, MODULE, "EnableXStatusNotify");
+ g_plugin.delSetting(hContact, "EnableXStatusNotify");
else
- db_set_b(hContact, MODULE, "EnableXStatusNotify", 0);
+ g_plugin.setByte(hContact, "EnableXStatusNotify", 0);
if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XLOGGING) == EXTRA_IMAGE_XLOGGING)
- db_unset(hContact, MODULE, "EnableXLogging");
+ g_plugin.delSetting(hContact, "EnableXLogging");
else
- db_set_b(hContact, MODULE, "EnableXLogging", 0);
+ g_plugin.setByte(hContact, "EnableXLogging", 0);
if (GetExtraImage(hList, hItem, EXTRA_IMAGE_STATUSMSG) == EXTRA_IMAGE_STATUSMSG)
- db_unset(hContact, MODULE, "EnableSMsgNotify");
+ g_plugin.delSetting(hContact, "EnableSMsgNotify");
else
- db_set_b(hContact, MODULE, "EnableSMsgNotify", 0);
+ g_plugin.setByte(hContact, "EnableSMsgNotify", 0);
if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SMSGLOGGING) == EXTRA_IMAGE_SMSGLOGGING)
- db_unset(hContact, MODULE, "EnableSMsgLogging");
+ g_plugin.delSetting(hContact, "EnableSMsgLogging");
else
- db_set_b(hContact, MODULE, "EnableSMsgLogging", 0);
+ g_plugin.setByte(hContact, "EnableSMsgLogging", 0);
}
}
return TRUE;
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index cd862bd444..b63428ef8a 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -69,7 +69,7 @@ PLUGININFOEX pluginInfoEx =
};
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULE, pluginInfoEx)
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
{}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -100,7 +100,7 @@ BYTE GetGender(MCONTACT hContact)
HANDLE GetIconHandle(char *szIcon)
{
char szSettingName[64];
- mir_snprintf(szSettingName, "%s_%s", MODULE, szIcon);
+ mir_snprintf(szSettingName, "%s_%s", MODULENAME, szIcon);
return IcoLib_GetIconHandle(szSettingName);
}
@@ -285,7 +285,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt)
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.timestamp = (DWORD)time(0);
- dbei.szModule = MODULE;
+ dbei.szModule = MODULENAME;
MEVENT hDBEvent = db_event_add(smi->hContact, &dbei);
if (opt.SMsgLogToDB_WinOpen && opt.SMsgLogToDB_Remove) {
@@ -338,7 +338,7 @@ void PlayChangeSound(MCONTACT hContact, const char *name)
if (opt.UseIndSnd) {
DBVARIANT dbv;
wchar_t stzSoundFile[MAX_PATH] = { 0 };
- if (!db_get_ws(hContact, MODULE, name, &dbv)) {
+ if (!g_plugin.getWString(hContact, name, &dbv)) {
wcsncpy(stzSoundFile, dbv.pwszVal, _countof(stzSoundFile) - 1);
db_free(&dbv);
}
@@ -370,7 +370,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.timestamp = (DWORD)time(0);
- dbei.szModule = MODULE;
+ dbei.szModule = MODULENAME;
MEVENT hDBEvent = db_event_add(hContact, &dbei);
if (opt.LogToDB_WinOpen && opt.LogToDB_Remove) {
@@ -403,20 +403,20 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
else
db_set_s(hContact, szProto, "LastOnline", szSubProto);
- if (db_get_b(0, MODULE, szSubProto, 1) == 0)
+ if (g_plugin.getByte(szSubProto, 1) == 0)
return 0;
szProto = szSubProto;
}
else {
- if (myStatus == ID_STATUS_OFFLINE || db_get_b(0, MODULE, szProto, 1) == 0)
+ if (myStatus == ID_STATUS_OFFLINE || g_plugin.getByte(szProto, 1) == 0)
return 0;
}
if (!opt.FromOffline || oldStatus != ID_STATUS_OFFLINE) { // Either it wasn't a change from Offline or we didn't enable that.
char buff[8];
mir_snprintf(buff, "%d", newStatus);
- if (db_get_b(0, MODULE, buff, 1) == 0)
+ if (g_plugin.getByte(buff, 1) == 0)
return 0; // "Notify when a contact changes to one of..." is unchecked
}
@@ -428,18 +428,18 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
char statusIDs[12], statusIDp[12];
mir_snprintf(statusIDs, "s%d", myStatus);
mir_snprintf(statusIDp, "p%d", myStatus);
- bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE;
- bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
+ bEnableSound = g_plugin.getByte(statusIDs, 1) ? FALSE : TRUE;
+ bEnablePopup = g_plugin.getByte(statusIDp, 1) ? FALSE : TRUE;
}
- if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) {
+ if (bEnablePopup && g_plugin.getByte(hContact, "EnablePopups", 1) && !opt.TempDisabled) {
int wStatus = Proto_GetStatus(szProto);
wchar_t str[MAX_SECONDLINE] = { 0 };
if (opt.ShowStatus)
GetStatusText(hContact, newStatus, oldStatus, str);
if (opt.ReadAwayMsg && wStatus != ID_STATUS_INVISIBLE && StatusHasAwayMessage(szProto, newStatus))
- db_set_ws(hContact, MODULE, "LastPopupText", str);
+ g_plugin.setWString(hContact, "LastPopupText", str);
PLUGINDATA *pdp = (PLUGINDATA *)mir_calloc(sizeof(PLUGINDATA));
pdp->oldStatus = oldStatus;
@@ -456,7 +456,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
BlinkIcon(hContact, hIcon, str);
}
- if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && db_get_b(hContact, MODULE, "EnableSounds", 1) && !opt.TempDisabled) {
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && g_plugin.getByte(hContact, "EnableSounds", 1) && !opt.TempDisabled) {
if (oldStatus == ID_STATUS_OFFLINE)
PlayChangeSound(hContact, StatusListEx[ID_STATUS_FROMOFFLINE].lpzSkinSoundName);
else
@@ -651,7 +651,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
}
// check per-contact ignored events
- if (db_get_b(hContact, MODULE, "EnableSMsgNotify", 1) == 0)
+ if (g_plugin.getByte(hContact, "EnableSMsgNotify", 1) == 0)
bEnableSound = bEnablePopup = false;
// we're offline or just connecting
@@ -662,11 +662,11 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
char dbSetting[64];
mir_snprintf(dbSetting, "%s_enabled", szProto);
// this proto is not set for status message notifications
- if (db_get_b(0, MODULE, dbSetting, 1) == 0)
+ if (g_plugin.getByte(dbSetting, 1) == 0)
goto skip_notify;
mir_snprintf(dbSetting, "%d", IDC_CHK_STATUS_MESSAGE);
// status message change notifications are disabled
- if (db_get_b(0, MODULE, dbSetting, 1) == 0)
+ if (g_plugin.getByte(dbSetting, 1) == 0)
goto skip_notify;
if (SkipHiddenContact(hContact))
@@ -677,8 +677,8 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
char statusIDs[12], statusIDp[12];
mir_snprintf(statusIDs, "s%d", myStatus);
mir_snprintf(statusIDp, "p%d", myStatus);
- bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : bEnableSound;
- bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : bEnablePopup;
+ bEnableSound = g_plugin.getByte(statusIDs, 1) ? FALSE : bEnableSound;
+ bEnablePopup = g_plugin.getByte(statusIDp, 1) ? FALSE : bEnablePopup;
}
// check flags
@@ -686,10 +686,10 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
|| (!(templates.PopupSMsgFlags & NOTIFY_NEW_MESSAGE) && (smi.compare == COMPARE_DIFF)))
bEnablePopup = false;
- if (db_get_b(0, MODULE, szProto, 1) == 0 && !opt.PSMsgOnConnect)
+ if (g_plugin.getByte(szProto, 1) == 0 && !opt.PSMsgOnConnect)
bEnablePopup = false;
- if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) {
+ if (bEnablePopup && g_plugin.getByte(hContact, "EnablePopups", 1) && !opt.TempDisabled) {
// cut message if needed
wchar_t *copyText = nullptr;
if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_wstrlen(smi.newstatusmsg) > opt.PSMsgLen)) {
@@ -706,7 +706,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
char protoname[MAX_PATH];
mir_snprintf(protoname, "%s_TPopupSMsgRemoved", szProto);
DBVARIANT dbVar = { 0 };
- if (db_get_ws(NULL, MODULE, protoname, &dbVar)) {
+ if (g_plugin.getWString(protoname, &dbVar)) {
str = GetStr(&smi, DEFAULT_POPUP_SMSGREMOVED);
}
else {
@@ -718,7 +718,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
char protoname[MAX_PATH];
mir_snprintf(protoname, "%s_TPopupSMsgChanged", szProto);
DBVARIANT dbVar = { 0 };
- if (db_get_ws(NULL, MODULE, protoname, &dbVar)) {
+ if (g_plugin.getWString(protoname, &dbVar)) {
str = GetStr(&smi, DEFAULT_POPUP_SMSGCHANGED);
}
else {
@@ -746,18 +746,18 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
BlinkIcon(hContact, hIcon, str);
}
- if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && db_get_b(hContact, MODULE, "EnableSounds", 1) && !opt.TempDisabled) {
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && g_plugin.getByte(hContact, "EnableSounds", 1) && !opt.TempDisabled) {
if (smi.compare == COMPARE_DEL)
PlayChangeSound(hContact, StatusListEx[ID_STATUS_SMSGREMOVED].lpzSkinSoundName);
else
PlayChangeSound(hContact, StatusListEx[ID_STATUS_SMSGCHANGED].lpzSkinSoundName);
}
- BOOL bEnableLog = opt.SMsgLogToDB && db_get_b(hContact, MODULE, "EnableSMsgLogging", 1);
+ BOOL bEnableLog = opt.SMsgLogToDB && g_plugin.getByte(hContact, "EnableSMsgLogging", 1);
if (bEnableLog && (!opt.SMsgLogToDB_WinOpen || CheckMsgWnd(hContact)))
LogSMsgToDB(&smi, smi.compare == COMPARE_DEL ? templates.LogSMsgRemoved : templates.LogSMsgChanged);
- if (opt.SMsgLogToFile && db_get_b(hContact, MODULE, "EnableSMsgLogging", 1)) {
+ if (opt.SMsgLogToFile && g_plugin.getByte(hContact, "EnableSMsgLogging", 1)) {
wchar_t stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN];
GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", stzTime, _countof(stzTime));
@@ -813,19 +813,19 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam)
if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) {
char szSetting[12];
mir_snprintf(szSetting, "p%d", wParam);
- BYTE hlpDisablePopup = db_get_b(0, MODULE, szSetting, 0);
+ BYTE hlpDisablePopup = g_plugin.getByte(szSetting, 0);
if (hlpDisablePopup != opt.PopupAutoDisabled) {
BYTE hlpPopupStatus = (BYTE)CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
opt.PopupAutoDisabled = hlpDisablePopup;
if (hlpDisablePopup) {
- db_set_b(0, MODULE, "OldPopupStatus", hlpPopupStatus);
+ g_plugin.setByte("OldPopupStatus", hlpPopupStatus);
CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
}
else {
if (hlpPopupStatus == FALSE) {
- if (db_get_b(0, MODULE, "OldPopupStatus", TRUE) == TRUE)
+ if (g_plugin.getByte("OldPopupStatus", TRUE) == TRUE)
CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
else
CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
@@ -837,18 +837,18 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam)
if (opt.DisableSoundGlobally) {
char szSetting[12];
mir_snprintf(szSetting, "s%d", wParam);
- BYTE hlpDisableSound = db_get_b(0, MODULE, szSetting, 0);
+ BYTE hlpDisableSound = g_plugin.getByte(szSetting, 0);
if (hlpDisableSound != opt.SoundAutoDisabled) {
BYTE hlpUseSound = db_get_b(0, "Skin", "UseSound", 1);
opt.SoundAutoDisabled = hlpDisableSound;
if (hlpDisableSound) {
- db_set_b(0, MODULE, "OldUseSound", hlpUseSound);
+ g_plugin.setByte("OldUseSound", hlpUseSound);
db_set_b(0, "Skin", "UseSound", FALSE);
}
else if (hlpUseSound == FALSE)
- db_set_b(0, "Skin", "UseSound", db_get_b(0, MODULE, "OldUseSound", 1));
+ db_set_b(0, "Skin", "UseSound", g_plugin.getByte("OldUseSound", 1));
}
}
}
@@ -868,8 +868,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnline", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Online"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"global.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40072bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40072tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40072bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40072tx", COLOR_TX_DEFAULT);
//Offline
index = Index(ID_STATUS_OFFLINE);
@@ -880,8 +880,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOffline", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Offline"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"offline.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40071bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40071tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40071bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40071tx", COLOR_TX_DEFAULT);
//Invisible
index = Index(ID_STATUS_INVISIBLE);
@@ -892,8 +892,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserInvisible", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Invisible"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"invisible.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40078bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40078tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40078bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40078tx", COLOR_TX_DEFAULT);
//Free for chat
index = Index(ID_STATUS_FREECHAT);
@@ -904,8 +904,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Free for chat"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"free4chat.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40077tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40077bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40077tx", COLOR_TX_DEFAULT);
//Away
index = Index(ID_STATUS_AWAY);
@@ -916,8 +916,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Away"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"away.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40073bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40073tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40073bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40073tx", COLOR_TX_DEFAULT);
//NA
index = Index(ID_STATUS_NA);
@@ -928,8 +928,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Not available"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"na.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40075tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40075bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40075tx", COLOR_TX_DEFAULT);
//Occupied
index = Index(ID_STATUS_OCCUPIED);
@@ -940,8 +940,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Occupied"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"occupied.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40076bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40076tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40076bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40076tx", COLOR_TX_DEFAULT);
//Do not disturb
index = Index(ID_STATUS_DND);
@@ -952,8 +952,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Do not disturb"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"dnd.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40074tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40074bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40074tx", COLOR_TX_DEFAULT);
//Out to lunch
index = Index(ID_STATUS_OUTTOLUNCH);
@@ -964,8 +964,8 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Out to lunch"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"lunch.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40080tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40080bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40080tx", COLOR_TX_DEFAULT);
//On the phone
index = Index(ID_STATUS_ONTHEPHONE);
@@ -976,18 +976,18 @@ void InitStatusList()
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: On the phone"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"phone.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40079tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40079bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40079tx", COLOR_TX_DEFAULT);
//Extra status
index = Index(ID_STATUS_EXTRASTATUS);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40081bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40081tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40081bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40081tx", COLOR_TX_DEFAULT);
//Status message
index = Index(ID_STATUS_STATUSMSG);
- StatusList[index].colorBack = db_get_dw(0, MODULE, "40082bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(0, MODULE, "40082tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = g_plugin.getDword("40082bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = g_plugin.getDword("40082tx", COLOR_TX_DEFAULT);
//From offline
index = ID_STATUS_FROMOFFLINE;
@@ -1033,7 +1033,7 @@ void CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD)
//We've received a timer message: enable the popups for a specified protocol.
char szProto[256];
if (GetAtomNameA((ATOM)idEvent, szProto, sizeof(szProto)) > 0) {
- db_set_b(0, MODULE, szProto, 1);
+ g_plugin.setByte(szProto, 1);
DeleteAtom((ATOM)idEvent);
}
}
@@ -1052,7 +1052,7 @@ int ProtoAck(WPARAM, LPARAM lParam)
char *szProto = (char *)ack->szModule;
if (newStatus == ID_STATUS_OFFLINE) {
//The protocol switched to offline. Disable the popups for this protocol
- db_set_b(0, MODULE, szProto, 0);
+ g_plugin.setByte(szProto, 0);
}
else if (oldStatus < ID_STATUS_ONLINE && newStatus >= ID_STATUS_ONLINE) {
//The protocol changed from a disconnected status to a connected status.
@@ -1068,7 +1068,7 @@ int ProtoAck(WPARAM, LPARAM lParam)
INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM)
{
- db_set_b(0, MODULE, "TempDisable", opt.TempDisabled = !opt.TempDisabled);
+ g_plugin.setByte("TempDisable", opt.TempDisabled = !opt.TempDisabled);
if (opt.TempDisabled)
Menu_ModifyItem(hEnableDisableMenu, LPGENW("Enable status notification"), GetIconHandle(ICO_NOTIFICATION_OFF));
@@ -1131,7 +1131,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
for (auto &pa : Accounts())
if (pa->IsEnabled())
- db_set_b(0, MODULE, pa->szModuleName, 0);
+ g_plugin.setByte(pa->szModuleName, 0);
return 0;
}
@@ -1146,7 +1146,7 @@ static int OnShutdown(WPARAM, LPARAM)
int CMPlugin::Load()
{
- g_plugin.registerIcon(LPGEN("New Status Notify"), iconList, MODULE);
+ g_plugin.registerIcon(LPGEN("New Status Notify"), iconList, MODULENAME);
//"Service" Hook, used when the DB settings change: we'll monitor the "status" setting.
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
@@ -1175,7 +1175,7 @@ int CMPlugin::Load()
// there's no need to declare the special service for getting text
// because a blob contains only text
DBEVENTTYPEDESCR evtype = { sizeof(evtype) };
- evtype.module = MODULE;
+ evtype.module = MODULENAME;
evtype.eventType = EVENTTYPE_STATUSCHANGE;
evtype.descr = LPGEN("Status change");
evtype.eventIcon = iconList[3].hIcolib;
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp
index 381b0ebb5c..6f59c4fd28 100644
--- a/plugins/NewXstatusNotify/src/options.cpp
+++ b/plugins/NewXstatusNotify/src/options.cpp
@@ -31,167 +31,167 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
void LoadTemplates()
{
- DBGetStringDefault(0, MODULE, "TPopupXChanged", templates.PopupXstatusChanged, _countof(templates.PopupXstatusChanged), DEFAULT_POPUP_CHANGED);
- DBGetStringDefault(0, MODULE, "TPopupXRemoved", templates.PopupXstatusRemoved, _countof(templates.PopupXstatusRemoved), DEFAULT_POPUP_REMOVED);
- DBGetStringDefault(0, MODULE, "TPopupXMsgChanged", templates.PopupXMsgChanged, _countof(templates.PopupXMsgChanged), DEFAULT_POPUP_MSGCHANGED);
- DBGetStringDefault(0, MODULE, "TPopupXMsgRemoved", templates.PopupXMsgRemoved, _countof(templates.PopupXMsgRemoved), DEFAULT_POPUP_MSGREMOVED);
-
- DBGetStringDefault(0, MODULE, "TLogXChanged", templates.LogXstatusChanged, _countof(templates.LogXstatusChanged), DEFAULT_LOG_CHANGED);
- DBGetStringDefault(0, MODULE, "TLogXRemoved", templates.LogXstatusRemoved, _countof(templates.LogXstatusRemoved), DEFAULT_LOG_REMOVED);
- DBGetStringDefault(0, MODULE, "TLogXMsgChanged", templates.LogXMsgChanged, _countof(templates.LogXMsgChanged), DEFAULT_LOG_MSGCHANGED);
- DBGetStringDefault(0, MODULE, "TLogXMsgRemoved", templates.LogXMsgRemoved, _countof(templates.LogXMsgRemoved), DEFAULT_LOG_MSGREMOVED);
- DBGetStringDefault(0, MODULE, "TLogXOpening", templates.LogXstatusOpening, _countof(templates.LogXstatusOpening), DEFAULT_LOG_OPENING);
-
- DBGetStringDefault(0, MODULE, "TLogSMsgChanged", templates.LogSMsgChanged, _countof(templates.LogSMsgChanged), DEFAULT_LOG_SMSGCHANGED);
- DBGetStringDefault(0, MODULE, "TLogSMsgRemoved", templates.LogSMsgRemoved, _countof(templates.LogSMsgRemoved), DEFAULT_LOG_SMSGREMOVED);
- DBGetStringDefault(0, MODULE, "TLogSMsgOpening", templates.LogSMsgOpening, _countof(templates.LogSMsgOpening), DEFAULT_LOG_SMSGOPENING);
-
- templates.PopupXFlags = db_get_b(0, MODULE, "TPopupXFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE);
- templates.PopupSMsgFlags = db_get_b(0, MODULE, "TPopupSMsgFlags", NOTIFY_NEW_MESSAGE);
- templates.LogXFlags = db_get_b(0, MODULE, "TLogXFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE | NOTIFY_OPENING_ML);
- templates.LogSMsgFlags = db_get_b(0, MODULE, "TLogSMsgFlags", NOTIFY_NEW_MESSAGE | NOTIFY_OPENING_ML);
+ DBGetStringDefault(0, "TPopupXChanged", templates.PopupXstatusChanged, _countof(templates.PopupXstatusChanged), DEFAULT_POPUP_CHANGED);
+ DBGetStringDefault(0, "TPopupXRemoved", templates.PopupXstatusRemoved, _countof(templates.PopupXstatusRemoved), DEFAULT_POPUP_REMOVED);
+ DBGetStringDefault(0, "TPopupXMsgChanged", templates.PopupXMsgChanged, _countof(templates.PopupXMsgChanged), DEFAULT_POPUP_MSGCHANGED);
+ DBGetStringDefault(0, "TPopupXMsgRemoved", templates.PopupXMsgRemoved, _countof(templates.PopupXMsgRemoved), DEFAULT_POPUP_MSGREMOVED);
+
+ DBGetStringDefault(0, "TLogXChanged", templates.LogXstatusChanged, _countof(templates.LogXstatusChanged), DEFAULT_LOG_CHANGED);
+ DBGetStringDefault(0, "TLogXRemoved", templates.LogXstatusRemoved, _countof(templates.LogXstatusRemoved), DEFAULT_LOG_REMOVED);
+ DBGetStringDefault(0, "TLogXMsgChanged", templates.LogXMsgChanged, _countof(templates.LogXMsgChanged), DEFAULT_LOG_MSGCHANGED);
+ DBGetStringDefault(0, "TLogXMsgRemoved", templates.LogXMsgRemoved, _countof(templates.LogXMsgRemoved), DEFAULT_LOG_MSGREMOVED);
+ DBGetStringDefault(0, "TLogXOpening", templates.LogXstatusOpening, _countof(templates.LogXstatusOpening), DEFAULT_LOG_OPENING);
+
+ DBGetStringDefault(0, "TLogSMsgChanged", templates.LogSMsgChanged, _countof(templates.LogSMsgChanged), DEFAULT_LOG_SMSGCHANGED);
+ DBGetStringDefault(0, "TLogSMsgRemoved", templates.LogSMsgRemoved, _countof(templates.LogSMsgRemoved), DEFAULT_LOG_SMSGREMOVED);
+ DBGetStringDefault(0, "TLogSMsgOpening", templates.LogSMsgOpening, _countof(templates.LogSMsgOpening), DEFAULT_LOG_SMSGOPENING);
+
+ templates.PopupXFlags = g_plugin.getByte("TPopupXFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE);
+ templates.PopupSMsgFlags = g_plugin.getByte("TPopupSMsgFlags", NOTIFY_NEW_MESSAGE);
+ templates.LogXFlags = g_plugin.getByte("TLogXFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE | NOTIFY_OPENING_ML);
+ templates.LogSMsgFlags = g_plugin.getByte("TLogSMsgFlags", NOTIFY_NEW_MESSAGE | NOTIFY_OPENING_ML);
}
void LoadOptions()
{
// IDD_OPT_POPUP
- opt.Colors = db_get_b(0, MODULE, "Colors", DEFAULT_COLORS);
- opt.ShowGroup = db_get_b(0, MODULE, "ShowGroup", 0);
- opt.ShowStatus = db_get_b(0, MODULE, "ShowStatus", 1);
- opt.UseAlternativeText = db_get_b(0, MODULE, "UseAlternativeText", 0);
- opt.ShowPreviousStatus = db_get_b(0, MODULE, "ShowPreviousStatus", 0);
- opt.ReadAwayMsg = db_get_b(0, MODULE, "ReadAwayMsg", 0);
- opt.PopupTimeout = db_get_dw(0, MODULE, "PopupTimeout", 0);
- opt.PopupConnectionTimeout = db_get_dw(0, MODULE, "PopupConnectionTimeout", 15);
- opt.LeftClickAction = db_get_b(0, MODULE, "LeftClickAction", 5);
- opt.RightClickAction = db_get_b(0, MODULE, "RightClickAction", 1);
+ opt.Colors = g_plugin.getByte("Colors", DEFAULT_COLORS);
+ opt.ShowGroup = g_plugin.getByte("ShowGroup", 0);
+ opt.ShowStatus = g_plugin.getByte("ShowStatus", 1);
+ opt.UseAlternativeText = g_plugin.getByte("UseAlternativeText", 0);
+ opt.ShowPreviousStatus = g_plugin.getByte("ShowPreviousStatus", 0);
+ opt.ReadAwayMsg = g_plugin.getByte("ReadAwayMsg", 0);
+ opt.PopupTimeout = g_plugin.getDword("PopupTimeout", 0);
+ opt.PopupConnectionTimeout = g_plugin.getDword("PopupConnectionTimeout", 15);
+ opt.LeftClickAction = g_plugin.getByte("LeftClickAction", 5);
+ opt.RightClickAction = g_plugin.getByte("RightClickAction", 1);
// IDD_OPT_XPOPUP
- opt.PXOnConnect = db_get_b(0, MODULE, "PXOnConnect", 0);
- opt.PXDisableForMusic = db_get_b(0, MODULE, "PXDisableForMusic", 1);
- opt.PXMsgTruncate = db_get_b(0, MODULE, "PXMsgTruncate", 0);
- opt.PXMsgLen = db_get_dw(0, MODULE, "PXMsgLen", 64);
+ opt.PXOnConnect = g_plugin.getByte("PXOnConnect", 0);
+ opt.PXDisableForMusic = g_plugin.getByte("PXDisableForMusic", 1);
+ opt.PXMsgTruncate = g_plugin.getByte("PXMsgTruncate", 0);
+ opt.PXMsgLen = g_plugin.getDword("PXMsgLen", 64);
// IDD_OPT_GENERAL
- opt.FromOffline = db_get_b(0, MODULE, "FromOffline", 1);
- opt.AutoDisable = db_get_b(0, MODULE, "AutoDisable", 0);
- opt.HiddenContactsToo = db_get_b(0, MODULE, "HiddenContactsToo", 0);
- opt.UseIndSnd = db_get_b(0, MODULE, "UseIndSounds", 1);
- opt.BlinkIcon = db_get_b(0, MODULE, "BlinkIcon", 0);
- opt.BlinkIcon_Status = db_get_b(0, MODULE, "BlinkIcon_Status", 0);
- opt.BlinkIcon_ForMsgs = db_get_b(0, MODULE, "BlinkIcon_ForMsgs", 0);
- DBGetStringDefault(0, MODULE, "LogFilePath", opt.LogFilePath, MAX_PATH, L"");
+ opt.FromOffline = g_plugin.getByte("FromOffline", 1);
+ opt.AutoDisable = g_plugin.getByte("AutoDisable", 0);
+ opt.HiddenContactsToo = g_plugin.getByte("HiddenContactsToo", 0);
+ opt.UseIndSnd = g_plugin.getByte("UseIndSounds", 1);
+ opt.BlinkIcon = g_plugin.getByte("BlinkIcon", 0);
+ opt.BlinkIcon_Status = g_plugin.getByte("BlinkIcon_Status", 0);
+ opt.BlinkIcon_ForMsgs = g_plugin.getByte("BlinkIcon_ForMsgs", 0);
+ DBGetStringDefault(0, "LogFilePath", opt.LogFilePath, MAX_PATH, L"");
// IDD_AUTODISABLE
- opt.OnlyGlobalChanges = db_get_b(0, MODULE, "OnlyGlobalChanges", 0);
- opt.DisablePopupGlobally = db_get_b(0, MODULE, "DisablePopupGlobally", 0);
- opt.DisableSoundGlobally = db_get_b(0, MODULE, "DisableSoundGlobally", 0);
+ opt.OnlyGlobalChanges = g_plugin.getByte("OnlyGlobalChanges", 0);
+ opt.DisablePopupGlobally = g_plugin.getByte("DisablePopupGlobally", 0);
+ opt.DisableSoundGlobally = g_plugin.getByte("DisableSoundGlobally", 0);
// IDD_OPT_LOG
- opt.LogToFile = db_get_b(0, MODULE, "LogToFile", 0);
- opt.LogToDB = db_get_b(0, MODULE, "LogToDB", 0);
- opt.LogToDB_WinOpen = db_get_b(0, MODULE, "LogToDB_WinOpen", 1);
- opt.LogToDB_Remove = db_get_b(0, MODULE, "LogToDB_Remove", 0);
- opt.LogPrevious = db_get_b(0, MODULE, "LogToPrevious", 0);
- opt.SMsgLogToFile = db_get_b(0, MODULE, "SMsgLogToFile", 0);
- opt.SMsgLogToDB = db_get_b(0, MODULE, "SMsgLogToDB", 0);
- opt.SMsgLogToDB_WinOpen = db_get_b(0, MODULE, "SMsgLogToDB_WinOpen", 1);
- opt.SMsgLogToDB_Remove = db_get_b(0, MODULE, "SMsgLogToDB_Remove", 0);
+ opt.LogToFile = g_plugin.getByte("LogToFile", 0);
+ opt.LogToDB = g_plugin.getByte("LogToDB", 0);
+ opt.LogToDB_WinOpen = g_plugin.getByte("LogToDB_WinOpen", 1);
+ opt.LogToDB_Remove = g_plugin.getByte("LogToDB_Remove", 0);
+ opt.LogPrevious = g_plugin.getByte("LogToPrevious", 0);
+ opt.SMsgLogToFile = g_plugin.getByte("SMsgLogToFile", 0);
+ opt.SMsgLogToDB = g_plugin.getByte("SMsgLogToDB", 0);
+ opt.SMsgLogToDB_WinOpen = g_plugin.getByte("SMsgLogToDB_WinOpen", 1);
+ opt.SMsgLogToDB_Remove = g_plugin.getByte("SMsgLogToDB_Remove", 0);
// IDD_OPT_XLOG
- opt.XLogToFile = db_get_b(0, MODULE, "XLogToFile", 0);
- opt.XLogToDB = db_get_b(0, MODULE, "XLogToDB", 0);
- opt.XLogToDB_WinOpen = db_get_b(0, MODULE, "XLogToDB_WinOpen", 1);
- opt.XLogToDB_Remove = db_get_b(0, MODULE, "XLogToDB_Remove", 0);
- opt.XLogDisableForMusic = db_get_b(0, MODULE, "XLogDisableForMusic", 1);
+ opt.XLogToFile = g_plugin.getByte("XLogToFile", 0);
+ opt.XLogToDB = g_plugin.getByte("XLogToDB", 0);
+ opt.XLogToDB_WinOpen = g_plugin.getByte("XLogToDB_WinOpen", 1);
+ opt.XLogToDB_Remove = g_plugin.getByte("XLogToDB_Remove", 0);
+ opt.XLogDisableForMusic = g_plugin.getByte("XLogDisableForMusic", 1);
// IDD_OPT_SMPOPUP
- opt.PSMsgOnConnect = db_get_b(0, MODULE, "PSMsgOnConnect", 0);
- opt.PSMsgTruncate = db_get_b(0, MODULE, "PSMsgTruncate", 0);
- opt.PSMsgLen = db_get_dw(0, MODULE, "PSMsgLen", 64);
+ opt.PSMsgOnConnect = g_plugin.getByte("PSMsgOnConnect", 0);
+ opt.PSMsgTruncate = g_plugin.getByte("PSMsgTruncate", 0);
+ opt.PSMsgLen = g_plugin.getDword("PSMsgLen", 64);
// OTHER
- opt.TempDisabled = db_get_b(0, MODULE, "TempDisable", 0);
- opt.EnableLastSeen = db_get_b(0, MODULE, "EnableLastSeen", 0);
+ opt.TempDisabled = g_plugin.getByte("TempDisable", 0);
+ opt.EnableLastSeen = g_plugin.getByte("EnableLastSeen", 0);
LoadTemplates();
}
void SaveTemplates()
{
- db_set_ws(0, MODULE, "TPopupXChanged", templates.PopupXstatusChanged);
- db_set_ws(0, MODULE, "TPopupXRemoved", templates.PopupXstatusRemoved);
- db_set_ws(0, MODULE, "TPopupXMsgChanged", templates.PopupXMsgChanged);
- db_set_ws(0, MODULE, "TPopupXMsgRemoved", templates.PopupXMsgRemoved);
-
- db_set_ws(0, MODULE, "TLogXChanged", templates.LogXstatusChanged);
- db_set_ws(0, MODULE, "TLogXRemoved", templates.LogXstatusRemoved);
- db_set_ws(0, MODULE, "TLogXMsgChanged", templates.LogXMsgChanged);
- db_set_ws(0, MODULE, "TLogXMsgRemoved", templates.LogXMsgRemoved);
- db_set_ws(0, MODULE, "TLogXOpening", templates.LogXstatusOpening);
-
- db_set_ws(0, MODULE, "TLogSMsgChanged", templates.LogSMsgChanged);
- db_set_ws(0, MODULE, "TLogSMsgRemoved", templates.LogSMsgRemoved);
- db_set_ws(0, MODULE, "TLogSMsgOpening", templates.LogSMsgOpening);
-
- db_set_b(0, MODULE, "TPopupXFlags", templates.PopupXFlags);
- db_set_b(0, MODULE, "TPopupSMsgFlags", templates.PopupSMsgFlags);
- db_set_b(0, MODULE, "TLogXFlags", templates.LogXFlags);
- db_set_b(0, MODULE, "TLogSMsgFlags", templates.LogSMsgFlags);
+ g_plugin.setWString("TPopupXChanged", templates.PopupXstatusChanged);
+ g_plugin.setWString("TPopupXRemoved", templates.PopupXstatusRemoved);
+ g_plugin.setWString("TPopupXMsgChanged", templates.PopupXMsgChanged);
+ g_plugin.setWString("TPopupXMsgRemoved", templates.PopupXMsgRemoved);
+
+ g_plugin.setWString("TLogXChanged", templates.LogXstatusChanged);
+ g_plugin.setWString("TLogXRemoved", templates.LogXstatusRemoved);
+ g_plugin.setWString("TLogXMsgChanged", templates.LogXMsgChanged);
+ g_plugin.setWString("TLogXMsgRemoved", templates.LogXMsgRemoved);
+ g_plugin.setWString("TLogXOpening", templates.LogXstatusOpening);
+
+ g_plugin.setWString("TLogSMsgChanged", templates.LogSMsgChanged);
+ g_plugin.setWString("TLogSMsgRemoved", templates.LogSMsgRemoved);
+ g_plugin.setWString("TLogSMsgOpening", templates.LogSMsgOpening);
+
+ g_plugin.setByte("TPopupXFlags", templates.PopupXFlags);
+ g_plugin.setByte("TPopupSMsgFlags", templates.PopupSMsgFlags);
+ g_plugin.setByte("TLogXFlags", templates.LogXFlags);
+ g_plugin.setByte("TLogSMsgFlags", templates.LogSMsgFlags);
for (auto &it : ProtoTemplates) {
char str[MAX_PATH];
mir_snprintf(str, "%s_TPopupSMsgChanged", it->ProtoName);
- db_set_ws(0, MODULE, str, it->ProtoTemplateMsg);
+ g_plugin.setWString(str, it->ProtoTemplateMsg);
mir_snprintf(str, "%s_TPopupSMsgRemoved", it->ProtoName);
- db_set_ws(0, MODULE, str, it->ProtoTemplateRemoved);
+ g_plugin.setWString(str, it->ProtoTemplateRemoved);
}
}
void SaveOptions()
{
// IDD_OPT_POPUP
- db_set_b(0, MODULE, "Colors", opt.Colors);
- db_set_b(0, MODULE, "ShowGroup", opt.ShowGroup);
- db_set_b(0, MODULE, "ShowStatus", opt.ShowStatus);
- db_set_b(0, MODULE, "UseAlternativeText", opt.UseAlternativeText);
- db_set_b(0, MODULE, "ShowPreviousStatus", opt.ShowPreviousStatus);
- db_set_b(0, MODULE, "ReadAwayMsg", opt.ReadAwayMsg);
- db_set_dw(0, MODULE, "PopupTimeout", opt.PopupTimeout);
- db_set_dw(0, MODULE, "PopupConnectionTimeout", opt.PopupConnectionTimeout);
- db_set_b(0, MODULE, "LeftClickAction", opt.LeftClickAction);
- db_set_b(0, MODULE, "RightClickAction", opt.RightClickAction);
+ g_plugin.setByte("Colors", opt.Colors);
+ g_plugin.setByte("ShowGroup", opt.ShowGroup);
+ g_plugin.setByte("ShowStatus", opt.ShowStatus);
+ g_plugin.setByte("UseAlternativeText", opt.UseAlternativeText);
+ g_plugin.setByte("ShowPreviousStatus", opt.ShowPreviousStatus);
+ g_plugin.setByte("ReadAwayMsg", opt.ReadAwayMsg);
+ g_plugin.setDword("PopupTimeout", opt.PopupTimeout);
+ g_plugin.setDword("PopupConnectionTimeout", opt.PopupConnectionTimeout);
+ g_plugin.setByte("LeftClickAction", opt.LeftClickAction);
+ g_plugin.setByte("RightClickAction", opt.RightClickAction);
// IDD_OPT_XPOPUP
- db_set_b(0, MODULE, "PXOnConnect", opt.PXOnConnect);
- db_set_b(0, MODULE, "PXDisableForMusic", opt.PXDisableForMusic);
- db_set_b(0, MODULE, "PXMsgTruncate", opt.PXMsgTruncate);
- db_set_dw(0, MODULE, "PXMsgLen", opt.PXMsgLen);
+ g_plugin.setByte("PXOnConnect", opt.PXOnConnect);
+ g_plugin.setByte("PXDisableForMusic", opt.PXDisableForMusic);
+ g_plugin.setByte("PXMsgTruncate", opt.PXMsgTruncate);
+ g_plugin.setDword("PXMsgLen", opt.PXMsgLen);
// IDD_OPT_GENERAL
- db_set_b(0, MODULE, "FromOffline", opt.FromOffline);
- db_set_b(0, MODULE, "AutoDisable", opt.AutoDisable);
- db_set_b(0, MODULE, "HiddenContactsToo", opt.HiddenContactsToo);
- db_set_b(0, MODULE, "UseIndSounds", opt.UseIndSnd);
- db_set_b(0, MODULE, "BlinkIcon", opt.BlinkIcon);
- db_set_b(0, MODULE, "BlinkIcon_Status", opt.BlinkIcon_Status);
- db_set_b(0, MODULE, "BlinkIcon_ForMsgs", opt.BlinkIcon_ForMsgs);
- db_set_ws(0, MODULE, "LogFilePath", opt.LogFilePath);
+ g_plugin.setByte("FromOffline", opt.FromOffline);
+ g_plugin.setByte("AutoDisable", opt.AutoDisable);
+ g_plugin.setByte("HiddenContactsToo", opt.HiddenContactsToo);
+ g_plugin.setByte("UseIndSounds", opt.UseIndSnd);
+ g_plugin.setByte("BlinkIcon", opt.BlinkIcon);
+ g_plugin.setByte("BlinkIcon_Status", opt.BlinkIcon_Status);
+ g_plugin.setByte("BlinkIcon_ForMsgs", opt.BlinkIcon_ForMsgs);
+ g_plugin.setWString("LogFilePath", opt.LogFilePath);
// IDD_AUTODISABLE
- db_set_b(0, MODULE, "OnlyGlobalChanges", opt.OnlyGlobalChanges);
- db_set_b(0, MODULE, "DisablePopupGlobally", opt.DisablePopupGlobally);
- db_set_b(0, MODULE, "DisableSoundGlobally", opt.DisableSoundGlobally);
+ g_plugin.setByte("OnlyGlobalChanges", opt.OnlyGlobalChanges);
+ g_plugin.setByte("DisablePopupGlobally", opt.DisablePopupGlobally);
+ g_plugin.setByte("DisableSoundGlobally", opt.DisableSoundGlobally);
// IDD_OPT_LOG
- db_set_b(0, MODULE, "LogToFile", opt.LogToFile);
- db_set_b(0, MODULE, "LogToDB", opt.LogToDB);
- db_set_b(0, MODULE, "LogToDB_WinOpen", opt.LogToDB_WinOpen);
- db_set_b(0, MODULE, "LogToDB_Remove", opt.LogToDB_Remove);
- db_set_b(0, MODULE, "LogPrevious", opt.LogPrevious);
- db_set_b(0, MODULE, "SMsgLogToFile", opt.SMsgLogToFile);
- db_set_b(0, MODULE, "SMsgLogToDB", opt.SMsgLogToDB);
- db_set_b(0, MODULE, "SMsgLogToDB_WinOpen", opt.SMsgLogToDB_WinOpen);
- db_set_b(0, MODULE, "SMsgLogToDB_Remove", opt.SMsgLogToDB_Remove);
+ g_plugin.setByte("LogToFile", opt.LogToFile);
+ g_plugin.setByte("LogToDB", opt.LogToDB);
+ g_plugin.setByte("LogToDB_WinOpen", opt.LogToDB_WinOpen);
+ g_plugin.setByte("LogToDB_Remove", opt.LogToDB_Remove);
+ g_plugin.setByte("LogPrevious", opt.LogPrevious);
+ g_plugin.setByte("SMsgLogToFile", opt.SMsgLogToFile);
+ g_plugin.setByte("SMsgLogToDB", opt.SMsgLogToDB);
+ g_plugin.setByte("SMsgLogToDB_WinOpen", opt.SMsgLogToDB_WinOpen);
+ g_plugin.setByte("SMsgLogToDB_Remove", opt.SMsgLogToDB_Remove);
// IDD_OPT_XLOG
- db_set_b(0, MODULE, "XLogToFile", opt.XLogToFile);
- db_set_b(0, MODULE, "XLogToDB", opt.XLogToDB);
- db_set_b(0, MODULE, "XLogToDB_WinOpen", opt.XLogToDB_WinOpen);
- db_set_b(0, MODULE, "XLogToDB_Remove", opt.XLogToDB_Remove);
- db_set_b(0, MODULE, "XLogDisableForMusic", opt.XLogDisableForMusic);
+ g_plugin.setByte("XLogToFile", opt.XLogToFile);
+ g_plugin.setByte("XLogToDB", opt.XLogToDB);
+ g_plugin.setByte("XLogToDB_WinOpen", opt.XLogToDB_WinOpen);
+ g_plugin.setByte("XLogToDB_Remove", opt.XLogToDB_Remove);
+ g_plugin.setByte("XLogDisableForMusic", opt.XLogDisableForMusic);
// IDD_OPT_SMPOPUP
- db_set_b(0, MODULE, "PSMsgOnConnect", opt.PSMsgOnConnect);
- db_set_b(0, MODULE, "PSMsgTruncate", opt.PSMsgTruncate);
- db_set_dw(0, MODULE, "PSMsgLen", opt.PSMsgLen);
+ g_plugin.setByte("PSMsgOnConnect", opt.PSMsgOnConnect);
+ g_plugin.setByte("PSMsgTruncate", opt.PSMsgTruncate);
+ g_plugin.setDword("PSMsgLen", opt.PSMsgLen);
}
INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -217,7 +217,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
//Statuses notified
char status[8];
mir_snprintf(status, "%d", i);
- CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, status, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, i, g_plugin.getByte(status, 1) ? BST_CHECKED : BST_UNCHECKED);
}
CheckDlgButton(hwndDlg, IDC_CHK_FROMOFFLINE, opt.FromOffline ? BST_CHECKED : BST_UNCHECKED);
@@ -285,7 +285,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
char status[8];
mir_snprintf(status, "%d", i);
- db_set_b(0, MODULE, status, (BYTE)IsDlgButtonChecked(hwndDlg, i));
+ g_plugin.setByte(status, (BYTE)IsDlgButtonChecked(hwndDlg, i));
}
opt.FromOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_FROMOFFLINE);
@@ -417,12 +417,12 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ctlColour = SendDlgItemMessage(hwndDlg, (i + 2000), CPM_GETCOLOUR, 0, 0);
StatusList[Index(i)].colorBack = SendDlgItemMessage(hwndDlg, (i + 2000), CPM_GETCOLOUR, 0, 0);
mir_snprintf(str, "%ibg", i);
- db_set_dw(0, MODULE, str, ctlColour);
+ g_plugin.setDword(str, ctlColour);
ctlColour = SendDlgItemMessage(hwndDlg, (i + 1000), CPM_GETCOLOUR, 0, 0);
StatusList[Index(i)].colorText = ctlColour;
mir_snprintf(str, "%itx", i);
- db_set_dw(0, MODULE, str, ctlColour);
+ g_plugin.setDword(str, ctlColour);
}
if (IsDlgButtonChecked(hwndDlg, IDC_USEOWNCOLORS))
@@ -469,13 +469,13 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
char str[8];
mir_snprintf(str, "p%d", i);
- CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, str, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, i, g_plugin.getByte(str, 0) ? BST_CHECKED : BST_UNCHECKED);
}
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
char str[8];
mir_snprintf(str, "s%d", i);
- CheckDlgButton(hwndDlg, (i + 2000), db_get_b(0, MODULE, str, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i + 2000), g_plugin.getByte(str, 0) ? BST_CHECKED : BST_UNCHECKED);
}
return TRUE;
@@ -489,13 +489,13 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
char str[8];
mir_snprintf(str, "p%d", i);
- db_set_b(0, MODULE, str, IsDlgButtonChecked(hwndDlg, i));
+ g_plugin.setByte(str, IsDlgButtonChecked(hwndDlg, i));
}
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
char str[8];
mir_snprintf(str, "s%d", i);
- db_set_b(0, MODULE, str, IsDlgButtonChecked(hwndDlg, i + 2000));
+ g_plugin.setByte(str, IsDlgButtonChecked(hwndDlg, i + 2000));
}
SaveOptions();
@@ -702,7 +702,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
DBVARIANT dbVar = { 0 };
char protoname[MAX_PATH] = { 0 };
mir_snprintf(protoname, "%s_TPopupSMsgChanged", pa->szModuleName);
- if (db_get_ws(NULL, MODULE, protoname, &dbVar))
+ if (g_plugin.getWString(protoname, &dbVar))
wcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, _countof(prototemplate->ProtoTemplateMsg));
else {
wcsncpy(prototemplate->ProtoTemplateMsg, dbVar.pwszVal, _countof(prototemplate->ProtoTemplateMsg));
@@ -710,7 +710,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
mir_snprintf(protoname, "%s_TPopupSMsgRemoved", pa->szModuleName);
- if (db_get_ws(NULL, MODULE, protoname, &dbVar))
+ if (g_plugin.getWString(protoname, &dbVar))
wcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, _countof(prototemplate->ProtoTemplateRemoved));
else {
wcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.pwszVal, _countof(prototemplate->ProtoTemplateRemoved));
@@ -722,7 +722,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", pa->szModuleName);
- ListView_SetCheckState(hList, lvItem.iItem, db_get_b(0, MODULE, dbSetting, TRUE));
+ ListView_SetCheckState(hList, lvItem.iItem, g_plugin.getByte(dbSetting, TRUE));
lvItem.iItem++;
}
}
@@ -830,7 +830,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", (char *)lvItem.lParam);
- db_set_b(0, MODULE, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
+ g_plugin.setByte(dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
}
}
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp
index a570cd7646..564183a572 100644
--- a/plugins/NewXstatusNotify/src/popup.cpp
+++ b/plugins/NewXstatusNotify/src/popup.cpp
@@ -76,7 +76,7 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj)
return 0;
MCONTACT hContact = PUGetContact(pdp->hWnd);
- ptrW pstzLast(db_get_wsa(hContact, MODULE, "LastPopupText"));
+ ptrW pstzLast(g_plugin.getWStringA(hContact, "LastPopupText"));
wchar_t *tszStatus = (wchar_t *)ack->lParam;
if (tszStatus == nullptr || *tszStatus == 0)
diff --git a/plugins/NewXstatusNotify/src/stdafx.h b/plugins/NewXstatusNotify/src/stdafx.h
index 5c87669c6f..5f92ba982a 100644
--- a/plugins/NewXstatusNotify/src/stdafx.h
+++ b/plugins/NewXstatusNotify/src/stdafx.h
@@ -66,7 +66,7 @@
#include "version.h"
#include "xstatus.h"
-#define MODULE "NewStatusNotify"
+#define MODULENAME "NewStatusNotify"
struct CMPlugin : public PLUGIN<CMPlugin>
{
diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp
index 07c1539e2e..e1d977bdd6 100644
--- a/plugins/NewXstatusNotify/src/utils.cpp
+++ b/plugins/NewXstatusNotify/src/utils.cpp
@@ -34,16 +34,16 @@ bool CheckMsgWnd(MCONTACT hContact)
return false;
}
-int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, wchar_t *setting, int size, const wchar_t *defaultValue)
+int DBGetStringDefault(MCONTACT hContact, const char *szSetting, wchar_t *setting, int size, const wchar_t *defaultValue)
{
DBVARIANT dbv;
- if (!db_get_ws(hContact, szModule, szSetting, &dbv)) {
- wcsncpy(setting, dbv.pwszVal, size);
+ if (!g_plugin.getWString(hContact, szSetting, &dbv)) {
+ wcsncpy_s(setting, size, dbv.pwszVal, _TRUNCATE);
db_free(&dbv);
return 0;
}
- wcsncpy(setting, defaultValue, size);
+ wcsncpy_s(setting, size, defaultValue, _TRUNCATE);
return 1;
}
diff --git a/plugins/NewXstatusNotify/src/utils.h b/plugins/NewXstatusNotify/src/utils.h
index 03f2105a87..e75a84098c 100644
--- a/plugins/NewXstatusNotify/src/utils.h
+++ b/plugins/NewXstatusNotify/src/utils.h
@@ -23,7 +23,7 @@
#define UTILS_H
bool CheckMsgWnd(MCONTACT hContact);
-int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, wchar_t *setting, int size, const wchar_t *defaultValue);
+int DBGetStringDefault(MCONTACT hContact, const char *szSetting, wchar_t *setting, int size, const wchar_t *defaultValue);
void ShowLog(wchar_t *file);
BOOL StatusHasAwayMessage(char *szProto, int status);
void LogToFile(wchar_t *stzText);
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp
index 906a4696de..944dddf5fd 100644
--- a/plugins/NewXstatusNotify/src/xstatus.cpp
+++ b/plugins/NewXstatusNotify/src/xstatus.cpp
@@ -286,10 +286,10 @@ void LogChangeToDB(XSTATUSCHANGE *xsc)
wchar_t stzLastLog[2 * MAX_TEXT_LEN];
CMStringW stzLogText(ReplaceVars(xsc, Template));
- DBGetStringDefault(xsc->hContact, MODULE, DB_LASTLOG, stzLastLog, _countof(stzLastLog), L"");
+ DBGetStringDefault(xsc->hContact, DB_LASTLOG, stzLastLog, _countof(stzLastLog), L"");
if (opt.XLogToDB) {
- db_set_ws(xsc->hContact, MODULE, DB_LASTLOG, stzLogText);
+ g_plugin.setWString(xsc->hContact, DB_LASTLOG, stzLogText);
T2Utf blob(stzLogText);
@@ -299,7 +299,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc)
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.timestamp = (DWORD)time(0);
- dbei.szModule = MODULE;
+ dbei.szModule = MODULENAME;
MEVENT hDBEvent = db_event_add(xsc->hContact, &dbei);
if (opt.XLogToDB_WinOpen && opt.XLogToDB_Remove) {
@@ -348,7 +348,7 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc)
char buff[12] = { 0 };
mir_snprintf(buff, "%d", ID_STATUS_EXTRASTATUS);
- if ((db_get_b(0, MODULE, buff, 1) == 0)
+ if ((g_plugin.getByte(buff, 1) == 0)
|| (db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
|| (!opt.HiddenContactsToo && (db_get_b(xsc->hContact, "CList", "Hidden", 0) == 1))
|| (Proto_GetStatus(xsc->szProto) == ID_STATUS_OFFLINE))
@@ -358,7 +358,7 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc)
}
// check per-contact ignored events
- if (db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1) == 0)
+ if (g_plugin.getByte(xsc->hContact, "EnableXStatusNotify", 1) == 0)
bEnableSound = bEnablePopup = false;
// check if our status isn't on autodisable list
@@ -367,24 +367,24 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc)
int myStatus = Proto_GetStatus(xsc->szProto);
mir_snprintf(statusIDs, "s%d", myStatus);
mir_snprintf(statusIDp, "p%d", myStatus);
- bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : bEnableSound;
- bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : bEnablePopup;
+ bEnableSound = g_plugin.getByte(statusIDs, 1) ? FALSE : bEnableSound;
+ bEnablePopup = g_plugin.getByte(statusIDp, 1) ? FALSE : bEnablePopup;
}
if (!(templates.PopupXFlags & xsc->action))
bEnablePopup = false;
- if (db_get_b(0, MODULE, xsc->szProto, 1) == 0 && !opt.PXOnConnect)
+ if (g_plugin.getByte(xsc->szProto, 1) == 0 && !opt.PXOnConnect)
bEnablePopup = false;
int xstatusID = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0);
if (opt.PXDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
bEnableSound = bEnablePopup = false;
- if (bEnablePopup && db_get_b(xsc->hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled)
+ if (bEnablePopup && g_plugin.getByte(xsc->hContact, "EnablePopups", 1) && !opt.TempDisabled)
ShowXStatusPopup(xsc);
- if (bEnableSound && db_get_b(0, "Skin", "UseSound", 1) && db_get_b(xsc->hContact, MODULE, "EnableSounds", 1) && !opt.TempDisabled)
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", 1) && g_plugin.getByte(xsc->hContact, "EnableSounds", 1) && !opt.TempDisabled)
PlayXStatusSound(xsc->hContact, xsc->action);
if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled)
@@ -396,10 +396,10 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc)
if (!(templates.LogXFlags & xsc->action))
bEnableLog = false;
- if (bEnableLog && db_get_b(xsc->hContact, MODULE, "EnableXLogging", 1))
+ if (bEnableLog && g_plugin.getByte(xsc->hContact, "EnableXLogging", 1))
LogChangeToDB(xsc);
- if (opt.XLogToFile && db_get_b(xsc->hContact, MODULE, "EnableXLogging", 1))
+ if (opt.XLogToFile && g_plugin.getByte(xsc->hContact, "EnableXLogging", 1))
LogChangeToFile(xsc);
FreeXSC(xsc);
@@ -526,10 +526,10 @@ int OnWindowEvent(WPARAM, LPARAM lParam)
RemoveLoggedEventsSMsg(mwed->hContact);
}
else if (mwed->uType == MSG_WINDOW_EVT_OPEN) {
- if (opt.XLogToDB && (templates.LogXFlags & NOTIFY_OPENING_ML) && db_get_b(mwed->hContact, MODULE, "EnableXLogging", 1))
+ if (opt.XLogToDB && (templates.LogXFlags & NOTIFY_OPENING_ML) && g_plugin.getByte(mwed->hContact, "EnableXLogging", 1))
mir_forkthread(AddXStatusEventThread, (void *)mwed->hContact);
- if (opt.SMsgLogToDB && (templates.LogSMsgFlags & NOTIFY_OPENING_ML) && db_get_b(mwed->hContact, MODULE, "EnableSMsgLogging", 1))
+ if (opt.SMsgLogToDB && (templates.LogSMsgFlags & NOTIFY_OPENING_ML) && g_plugin.getByte(mwed->hContact, "EnableSMsgLogging", 1))
mir_forkthread(AddSMsgEventThread, (void *)mwed->hContact);
}
return 0;