summaryrefslogtreecommitdiff
path: root/plugins/Spamotron/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Spamotron/src')
-rw-r--r--plugins/Spamotron/src/bayes.cpp12
-rw-r--r--plugins/Spamotron/src/options.cpp106
-rw-r--r--plugins/Spamotron/src/popups.cpp90
-rw-r--r--plugins/Spamotron/src/spamotron.cpp132
-rw-r--r--plugins/Spamotron/src/stdafx.h14
-rw-r--r--plugins/Spamotron/src/utils.cpp8
6 files changed, 175 insertions, 187 deletions
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp
index f099109530..9b6c1874a7 100644
--- a/plugins/Spamotron/src/bayes.cpp
+++ b/plugins/Spamotron/src/bayes.cpp
@@ -225,11 +225,11 @@ void queue_message(MCONTACT hContact, DWORD msgtime, wchar_t *message)
char *tmp;
sqlite3_stmt *stmt;
- if (!_getOptB("BayesAutolearnApproved", defaultBayesAutolearnApproved) &&
- !_getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
+ if (!g_plugin.getByte("BayesAutolearnApproved", defaultBayesAutolearnApproved) &&
+ !g_plugin.getByte("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
return;
- if (_getOptB("BayesEnabled", defaultBayesEnabled) == 0)
+ if (g_plugin.getByte("BayesEnabled", defaultBayesEnabled) == 0)
return;
if (bayesdb == nullptr)
OpenBayes();
@@ -286,7 +286,7 @@ void dequeue_messages()
return;
sqlite3_prepare_v2(bayesdb, "SELECT message FROM queue WHERE msgtime + ? < ?", -1, &stmt, nullptr);
- sqlite3_bind_int(stmt, 1, _getOptD("BayesWaitApprove", defaultBayesWaitApprove)*86400);
+ sqlite3_bind_int(stmt, 1, g_plugin.getDword("BayesWaitApprove", defaultBayesWaitApprove)*86400);
sqlite3_bind_int(stmt, 2, (DWORD)t);
while (sqlite3_step(stmt) == SQLITE_ROW) {
d = 1;
@@ -298,7 +298,7 @@ void dequeue_messages()
sqlite3_finalize(stmt);
if (d) {
sqlite3_prepare_v2(bayesdb, "DELETE FROM queue WHERE msgtime + ? < ?", -1, &stmt, nullptr);
- sqlite3_bind_int(stmt, 1, _getOptD("BayesWaitApprove", defaultBayesWaitApprove)*86400);
+ sqlite3_bind_int(stmt, 1, g_plugin.getDword("BayesWaitApprove", defaultBayesWaitApprove)*86400);
sqlite3_bind_int(stmt, 2, (DWORD)t);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
@@ -316,7 +316,7 @@ void learn(int type, wchar_t *msg)
sqlite3_stmt *stmtdbg;
#endif
- if (_getOptB("BayesEnabled", defaultBayesEnabled) == 0)
+ if (g_plugin.getByte("BayesEnabled", defaultBayesEnabled) == 0)
return;
if (bayesdb == nullptr)
OpenBayes();
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp
index 0cff0e8420..9d124fb5ce 100644
--- a/plugins/Spamotron/src/options.cpp
+++ b/plugins/Spamotron/src/options.cpp
@@ -40,7 +40,7 @@ BOOL _saveDlgItemText(HWND hDialog, int controlID, char* option)
len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
tmp = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len + 1);
- _setOptTS(option, tmp);
+ g_plugin.setWString(option, tmp);
free(tmp);
return TRUE;
}
@@ -72,7 +72,7 @@ BOOL _saveDlgItemInt(HWND hDialog, int controlID, char* option)
len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
tmp = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len + 1);
- _setOptD(option, _wtoi(tmp));
+ g_plugin.setDword(option, _wtoi(tmp));
free(tmp);
return TRUE;
}
@@ -83,7 +83,7 @@ BOOL _saveDlgItemScore(HWND hDialog, int controlID, char* option)
len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
tmp = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len + 1);
- _setOptD(option, wcstod(tmp, nullptr)/SCORE_C);
+ g_plugin.setDword(option, wcstod(tmp, nullptr)/SCORE_C);
return TRUE;
}
@@ -103,17 +103,17 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
bInitializing = 1;
///Main enable switch
- CheckDlgButton(optDlg, IDC_OPT_OUT_MSG_APPROVE, _getOptB("ApproveOnMsgOut", defaultApproveOnMsgOut) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_IN_MSG_APPROVE, _getOptB("ApproveOnMsgIn", defaultApproveOnMsgIn) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_DONT_REPLY_SAME_MSG, _getOptB("DontReplySameMsg", defaultDontReplySameMsg) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_DONT_REPLY_MSG, _getOptB("DontReplyMsg", defaultDontReplyMsg) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_HIDE_UNTIL_VERIFIED, _getOptB("HideUnverified", defaultHideUnverified) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_ADD_PERMANENTLY, _getOptB("AddPermanently", defaultAddPermanently) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_LOG_ACTIONS, _getOptB("LogActions", defaultLogActions) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_OUT_MSG_APPROVE, g_plugin.getByte("ApproveOnMsgOut", defaultApproveOnMsgOut) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_IN_MSG_APPROVE, g_plugin.getByte("ApproveOnMsgIn", defaultApproveOnMsgIn) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_DONT_REPLY_SAME_MSG, g_plugin.getByte("DontReplySameMsg", defaultDontReplySameMsg) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_DONT_REPLY_MSG, g_plugin.getByte("DontReplyMsg", defaultDontReplyMsg) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_HIDE_UNTIL_VERIFIED, g_plugin.getByte("HideUnverified", defaultHideUnverified) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_ADD_PERMANENTLY, g_plugin.getByte("AddPermanently", defaultAddPermanently) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_LOG_ACTIONS, g_plugin.getByte("LogActions", defaultLogActions) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(optDlg, IDC_OPT_IN_MSG_APPROVE_WORDLIST, _getOptS(buf, _countof(buf), "ApproveOnMsgInWordlist", defaultApproveOnMsgInWordlist));
- SetDlgItemText(optDlg, IDC_OPT_MAX_MSG_CONTACT, _itow((unsigned int)_getOptD("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay), buf, 10));
- SetDlgItemText(optDlg, IDC_OPT_MAX_SAME_MSG, _itow((unsigned int)_getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay), buf, 10));
+ SetDlgItemText(optDlg, IDC_OPT_MAX_MSG_CONTACT, _itow(g_plugin.getDword("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay), buf, 10));
+ SetDlgItemText(optDlg, IDC_OPT_MAX_SAME_MSG, _itow(g_plugin.getDword("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay), buf, 10));
SetDlgItemText(optDlg, IDC_OPT_DONT_REPLY_MSG_WORDLIST, _getOptS(buf, _countof(buf), "DontReplyMsgWordlist", defaultDontReplyMsgWordlist));
///Individual protocols list
@@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
memset(protoOption, 0, sizeof(protoOption));
mir_strcat(protoOption, "proto_");
mir_strcat(protoOption, pa->szModuleName);
- ListView_SetCheckState(hProtocolsList, j++, _getOptB(protoOption, 0));
+ ListView_SetCheckState(hProtocolsList, j++, g_plugin.getByte(protoOption, 0));
}
bInitializing = 0;
@@ -181,13 +181,13 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
}
switch (((NMHDR*)lParam)->code) {
case PSN_APPLY:
- _setOptB("ApproveOnMsgOut", IsDlgButtonChecked(optDlg, IDC_OPT_OUT_MSG_APPROVE));
- _setOptB("ApproveOnMsgIn", IsDlgButtonChecked(optDlg, IDC_OPT_IN_MSG_APPROVE));
- _setOptB("DontReplySameMsg", IsDlgButtonChecked(optDlg, IDC_OPT_DONT_REPLY_SAME_MSG));
- _setOptB("DontReplyMsg", IsDlgButtonChecked(optDlg, IDC_OPT_DONT_REPLY_MSG));
- _setOptB("AddPermanently", IsDlgButtonChecked(optDlg, IDC_OPT_ADD_PERMANENTLY));
- _setOptB("HideUnverified", IsDlgButtonChecked(optDlg, IDC_OPT_HIDE_UNTIL_VERIFIED));
- _setOptB("LogActions", IsDlgButtonChecked(optDlg, IDC_OPT_LOG_ACTIONS));
+ g_plugin.setByte("ApproveOnMsgOut", IsDlgButtonChecked(optDlg, IDC_OPT_OUT_MSG_APPROVE));
+ g_plugin.setByte("ApproveOnMsgIn", IsDlgButtonChecked(optDlg, IDC_OPT_IN_MSG_APPROVE));
+ g_plugin.setByte("DontReplySameMsg", IsDlgButtonChecked(optDlg, IDC_OPT_DONT_REPLY_SAME_MSG));
+ g_plugin.setByte("DontReplyMsg", IsDlgButtonChecked(optDlg, IDC_OPT_DONT_REPLY_MSG));
+ g_plugin.setByte("AddPermanently", IsDlgButtonChecked(optDlg, IDC_OPT_ADD_PERMANENTLY));
+ g_plugin.setByte("HideUnverified", IsDlgButtonChecked(optDlg, IDC_OPT_HIDE_UNTIL_VERIFIED));
+ g_plugin.setByte("LogActions", IsDlgButtonChecked(optDlg, IDC_OPT_LOG_ACTIONS));
_saveDlgItemText(optDlg, IDC_OPT_IN_MSG_APPROVE_WORDLIST, "ApproveOnMsgInWordlist");
_saveDlgItemText(optDlg, IDC_OPT_DONT_REPLY_MSG_WORDLIST, "DontReplyMsgWordlist");
_saveDlgItemInt(optDlg, IDC_OPT_MAX_MSG_CONTACT, "MaxMsgContactCountPerDay");
@@ -200,7 +200,7 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
memset(protoOption, 0, sizeof(protoOption));
mir_strcat(protoOption, "proto_");
mir_strcat(protoOption, mir_u2a(buf));
- _setOptB(protoOption, ListView_GetCheckState(hProtocolsList, i));
+ g_plugin.setByte(protoOption, ListView_GetCheckState(hProtocolsList, i));
}
return TRUE;
}
@@ -232,7 +232,7 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP
SendMessage(ht, CB_ADDSTRING, 0, (LPARAM)TranslateT("Random"));
SendMessage(ht, CB_SETITEMDATA, 3, SPAMOTRON_MODE_RANDOM);
- selectedMode = _getOptB("Mode", defaultMode);
+ selectedMode = g_plugin.getByte("Mode", defaultMode);
for (i = 0; i < SendMessage(ht, CB_GETCOUNT, 0, 0); i++) {
if (SendMessage(ht, CB_GETITEMDATA, i, 0) == selectedMode) {
SendMessage(ht, CB_SETCURSEL, i, 0);
@@ -263,13 +263,13 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP
SetDlgItemText(optDlg, IDC_OPT_AUTH_CHALLENGE, _getOptS(buf, buflen, "AuthChallengeMath", defaultAuthChallengeMath));
break;
}
- CheckDlgButton(optDlg, IDC_OPT_REPLY_ON_SUCCESS, _getOptB("ReplyOnSuccess", defaultReplyOnSuccess) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_REPLY_ON_AUTH, _getOptB("ReplyOnAuth", defaultReplyOnAuth) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_REPLY_ON_MSG, _getOptB("ReplyOnMsg", defaultReplyOnMsg) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_KEEP_BLOCKED_MSG, _getOptB("KeepBlockedMsg", defaultKeepBlockedMsg) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_MARK_MSG_UNREAD_ON_APPROVAL, _getOptB("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(optDlg, IDC_OPT_MARK_MSG_UNREAD_ON_APPROVAL), _getOptB("KeepBlockedMsg", defaultKeepBlockedMsg));
- CheckDlgButton(optDlg, IDC_OPT_CCRESPONSE, _getOptB("ResponseCC", defaultResponseCC) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_REPLY_ON_SUCCESS, g_plugin.getByte("ReplyOnSuccess", defaultReplyOnSuccess) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_REPLY_ON_AUTH, g_plugin.getByte("ReplyOnAuth", defaultReplyOnAuth) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_REPLY_ON_MSG, g_plugin.getByte("ReplyOnMsg", defaultReplyOnMsg) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_KEEP_BLOCKED_MSG, g_plugin.getByte("KeepBlockedMsg", defaultKeepBlockedMsg) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_MARK_MSG_UNREAD_ON_APPROVAL, g_plugin.getByte("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(optDlg, IDC_OPT_MARK_MSG_UNREAD_ON_APPROVAL), g_plugin.getByte("KeepBlockedMsg", defaultKeepBlockedMsg));
+ CheckDlgButton(optDlg, IDC_OPT_CCRESPONSE, g_plugin.getByte("ResponseCC", defaultResponseCC) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(optDlg, IDC_OPT_RESPONSE, _getOptS(buf, buflen, "Response", defaultResponse));
SetDlgItemText(optDlg, IDC_OPT_SUCCESS_RESPONSE, _getOptS(buf, buflen, "SuccessResponse", defaultSuccessResponse));
free(buf);
@@ -353,13 +353,13 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP
case PSN_APPLY:
i = SendDlgItemMessage(optDlg, IDC_OPT_MODE, CB_GETCURSEL, 0, 0);
selectedMode = SendDlgItemMessage(optDlg, IDC_OPT_MODE, CB_GETITEMDATA, i, 0);
- _setOptB("Mode", selectedMode);
- _setOptB("ReplyOnSuccess", IsDlgButtonChecked(optDlg, IDC_OPT_REPLY_ON_SUCCESS));
- _setOptB("ReplyOnAuth", IsDlgButtonChecked(optDlg, IDC_OPT_REPLY_ON_AUTH));
- _setOptB("ReplyOnMsg", IsDlgButtonChecked(optDlg, IDC_OPT_REPLY_ON_MSG));
- _setOptB("KeepBlockedMsg", IsDlgButtonChecked(optDlg, IDC_OPT_KEEP_BLOCKED_MSG));
- _setOptB("MarkMsgUnreadOnApproval", IsDlgButtonChecked(optDlg, IDC_OPT_MARK_MSG_UNREAD_ON_APPROVAL));
- _setOptB("ResponseCC", IsDlgButtonChecked(optDlg, IDC_OPT_CCRESPONSE));
+ g_plugin.setByte("Mode", selectedMode);
+ g_plugin.setByte("ReplyOnSuccess", IsDlgButtonChecked(optDlg, IDC_OPT_REPLY_ON_SUCCESS));
+ g_plugin.setByte("ReplyOnAuth", IsDlgButtonChecked(optDlg, IDC_OPT_REPLY_ON_AUTH));
+ g_plugin.setByte("ReplyOnMsg", IsDlgButtonChecked(optDlg, IDC_OPT_REPLY_ON_MSG));
+ g_plugin.setByte("KeepBlockedMsg", IsDlgButtonChecked(optDlg, IDC_OPT_KEEP_BLOCKED_MSG));
+ g_plugin.setByte("MarkMsgUnreadOnApproval", IsDlgButtonChecked(optDlg, IDC_OPT_MARK_MSG_UNREAD_ON_APPROVAL));
+ g_plugin.setByte("ResponseCC", IsDlgButtonChecked(optDlg, IDC_OPT_CCRESPONSE));
switch (selectedMode) {
case SPAMOTRON_MODE_PLAIN:
_saveDlgItemText(optDlg, IDC_OPT_CHALLENGE, "Challenge");
@@ -422,22 +422,22 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
case WM_INITDIALOG:
bInitializing = 1;
TranslateDialogDefault(optDlg);
- bEnabled = _getOptB("BayesEnabled", defaultBayesEnabled);
+ bEnabled = g_plugin.getByte("BayesEnabled", defaultBayesEnabled);
CheckDlgButton(optDlg, IDC_OPT_BAYES_ENABLED, bEnabled ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_BAYES_BLOCK_MSG, _getOptB("BayesBlockMsg", defaultBayesBlockMsg) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTO_APPROVE, _getOptB("BayesAutoApprove", defaultBayesAutoApprove) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_APPROVED, _getOptB("BayesAutolearnApproved", defaultBayesAutolearnApproved) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_AUTOAPPROVED, _getOptB("BayesAutolearnAutoApproved", defaultBayesAutolearnAutoApproved) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_NOT_APPROVED, _getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_OUTGOING, _getOptB("BayesAutolearnOutgoing", defaultBayesAutolearnOutgoing) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_BAYES_BLOCK_MSG, g_plugin.getByte("BayesBlockMsg", defaultBayesBlockMsg) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTO_APPROVE, g_plugin.getByte("BayesAutoApprove", defaultBayesAutoApprove) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_APPROVED, g_plugin.getByte("BayesAutolearnApproved", defaultBayesAutolearnApproved) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_AUTOAPPROVED, g_plugin.getByte("BayesAutolearnAutoApproved", defaultBayesAutolearnAutoApproved) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_NOT_APPROVED, g_plugin.getByte("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_BAYES_AUTOLEARN_OUTGOING, g_plugin.getByte("BayesAutolearnOutgoing", defaultBayesAutolearnOutgoing) ? BST_CHECKED : BST_UNCHECKED);
EnableControlsBayes(optDlg, bEnabled);
- mir_snwprintf(buf, L"%0.02f", (double)_getOptD("BayesSpamScore", defaultBayesSpamScore)*SCORE_C);
+ mir_snwprintf(buf, L"%0.02f", (double)g_plugin.getDword("BayesSpamScore", defaultBayesSpamScore)*SCORE_C);
SetDlgItemText(optDlg, IDC_OPT_BAYES_SPAM_SCORE, buf);
- mir_snwprintf(buf, L"%.02f", (double)_getOptD("BayesHamScore", defaultBayesHamScore)*SCORE_C);
+ mir_snwprintf(buf, L"%.02f", (double)g_plugin.getDword("BayesHamScore", defaultBayesHamScore)*SCORE_C);
SetDlgItemText(optDlg, IDC_OPT_BAYES_HAM_SCORE, buf);
- mir_snwprintf(buf, L"%d", _getOptD("BayesWaitApprove", defaultBayesWaitApprove));
+ mir_snwprintf(buf, L"%d", g_plugin.getDword("BayesWaitApprove", defaultBayesWaitApprove));
SetDlgItemText(optDlg, IDC_OPT_BAYES_WAIT_APPROVE, buf);
if (bEnabled) {
@@ -528,13 +528,13 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
case WM_NOTIFY:
switch (((NMHDR*)lParam)->code) {
case PSN_APPLY:
- _setOptB("BayesEnabled", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_ENABLED));
- _setOptB("BayesBlockMsg", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_BLOCK_MSG));
- _setOptB("BayesAutoApprove", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTO_APPROVE));
- _setOptB("BayesAutolearnApproved", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_APPROVED));
- _setOptB("BayesAutolearnAutoApproved", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_AUTOAPPROVED));
- _setOptB("BayesAutolearnNotApproved", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_NOT_APPROVED));
- _setOptB("BayesAutolearnOutgoing", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_OUTGOING));
+ g_plugin.setByte("BayesEnabled", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_ENABLED));
+ g_plugin.setByte("BayesBlockMsg", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_BLOCK_MSG));
+ g_plugin.setByte("BayesAutoApprove", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTO_APPROVE));
+ g_plugin.setByte("BayesAutolearnApproved", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_APPROVED));
+ g_plugin.setByte("BayesAutolearnAutoApproved", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_AUTOAPPROVED));
+ g_plugin.setByte("BayesAutolearnNotApproved", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_NOT_APPROVED));
+ g_plugin.setByte("BayesAutolearnOutgoing", IsDlgButtonChecked(optDlg, IDC_OPT_BAYES_AUTOLEARN_OUTGOING));
_saveDlgItemScore(optDlg, IDC_OPT_BAYES_SPAM_SCORE, "BayesSpamScore");
_saveDlgItemScore(optDlg, IDC_OPT_BAYES_HAM_SCORE, "BayesHamScore");
_saveDlgItemInt(optDlg, IDC_OPT_BAYES_WAIT_APPROVE, "BayesWaitApprove");
diff --git a/plugins/Spamotron/src/popups.cpp b/plugins/Spamotron/src/popups.cpp
index a58f62d27e..19b17de683 100644
--- a/plugins/Spamotron/src/popups.cpp
+++ b/plugins/Spamotron/src/popups.cpp
@@ -54,29 +54,29 @@ INT_PTR CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wParam, LPAR
case WM_INITDIALOG:
bInitializing = 1;
TranslateDialogDefault(optDlg);
- bEnabled = _getOptB("NotifyPopup", defaultNotifyPopup);
+ bEnabled = g_plugin.getByte("NotifyPopup", defaultNotifyPopup);
CheckDlgButton(optDlg, IDC_OPT_POPUPS_ENABLED, bEnabled ? BST_CHECKED : BST_UNCHECKED);
EnablePopupControls(optDlg, bEnabled);
- CheckDlgButton(optDlg, IDC_OPT_POPUPS_NOTIFY_BLOCKED, _getOptB("NotifyPopupBlocked", defaultNotifyPopupBlocked) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_POPUPS_NOTIFY_APPROVED, _getOptB("NotifyPopupApproved", defaultNotifyPopupApproved) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_POPUPS_NOTIFY_CHALLENGE, _getOptB("NotifyPopupChallenge", defaultNotifyPopupChallenge) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_POPUPS_DEFAULT_COLORS, _getOptB("PopupDefaultColors", defaultPopupDefaultColors) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_POPUPS_WINDOWS_COLORS, _getOptB("PopupWindowsColors", defaultPopupWindowsColors) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(optDlg, IDC_OPT_POPUPS_DEFAULT_TIMEOUT, _getOptB("PopupDefaultTimeout", defaultPopupDefaultTimeout) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(optDlg, IDC_OPT_POPUPS_BLOCKED_TIMEOUT, _getOptD("PopupBlockedTimeout", defaultPopupBlockedTimeout), FALSE);
- SetDlgItemInt(optDlg, IDC_OPT_POPUPS_APPROVED_TIMEOUT, _getOptD("PopupApprovedTimeout", defaultPopupApprovedTimeout), FALSE);
- SetDlgItemInt(optDlg, IDC_OPT_POPUPS_CHALLENGE_TIMEOUT, _getOptD("PopupChallengeTimeout", defaultPopupChallengeTimeout), FALSE);
- SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_BLOCKED_FOREGROUND, CPM_SETCOLOUR, 0, _getOptD("PopupBlockedForeground", defaultPopupBlockedForeground));
- SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_BLOCKED_BACKGROUND, CPM_SETCOLOUR, 0, _getOptD("PopupBlockedBackground", defaultPopupBlockedBackground));
- SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_APPROVED_FOREGROUND, CPM_SETCOLOUR, 0, _getOptD("PopupApprovedForeground", defaultPopupApprovedForeground));
- SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_APPROVED_BACKGROUND, CPM_SETCOLOUR, 0, _getOptD("PopupApprovedBackground", defaultPopupApprovedBackground));
- SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_CHALLENGE_FOREGROUND, CPM_SETCOLOUR, 0, _getOptD("PopupChallengeForeground", defaultPopupChallengeForeground));
- SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_CHALLENGE_BACKGROUND, CPM_SETCOLOUR, 0, _getOptD("PopupChallengeBackground", defaultPopupChallengeBackground));
+ CheckDlgButton(optDlg, IDC_OPT_POPUPS_NOTIFY_BLOCKED, g_plugin.getByte("NotifyPopupBlocked", defaultNotifyPopupBlocked) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_POPUPS_NOTIFY_APPROVED, g_plugin.getByte("NotifyPopupApproved", defaultNotifyPopupApproved) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_POPUPS_NOTIFY_CHALLENGE, g_plugin.getByte("NotifyPopupChallenge", defaultNotifyPopupChallenge) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_POPUPS_DEFAULT_COLORS, g_plugin.getByte("PopupDefaultColors", defaultPopupDefaultColors) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_POPUPS_WINDOWS_COLORS, g_plugin.getByte("PopupWindowsColors", defaultPopupWindowsColors) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(optDlg, IDC_OPT_POPUPS_DEFAULT_TIMEOUT, g_plugin.getByte("PopupDefaultTimeout", defaultPopupDefaultTimeout) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(optDlg, IDC_OPT_POPUPS_BLOCKED_TIMEOUT, g_plugin.getDword("PopupBlockedTimeout", defaultPopupBlockedTimeout), FALSE);
+ SetDlgItemInt(optDlg, IDC_OPT_POPUPS_APPROVED_TIMEOUT, g_plugin.getDword("PopupApprovedTimeout", defaultPopupApprovedTimeout), FALSE);
+ SetDlgItemInt(optDlg, IDC_OPT_POPUPS_CHALLENGE_TIMEOUT, g_plugin.getDword("PopupChallengeTimeout", defaultPopupChallengeTimeout), FALSE);
+ SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_BLOCKED_FOREGROUND, CPM_SETCOLOUR, 0, g_plugin.getDword("PopupBlockedForeground", defaultPopupBlockedForeground));
+ SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_BLOCKED_BACKGROUND, CPM_SETCOLOUR, 0, g_plugin.getDword("PopupBlockedBackground", defaultPopupBlockedBackground));
+ SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_APPROVED_FOREGROUND, CPM_SETCOLOUR, 0, g_plugin.getDword("PopupApprovedForeground", defaultPopupApprovedForeground));
+ SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_APPROVED_BACKGROUND, CPM_SETCOLOUR, 0, g_plugin.getDword("PopupApprovedBackground", defaultPopupApprovedBackground));
+ SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_CHALLENGE_FOREGROUND, CPM_SETCOLOUR, 0, g_plugin.getDword("PopupChallengeForeground", defaultPopupChallengeForeground));
+ SendDlgItemMessage(optDlg, IDC_OPT_POPUPS_CHALLENGE_BACKGROUND, CPM_SETCOLOUR, 0, g_plugin.getDword("PopupChallengeBackground", defaultPopupChallengeBackground));
EnablePopupTimeouts(optDlg, IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_DEFAULT_TIMEOUT));
EnablePopupColors(optDlg,
- _getOptB("PopupDefaultColors", defaultPopupDefaultColors),
- _getOptB("PopupWindowsColors", defaultPopupWindowsColors));
+ g_plugin.getByte("PopupDefaultColors", defaultPopupDefaultColors),
+ g_plugin.getByte("PopupWindowsColors", defaultPopupWindowsColors));
bInitializing = 0;
break;
@@ -118,22 +118,22 @@ INT_PTR CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wParam, LPAR
case WM_NOTIFY:
switch (((NMHDR*)lParam)->code) {
case PSN_APPLY:
- _setOptB("NotifyPopup", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_ENABLED));
- _setOptB("NotifyPopupBlocked", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_NOTIFY_BLOCKED));
- _setOptB("NotifyPopupApproved", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_NOTIFY_APPROVED));
- _setOptB("NotifyPopupChallenge", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_NOTIFY_CHALLENGE));
- _setOptB("PopupDefaultColors", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_DEFAULT_COLORS));
- _setOptB("PopupWindowsColors", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_WINDOWS_COLORS));
- _setOptB("PopupDefaultTimeout", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_DEFAULT_TIMEOUT));
+ g_plugin.setByte("NotifyPopup", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_ENABLED));
+ g_plugin.setByte("NotifyPopupBlocked", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_NOTIFY_BLOCKED));
+ g_plugin.setByte("NotifyPopupApproved", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_NOTIFY_APPROVED));
+ g_plugin.setByte("NotifyPopupChallenge", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_NOTIFY_CHALLENGE));
+ g_plugin.setByte("PopupDefaultColors", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_DEFAULT_COLORS));
+ g_plugin.setByte("PopupWindowsColors", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_WINDOWS_COLORS));
+ g_plugin.setByte("PopupDefaultTimeout", IsDlgButtonChecked(optDlg, IDC_OPT_POPUPS_DEFAULT_TIMEOUT));
_saveDlgItemInt(optDlg, IDC_OPT_POPUPS_BLOCKED_TIMEOUT, "PopupBlockedTimeout");
_saveDlgItemInt(optDlg, IDC_OPT_POPUPS_APPROVED_TIMEOUT, "PopupApprovedTimeout");
_saveDlgItemInt(optDlg, IDC_OPT_POPUPS_CHALLENGE_TIMEOUT, "PopupChallengeTimeout");
- _setOptD("PopupBlockedForeground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_BLOCKED_FOREGROUND,CPM_GETCOLOUR,0,0));
- _setOptD("PopupBlockedBackground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_BLOCKED_BACKGROUND,CPM_GETCOLOUR,0,0));
- _setOptD("PopupApprovedForeground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_APPROVED_FOREGROUND,CPM_GETCOLOUR,0,0));
- _setOptD("PopupApprovedBackground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_APPROVED_BACKGROUND,CPM_GETCOLOUR,0,0));
- _setOptD("PopupChallengeForeground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_CHALLENGE_FOREGROUND,CPM_GETCOLOUR,0,0));
- _setOptD("PopupChallengeBackground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_CHALLENGE_BACKGROUND,CPM_GETCOLOUR,0,0));
+ g_plugin.setDword("PopupBlockedForeground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_BLOCKED_FOREGROUND,CPM_GETCOLOUR,0,0));
+ g_plugin.setDword("PopupBlockedBackground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_BLOCKED_BACKGROUND,CPM_GETCOLOUR,0,0));
+ g_plugin.setDword("PopupApprovedForeground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_APPROVED_FOREGROUND,CPM_GETCOLOUR,0,0));
+ g_plugin.setDword("PopupApprovedBackground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_APPROVED_BACKGROUND,CPM_GETCOLOUR,0,0));
+ g_plugin.setDword("PopupChallengeForeground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_CHALLENGE_FOREGROUND,CPM_GETCOLOUR,0,0));
+ g_plugin.setDword("PopupChallengeBackground", SendDlgItemMessage(optDlg,IDC_OPT_POPUPS_CHALLENGE_BACKGROUND,CPM_GETCOLOUR,0,0));
break;
}
break;
@@ -198,39 +198,39 @@ int ShowPopup(MCONTACT hContact, BYTE popupType, wchar_t *line1, wchar_t *line2)
switch (popupType)
{
case POPUP_DEFAULT:
- ppdp.colorText = _getOptD("PopupApprovedForeground", defaultPopupApprovedForeground);
- ppdp.colorBack = _getOptD("PopupApprovedBackground", defaultPopupApprovedBackground);
+ ppdp.colorText = g_plugin.getDword("PopupApprovedForeground", defaultPopupApprovedForeground);
+ ppdp.colorBack = g_plugin.getDword("PopupApprovedBackground", defaultPopupApprovedBackground);
break;
case POPUP_BLOCKED:
- ppdp.colorText = _getOptD("PopupBlockedForeground", defaultPopupBlockedForeground);
- ppdp.colorBack = _getOptD("PopupBlockedBackground", defaultPopupBlockedBackground);
- ppdp.iSeconds = _getOptD("PopupBlockedTimeout", defaultPopupBlockedTimeout);
+ ppdp.colorText = g_plugin.getDword("PopupBlockedForeground", defaultPopupBlockedForeground);
+ ppdp.colorBack = g_plugin.getDword("PopupBlockedBackground", defaultPopupBlockedBackground);
+ ppdp.iSeconds = g_plugin.getDword("PopupBlockedTimeout", defaultPopupBlockedTimeout);
ppdp.lchIcon = Skin_LoadIcon(SKINICON_OTHER_DELETE);
break;
case POPUP_APPROVED:
- ppdp.colorText = _getOptD("PopupApprovedForeground", defaultPopupApprovedForeground);
- ppdp.colorBack = _getOptD("PopupApprovedBackground", defaultPopupApprovedBackground);
- ppdp.iSeconds = _getOptD("PopupApprovedTimeout", defaultPopupApprovedTimeout);
+ ppdp.colorText = g_plugin.getDword("PopupApprovedForeground", defaultPopupApprovedForeground);
+ ppdp.colorBack = g_plugin.getDword("PopupApprovedBackground", defaultPopupApprovedBackground);
+ ppdp.iSeconds = g_plugin.getDword("PopupApprovedTimeout", defaultPopupApprovedTimeout);
ppdp.lchIcon = Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT);
break;
case POPUP_CHALLENGE:
- ppdp.colorText = _getOptD("PopupChallengeForeground", defaultPopupChallengeForeground);
- ppdp.colorBack = _getOptD("PopupChallengeBackground", defaultPopupChallengeBackground);
- ppdp.iSeconds = _getOptD("PopupChallengeTimeout", defaultPopupChallengeTimeout);
+ ppdp.colorText = g_plugin.getDword("PopupChallengeForeground", defaultPopupChallengeForeground);
+ ppdp.colorBack = g_plugin.getDword("PopupChallengeBackground", defaultPopupChallengeBackground);
+ ppdp.iSeconds = g_plugin.getDword("PopupChallengeTimeout", defaultPopupChallengeTimeout);
ppdp.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
break;
}
- if (_getOptB("PopupWindowsColors", defaultPopupWindowsColors)) {
+ if (g_plugin.getByte("PopupWindowsColors", defaultPopupWindowsColors)) {
ppdp.colorText = GetSysColor(COLOR_WINDOWTEXT);
ppdp.colorBack = GetSysColor(COLOR_WINDOW);
}
- if (_getOptB("PopupDefaultColors", defaultPopupDefaultColors)) {
+ if (g_plugin.getByte("PopupDefaultColors", defaultPopupDefaultColors)) {
ppdp.colorText = NULL;
ppdp.colorBack = NULL;
}
if (ppdp.iSeconds < 1)
ppdp.iSeconds = -1;
- if (_getOptB("PopupDefaultTimeout", defaultPopupDefaultTimeout) || popupType == POPUP_DEFAULT)
+ if (g_plugin.getByte("PopupDefaultTimeout", defaultPopupDefaultTimeout) || popupType == POPUP_DEFAULT)
ppdp.iSeconds = 0;
ppdp.lchContact = hContact;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp
index 1f63559f90..f5632f6614 100644
--- a/plugins/Spamotron/src/spamotron.cpp
+++ b/plugins/Spamotron/src/spamotron.cpp
@@ -37,7 +37,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
wchar_t *challengeW = nullptr, *tmpW = nullptr;
wchar_t mexpr[64];
int maxmsglen = 0, a, b, i;
- BOOL bayesEnabled = _getOptB("BayesEnabled", defaultBayesEnabled);
+ BOOL bayesEnabled = g_plugin.getByte("BayesEnabled", defaultBayesEnabled);
BOOL bCorrectResponse = FALSE;
// get hContact from DBEVENTINFO as icq_proto.c doesn't pass hContact the usual way for some reason.
@@ -50,7 +50,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
/*** Dequeue and learn messages ***/
- if (bayesEnabled && _getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
+ if (bayesEnabled && g_plugin.getByte("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
if (time(0) - last_queue_check > 4*3600) { // dequeue every 4 hours
dequeue_messages();
last_queue_check = time(0);
@@ -61,7 +61,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
// Pass-through if protocol is not enabled
mir_strcat(protoOption, "proto_");
mir_strcat(protoOption, dbei->szModule);
- if (_getOptB(protoOption, 0) == 0) // Protocol is not handled by Spam-o-tron
+ if (g_plugin.getByte(protoOption, 0) == 0) // Protocol is not handled by Spam-o-tron
return 0;
// Pass-through if the event is not of type EVENTTYPE_MESSAGE or EVENTTYPE_AUTHREQUEST
@@ -69,7 +69,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
return 0;
// Pass-through if contact is already verified.
- if (_getCOptB(hContact, "Verified", 0) == 1)
+ if (g_plugin.getByte(hContact, "Verified", 0) == 1)
return 0;
// Pass-through if the event is already read.
@@ -90,9 +90,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
// Pass-through and approve if outgoing event.
if (dbei->flags & DBEF_SENT) {
- if (_getOptB("ApproveOnMsgOut", 0)) {
- _setCOptB(hContact, "Verified", 1);
- if (_getOptB("AddPermanently", defaultAddPermanently))
+ if (g_plugin.getByte("ApproveOnMsgOut", 0)) {
+ g_plugin.setByte(hContact, "Verified", 1);
+ if (g_plugin.getByte("AddPermanently", defaultAddPermanently))
db_unset(hContact, "CList", "NotOnList");
db_unset(hContact, "CList", "Delete");
}
@@ -100,7 +100,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
}
// Hide the contact until verified if option set.
- if (_getOptB("HideUnverified", defaultHideUnverified))
+ if (g_plugin.getByte("HideUnverified", defaultHideUnverified))
db_set_b(hContact, "CList", "Hidden", 1);
// Fetch the incoming message body
@@ -122,7 +122,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
message = mir_a2u(msgblob);
/*** Check for words in white-list ***/
- if (_getOptB("ApproveOnMsgIn", defaultApproveOnMsgIn)) {
+ if (g_plugin.getByte("ApproveOnMsgIn", defaultApproveOnMsgIn)) {
wchar_t *whitelist = (wchar_t*)malloc(2048 * sizeof(wchar_t));
if (whitelist != nullptr) {
_getOptS(whitelist, 2048, "ApproveOnMsgInWordlist", defaultApproveOnMsgInWordlist);
@@ -143,13 +143,13 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
free(whitelist);
if (bCorrectResponse) {
- _setCOptB(hContact, "Verified", 1);
- if (_getOptB("HideUnverified", defaultHideUnverified))
+ g_plugin.setByte(hContact, "Verified", 1);
+ if (g_plugin.getByte("HideUnverified", defaultHideUnverified))
db_unset(hContact, "CList", "Hidden");
- if (_getOptB("AddPermanently", defaultAddPermanently))
+ if (g_plugin.getByte("AddPermanently", defaultAddPermanently))
db_unset(hContact, "CList", "NotOnList");
db_unset(hContact, "CList", "Delete");
- if (_getOptB("ReplyOnSuccess", defaultReplyOnSuccess) && (_getCOptB(hContact, "MsgSent", 0))) {
+ if (g_plugin.getByte("ReplyOnSuccess", defaultReplyOnSuccess) && (g_plugin.getByte(hContact, "MsgSent", 0))) {
T2Utf response(_getOptS(buf, buflen, "SuccessResponse", defaultSuccessResponse));
ProtoChainSend(hContact, PSS_MESSAGE, 0, response);
}
@@ -161,16 +161,16 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
/*** Check for correct answer ***/
- switch (_getOptB("Mode", defaultMode))
+ switch (g_plugin.getByte("Mode", defaultMode))
{
case SPAMOTRON_MODE_ROTATE:
case SPAMOTRON_MODE_RANDOM:
- get_response(buf, buflen, _getCOptD(hContact, "ResponseNum", 0));
+ get_response(buf, buflen, g_plugin.getDword(hContact, "ResponseNum", 0));
if (_isregex(buf)) {
if (_regmatch(message, buf))
bCorrectResponse = TRUE;
} else {
- if (_tcsstr_cc(message, buf, _getOptB("ResponseCC", defaultResponseCC)) &&
+ if (_tcsstr_cc(message, buf, g_plugin.getByte("ResponseCC", defaultResponseCC)) &&
(mir_wstrlen(message) == mir_wstrlen(buf)))
bCorrectResponse = TRUE;
}
@@ -187,7 +187,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
break;
}
} else {
- if (_tcsstr_cc(message, buf, _getOptB("ResponseCC", defaultResponseCC)) &&
+ if (_tcsstr_cc(message, buf, g_plugin.getByte("ResponseCC", defaultResponseCC)) &&
(mir_wstrlen(message) == mir_wstrlen(buf))) {
bCorrectResponse = TRUE;
break;
@@ -199,7 +199,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
case SPAMOTRON_MODE_MATH:
if (message == nullptr)
break;
- _itow(_getCOptD(hContact, "ResponseMath", -1), buf, 10);
+ _itow(g_plugin.getDword(hContact, "ResponseMath", -1), buf, 10);
if (wcsstr(message, buf) && (mir_wstrlen(buf) == mir_wstrlen(message))) {
bCorrectResponse = TRUE;
}
@@ -208,21 +208,21 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
if (bCorrectResponse)
{
- _setCOptB(hContact, "Verified", 1);
- if (_getOptB("HideUnverified", defaultHideUnverified))
+ g_plugin.setByte(hContact, "Verified", 1);
+ if (g_plugin.getByte("HideUnverified", defaultHideUnverified))
db_unset(hContact, "CList", "Hidden");
- if (_getOptB("AddPermanently", defaultAddPermanently))
+ if (g_plugin.getByte("AddPermanently", defaultAddPermanently))
db_unset(hContact, "CList", "NotOnList");
db_unset(hContact, "CList", "Delete");
db_unset(hContact, "CList", "ResponseNum");
- if (_getOptB("ReplyOnSuccess", defaultReplyOnSuccess)) {
+ if (g_plugin.getByte("ReplyOnSuccess", defaultReplyOnSuccess)) {
T2Utf response(_getOptS(buf, buflen, "SuccessResponse", defaultSuccessResponse));
ProtoChainSend(hContact, PSS_MESSAGE, 0, response);
}
_notify(hContact, POPUP_APPROVED, TranslateT("Contact %s approved."), nullptr);
// Resubmit pending authorization request
- if (_getCOptB(hContact, "AuthEventPending", FALSE)) {
+ if (g_plugin.getByte(hContact, "AuthEventPending", FALSE)) {
DBVARIANT _dbv;
wchar_t AuthEventModule[100];
char* szAuthEventModule;
@@ -249,12 +249,12 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
}
// User approved, learn from previous messages
- if (bayesEnabled && _getOptB("BayesAutolearnApproved", defaultBayesAutolearnApproved))
+ if (bayesEnabled && g_plugin.getByte("BayesAutolearnApproved", defaultBayesAutolearnApproved))
bayes_approve_contact(hContact);
// Mark previous messages unread if option set
- if (_getOptB("KeepBlockedMsg", defaultKeepBlockedMsg) &&
- _getOptB("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval) &&
+ if (g_plugin.getByte("KeepBlockedMsg", defaultKeepBlockedMsg) &&
+ g_plugin.getByte("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval) &&
hContact != NULL) {
// We will mark unread all blocked messages for the most recent day
MarkUnread(hContact);
@@ -269,9 +269,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
// Completely reject if challenge was already sent today for MaxMsgContactCountPerDay times
// and the option is turned on.
- if (isOneDay(dbei->timestamp, _getCOptD(hContact, "MsgSentTime", 0)) &&
- _getOptD("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay) > 0 &&
- _getCOptD(hContact, "MsgSent", 0) >= _getOptD("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay)) {
+ if (isOneDay(dbei->timestamp, g_plugin.getDword(hContact, "MsgSentTime", 0)) &&
+ g_plugin.getDword("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay) > 0 &&
+ g_plugin.getDword(hContact, "MsgSent", 0) >= g_plugin.getDword("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay)) {
_notify(hContact, POPUP_BLOCKED, TranslateT("Message from %s rejected because it reached a maximum for challenge requests per day."), message);
if (bayesEnabled)
queue_message(hContact, dbei->timestamp, message);
@@ -279,8 +279,8 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
}
// Completely reject if duplicate incoming message found
- if (_getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) > 0 &&
- _getCOptD(hContact, "SameMsgCount", 0) >= _getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) &&
+ if (g_plugin.getDword("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) > 0 &&
+ g_plugin.getDword(hContact, "SameMsgCount", 0) >= g_plugin.getDword("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) &&
mir_wstrcmp(message, _getCOptS(buf, buflen, hContact, "LastInMsg", L"")) == 0) {
_notify(hContact, POPUP_BLOCKED, TranslateT("Message from %s rejected because it reached a maximum for same responses per day."), message);
if (bayesEnabled)
@@ -289,7 +289,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
}
// Completely reject if incoming message contains any word from DontReplyMsgWordlist option
- if (_getOptB("DontReplyMsg", defaultDontReplyMsg) &&
+ if (g_plugin.getByte("DontReplyMsg", defaultDontReplyMsg) &&
Contains(message, _getOptS(buf, buflen, "DontReplyMsgWordlist", defaultDontReplyMsgWordlist))) {
_notify(hContact, POPUP_BLOCKED, TranslateT("Message from %s dropped because it has a word from black list."), message);
return 1;
@@ -299,27 +299,27 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
/*** Bayes checks ***/
// Drop if score > spam score
- if (bayesEnabled && _getOptB("BayesBlockMsg", defaultBayesBlockMsg))
- if (get_msg_score(message) >= (double)_getOptD("BayesSpamScore", defaultBayesSpamScore) * SCORE_C) {
+ if (bayesEnabled && g_plugin.getByte("BayesBlockMsg", defaultBayesBlockMsg))
+ if (get_msg_score(message) >= (double)g_plugin.getDword("BayesSpamScore", defaultBayesSpamScore) * SCORE_C) {
_notify(hContact, POPUP_BLOCKED, TranslateT("Message from %s dropped because of high spam score."), message);
- if (bayesEnabled && _getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
+ if (bayesEnabled && g_plugin.getByte("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved))
queue_message(hContact, dbei->timestamp, message);
return 1;
}
// Accept if score < ham score
- if (bayesEnabled && _getOptB("BayesAutoApprove", defaultBayesAutoApprove))
- if (get_msg_score(message) <= (double)_getOptD("BayesHamScore", defaultBayesHamScore) * SCORE_C) {
+ if (bayesEnabled && g_plugin.getByte("BayesAutoApprove", defaultBayesAutoApprove))
+ if (get_msg_score(message) <= (double)g_plugin.getDword("BayesHamScore", defaultBayesHamScore) * SCORE_C) {
_notify(hContact, POPUP_APPROVED, TranslateT("Contact %s approved."), message);
- _setCOptB(hContact, "Verified", 1);
- if (_getOptB("HideUnverified", defaultHideUnverified))
+ g_plugin.setByte(hContact, "Verified", 1);
+ if (g_plugin.getByte("HideUnverified", defaultHideUnverified))
db_unset(hContact, "CList", "Hidden");
- if (_getOptB("AddPermanently", defaultAddPermanently))
+ if (g_plugin.getByte("AddPermanently", defaultAddPermanently))
db_unset(hContact, "CList", "NotOnList");
db_unset(hContact, "CList", "Delete");
if (bayesEnabled &&
- _getOptB("BayesAutolearnApproved", defaultBayesAutolearnApproved) &&
- _getOptB("BayesAutolearnAutoApproved", defaultBayesAutolearnAutoApproved)) {
+ g_plugin.getByte("BayesAutolearnApproved", defaultBayesAutolearnApproved) &&
+ g_plugin.getByte("BayesAutolearnAutoApproved", defaultBayesAutolearnAutoApproved)) {
queue_message(hContact, dbei->timestamp, message);
bayes_approve_contact(hContact);
}
@@ -327,17 +327,17 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
}
// Accept if event is EVENTTYPE_AUTHREQUEST and ReplyOnAuth is NOT set
- if (dbei->eventType == EVENTTYPE_AUTHREQUEST && !_getOptB("ReplyOnAuth", defaultReplyOnAuth))
+ if (dbei->eventType == EVENTTYPE_AUTHREQUEST && !g_plugin.getByte("ReplyOnAuth", defaultReplyOnAuth))
return 0;
// Accept if event is EVENTTYPE_MESSAGE and ReplyOnMsg is NOT set
- if (dbei->eventType == EVENTTYPE_MESSAGE && !_getOptB("ReplyOnMsg", defaultReplyOnMsg))
+ if (dbei->eventType == EVENTTYPE_MESSAGE && !g_plugin.getByte("ReplyOnMsg", defaultReplyOnMsg))
return 0;
/*** Send Challenge ***/
challengeW = (wchar_t *)malloc(maxmsglen * sizeof(wchar_t));
tmpW = (wchar_t *)malloc(maxmsglen * sizeof(wchar_t));
- switch (_getOptB("Mode", defaultMode)) {
+ switch (g_plugin.getByte("Mode", defaultMode)) {
case SPAMOTRON_MODE_PLAIN:
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
_getOptS(challengeW, maxmsglen, "AuthChallenge", defaultAuthChallenge);
@@ -354,11 +354,11 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
else
_getOptS(challengeW, maxmsglen, "Challenge", defaultChallenge);
_getOptS(buf, buflen, "Response", defaultResponse);
- if (_getCOptD(hContact, "ResponseNum", 0) >= (unsigned int)(get_response_num(buf) - 1))
- _setCOptD(hContact, "ResponseNum", -1);
+ if (g_plugin.getDword(hContact, "ResponseNum", 0) >= (unsigned int)(get_response_num(buf) - 1))
+ g_plugin.setDword(hContact, "ResponseNum", -1);
- _setCOptD(hContact, "ResponseNum", _getCOptD(hContact, "ResponseNum", -1) + 1);
- ReplaceVarsNum(challengeW, maxmsglen, _getCOptD(hContact, "ResponseNum", 0));
+ g_plugin.setDword(hContact, "ResponseNum", g_plugin.getDword(hContact, "ResponseNum", -1) + 1);
+ ReplaceVarsNum(challengeW, maxmsglen, g_plugin.getDword(hContact, "ResponseNum", 0));
ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
_notify(hContact, POPUP_CHALLENGE, TranslateT("Sending round-robin challenge to %s."), message);
break;
@@ -370,8 +370,8 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
_getOptS(challengeW, maxmsglen, "Challenge", defaultChallenge);
_getOptS(buf, buflen, "Response", defaultResponse);
srand(time(0));
- _setCOptD(hContact, "ResponseNum", rand() % get_response_num(buf));
- ReplaceVarsNum(challengeW, maxmsglen, _getCOptD(hContact, "ResponseNum", 0));
+ g_plugin.setDword(hContact, "ResponseNum", rand() % get_response_num(buf));
+ ReplaceVarsNum(challengeW, maxmsglen, g_plugin.getDword(hContact, "ResponseNum", 0));
ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
_notify(hContact, POPUP_CHALLENGE, TranslateT("Sending random challenge to %s."), message);
break;
@@ -385,7 +385,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
else
_getOptS(challengeW, maxmsglen, "ChallengeMath", defaultChallengeMath);
ReplaceVar(challengeW, maxmsglen, L"%mathexpr%", mexpr);
- _setCOptD(hContact, "ResponseMath", a + b);
+ g_plugin.setDword(hContact, "ResponseMath", a + b);
ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
_notify(hContact, POPUP_CHALLENGE, TranslateT("Sending math expression challenge to %s."), message);
break;
@@ -406,26 +406,26 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
/*** Do any post-send procedures we need to do ***/
// Increment MsgSent if it was sent the same day. Otherwise set it to 1.
- if (isOneDay(dbei->timestamp, _getCOptD(hContact, "MsgSentTime", 0)))
- _setCOptD(hContact, "MsgSent", _getCOptD(hContact, "MsgSent", 0) + 1);
+ if (isOneDay(dbei->timestamp, g_plugin.getDword(hContact, "MsgSentTime", 0)))
+ g_plugin.setDword(hContact, "MsgSent", g_plugin.getDword(hContact, "MsgSent", 0) + 1);
else
- _setCOptD(hContact, "MsgSent", 1);
- _setCOptD(hContact, "MsgSentTime", dbei->timestamp);
+ g_plugin.setDword(hContact, "MsgSent", 1);
+ g_plugin.setDword(hContact, "MsgSentTime", dbei->timestamp);
// Save Last Msg and update SameMsgCount
if (message != nullptr) {
if (mir_wstrcmp(_getCOptS(buf, buflen, hContact, "LastInMsg", L""), message) == 0)
- _setCOptD(hContact, "SameMsgCount", 1 + _getCOptD(hContact, "SameMsgCount", 0));
+ g_plugin.setDword(hContact, "SameMsgCount", 1 + g_plugin.getDword(hContact, "SameMsgCount", 0));
else
- _setCOptD(hContact, "SameMsgCount", 1);
- _setCOptTS(hContact, "LastInMsg", message);
+ g_plugin.setDword(hContact, "SameMsgCount", 1);
+ g_plugin.setWString(hContact, "LastInMsg", message);
}
if (message != nullptr)
mir_free(message);
// Finally silently save the message to contact history if corresponding option is set
- if (_getOptB("KeepBlockedMsg", defaultKeepBlockedMsg)) {
+ if (g_plugin.getByte("KeepBlockedMsg", defaultKeepBlockedMsg)) {
if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
// Save the request to database so that it can be automatically submitted on user approval
PBYTE eventdata = (PBYTE)malloc(sizeof(DWORD) + dbei->cbBlob);
@@ -433,13 +433,13 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
memcpy(eventdata, &dbei->cbBlob, sizeof(DWORD));
memcpy(eventdata + sizeof(DWORD), dbei->pBlob, dbei->cbBlob);
db_set_blob(hContact, MODULENAME, "AuthEvent", eventdata, sizeof(DWORD) + dbei->cbBlob);
- _setCOptS(hContact, "AuthEventModule", dbei->szModule);
- _setCOptB(hContact, "AuthEventPending", TRUE);
+ g_plugin.setString(hContact, "AuthEventModule", dbei->szModule);
+ g_plugin.setByte(hContact, "AuthEventPending", TRUE);
free(eventdata);
}
}
else {
- if (_getOptB("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval)) {
+ if (g_plugin.getByte("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval)) {
DBVARIANT _dbv;
DWORD dbei_size = 3 * sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)mir_strlen(dbei->szModule) + 1;
PBYTE eventdata = (PBYTE)malloc(dbei_size);
@@ -481,7 +481,7 @@ void RemoveNotOnListSettings()
for (auto &hContact : Contacts()) {
if (db_get_s(hContact, "Protocol", "p", &dbv) == 0) {
mir_strcat(protoName, dbv.pszVal);
- if (_getOptB(protoName, 0) != 0) {
+ if (g_plugin.getByte(protoName, 0) != 0) {
if (db_get_b(hContact, "CList", "Delete", 0) == 1) {
db_unset(hContact, "CList", "NotOnList");
}
@@ -498,10 +498,10 @@ int CMPlugin::Load()
{
srand((unsigned)time(0));
bayesdb = nullptr;
- if (_getOptB("BayesEnabled", defaultBayesEnabled)) {
+ if (g_plugin.getByte("BayesEnabled", defaultBayesEnabled)) {
if (CheckBayes()) {
OpenBayes();
- if (_getOptB("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved)) {
+ if (g_plugin.getByte("BayesAutolearnNotApproved", defaultBayesAutolearnNotApproved)) {
dequeue_messages();
last_queue_check = time(0);
}
diff --git a/plugins/Spamotron/src/stdafx.h b/plugins/Spamotron/src/stdafx.h
index e6e87b4136..87ceb09808 100644
--- a/plugins/Spamotron/src/stdafx.h
+++ b/plugins/Spamotron/src/stdafx.h
@@ -33,20 +33,8 @@
#define MAX_BUFFER_LENGTH 1024
-#define _getCOptB(a,b,c) db_get_b(a, MODULENAME, b, c)
-#define _setCOptB(a,b,c) db_set_b(a, MODULENAME, b, c)
-#define _getCOptD(a,b,c) db_get_dw(a, MODULENAME, b, c)
-#define _setCOptD(a,b,c) db_set_dw(a, MODULENAME, b, c)
-#define _getOptB(a,b) _getCOptB(NULL, a, b)
-#define _setOptB(a,b) _setCOptB(NULL, a, b)
-#define _getOptD(a,b) _getCOptD(NULL, a, b)
-#define _setOptD(a,b) _setCOptD(NULL, a, b)
-
wchar_t* _getCOptS(wchar_t *buf, unsigned int buflen, MCONTACT hContact, const char* option, const wchar_t *def);
#define _getOptS(a,b,c,d) _getCOptS(a, b, NULL, c, d)
-#define _setCOptTS(a,b,c) db_set_ws(a, MODULENAME, b, c)
-#define _setCOptS(a,b,c) db_set_s(a, MODULENAME, b, c)
-#define _setOptTS(a,b) _setCOptTS(NULL, a, b)
#define defaultMode SPAMOTRON_MODE_PLAIN
#define defaultChallenge TranslateT("Spam-o-tron needs to verify you're not a bot. Reply with \"%response%\" without quotes.")
@@ -90,7 +78,7 @@ wchar_t* _getCOptS(wchar_t *buf, unsigned int buflen, MCONTACT hContact, const c
#define defaultPopupChallengeForeground RGB(0, 0, 0)
#define defaultPopupChallengeBackground RGB(180, 210, 240)
-#define _NOTIFYP _getOptB("NotifyPopup", defaultNotifyPopup)
+#define _NOTIFYP g_plugin.getByte("NotifyPopup", defaultNotifyPopup)
wchar_t* ReplaceVars(wchar_t *dst, unsigned int len);
wchar_t* ReplaceVarsNum(wchar_t *dst, unsigned int len, int num);
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp
index 39f4fd35f5..bdbbdacd09 100644
--- a/plugins/Spamotron/src/utils.cpp
+++ b/plugins/Spamotron/src/utils.cpp
@@ -429,7 +429,7 @@ int _notify(MCONTACT hContact, BYTE type, wchar_t *message, wchar_t *origmessage
wchar_t msg[MAX_BUFFER_LENGTH];
mir_snwprintf(msg, message, Clist_GetContactDisplayName(hContact));
- if (_getOptB("LogActions", defaultLogActions)) {
+ if (g_plugin.getByte("LogActions", defaultLogActions)) {
tmp = mir_u2a(msg);
tmporig = mir_u2a(origmessage);
LogToSystemHistory(tmp, origmessage ? tmporig : nullptr);
@@ -439,13 +439,13 @@ int _notify(MCONTACT hContact, BYTE type, wchar_t *message, wchar_t *origmessage
if (_NOTIFYP) {
if (type == POPUP_BLOCKED) {
- if (_getOptB("NotifyPopupBlocked", defaultNotifyPopupBlocked))
+ if (g_plugin.getByte("NotifyPopupBlocked", defaultNotifyPopupBlocked))
ShowPopup(hContact, type, nullptr, msg);
} else if (type == POPUP_APPROVED) {
- if (_getOptB("NotifyPopupApproved", defaultNotifyPopupApproved))
+ if (g_plugin.getByte("NotifyPopupApproved", defaultNotifyPopupApproved))
ShowPopup(hContact, type, nullptr, msg);
} else if (type == POPUP_CHALLENGE) {
- if (_getOptB("NotifyPopupChallenge", defaultNotifyPopupChallenge))
+ if (g_plugin.getByte("NotifyPopupChallenge", defaultNotifyPopupChallenge))
ShowPopup(hContact, type, nullptr, msg);
} else {
ShowPopup(hContact, type, nullptr, msg);