summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_contacts.h8
-rw-r--r--libs/win32/mir_app.libbin194084 -> 194782 bytes
-rw-r--r--libs/win64/mir_app.libbin189738 -> 190380 bytes
-rw-r--r--plugins/AVS/src/poll.cpp2
-rw-r--r--plugins/AddContactPlus/src/addcontact.cpp2
-rw-r--r--plugins/AutoShutdown/src/watcher.cpp2
-rw-r--r--plugins/Boltun/src/boltun.cpp4
-rw-r--r--plugins/Boltun/src/stdafx.h1
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp2
-rw-r--r--plugins/Clist_nicer/src/clistmod.cpp2
-rw-r--r--plugins/ContactsPlus/src/utils.cpp2
-rw-r--r--plugins/FileAsMessage/src/dialog.cpp2
-rw-r--r--plugins/FileAsMessage/src/stdafx.h1
-rw-r--r--plugins/FloatingContacts/src/stdafx.h2
-rw-r--r--plugins/FloatingContacts/src/thumbs.cpp4
-rw-r--r--plugins/KeyboardNotify/src/ignore.cpp2
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp3
-rw-r--r--plugins/NewAwaySysMod/src/MsgEventAdded.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/stdafx.h5
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp4
-rw-r--r--plugins/Scriver/src/msgdialog.cpp4
-rw-r--r--plugins/Scriver/src/msgutils.cpp2
-rw-r--r--plugins/Scriver/src/utils.cpp2
-rw-r--r--plugins/SecureIM/src/crypt_check.cpp4
-rw-r--r--plugins/ShellExt/src/shlcom.cpp4
-rw-r--r--plugins/SimpleAR/src/Main.cpp2
-rw-r--r--plugins/SimpleAR/src/stdafx.h1
-rw-r--r--plugins/Spamotron/src/spamotron.cpp12
-rwxr-xr-xplugins/StopSpamMod/src/stopspam.cpp14
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp4
-rw-r--r--plugins/StopSpamPlus/src/events.cpp10
-rw-r--r--plugins/StopSpamPlus/src/services.cpp4
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp6
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.cpp2
-rw-r--r--plugins/wbOSD/src/events.cpp2
-rw-r--r--protocols/Discord/src/proto.cpp2
-rw-r--r--protocols/Discord/src/utils.cpp4
-rw-r--r--protocols/Dummy/src/dummy_proto.cpp6
-rw-r--r--protocols/EmLanProto/src/mlan.cpp4
-rw-r--r--protocols/FacebookRM/src/contacts.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp2
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp4
-rw-r--r--protocols/ICQ-WIM/src/server.cpp2
-rw-r--r--protocols/ICQ-WIM/src/utils.cpp2
-rw-r--r--protocols/ICQCorp/src/protocol.cpp4
-rw-r--r--protocols/IRCG/src/clist.cpp8
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp2
-rw-r--r--protocols/IRCG/src/services.cpp2
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp4
-rw-r--r--protocols/MSN/src/msn_contact.cpp6
-rw-r--r--protocols/MSN/src/msn_proto.cpp2
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp4
-rw-r--r--protocols/Sametime/src/userlist.cpp6
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp2
-rw-r--r--protocols/Steam/src/stdafx.h1
-rw-r--r--protocols/Steam/src/steam_contacts.cpp4
-rw-r--r--protocols/Tox/src/tox_contacts.cpp6
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp4
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp2
-rw-r--r--protocols/Weather/src/weather_addstn.cpp4
-rw-r--r--protocols/WebView/src/webview_services.cpp8
-rw-r--r--src/core/stdfile/src/file.cpp2
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp6
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp6
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp8
-rw-r--r--src/mir_app/src/addcontact.cpp2
-rw-r--r--src/mir_app/src/auth.cpp8
-rw-r--r--src/mir_app/src/clcitems.cpp2
-rw-r--r--src/mir_app/src/clistmod.cpp4
-rw-r--r--src/mir_app/src/contacts.cpp17
-rw-r--r--src/mir_app/src/ignore.cpp2
-rw-r--r--src/mir_app/src/menu_clist.cpp2
-rw-r--r--src/mir_app/src/meta_utils.cpp2
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
83 files changed, 175 insertions, 144 deletions
diff --git a/include/m_contacts.h b/include/m_contacts.h
index 9459beccb7..524c1eca3a 100644
--- a/include/m_contacts.h
+++ b/include/m_contacts.h
@@ -88,6 +88,14 @@ EXTERN_C MIR_APP_DLL(bool) Contact_IsHidden(MCONTACT hContact);
EXTERN_C MIR_APP_DLL(void) Contact_Hide(MCONTACT hContact, bool bHidden = true);
/////////////////////////////////////////////////////////////////////////////////////////
+// checks / adds / removes a contact from list of contacts
+// removed contacts would be physically deleted after restart
+
+EXTERN_C MIR_APP_DLL(bool) Contact_OnList(MCONTACT hContact);
+EXTERN_C MIR_APP_DLL(void) Contact_PutOnList(MCONTACT hContact);
+EXTERN_C MIR_APP_DLL(void) Contact_RemoveFromList(MCONTACT hContact);
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Add contact's dialog
// passing hWnd == NULL will result in a dialog that is created modeless
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index d9c0a55bb4..7ff2cd557f 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index b5996e0a9d..107ab240c3 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
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 <newpluginapi.h>
#include <m_clist.h>
+#include <m_contacts.h>
#include <m_protosvc.h>
#include <m_database.h>
#include <m_genmenu.h>
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 <commctrl.h>
#include <newpluginapi.h>
+#include <m_contacts.h>
#include <m_database.h>
#include <m_protosvc.h>
#include <m_langpack.h>
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 <CommCtrl.h>
#include <newpluginapi.h>
-#include <m_system.h>
+#include <m_contacts.h>
#include <m_skin.h>
#include <m_file.h>
#include <m_fontservice.h>
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 <stdarg.h>
#include "newpluginapi.h"
-#include "m_clist.h"
-#include "m_system.h"
-#include "m_database.h"
#include "m_clistint.h"
+#include <m_contacts.h>
+#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 <newpluginapi.h>
#include <m_clistint.h>
+#include <m_contacts.h>
#include <m_langpack.h>
#include <m_database.h>
#include <m_options.h>
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<MCONTACT> 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<MCONTACT> 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];
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index b9b1dc1810..355ffd9d7a 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -341,7 +341,7 @@ MCONTACT CDiscordProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
if (flags & PALF_TEMPORARY)
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
*p = 0;
CDiscordUser *pUser = new CDiscordUser(0);
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index 95a7b098c3..e26317d0f8 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -228,13 +228,13 @@ void CDiscordProto::ProcessType(CDiscordUser *pUser, const JSONNode &pRoot)
{
switch (pRoot["type"].as_int()) {
case 1: // confirmed
- db_unset(pUser->hContact, "CList", "NotOnList");
+ Contact_PutOnList(pUser->hContact);
delSetting(pUser->hContact, DB_KEY_REQAUTH);
delSetting(pUser->hContact, "ApparentMode");
break;
case 3: // expecting authorization
- db_set_b(pUser->hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(pUser->hContact);
if (!getByte(pUser->hContact, DB_KEY_REQAUTH, 0)) {
setByte(pUser->hContact, DB_KEY_REQAUTH, 1);
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp
index 5806991b23..b1b10c4060 100644
--- a/protocols/Dummy/src/dummy_proto.cpp
+++ b/protocols/Dummy/src/dummy_proto.cpp
@@ -155,11 +155,11 @@ MCONTACT CDummyProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
if (flags & PALF_TEMPORARY) {
Contact_Hide(hContact);
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
}
- else if (db_get_b(hContact, "CList", "NotOnList", 0)) {
+ else if (!Contact_OnList(hContact)) {
Contact_Hide(hContact, false);
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
}
setWString(hContact, uniqueIdSetting, psr->id.w);
setWString(hContact, "Nick", psr->id.w);
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index 2f72daf65d..2db580c26b 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -205,7 +205,7 @@ MCONTACT CMLan::FindContact(in_addr addr, const char *nick, bool add_to_list, bo
u_long caddr = g_plugin.getDword(res, "ipaddr", -1);
if (caddr == addr.S_un.S_addr) {
if (make_permanent)
- db_unset(res, "CList", "NotOnList");
+ Contact_PutOnList(res);
if (make_visible)
Contact_Hide(res, false);
return res;
@@ -219,7 +219,7 @@ MCONTACT CMLan::FindContact(in_addr addr, const char *nick, bool add_to_list, bo
g_plugin.setString(res, "Nick", nick);
if (!make_permanent)
- db_set_b(res, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(res);
if (!make_visible)
Contact_Hide(res);
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 4c03674cb1..2d4c81513e 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -235,7 +235,7 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, bool force_add, boo
// Save these values only when adding new contact, not when updating existing
if (add_temporarily) {
Contact_Hide(hContact);
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
}
setString(hContact, FACEBOOK_KEY_ID, fbu->user_id.c_str());
@@ -415,7 +415,7 @@ void FacebookProto::IgnoreFriendshipRequest(void *data)
NotifyEvent(m_tszUserName, TranslateT("Request for friendship was ignored."), 0, EVENT_FRIENDSHIP);
// Delete this contact, if he's temporary
- if (db_get_b(hContact, "CList", "NotOnList", 0))
+ if (!Contact_OnList(hContact))
db_delete_contact(hContact);
}
else facy.client_notify(TranslateT("Error occurred when ignoring friendship request."));
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index dc9655839b..ef5f0f6399 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -281,9 +281,9 @@ MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
MCONTACT hContact = AddToContactList(&fbu, false, add_temporarily);
// Reset NotOnList flag if present and we're adding this contact not temporarily
- if (hContact && !add_temporarily && db_get_b(hContact, "CList", "NotOnList", 0)) {
+ if (hContact && !add_temporarily && !Contact_OnList(hContact)) {
Contact_Hide(hContact, false);
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
}
return hContact;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 4e3135be50..08649d5ac0 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -1367,8 +1367,7 @@ void GaduProto::notifyuser(MCONTACT hContact, int refresh)
{
// Check if user should be invisible
// Or be blocked ?
- if ((getWord(hContact, GG_KEY_APPARENT, (WORD)ID_STATUS_ONLINE) == ID_STATUS_OFFLINE) ||
- db_get_b(hContact, "CList", "NotOnList", 0))
+ if ((getWord(hContact, GG_KEY_APPARENT, (WORD)ID_STATUS_ONLINE) == ID_STATUS_OFFLINE) || !Contact_OnList(hContact))
{
gg_EnterCriticalSection(&sess_mutex, "notifyuser", 77, "sess_mutex", 1);
if (refresh) {
@@ -1423,8 +1422,7 @@ void GaduProto::notifyall()
int cc = 0;
for (auto &hContact : AccContacts()) {
if (uins[cc] = getDword(hContact, GG_KEY_UIN, 0)) {
- if ((getWord(hContact, GG_KEY_APPARENT, (WORD)ID_STATUS_ONLINE) == ID_STATUS_OFFLINE) ||
- db_get_b(hContact, "CList", "NotOnList", 0))
+ if ((getWord(hContact, GG_KEY_APPARENT, (WORD)ID_STATUS_ONLINE) == ID_STATUS_OFFLINE) || !Contact_OnList(hContact))
types[cc] = GG_USER_OFFLINE;
else if (getByte(hContact, GG_KEY_BLOCK, 0))
types[cc] = GG_USER_BLOCKED;
@@ -1460,7 +1458,7 @@ MCONTACT GaduProto::getcontact(uin_t uin, int create, int inlist, wchar_t *szNic
for (auto &hContact : AccContacts()) {
if ((uin_t)getDword(hContact, GG_KEY_UIN, 0) == uin && !isChatRoom(hContact)) {
if (inlist) {
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
Contact_Hide(hContact, false);
}
return hContact;
@@ -1474,7 +1472,7 @@ MCONTACT GaduProto::getcontact(uin_t uin, int create, int inlist, wchar_t *szNic
debugLogA("getcontact(): Added buddy: %d", uin);
if (!inlist)
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
setDword(hContact, GG_KEY_UIN, (DWORD)uin);
setWord(hContact, GG_KEY_STATUS, ID_STATUS_OFFLINE);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 09a379ecfc..cb5bda1bc6 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -221,7 +221,7 @@ static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM)
if (gg == nullptr)
return 0;
- if (gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) || gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
+ if (gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) || gg->isChatRoom(hContact) || !Contact_OnList(hContact))
Menu_ShowItem(gg->hBlockMenuItem, false);
else
Menu_ModifyItem(gg->hBlockMenuItem, gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENW("&Unblock") : LPGENW("&Block"));
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp
index 4b66664cae..9409d474d3 100644
--- a/protocols/ICQ-WIM/src/poll.cpp
+++ b/protocols/ICQ-WIM/src/poll.cpp
@@ -70,7 +70,7 @@ void CIcqProto::ProcessBuddyList(const JSONNode &ev)
for (auto &it : m_arCache)
if (!it->m_bInList)
- db_set_b(it->m_hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(it->m_hContact);
RetrieveUserInfo();
}
@@ -116,7 +116,7 @@ void CIcqProto::ProcessDiff(const JSONNode &ev)
// prepare contact for deletion
Clist_SetGroup(hContact, nullptr);
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
continue;
}
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 13b868c525..c44419727b 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -611,7 +611,7 @@ void CIcqProto::OnAddBuddy(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
JsonReply root(pReply);
if (root.error() == 200) {
RetrieveUserInfo(pReq->hContact);
- db_unset(pReq->hContact, "CList", "NotOnList");
+ Contact_PutOnList(pReq->hContact);
}
}
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp
index d59d423f6f..ced91a21cf 100644
--- a/protocols/ICQ-WIM/src/utils.cpp
+++ b/protocols/ICQ-WIM/src/utils.cpp
@@ -99,7 +99,7 @@ MCONTACT CIcqProto::CreateContact(const CMStringW &wszId, bool bTemporary)
RetrieveUserInfo(hContact);
if (bTemporary)
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
return hContact;
}
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp
index ad23549195..c448e4a15e 100644
--- a/protocols/ICQCorp/src/protocol.cpp
+++ b/protocols/ICQCorp/src/protocol.cpp
@@ -1256,7 +1256,7 @@ ICQUser* ICQ::addUser(unsigned int uin, bool persistent)
u = icqUsers[i];
if (u->dwUIN == uin) {
if (persistent) {
- db_unset(u->hContact, "CList", "NotOnList");
+ Contact_PutOnList(u->hContact);
Contact_Hide(u->hContact, false);
}
return u;
@@ -1274,7 +1274,7 @@ ICQUser* ICQ::addUser(unsigned int uin, bool persistent)
if (persistent)
getUserInfo(u, true);
else {
- db_set_b(u->hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(u->hContact);
Contact_Hide(u->hContact);
}
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index 5c16b03065..cb4a237209 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -31,7 +31,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas
CONTACT usertemp = { name, nullptr, nullptr, false, false, true };
MCONTACT hc = CList_FindContact(&usertemp);
- if (hc && db_get_b(hc, "CList", "NotOnList", 0) == 0 && Contact_IsHidden(hc) == 0)
+ if (hc && Contact_OnList(hc) && !Contact_IsHidden(hc))
bFlag = true;
CMStringW contactname = name; contactname += DCCSTRING;
@@ -88,7 +88,7 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline)
MCONTACT hContact = CList_FindContact(user);
if (hContact) {
if (InList)
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
setWString(hContact, "Nick", user->name);
Contact_Hide(hContact, false);
if (SetOnline && getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
@@ -102,9 +102,9 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline)
Proto_AddToContact(hContact, m_szModuleName);
if (InList)
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
else
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
Contact_Hide(hContact, false);
setWString(hContact, "Nick", user->name);
setWString(hContact, "Default", user->name);
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 014b34b2c5..25a6dd90c3 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -1063,7 +1063,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
MCONTACT hContact = CList_FindContact(&user);
// check if it should be ignored
- if (m_DCCChatIgnore == 1 || m_DCCChatIgnore == 2 && hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0 && !Contact_IsHidden(hContact)) {
+ if (m_DCCChatIgnore == 1 || m_DCCChatIgnore == 2 && hContact && Contact_OnList(hContact) && !Contact_IsHidden(hContact)) {
CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
CList_AddDCCChat(pmsg->prefix.sNick, host, dwAdr, iPort); // add a CHAT event to the clist
}
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 8b91562f6f..6b05f1efb8 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -803,7 +803,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
CONTACT user = { (wchar_t*)gcmi->pszUID, nullptr, nullptr, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
- BOOL bIsInList = (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0);
+ BOOL bIsInList = hContact && Contact_OnList(hContact);
nickItems[_countof(nickItems)-1].bDisabled = bIsInList;
unsigned long ulAdr = 0;
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index 0b63c8b10d..1b0ddb05e7 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -1293,7 +1293,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
case SD_ACT_ROSTER:
{
MCONTACT hContact = DBCreateContact(pNode->GetJid(), pNode->GetName(), false, false);
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
JABBER_LIST_ITEM *item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid(), hContact);
item->bUseResource = true;
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index c5f2534707..e4693220ae 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -86,7 +86,7 @@ MCONTACT CJabberProto::DBCreateContact(const char *jid, const char *nick, bool t
if (nick != nullptr && *nick != '\0')
setUString(hNewContact, "Nick", nick);
if (temporary)
- db_set_b(hNewContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hNewContact);
else
SendGetVcard(hNewContact);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 5e31b10f3d..0122da30ba 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -424,7 +424,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent)
if (MCONTACT hContact = AddToListByJID(blob.get_email(), 0)) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
}
}
}
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index b3446760ff..29e11ee2cc 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1684,7 +1684,7 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info)
ListRemoveResource(LIST_ROSTER, from);
hContact = HContactFromJID(from);
- if (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 1) {
+ if (hContact && !Contact_OnList(hContact)) {
// remove selfcontact, if where is no more another resources
if (item->arResources.getCount() == 1 && ResourceInfoFromJID(info->fullJID))
ListRemoveResource(LIST_ROSTER, info->fullJID);
@@ -1734,7 +1734,7 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info)
if (item)
item->hContact = hContact;
setUString(hContact, "Nick", szNick);
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
}
}
}
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp
index 863a8e99f3..0bc5838533 100644
--- a/protocols/MSN/src/msn_contact.cpp
+++ b/protocols/MSN/src/msn_contact.cpp
@@ -44,7 +44,7 @@ MCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick,
setWord(hContact, "netId", netId);
setString(hContact, "wlid", szEmail);
if (temporary)
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
Lists_Add(0, szNet?atoi(szNet):NETID_MSN, szEmail, hContact);
}
@@ -78,8 +78,8 @@ void CMsnProto::MSN_SetContactDb(MCONTACT hContact, const char *szEmail)
const int listId = cont->list;
if (listId & LIST_FL) {
- if (db_get_b(hContact, "CList", "NotOnList", 0) == 1) {
- db_unset(hContact, "CList", "NotOnList");
+ if (!Contact_OnList(hContact)) {
+ Contact_PutOnList(hContact);
Contact_Hide(hContact, false);
}
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index fd78f32d77..b4eed8da74 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -194,7 +194,7 @@ MCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD
MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, flags & PALF_TEMPORARY);
if (flags & PALF_TEMPORARY) {
- if (db_get_b(hContact, "CList", "NotOnList", 0) == 1)
+ if (!Contact_OnList(hContact))
Contact_Hide(hContact);
}
else {
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index ca657be854..db816ad08b 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -171,7 +171,7 @@ int CSametimeProto::RecvFile(MCONTACT hContact, PROTORECVFILE* pre)
debugLogW(L"CSametimeProto::RecvFile() hContact=[%x]", hContact);
Contact_Hide(hContact, false);
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
return CSuper::RecvFile(hContact, pre);
}
@@ -181,7 +181,7 @@ MEVENT CSametimeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre)
debugLogW(L"CSametimeProto::RecvMsg() hContact=[%x]", hContact);
Contact_Hide(hContact, false);
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
return CSuper::RecvMsg(hContact, pre);
}
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp
index 0ebbce3d22..94545c4d13 100644
--- a/protocols/Sametime/src/userlist.cpp
+++ b/protocols/Sametime/src/userlist.cpp
@@ -69,7 +69,7 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary)
new_contact = true;
}
else if (!temporary) {
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
Contact_Hide(hContact, false);
}
@@ -104,11 +104,11 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary)
}
if (temporary) {
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
Contact_Hide(hContact);
}
else {
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
Contact_Hide(hContact, false);
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index c8a63041a7..915f625ef3 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -85,7 +85,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary)
setByte(hContact, "Grant", 1);
if (isTemporary)
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
}
return hContact;
}
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h
index 0783ee01e4..a3ce6ef4b7 100644
--- a/protocols/Steam/src/stdafx.h
+++ b/protocols/Steam/src/stdafx.h
@@ -12,6 +12,7 @@
#include <algorithm>
#include <newpluginapi.h>
+#include <m_contacts.h>
#include <m_database.h>
#include <m_langpack.h>
#include <m_message.h>
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 8eeb7c6eb3..d60f15a0d1 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -245,7 +245,7 @@ void CSteamProto::ContactIsFriend(MCONTACT hContact)
delSetting(hContact, "AuthAsked");
delSetting(hContact, "Auth");
delSetting(hContact, "Grant");
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
// Check if this contact was removed someday and if so, notify he's back
if (getDword(hContact, "DeletedTS", 0) && !getByte(hContact, "Auth", 0)) {
@@ -347,7 +347,7 @@ MCONTACT CSteamProto::AddContact(const char *steamId, const wchar_t *nick, bool
if (isTemporary) {
debugLogA("Contact %d added as a temporary one");
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
}
setByte(hContact, "Auth", 1);
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index ea388e0748..f9ba570330 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -98,7 +98,7 @@ MCONTACT CToxProto::AddContact(const char *address, const wchar_t *nick, const w
setByte(hContact, "Grant", 1);
}
else
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
return hContact;
}
@@ -167,7 +167,7 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
return addFriendResult;
}
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
delSetting(hContact, "Grant");
/*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
@@ -193,7 +193,7 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM)
return error;
}
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
delSetting(hContact, "Grant");
SaveToxProfile(m_tox);
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 91c2c2b5e7..6e8a4eec7c 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -476,7 +476,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam)
if (hContact == 0) {
hContact = FindUser(_wtoi(gch->ptszUID), true);
Contact_Hide(hContact);
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
db_set_dw(hContact, "Ignore", "Mask1", 0);
RetrieveUserInfo(_wtoi(gch->ptszUID));
}
@@ -724,7 +724,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch)
if (hContact == 0) {
hContact = FindUser(cu->m_uid, true);
Contact_Hide(hContact);
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
db_set_dw(hContact, "Ignore", "Mask1", 0);
}
CallService(MS_USERINFO_SHOWDIALOG, hContact);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 1a69ec8000..ed42f520ec 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -649,7 +649,7 @@ void CVkProto::OnContactDeleted(MCONTACT hContact)
ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
debugLogW(L"CVkProto::OnContactDeleted %s", pwszNick.get());
- if (db_get_b(hContact, "CList", "NotOnList") || getBool(hContact, "SilentDelete") || isChatRoom((MCONTACT)hContact))
+ if (!Contact_OnList(hContact) || getBool(hContact, "SilentDelete") || isChatRoom((MCONTACT)hContact))
return;
LONG userID = getDword(hContact, "ID", VK_INVALID_USER);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index 127800c45d..a69a5c3c35 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -358,7 +358,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, VKContactTy
if (vkContactType == VKContactType::vkContactMUCUser) {
Contact_Hide(hContact);
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
db_set_dw(hContact, "Ignore", "Mask1", 0);
}
diff --git a/protocols/Weather/src/weather_addstn.cpp b/protocols/Weather/src/weather_addstn.cpp
index ff4287a988..3ef5a46894 100644
--- a/protocols/Weather/src/weather_addstn.cpp
+++ b/protocols/Weather/src/weather_addstn.cpp
@@ -48,8 +48,8 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
if (!mir_wstrcmpi(psr->email.w, dbv.pwszVal)) {
// remove the flag for not on list and hidden, thus make the contact visible
// and add them on the list
- if (db_get_b(hContact, "CList", "NotOnList", 1)) {
- db_unset(hContact, "CList", "NotOnList");
+ if (!Contact_OnList(hContact)) {
+ Contact_PutOnList(hContact);
Contact_Hide(hContact, false);
}
db_free(&dbv);
diff --git a/protocols/WebView/src/webview_services.cpp b/protocols/WebView/src/webview_services.cpp
index c3b412c7e5..6fe8a258a1 100644
--- a/protocols/WebView/src/webview_services.cpp
+++ b/protocols/WebView/src/webview_services.cpp
@@ -351,8 +351,8 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
// contact visible
// and add them on the list
sameurl++;
- if (db_get_b(hContact, "CList", "NotOnList", 1)) {
- db_unset(hContact, "CList", "NotOnList");
+ if (!Contact_OnList(hContact)) {
+ Contact_PutOnList(hContact);
Contact_Hide(hContact, false);
}
}
@@ -402,8 +402,8 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
// contact visible
// and add them on the list
samename++;
- if (db_get_b(hContact2, "CList", "NotOnList", 1)) {
- db_unset(hContact2, "CList", "NotOnList");
+ if (!Contact_OnList(hContact2)) {
+ Contact_PutOnList(hContact2);
Contact_Hide(hContact2, false);
}
db_free(&dbv);
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index cd106fedba..df862eb0ca 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -101,7 +101,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam)
cle.hContact = hContact;
cle.hDbEvent = hdbe;
cle.lParam = lParam;
- if (g_plugin.getByte("AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) {
+ if (g_plugin.getByte("AutoAccept", 0) && Contact_OnList(hContact)) {
CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
}
else {
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index 2fe57e4935..6c14b8d406 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
ptrW info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
SetDlgItemText(hwndDlg, IDC_NAME, (info) ? info : contactName);
- if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
+ if (!Contact_OnList(dat->hContact)) {
RECT rcBtn1, rcBtn2, rcDateCtrl;
GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rcBtn1);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rcBtn2);
@@ -261,7 +261,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
//don't check auto-min here to fix BUG#647620
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK));
}
- if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ if (Contact_OnList(dat->hContact))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
return TRUE;
@@ -348,7 +348,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_ADD:
Contact_Add(dat->hContact, hwndDlg);
- if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ if (Contact_OnList(dat->hContact))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
break;
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 9f8bc128f8..adaa06e9cf 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -245,8 +245,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
CreateDirectoryTreeW(dat->szSavePath);
dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
dat->transferStatus.szWorkingDir.w = mir_wstrdup(dat->szSavePath);
- if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
- else dat->resumeBehaviour = g_plugin.getByte("IfExists", FILERESUME_ASK);
+ if (!Contact_OnList(dat->hContact))
+ dat->resumeBehaviour = FILERESUME_ASK;
+ else
+ dat->resumeBehaviour = g_plugin.getByte("IfExists", FILERESUME_ASK);
SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT);
}
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index f5e3c146c3..d1e6bfdb9c 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -336,7 +336,7 @@ void CMsgDialog::OnDestroy()
// a temporary contact should be destroyed after removing window from the window list to prevent recursion
if (m_hContact && g_dat.bDeleteTempCont)
- if (db_get_b(m_hContact, "CList", "NotOnList", 0))
+ if (!Contact_OnList(m_hContact))
db_delete_contact(m_hContact);
}
@@ -878,7 +878,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDC_ADD:
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), FALSE);
break;
}
@@ -1472,7 +1472,7 @@ void CMsgDialog::OnOptionsApplied(bool bUpdateAvatar)
bool bShow = false;
if (m_hContact && g_dat.bShowButtons) {
if (cbd->m_dwButtonCID == IDC_ADD) {
- bShow = 0 != db_get_b(m_hContact, "CList", "NotOnList", 0);
+ bShow = !Contact_OnList(m_hContact);
cbd->m_bHidden = !bShow;
}
else bShow = true;
@@ -1611,7 +1611,7 @@ void CMsgDialog::NotifyTyping(int mode)
if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return;
- if (!g_dat.bTypingUnknown && db_get_b(m_hContact, "CList", "NotOnList", 0))
+ if (!g_dat.bTypingUnknown && !Contact_OnList(m_hContact))
return;
// End user check
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp
index 4d89422941..634ef8a50e 100644
--- a/src/mir_app/src/addcontact.cpp
+++ b/src/mir_app/src/addcontact.cpp
@@ -146,7 +146,7 @@ public:
if (item > 0)
Clist_ContactChangeGroup(hContact, m_group.GetItemData(item));
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
if (m_chkAuth.GetState()) {
DWORD flags = CallProtoServiceInt(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0);
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp
index 11b834b36c..c17866e93a 100644
--- a/src/mir_app/src/auth.cpp
+++ b/src/mir_app/src/auth.cpp
@@ -117,7 +117,7 @@ public:
SetDlgItemText(m_hwnd, IDC_HEADERBAR, hdr);
SetDlgItemText(m_hwnd, IDC_REASON, reasonT);
- if (m_hContact == INVALID_CONTACT_ID || !db_get_b(m_hContact, "CList", "NotOnList", 0))
+ if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact))
ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE);
SendDlgItemMessage(m_hwnd, IDC_DENYREASON, EM_LIMITTEXT, 255, 0);
@@ -126,7 +126,7 @@ public:
SetDlgItemText(m_hwnd, IDC_DENYREASON, TranslateT("Feature is not supported by protocol"));
}
- if (!db_get_b(m_hContact, "CList", "NotOnList", 0)) {
+ if (Contact_OnList(m_hContact)) {
chkAdd.Disable();
chkAdd.SetState(false);
}
@@ -254,7 +254,7 @@ public:
mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT.get() : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(m_hwnd, IDC_HEADERBAR, hdr);
- if (m_hContact == INVALID_CONTACT_ID || !db_get_b(m_hContact, "CList", "NotOnList", 0))
+ if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact))
ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE);
return true;
}
@@ -276,7 +276,7 @@ public:
{
Contact_AddByEvent(m_hDbEvent, m_hwnd);
- if (m_hContact == INVALID_CONTACT_ID || !db_get_b(m_hContact, "CList", "NotOnList", 0))
+ if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact))
ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE);
}
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index ac6e365177..17da6a7888 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -201,7 +201,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact
cc->flags |= CONTACTF_VISTO;
else if (apparentMode)
cc->flags |= CONTACTF_VISTO | CONTACTF_INVISTO;
- if (db_get_b(hContact, "CList", "NotOnList", 0))
+ if (!Contact_OnList(hContact))
cc->flags |= CONTACTF_NOTONLIST;
DWORD idleMode = szProto != nullptr ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0;
if (idleMode)
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp
index ed2f250eb5..7769183396 100644
--- a/src/mir_app/src/clistmod.cpp
+++ b/src/mir_app/src/clistmod.cpp
@@ -239,7 +239,7 @@ int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY)
{
RECT rc, rcWin, rcWorkArea;
POINT pt;
- register int i, j, width, height, iCountedDots = 0, iNotCoveredDots = 0;
+ int i, j, width, height, iCountedDots = 0, iNotCoveredDots = 0;
BOOL bPartiallyCovered = FALSE;
HWND hAux = nullptr;
@@ -405,7 +405,7 @@ void UnloadContactListModule()
// remove transitory contacts
for (MCONTACT hContact = db_find_first(); hContact != 0; ) {
MCONTACT hNext = db_find_next(hContact);
- if (db_get_b(hContact, "CList", "NotOnList", 0))
+ if (!Contact_OnList(hContact))
db_delete_contact(hContact);
hContact = hNext;
}
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index daf95dbf86..afd191c9b0 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -294,6 +294,23 @@ MIR_APP_DLL(void) Contact_Hide(MCONTACT hContact, bool bHidden)
db_unset(hContact, "CList", "Hidden");
}
+///////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(bool) Contact_OnList(MCONTACT hContact)
+{
+ return db_get_b(hContact, "CList", "NotOnList", 0) == 0;
+}
+
+MIR_APP_DLL(void) Contact_PutOnList(MCONTACT hContact)
+{
+ db_unset(hContact, "CList", "NotOnList");
+}
+
+MIR_APP_DLL(void) Contact_RemoveFromList(MCONTACT hContact)
+{
+ db_set_b(hContact, "CList", "NotOnList", 1);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Options dialog
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp
index 56c38e303f..9832bf56e1 100644
--- a/src/mir_app/src/ignore.cpp
+++ b/src/mir_app/src/ignore.cpp
@@ -38,7 +38,7 @@ static DWORD GetMask(MCONTACT hContact)
if (hContact == 0)
mask = 0;
else {
- if (Contact_IsHidden(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
+ if (Contact_IsHidden(hContact) || !Contact_OnList(hContact))
mask = db_get_dw(0, "Ignore", "Mask1", 0);
else
mask = db_get_dw(0, "Ignore", "Default1", 0);
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp
index 181df23c64..2f16fe578f 100644
--- a/src/mir_app/src/menu_clist.cpp
+++ b/src/mir_app/src/menu_clist.cpp
@@ -229,7 +229,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact)
BuildContactParam bcp;
bcp.szProto = szProto;
- bcp.isOnList = (db_get_b(hContact, "CList", "NotOnList", 0) == 0);
+ bcp.isOnList = Contact_OnList(hContact);
bcp.isOnline = (szProto != nullptr && ID_STATUS_OFFLINE != db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE));
HMENU hMenu = CreatePopupMenu();
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp
index e16a24d00b..9bae3558e5 100644
--- a/src/mir_app/src/meta_utils.cpp
+++ b/src/mir_app/src/meta_utils.cpp
@@ -79,7 +79,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
}
// Check that is is 'on the list'
- if (db_get_b(hSub, "CList", "NotOnList", 0) == 1) {
+ if (!Contact_OnList(hSub)) {
MessageBox(nullptr, TranslateT("Contact is 'not on list' - please add the contact to your contact list before assigning."), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
db_free(&dbv);
return FALSE;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index a31384307a..5bfcbfed5a 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -693,3 +693,6 @@ Miranda_GetIdle @778 NONAME
Ignore_Allow @779
Ignore_Ignore @780
Ignore_IsIgnored @781
+Contact_OnList @782
+Contact_PutOnList @783
+Contact_RemoveFromList @784
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index c92292f409..3a5645f024 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -693,3 +693,6 @@ Miranda_GetIdle @778 NONAME
Ignore_Allow @779
Ignore_Ignore @780
Ignore_IsIgnored @781
+Contact_OnList @782
+Contact_PutOnList @783
+Contact_RemoveFromList @784