From e441a31e9f912fc8e9244d16560565559b1924d2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 27 Sep 2019 23:43:06 +0300 Subject: end of manual experiments with CList/NotOnList --- plugins/AVS/src/poll.cpp | 2 +- plugins/AddContactPlus/src/addcontact.cpp | 2 +- plugins/AutoShutdown/src/watcher.cpp | 2 +- plugins/Boltun/src/boltun.cpp | 4 ++-- plugins/Boltun/src/stdafx.h | 1 + plugins/BuddyExpectator/src/BuddyExpectator.cpp | 6 +++--- plugins/Clist_modern/src/modern_clcitems.cpp | 2 +- plugins/Clist_nicer/src/clistmod.cpp | 2 +- plugins/ContactsPlus/src/utils.cpp | 2 +- plugins/FileAsMessage/src/dialog.cpp | 2 +- plugins/FileAsMessage/src/stdafx.h | 1 + plugins/FloatingContacts/src/stdafx.h | 2 +- plugins/FloatingContacts/src/thumbs.cpp | 4 ++-- plugins/KeyboardNotify/src/ignore.cpp | 2 +- plugins/MirandaG15/src/CAppletManager.cpp | 3 +-- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 2 +- plugins/NewAwaySysMod/src/stdafx.h | 5 ++--- plugins/Popup/src/popup_wnd2.cpp | 4 ++-- plugins/Scriver/src/msgdialog.cpp | 4 ++-- plugins/Scriver/src/msgutils.cpp | 2 +- plugins/Scriver/src/utils.cpp | 2 +- plugins/SecureIM/src/crypt_check.cpp | 4 ++-- plugins/ShellExt/src/shlcom.cpp | 4 +--- plugins/SimpleAR/src/Main.cpp | 2 +- plugins/SimpleAR/src/stdafx.h | 1 + plugins/Spamotron/src/spamotron.cpp | 12 ++++++------ plugins/StopSpamMod/src/stopspam.cpp | 14 +++++++------- plugins/StopSpamMod/src/utilities.cpp | 4 ++-- plugins/StopSpamPlus/src/events.cpp | 10 +++++----- plugins/StopSpamPlus/src/services.cpp | 4 ++-- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 6 +++--- plugins/TooltipNotify/src/TooltipNotify.cpp | 2 +- plugins/wbOSD/src/events.cpp | 2 +- 34 files changed, 61 insertions(+), 62 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index 90f2e614ce..ea2d970f1f 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -89,7 +89,7 @@ static BOOL PollContactCanHaveAvatar(MCONTACT hContact, const char *szProto) { int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); return (Proto_IsFetchingWhenContactOfflineAllowed(szProto) || status != ID_STATUS_OFFLINE) - && !db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, "CList", "ApparentMode", 0) != ID_STATUS_OFFLINE; + && Contact_OnList(hContact) && db_get_b(hContact, "CList", "ApparentMode", 0) != ID_STATUS_OFFLINE; } // Return true if this contact has to be checked diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 7e771bacc3..d71029b462 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -263,7 +263,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) } if (BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_ADDTEMP)) { - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); if (IsDlgButtonChecked(hdlg, IDC_AUTH)) { DWORD flags = CallProtoService(acs->proto, PS_GETCAPS, PFLAGNUM_4, 0); diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index 85de2aa7df..0235ac9be0 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -183,7 +183,7 @@ static BOOL CheckAllContactsOffline(void) if (db_get_w(hContact, pszProto, "Status", 0) != ID_STATUS_OFFLINE) { if (fSmartCheck) { if (Contact_IsHidden(hContact)) continue; - if (db_get_b(hContact, "CList", "NotOnList", 0)) continue; + if (!Contact_OnList(hContact)) continue; } fAllOffline = FALSE; break; diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index e50af48380..deb08f133c 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -181,7 +181,7 @@ static bool BoltunAutoChat(MCONTACT hContact) return true; } - if ((db_get_b(hContact, "CList", "NotOnList", 0) == 1) && Config.TalkWithNotInList) + if (!Contact_OnList(hContact) && Config.TalkWithNotInList) return true; if (g_plugin.getByte(hContact, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE) == TRUE) @@ -491,7 +491,7 @@ static int OnContactMenuPrebuild(WPARAM hContact, LPARAM) { INT_PTR flags = CallProtoService(GetContactProto(hContact), PS_GETCAPS, PFLAGNUM_1); - bool bEnable = blInit && !db_get_b(hContact, "CList", "NotOnList", 0) && (flags & PF1_IM) != 0; + bool bEnable = blInit && Contact_OnList(hContact) && (flags & PF1_IM) != 0; Menu_ShowItem(hMenuItemAutoChat, bEnable); Menu_ShowItem(hMenuItemNotToChat, bEnable); Menu_ShowItem(hMenuItemStartChatting, bEnable); diff --git a/plugins/Boltun/src/stdafx.h b/plugins/Boltun/src/stdafx.h index 18153fec0e..7b452aa982 100644 --- a/plugins/Boltun/src/stdafx.h +++ b/plugins/Boltun/src/stdafx.h @@ -34,6 +34,7 @@ #include #include +#include #include #include #include diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index c5f236747c..5d90e8274e 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -252,7 +252,7 @@ bool isContactGoneFor(MCONTACT hContact, int days) void ReturnNotify(MCONTACT hContact, wchar_t *message) { - if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || Contact_IsHidden(hContact)) + if (!Contact_OnList(hContact) || Contact_IsHidden(hContact)) return; Skin_PlaySound("buddyExpectatorReturn"); @@ -291,7 +291,7 @@ void ReturnNotify(MCONTACT hContact, wchar_t *message) void GoneNotify(MCONTACT hContact, wchar_t *message) { - if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || Contact_IsHidden(hContact)) + if (!Contact_OnList(hContact) || Contact_IsHidden(hContact)) return; if (options.iShowPopup2 > 0) { @@ -457,7 +457,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) if (hContact == NULL || inf->value.type == DBVT_DELETED || strcmp(inf->szSetting, "Status") != 0) return 0; - if (db_get_b(hContact, "CList", "NotOnList", 0) == 1) + if (!Contact_OnList(hContact)) return 0; char *proto = GetContactProto(hContact); diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 7eeaf93654..f77e7ebf9f 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -331,7 +331,7 @@ ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact) pdnce->m_bNoHiddenOffline = g_plugin.getByte(hContact, "noOffline"); pdnce->IdleTS = db_get_dw(hContact, pdnce->szProto, "IdleTS", 0); pdnce->ApparentMode = db_get_w(hContact, pdnce->szProto, "ApparentMode", 0); - pdnce->NotOnList = g_plugin.getByte(hContact, "NotOnList"); + pdnce->NotOnList = !Contact_OnList(hContact); pdnce->IsExpanded = g_plugin.getByte(hContact, "Expanded"); pdnce->dwLastOnlineTime = db_get_dw(hContact, pdnce->szProto, "LastSeen", 0); pdnce->dwLastMsgTime = -1; diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index d4c08d0897..73c10bbd16 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -79,7 +79,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) { RECT rc = { 0 }; POINT pt = { 0 }; - register int i = 0, j = 0, width = 0, height = 0, iCountedDots = 0, iNotCoveredDots = 0; + int i = 0, j = 0, width = 0, height = 0, iCountedDots = 0, iNotCoveredDots = 0; BOOL bPartiallyCovered = FALSE; HWND hAux = nullptr; diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index a3dd0e8a84..4656317da4 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -131,7 +131,7 @@ void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, wchar_t *pszTitleStart) void UpdateDialogAddButton(HWND hwndDlg, MCONTACT hContact) { - int bVisible = db_get_b(hContact, "CList", "NotOnList", 0); + int bVisible = !Contact_OnList(hContact); ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), bVisible ? SW_SHOW : SW_HIDE); } diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 11d3939da6..4613b97438 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -405,7 +405,7 @@ void FILEECHO::incomeRequest(char *param) Skin_PlaySound("RecvFile"); int AutoMin = db_get_b(0, "SRFile", "AutoMin", 0); - if (db_get_b(0, "SRFile", "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) { + if (db_get_b(0, "SRFile", "AutoAccept", 0) && Contact_OnList(hContact)) { PostMessage(hDlg, WM_COMMAND, IDC_PLAY, 0); if (AutoMin) ShowWindow(hDlg, SW_SHOWMINIMIZED); diff --git a/plugins/FileAsMessage/src/stdafx.h b/plugins/FileAsMessage/src/stdafx.h index 7020a88dab..047f16d9a2 100644 --- a/plugins/FileAsMessage/src/stdafx.h +++ b/plugins/FileAsMessage/src/stdafx.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/plugins/FloatingContacts/src/stdafx.h b/plugins/FloatingContacts/src/stdafx.h index 743d49362c..5d556a5548 100644 --- a/plugins/FloatingContacts/src/stdafx.h +++ b/plugins/FloatingContacts/src/stdafx.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index 47009cf72c..b921ee6460 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -244,7 +244,7 @@ void ThumbInfo::ResizeThumb() ImageList_GetIconSize_my(himlMiranda, sizeIcon); HDC hdc = GetWindowDC(hwnd); - if (!db_get_b(hContact, "CList", "NotOnList", 0)) { + if (Contact_OnList(hContact)) { char *szProto = GetContactProto(hContact); if (nullptr != szProto) { int nStatus = Proto_GetStatus(szProto); @@ -572,7 +572,7 @@ void ThumbInfo::UpdateContent() oldBkMode = SetBkMode(hdcDraw, TRANSPARENT); - if (!db_get_b(hContact, "CList", "NotOnList", 0)) { + if (Contact_OnList(hContact)) { char *szProto = GetContactProto(hContact); if (nullptr != szProto) { int nStatus = Proto_GetStatus(szProto); diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 4fd2ba56f2..878b9a4d8c 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -32,7 +32,7 @@ static DWORD GetMask(MCONTACT hContact) if(hContact == NULL) mask=0; else { - if (Contact_IsHidden(hContact) || db_get_b(hContact, "CList", "NotOnList", 0)) + if (Contact_IsHidden(hContact) || !Contact_OnList(hContact)) mask = g_plugin.getDword("Mask1", 0); else mask = g_plugin.getDword("Default1", 0); diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index e30975cc82..0f6ea0cb75 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -720,8 +720,7 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact, bool bEnable) return; if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) return; - if (db_get_b(hContact, "CList", "NotOnList", 0) - && !db_get_b(0, "SRMsg", "UnknownTyping", 1)) + if (!Contact_OnList(hContact) && !db_get_b(0, "SRMsg", "UnknownTyping", 1)) return; // End user check CallService(MS_PROTO_SELFISTYPING, hContact, bEnable ? PROTOTYPE_SELFTYPING_ON : PROTOTYPE_SELFTYPING_OFF); diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index f66cd6dc24..8cc39f69e8 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -182,7 +182,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) return 0; MCONTACT hContactForSettings = hContact; // used to take into account not-on-list contacts when getting contact settings, but at the same time allows to get correct contact info for contacts that are in the DB - if (hContactForSettings != INVALID_CONTACT_ID && db_get_b(hContactForSettings, "CList", "NotOnList", 0)) + if (hContactForSettings != INVALID_CONTACT_ID && !Contact_OnList(hContactForSettings)) hContactForSettings = INVALID_CONTACT_ID; // INVALID_HANDLE_VALUE means the contact is not-on-list if (!CContactSettings(iMode, hContactForSettings).Autoreply.IncludingParents(szProto) || CContactSettings(iMode, hContactForSettings).Ignore) diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index c71216797b..5ff302b3bb 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -37,10 +37,9 @@ #include #include "newpluginapi.h" -#include "m_clist.h" -#include "m_system.h" -#include "m_database.h" #include "m_clistint.h" +#include +#include "m_database.h" #include "m_langpack.h" #include "m_protosvc.h" #include "m_options.h" diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 16c0c2c5de..9a6265ac6b 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -535,7 +535,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && isIm && IsActionEnabled("General/Send message")) ++m_actionCount; if (enableDefaultUsr && IsActionEnabled("General/User details")) ++m_actionCount; if (enableDefaultUsr && IsActionEnabled("General/Contact menu")) ++m_actionCount; - if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) ++m_actionCount; + if (enableDefaultUsr && !Contact_OnList(m_hContact) && IsActionEnabled("General/Add permanently")) ++m_actionCount; if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) ++m_actionCount; if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) ++m_actionCount; if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) ++m_actionCount; @@ -578,7 +578,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) ++iAction; } - if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) { + if (enableDefaultUsr && !Contact_OnList(m_hContact) && IsActionEnabled("General/Add permanently")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(IDI_ACT_ADD, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Add permanently"); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 10e5c954f9..82a13c15ba 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -470,7 +470,7 @@ void CMsgDialog::OnDestroy() if (m_hContact && g_dat.flags.bDelTemp) { m_hContact = INVALID_CONTACT_ID; // to prevent recursion - if (db_get_b(m_hContact, "CList", "NotOnList", 0)) + if (!Contact_OnList(m_hContact)) db_delete_contact(m_hContact); } @@ -632,7 +632,7 @@ void CMsgDialog::onClick_Add(CCtrlButton*) { Contact_Add(m_hContact, m_hwnd); - if (!db_get_b(m_hContact, "CList", "NotOnList", 0)) + if (Contact_OnList(m_hContact)) ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), SW_HIDE); } diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 34bde9dbdc..71fea672d6 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -123,7 +123,7 @@ bool CMsgDialog::IsTypingNotificationEnabled() if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) return FALSE; - if (db_get_b(m_hContact, "CList", "NotOnList", 0) && !g_plugin.bTypingUnknown) + if (!Contact_OnList(m_hContact) && !g_plugin.bTypingUnknown) return FALSE; return TRUE; } diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 4d80e51e98..c3bb35d3f2 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -296,7 +296,7 @@ void SetButtonsPos(HWND hwndDlg, MCONTACT hContact, bool bShow) continue; if (cbd->m_dwButtonCID == IDC_ADD) - if (!db_get_b(hContact, "CList", "NotOnList", 0)) { + if (Contact_OnList(hContact)) { ShowWindow(hwndButton, SW_HIDE); continue; } diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index 0b5116682d..1cf85abbff 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -116,7 +116,7 @@ bool isContactInvisible(MCONTACT hContact) bool isNotOnList(MCONTACT hContact) { - return db_get_b(hContact, "CList", "NotOnList", 0) != 0; + return !Contact_OnList(hContact); } bool isContactNewPG(MCONTACT hContact) @@ -193,7 +193,7 @@ bool isSecureIM(pUinKey ptr, BOOL emptyMirverAsSecureIM) if (!bAIP) return false; if (!ptr->proto->inspecting) return false; - if (bNOL && db_get_b(ptr->hContact, "CList", "NotOnList", 0)) + if (bNOL && !Contact_OnList(ptr->hContact)) return false; bool isSecureIM = false; diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index f0cef53c39..82b593cac7 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -272,9 +272,7 @@ bool ipcGetSortedContacts(THeaderIPC * ipch, int* pSlot, bool bGroupMode) // is HIT on? if (BST_UNCHECKED == g_plugin.getByte(SHLExt_UseHITContacts, BST_UNCHECKED)) { // don't show people who are hidden, "NotOnList" or ignored - if (Contact_IsHidden(hContact) || - db_get_b(hContact, "CList", "NotOnList", 0) == 1 || - Ignore_IsIgnored(hContact, IGNOREEVENT_MESSAGE | IGNOREEVENT_FILE) != 0) + if (Contact_IsHidden(hContact) || !Contact_OnList(hContact) || Ignore_IsIgnored(hContact, IGNOREEVENT_MESSAGE | IGNOREEVENT_FILE) != 0) continue; } // is HIT2 off? diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index d189657681..2ae24b208e 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -157,7 +157,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) return FALSE; mir_free(ptszVal); - if (db_get_b(hContact, "CList", "NotOnList", 0)) + if (!Contact_OnList(hContact)) return FALSE; if (g_plugin.getByte(hContact, "TurnedOn")) diff --git a/plugins/SimpleAR/src/stdafx.h b/plugins/SimpleAR/src/stdafx.h index afbf46a9e4..fe18a6c968 100644 --- a/plugins/SimpleAR/src/stdafx.h +++ b/plugins/SimpleAR/src/stdafx.h @@ -5,6 +5,7 @@ #include #include +#include #include #include #include diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index f45d88aaa3..445261ee14 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -77,7 +77,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) return 0; // Pass-through if event is from a contact that is already in the list. - if (db_get_b(hContact, "CList", "NotOnList", 1) == 0) // Already in the list + if (!Contact_OnList(hContact)) // Already in the list return 0; // Pass-through if event is from a contact that is already in the server-side contact list @@ -93,7 +93,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (g_plugin.getByte("ApproveOnMsgOut", 0)) { g_plugin.setByte(hContact, "Verified", 1); if (g_plugin.getByte("AddPermanently", defaultAddPermanently)) - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); db_unset(hContact, "CList", "Delete"); } return 0; @@ -147,7 +147,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (g_plugin.getByte("HideUnverified", defaultHideUnverified)) Contact_Hide(hContact, false); if (g_plugin.getByte("AddPermanently", defaultAddPermanently)) - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); db_unset(hContact, "CList", "Delete"); if (g_plugin.getByte("ReplyOnSuccess", defaultReplyOnSuccess) && (g_plugin.getByte(hContact, "MsgSent", 0))) { T2Utf response(_getOptS(buf, buflen, "SuccessResponse", defaultSuccessResponse)); @@ -212,7 +212,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (g_plugin.getByte("HideUnverified", defaultHideUnverified)) Contact_Hide(hContact, false); if (g_plugin.getByte("AddPermanently", defaultAddPermanently)) - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); db_unset(hContact, "CList", "Delete"); db_unset(hContact, "CList", "ResponseNum"); if (g_plugin.getByte("ReplyOnSuccess", defaultReplyOnSuccess)) { @@ -315,7 +315,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (g_plugin.getByte("HideUnverified", defaultHideUnverified)) Contact_Hide(hContact, false); if (g_plugin.getByte("AddPermanently", defaultAddPermanently)) - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); db_unset(hContact, "CList", "Delete"); if (bayesEnabled && g_plugin.getByte("BayesAutolearnApproved", defaultBayesAutolearnApproved) && @@ -483,7 +483,7 @@ void RemoveNotOnListSettings() mir_strcat(protoName, dbv.pszVal); if (g_plugin.getByte(protoName, 0) != 0) { if (db_get_b(hContact, "CList", "Delete", 0) == 1) { - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); } } db_free(&dbv); diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index bab6eb4db1..b32afb3e90 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -37,7 +37,7 @@ int OnDbEventAdded(WPARAM hContact, LPARAM hDbEvent) MCONTACT hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact - int a = db_get_b(hcntct, "CList", "NotOnList", 0); + int a = !Contact_OnList(hcntct); int b = !g_plugin.getByte(hcntct, "Answered"); if (a && b) { @@ -85,7 +85,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l) return 0; if (g_plugin.getByte(hContact, "Excluded")) { - if (!db_get_b(hContact, "CList", "NotOnList", 0)) + if (Contact_OnList(hContact)) g_plugin.delSetting(hContact, "Excluded"); return 0; } @@ -95,14 +95,14 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l) return 0; // ...let the event go its way // mark contact which we trying to contact for exclude from check - if ((dbei->flags & DBEF_SENT) && db_get_b(hContact, "CList", "NotOnList", 0) + if ((dbei->flags & DBEF_SENT) && !Contact_OnList(hContact) && (!gbMaxQuestCount || g_plugin.getDword(hContact, "QuestionCount") < gbMaxQuestCount) && gbExclude) { g_plugin.setByte(hContact, "Excluded", 1); return 0; } // if message is from known or marked Answered contact - if (!db_get_b(hContact, "CList", "NotOnList", 0)) + if (Contact_OnList(hContact)) return 0; // ...let the event go its way // if message is corrupted or empty it cannot be an answer. @@ -165,7 +165,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l) //add contact permanently if (gbAddPermanent) //do not use this ) - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); // send congratulation if (bSendMsg) { @@ -184,7 +184,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l) // add contact to server list and local group if (gbAutoAddToServerList) { Clist_SetGroup(hContact, gbAutoAuthGroup.c_str()); - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); } // auto auth. request with send congratulation @@ -273,7 +273,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l) Contact_Hide(hContact); if (gbSpecialGroup) Clist_SetGroup(hContact, gbSpammersGroup.c_str()); - db_set_b(hContact, "CList", "NotOnList", 1); + Contact_RemoveFromList(hContact); // save first message from contact if (g_plugin.getDword(hContact, "QuestionCount") < 2) { diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index df98a7efbb..d8dd94c673 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -249,7 +249,7 @@ void __cdecl CleanProtocolTmpThread(void *param) std::list contacts; for (auto &hContact : Contacts(szProto)) - if (db_get_b(hContact, "CList", "NotOnList", 0) || (L"Not In List" == DBGetContactSettingStringPAN(hContact, "CList", "Group", L""))) + if (!Contact_OnList(hContact) || (L"Not In List" == DBGetContactSettingStringPAN(hContact, "CList", "Group", L""))) contacts.push_back(hContact); Sleep(5000); @@ -279,7 +279,7 @@ void __cdecl CleanProtocolExclThread(void *param) std::list contacts; for (auto &hContact : Contacts(szProto)) - if (db_get_b(hContact, "CList", "NotOnList", 0) && g_plugin.getByte(hContact, "Excluded")) + if (!Contact_OnList(hContact) && g_plugin.getByte(hContact, "Excluded")) contacts.push_back(hContact); Sleep(5000); diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index a854f547a0..4b3d6cd040 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -23,7 +23,7 @@ int OnDbEventAdded(WPARAM, LPARAM lParam) // if request is from unknown or not marked Answered contact //and if I don't sent message to this contact - if (db_get_b(hcntct, "CList", "NotOnList", 0) && !g_plugin.getByte(hcntct, DB_KEY_ANSWERED) && !IsExistMyMessage(hcntct)) { + if (!Contact_OnList(hcntct) && !g_plugin.getByte(hcntct, DB_KEY_ANSWERED) && !IsExistMyMessage(hcntct)) { if (!g_sets.HandleAuthReq) { char *buf = mir_utf8encodeW(variables_parse(g_sets.getReply(), hcntct).c_str()); ProtoChainSend(hcntct, PSS_MESSAGE, 0, (LPARAM)buf); @@ -33,7 +33,7 @@ int OnDbEventAdded(WPARAM, LPARAM lParam) // ...send message CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, (LPARAM)_T2A(variables_parse(g_sets.getReply(), hcntct).c_str())); - db_set_b(hcntct, "CList", "NotOnList", 1); + Contact_RemoveFromList(hcntct); Contact_Hide(hcntct); if (!g_sets.HistLog) db_event_delete(0, hDbEvent); @@ -67,7 +67,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l) // checking if message from self-added contact //Contact in Not in list icq group - if (!db_get_b(hContact, "CList", "NotOnList", 0) && db_get_w(hContact, dbei->szModule, "SrvGroupId", -1) != 1) + if (Contact_OnList(hContact) && db_get_w(hContact, dbei->szModule, "SrvGroupId", -1) != 1) return 0; //if I sent message to this contact @@ -112,7 +112,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l) //add contact permanently if (g_sets.AddPermanent) - db_unset(hContact, "CList", "NotOnList"); + Contact_PutOnList(hContact); // send congratulation @@ -146,7 +146,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l) } // hide contact from contact list - db_set_b(hContact, "CList", "NotOnList", 1); + Contact_RemoveFromList(hContact); Contact_Hide(hContact); // save message from contact diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 05fd78bc3d..de73b2b6e8 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -12,7 +12,7 @@ INT_PTR IsContactPassed(WPARAM hContact, LPARAM /*lParam*/) if (g_plugin.getByte(hContact, DB_KEY_ANSWERED)) return CS_PASSED; - if (!db_get_b(hContact, "CList", "NotOnList", 0) && db_get_w(hContact, szProto, "SrvGroupId", -1) != 1) + if (Contact_OnList(hContact) && db_get_w(hContact, szProto, "SrvGroupId", -1) != 1) return CS_PASSED; if (IsExistMyMessage(hContact)) @@ -27,7 +27,7 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) MCONTACT hNext = db_find_next(hContact); ptrW szGroup(Clist_GetGroup(hContact)); - if (db_get_b(hContact, "CList", "NotOnList", 0) || (szGroup != NULL && (wcsstr(szGroup, L"Not In List") || wcsstr(szGroup, TranslateT("Not In List"))))) { + if (!Contact_OnList(hContact) || (szGroup != NULL && (wcsstr(szGroup, L"Not In List") || wcsstr(szGroup, TranslateT("Not In List"))))) { char *szProto = GetContactProto(hContact); if (szProto != nullptr) { // Check if protocol uses server side lists diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 6340d1a13d..9e06777e0d 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -931,7 +931,7 @@ void CMsgDialog::DM_NotifyTyping(int mode) // don't send to contacts which are not permanently added to the contact list, // unless the option to ignore added status is set. - if (db_get_b(m_hContact, "CList", "NotOnList", 0) && !g_plugin.getByte(SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) + if (!Contact_OnList(m_hContact) && !g_plugin.getByte(SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) return; // End user check diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index de3d44882b..7446488f63 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -126,7 +126,7 @@ static void ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cContro void CMsgDialog::SetDialogToType() { if (m_hContact) { - if (db_get_b(m_hContact, "CList", "NotOnList", 0)) { + if (!Contact_OnList(m_hContact)) { m_bNotOnList = true; ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_SHOW); Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, SW_SHOW); @@ -710,7 +710,7 @@ void CMsgDialog::OnDestroy() m_pContainer->m_pSideBar->removeSession(this); if (m_hContact && M.GetByte("deletetemp", 0)) - if (db_get_b(m_hContact, "CList", "NotOnList", 0)) + if (!Contact_OnList(m_hContact)) db_delete_contact(m_hContact); if (m_hwndContactPic) @@ -943,7 +943,7 @@ void CMsgDialog::onClick_Add(CCtrlButton*) { Contact_Add(m_hContact, m_hwnd); - if (!db_get_b(m_hContact, "CList", "NotOnList", 0)) { + if (Contact_OnList(m_hContact)) { m_bNotOnList = false; ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_HIDE); if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)) diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index fd47f107a4..5fe29327b7 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -210,7 +210,7 @@ int CTooltipNotify::ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (g_plugin.getByte(pszProto, ProtoUserBit | ProtoIntBit) != (ProtoUserBit | ProtoIntBit)) return 0; - if (db_get_b(hContact, "CList", "NotOnList", 0) && m_sOptions.bIgnoreUnknown) + if (!Contact_OnList(hContact) && m_sOptions.bIgnoreUnknown) return 0; if (g_plugin.getByte(hContact, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 50c5ee03fd..81429c9b09 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -117,7 +117,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) logmsg("ContactStatusChanged2"); - if (db_get_b(hContact, "CList", "NotOnList", 0) || Contact_IsHidden(hContact) || (Ignore_IsIgnored(wParam, IGNOREEVENT_USERONLINE) && newStatus == ID_STATUS_ONLINE)) + if (!Contact_OnList(hContact) || Contact_IsHidden(hContact) || (Ignore_IsIgnored(wParam, IGNOREEVENT_USERONLINE) && newStatus == ID_STATUS_ONLINE)) return 0; wchar_t bufferW[512]; -- cgit v1.2.3