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 --- protocols/Discord/src/proto.cpp | 2 +- protocols/Discord/src/utils.cpp | 4 ++-- protocols/Dummy/src/dummy_proto.cpp | 6 +++--- protocols/EmLanProto/src/mlan.cpp | 4 ++-- protocols/FacebookRM/src/contacts.cpp | 4 ++-- protocols/FacebookRM/src/proto.cpp | 4 ++-- protocols/Gadu-Gadu/src/core.cpp | 10 ++++------ protocols/Gadu-Gadu/src/gg.cpp | 2 +- protocols/ICQ-WIM/src/poll.cpp | 4 ++-- protocols/ICQ-WIM/src/server.cpp | 2 +- protocols/ICQ-WIM/src/utils.cpp | 2 +- protocols/ICQCorp/src/protocol.cpp | 4 ++-- protocols/IRCG/src/clist.cpp | 8 ++++---- protocols/IRCG/src/commandmonitor.cpp | 2 +- protocols/IRCG/src/services.cpp | 2 +- protocols/JabberG/src/jabber_disco.cpp | 2 +- protocols/JabberG/src/jabber_misc.cpp | 2 +- protocols/JabberG/src/jabber_proto.cpp | 2 +- protocols/JabberG/src/jabber_thread.cpp | 4 ++-- protocols/MSN/src/msn_contact.cpp | 6 +++--- protocols/MSN/src/msn_proto.cpp | 2 +- protocols/Sametime/src/sametime_proto.cpp | 4 ++-- protocols/Sametime/src/userlist.cpp | 6 +++--- protocols/SkypeWeb/src/skype_contacts.cpp | 2 +- protocols/Steam/src/stdafx.h | 1 + protocols/Steam/src/steam_contacts.cpp | 4 ++-- protocols/Tox/src/tox_contacts.cpp | 6 +++--- protocols/VKontakte/src/vk_chats.cpp | 4 ++-- protocols/VKontakte/src/vk_proto.cpp | 2 +- protocols/VKontakte/src/vk_thread.cpp | 2 +- protocols/Weather/src/weather_addstn.cpp | 4 ++-- protocols/WebView/src/webview_services.cpp | 8 ++++---- 32 files changed, 60 insertions(+), 61 deletions(-) (limited to 'protocols') 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 #include +#include #include #include #include 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); -- cgit v1.2.3