diff options
Diffstat (limited to 'protocols')
36 files changed, 66 insertions, 72 deletions
diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp index 95e3c47fb8..8d1f584fe4 100644 --- a/protocols/Discord/src/groupchat.cpp +++ b/protocols/Discord/src/groupchat.cpp @@ -82,7 +82,7 @@ void CDiscordProto::Chat_SendPrivateMessage(GCHOOK *gch) setId(hContact, DB_KEY_ID, userId); setId(hContact, DB_KEY_CHANNELID, _wtoi64(gch->ptszID)); setWString(hContact, "Nick", gch->ptszNick); - db_set_b(hContact, "CList", "Hidden", 1); + Clist_HideContact(hContact); db_set_dw(hContact, "Ignore", "Mask1", 0); } else hContact = pUser->hContact; diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 3c32087d23..6fc7b953cf 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -154,11 +154,11 @@ MCONTACT CDummyProto::AddToList(int flags, PROTOSEARCHRESULT* psr) Proto_AddToContact(hContact, m_szModuleName); if (flags & PALF_TEMPORARY) { - db_set_b(hContact, "CList", "Hidden", 1); + Clist_HideContact(hContact); db_set_b(hContact, "CList", "NotOnList", 1); } else if (db_get_b(hContact, "CList", "NotOnList", 0)) { - db_unset(hContact, "CList", "Hidden"); + Clist_HideContact(hContact, false); db_unset(hContact, "CList", "NotOnList"); } setWString(hContact, uniqueIdSetting, psr->id.w); diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 6ad76e2f95..27a3d9508e 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -207,7 +207,7 @@ MCONTACT CMLan::FindContact(in_addr addr, const char *nick, bool add_to_list, bo if (make_permanent) db_unset(res, "CList", "NotOnList"); if (make_visible) - db_unset(res, "CList", "Hidden"); + Clist_HideContact(res, false); return res; } } @@ -221,7 +221,7 @@ MCONTACT CMLan::FindContact(in_addr addr, const char *nick, bool add_to_list, bo if (!make_permanent) db_set_b(res, "CList", "NotOnList", 1); if (!make_visible) - db_set_b(res, "CList", "Hidden", 1); + Clist_HideContact(res); g_plugin.setWord(res, "Status", status); return res; @@ -340,7 +340,7 @@ void CMLan::OnRecvPacket(u_char *mes, int len, in_addr from) void CMLan::RecvMessageUrl(CCSDATA *ccs) { - db_unset(ccs->hContact, "CList", "Hidden"); + Clist_HideContact(ccs->hContact, false); PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam; ptrA szMessage(mir_utf8encode(pre->szMessage)); @@ -924,7 +924,7 @@ void CMLan::RecvFile(CCSDATA *ccs) { PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam; - db_unset(ccs->hContact, "CList", "Hidden"); + Clist_HideContact(ccs->hContact, false); char *szFile = pre->szMessage + sizeof(DWORD); char *szDesc = szFile + mir_strlen(szFile) + 1; diff --git a/protocols/EmLanProto/src/stdafx.h b/protocols/EmLanProto/src/stdafx.h index 5da73a09ee..550e2dfaf3 100644 --- a/protocols/EmLanProto/src/stdafx.h +++ b/protocols/EmLanProto/src/stdafx.h @@ -16,6 +16,7 @@ #include <m_protosvc.h>
#include <m_database.h>
#include <m_langpack.h>
+#include <m_clist.h>
#include "resource.h"
#include "version.h"
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 74f73fae43..5251abe84a 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -234,7 +234,7 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, bool force_add, boo if (hContact) { // Save these values only when adding new contact, not when updating existing if (add_temporarily) { - db_set_b(hContact, "CList", "Hidden", 1); + Clist_HideContact(hContact); db_set_b(hContact, "CList", "NotOnList", 1); } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index ba0acbd03f..12b5f3c80f 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -282,7 +282,7 @@ MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) // Reset NotOnList flag if present and we're adding this contact not temporarily if (hContact && !add_temporarily && db_get_b(hContact, "CList", "NotOnList", 0)) { - db_unset(hContact, "CList", "Hidden"); + Clist_HideContact(hContact, false); db_unset(hContact, "CList", "NotOnList"); } diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index d6a16a9493..3a2644f0b6 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1317,8 +1317,9 @@ int GaduProto::dbsettingchanged(WPARAM hContact, LPARAM lParam) // If not on list changed
if (!strcmp(cws->szSetting, "NotOnList"))
{
- if (db_get_b(hContact, "CList", "Hidden", 0))
+ if (Clist_IsHidden(hContact))
return 0;
+
// Notify user normally this time if added to the list permanently
if (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_BYTE && cws->value.bVal == 0))
notifyuser(hContact, 1);
@@ -1460,7 +1461,7 @@ MCONTACT GaduProto::getcontact(uin_t uin, int create, int inlist, wchar_t *szNic if ((uin_t)getDword(hContact, GG_KEY_UIN, 0) == uin && !isChatRoom(hContact)) {
if (inlist) {
db_unset(hContact, "CList", "NotOnList");
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
}
return hContact;
}
diff --git a/protocols/ICQ-WIM/src/groupchats.cpp b/protocols/ICQ-WIM/src/groupchats.cpp index dc5747e0c8..c0f477b122 100644 --- a/protocols/ICQ-WIM/src/groupchats.cpp +++ b/protocols/ICQ-WIM/src/groupchats.cpp @@ -258,7 +258,7 @@ void CIcqProto::Chat_SendPrivateMessage(GCHOOK *gch) if (pCache == nullptr) { hContact = CreateContact(gch->ptszUID, true); setWString(hContact, "Nick", gch->ptszNick); - db_set_b(hContact, "CList", "Hidden", 1); + Clist_HideContact(hContact); db_set_dw(hContact, "Ignore", "Mask1", 0); } else hContact = pCache->m_hContact; diff --git a/protocols/ICQ-WIM/src/ignore.cpp b/protocols/ICQ-WIM/src/ignore.cpp index 069d8c1844..cdf83cc517 100644 --- a/protocols/ICQ-WIM/src/ignore.cpp +++ b/protocols/ICQ-WIM/src/ignore.cpp @@ -50,7 +50,7 @@ void CIcqProto::ProcessPermissions(const JSONNode &ev) auto *p = FindContactByUIN(wszId); if (p == nullptr) { auto hContact = CreateContact(wszId, false); - db_set_b(hContact, "CList", "Hidden", 1); + Clist_HideContact(hContact); p = FindContactByUIN(wszId); } p->m_iApparentMode = ID_STATUS_OFFLINE; diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index c43c3b6fad..6aeebfe8f5 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -1257,7 +1257,7 @@ ICQUser* ICQ::addUser(unsigned int uin, bool persistent) if (u->dwUIN == uin) {
if (persistent) {
db_unset(u->hContact, "CList", "NotOnList");
- db_unset(u->hContact, "CList", "Hidden");
+ Clist_HideContact(u->hContact, false);
}
return u;
}
@@ -1275,7 +1275,7 @@ ICQUser* ICQ::addUser(unsigned int uin, bool persistent) getUserInfo(u, true);
else {
db_set_b(u->hContact, "CList", "NotOnList", 1);
- db_set_b(u->hContact, "CList", "Hidden", 1);
+ Clist_HideContact(u->hContact);
}
updateContactList();
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index 0781c67d5c..a33c243606 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -189,7 +189,7 @@ static INT_PTR icqRecvMessage(WPARAM, LPARAM lParam) Netlib_Logf(hNetlibUser, "[ ] receive message\n");
CCSDATA *ccs = (CCSDATA*)lParam;
- db_unset(ccs->hContact, "CList", "Hidden");
+ Clist_HideContact(ccs->hContact, false);
PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam;
ptrA szMsg(mir_utf8encode(pre->szMessage));
@@ -362,7 +362,7 @@ static INT_PTR icqRecvFile(WPARAM, LPARAM lParam) Netlib_Logf(hNetlibUser, "[ ] receive file\n");
CCSDATA *ccs = (CCSDATA *)lParam;
- db_unset(ccs->hContact, "CList", "Hidden");
+ Clist_HideContact(ccs->hContact, false);
PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
char *szFile = pre->szMessage + sizeof(DWORD);
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 02739d42e0..43011ce264 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 && db_get_b(hc, "CList", "Hidden", 0) == 0)
+ if (hc && db_get_b(hc, "CList", "NotOnList", 0) == 0 && Clist_IsHidden(hc) == 0)
bFlag = true;
CMStringW contactname = name; contactname += DCCSTRING;
@@ -90,7 +90,7 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) if (InList)
db_unset(hContact, "CList", "NotOnList");
setWString(hContact, "Nick", user->name);
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
if (SetOnline && getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
return hContact;
@@ -105,7 +105,7 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) db_unset(hContact, "CList", "NotOnList");
else
db_set_b(hContact, "CList", "NotOnList", 1);
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
setWString(hContact, "Nick", user->name);
setWString(hContact, "Default", user->name);
setWord(hContact, "Status", SetOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 36ae19a469..d982705974 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -146,7 +146,7 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) continue;
BYTE bDCC = ppro->getByte(hContact, "DCC", 0);
- BYTE bHidden = db_get_b(hContact, "CList", "Hidden", 0);
+ bool bHidden = Clist_IsHidden(hContact);
if (bDCC || bHidden)
continue;
if (ppro->getWString(hContact, "Default", &dbv))
@@ -691,7 +691,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage *pmsg) if ((m_ignore && IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'q'))) {
MCONTACT hContact = CList_FindContact(&user);
- if (!hContact || (hContact && db_get_b(hContact, "CList", "Hidden", 0) == 1))
+ if (!hContact || (hContact && Clist_IsHidden(hContact)))
return true;
}
@@ -1063,10 +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 &&
- db_get_b(hContact, "CList", "Hidden", 0) == 0) {
+ if (m_DCCChatIgnore == 1 || m_DCCChatIgnore == 2 && hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0 && !Clist_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/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 8feab67e1b..402d007463 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -330,7 +330,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, const TiXmlElement * else
Chat_Control(m_szModuleName, wszRoomJid, SESSION_OFFLINE);
- db_unset(item->hContact, "CList", "Hidden");
+ Clist_HideContact(item->hContact, false);
item->bChatActive = false;
if (m_bJabberOnline) {
@@ -1346,7 +1346,7 @@ static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, co if (r)
ppro->setWord(hContact, "Status", r->m_iStatus);
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
ppro->setUString(hContact, "Nick", nick);
db_set_dw(hContact, "Ignore", "Mask1", 0);
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 8bc1189fdf..8aac09a5cc 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -151,7 +151,7 @@ void __cdecl CJabberProto::OnAddContactForever(MCONTACT hContact) SendGetVcard(hContact);
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
}
int __cdecl CJabberProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam)
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index ed0ace2ff0..686e531a28 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -257,7 +257,7 @@ BOOL CJabberProto::OnRosterPushRequest(const TiXmlElement*, CJabberIqInfo *pInfo UpdateSubscriptionInfo(item->hContact, item);
}
else if (isChatRoom(item->hContact))
- db_unset(item->hContact, "CList", "Hidden");
+ Clist_HideContact(item->hContact, false);
else
UpdateSubscriptionInfo(item->hContact, item);
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index eb528f544b..c15d6cc78b 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -431,7 +431,7 @@ void CJabberProto::OnIqResultGetRoster(const TiXmlElement *iqNode, CJabberIqInfo if (char *p = strchr(wszTitle, '@')) *p = 0;
Chat_NewSession(GCW_CHATROOM, m_szModuleName, Utf2T(jid), Utf2T(wszTitle));
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
chatRooms.insert((HANDLE)hContact);
}
else UpdateSubscriptionInfo(hContact, item);
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index f41edad6c6..736e60e854 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -46,7 +46,7 @@ void CJabberProto::AddContactToRoster(const char *jid, const char *nick, const c void CJabberProto::DBAddAuthRequest(const char *jid, const char *nick)
{
MCONTACT hContact = DBCreateContact(jid, nick, true, true);
- delSetting(hContact, "Hidden");
+ Clist_HideContact(hContact, false);
DB_AUTH_BLOB blob(hContact, nick, nullptr, nullptr, jid, nullptr);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 3ac61aec58..bdca637d77 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -358,7 +358,7 @@ MCONTACT CJabberProto::AddToListByJID(const char *newJid, DWORD flags) MCONTACT hContact = DBCreateContact(newJid, nullptr, true, false);
if (flags & PALF_TEMPORARY)
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
return hContact;
}
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index e4e3beca97..54a751bc27 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -524,7 +524,7 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) MSN_AddUser(hContact, szEmail, netId, LIST_PL + LIST_REMOVE);
MSN_AddUser(hContact, szEmail, netId, LIST_BL + LIST_REMOVE);
MSN_AddUser(hContact, szEmail, netId, LIST_AL);
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
}
MSN_SetContactDb(hContact, szEmail);
}
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index 61e1cbb5fb..46e96c72c3 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -80,7 +80,7 @@ void CMsnProto::MSN_SetContactDb(MCONTACT hContact, const char *szEmail) if (listId & LIST_FL) {
if (db_get_b(hContact, "CList", "NotOnList", 0) == 1) {
db_unset(hContact, "CList", "NotOnList");
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
}
if (listId & (LIST_BL | LIST_AL)) {
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 1ab70262a8..56fa7c818b 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -195,17 +195,17 @@ MCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD if (flags & PALF_TEMPORARY) {
if (db_get_b(hContact, "CList", "NotOnList", 0) == 1)
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
}
else {
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
if (msnLoggedIn) {
int netId = strncmp(email, "tel:", 4) ? NETID_MSN : NETID_MOB;
if (MSN_AddUser(hContact, email, netId, LIST_FL)) {
MSN_AddUser(hContact, email, netId, LIST_PL + LIST_REMOVE);
MSN_AddUser(hContact, email, netId, LIST_BL + LIST_REMOVE);
MSN_AddUser(hContact, email, netId, LIST_AL);
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
}
MSN_SetContactDb(hContact, email);
@@ -660,7 +660,7 @@ MEVENT CMsnProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) char tEmail[MSN_MAX_EMAIL_LEN];
if (!db_get_static(hContact, m_szModuleName, "wlid", tEmail, sizeof(tEmail)) || !db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail)))
if (Lists_IsInList(LIST_FL, tEmail) && db_get_b(hContact, "MetaContacts", "IsSubcontact", 0) == 0)
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
return CSuper::RecvMsg(hContact, pre);
}
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index 3b73664455..6e84d40ea2 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -917,7 +917,7 @@ bool CMsnProto::MSN_ABRefreshClist(unsigned int nTry) else
delSetting(hContact, "Nick");
if (mir_strcmpi(ezxml_txt(ezxml_child(pers, "onHideList")), "true") == 0)
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
setString(hContact, "ID", ezxml_txt(ezxml_child(pers, "id")));
SetAbParam(hContact, "CID", cid);
diff --git a/protocols/NewsAggregator/Src/Options.cpp b/protocols/NewsAggregator/Src/Options.cpp index 986051a6bf..c6e1967edc 100644 --- a/protocols/NewsAggregator/Src/Options.cpp +++ b/protocols/NewsAggregator/Src/Options.cpp @@ -880,9 +880,9 @@ bool COptionsMain::OnApply() if (mir_wstrcmp(dbNick, nick) == 0) { g_plugin.setByte(hContact, "CheckState", m_feeds.GetCheckState(i)); if (!m_feeds.GetCheckState(i)) - db_set_b(hContact, "CList", "Hidden", 1); + Clist_HideContact(hContact); else - db_unset(hContact, "CList", "Hidden"); + Clist_HideContact(hContact, false); } } } diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index ace07a8da0..7feebbafc2 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -170,7 +170,7 @@ int CSametimeProto::RecvFile(MCONTACT hContact, PROTORECVFILE* pre) {
debugLogW(L"CSametimeProto::RecvFile() hContact=[%x]", hContact);
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
db_unset(hContact, "CList", "NotOnList");
return CSuper::RecvFile(hContact, pre);
@@ -180,7 +180,7 @@ MEVENT CSametimeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) {
debugLogW(L"CSametimeProto::RecvMsg() hContact=[%x]", hContact);
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
db_unset(hContact, "CList", "NotOnList");
return CSuper::RecvMsg(hContact, pre);
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 8b892d85d5..ea482a1122 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -70,7 +70,7 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) }
else if (!temporary) {
db_unset(hContact, "CList", "NotOnList");
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
}
@@ -105,11 +105,11 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) if (temporary) {
db_set_b(hContact, "CList", "NotOnList", 1);
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
}
else {
db_unset(hContact, "CList", "NotOnList");
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
}
return hContact;
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index b75fa2509f..cfc268094f 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -107,7 +107,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) if (hContact == NULL) {
hContact = AddContact(user_id, true);
setWord(hContact, "Status", ID_STATUS_ONLINE);
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
setWString(hContact, "Nick", gch->ptszUID);
}
CallService(MS_MSG_SENDMESSAGEW, hContact, 0);
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 2961cda97d..57fcdc1355 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -181,11 +181,11 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) else setByte(hContact, "Grant", 1);
if (item["blocked"].as_bool()) {
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
setByte(hContact, "IsBlocked", 1);
}
else {
- db_unset(hContact, "CList", "Hidden");
+ Clist_HideContact(hContact, false);
delSetting(hContact, "IsBlocked");
}
@@ -283,9 +283,8 @@ INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM) void CSkypeProto::OnBlockContact(const NETLIBHTTPREQUEST *response, void *p)
{
MCONTACT hContact = (DWORD_PTR)p;
- if (response == nullptr)
- return;
- db_set_b(hContact, "CList", "Hidden", 1);
+ if (response != nullptr)
+ Clist_HideContact(hContact);
}
INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM)
@@ -300,6 +299,6 @@ void CSkypeProto::OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p) return;
MCONTACT hContact = (DWORD_PTR)p;
- db_set_b(hContact, "CList", "Hidden", 0);
+ Clist_HideContact(hContact, false);
delSetting(hContact, "IsBlocked");
}
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 9d54898e85..9a06c9b164 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -1500,7 +1500,7 @@ void CVkProto::AddVkDeactivateEvent(MCONTACT hContact, CMStringW& wszType) hContact, wszType.c_str(),
(int)m_vkOptions.bShowVkDeactivateEvents,
(int)getBool(hContact, "ShowVkDeactivateEvents", true),
- (int)(db_get_b(hContact, "CList", "Hidden", 0) == 0));
+ (int)(!Clist_IsHidden(hContact)));
CVKDeactivateEvent vkDeactivateEvent[] = {
{ L"", Translate("User restored control over own page") },
@@ -1528,7 +1528,7 @@ void CVkProto::AddVkDeactivateEvent(MCONTACT hContact, CMStringW& wszType) (
m_vkOptions.bShowVkDeactivateEvents
&& getBool(hContact, "ShowVkDeactivateEvents", true)
- && (db_get_b(hContact, "CList", "Hidden", 0) == 0)
+ && (!Clist_IsHidden(hContact))
) ? 0 : DBEF_READ);
db_event_add(hContact, &dbei);
}
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 35977921be..4e5ff332e4 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -475,7 +475,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) MCONTACT hContact = FindUser(_wtoi(gch->ptszUID));
if (hContact == 0) {
hContact = FindUser(_wtoi(gch->ptszUID), true);
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
db_set_b(hContact, "CList", "NotOnList", 1);
db_set_dw(hContact, "Ignore", "Mask1", 0);
RetrieveUserInfo(_wtoi(gch->ptszUID));
@@ -723,7 +723,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) hContact = FindUser(cu->m_uid);
if (hContact == 0) {
hContact = FindUser(cu->m_uid, true);
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
db_set_b(hContact, "CList", "NotOnList", 1);
db_set_dw(hContact, "Ignore", "Mask1", 0);
}
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index ecae89cdd5..b73a88103f 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -357,12 +357,11 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, VKContactTy return 0;
if (vkContactType == VKContactType::vkContactMUCUser) {
- db_set_b(hContact, "CList", "Hidden", 1);
+ Clist_HideContact(hContact);
db_set_b(hContact, "CList", "NotOnList", 1);
db_set_dw(hContact, "Ignore", "Mask1", 0);
}
-
CMStringW wszNick, wszValue;
int iValue;
diff --git a/protocols/Weather/src/weather_addstn.cpp b/protocols/Weather/src/weather_addstn.cpp index ca7a8ae6e3..5804f42b00 100644 --- a/protocols/Weather/src/weather_addstn.cpp +++ b/protocols/Weather/src/weather_addstn.cpp @@ -50,7 +50,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) // and add them on the list if (db_get_b(hContact, "CList", "NotOnList", 1)) { db_unset(hContact, "CList", "NotOnList"); - db_unset(hContact, "CList", "Hidden"); + Clist_HideContact(hContact, false); } db_free(&dbv); // contact is added, function quitting diff --git a/protocols/Weather/src/weather_mwin.cpp b/protocols/Weather/src/weather_mwin.cpp index 1c1a7b7896..1ab04f0811 100644 --- a/protocols/Weather/src/weather_mwin.cpp +++ b/protocols/Weather/src/weather_mwin.cpp @@ -250,7 +250,7 @@ static void addWindow(MCONTACT hContact) int frameID = g_plugin.addFrame(&Frame); g_plugin.setDword(hContact, "mwin", frameID); - db_set_b(hContact, "CList", "Hidden", TRUE); + Clist_HideContact(hContact); } void removeWindow(MCONTACT hContact) @@ -261,7 +261,7 @@ void removeWindow(MCONTACT hContact) CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0); g_plugin.setDword(hContact, "mwin", 0); - db_unset(hContact, "CList", "Hidden"); + Clist_HideContact(hContact, false); } void UpdateMwinData(MCONTACT hContact) diff --git a/protocols/WebView/src/webview_services.cpp b/protocols/WebView/src/webview_services.cpp index 5371ff0780..f0af2a30fe 100644 --- a/protocols/WebView/src/webview_services.cpp +++ b/protocols/WebView/src/webview_services.cpp @@ -353,7 +353,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) sameurl++; if (db_get_b(hContact, "CList", "NotOnList", 1)) { db_unset(hContact, "CList", "NotOnList"); - db_unset(hContact, "CList", "Hidden"); + Clist_HideContact(hContact, false); } } db_free(&dbv); @@ -404,7 +404,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) samename++; if (db_get_b(hContact2, "CList", "NotOnList", 1)) { db_unset(hContact2, "CList", "NotOnList"); - db_unset(hContact2, "CList", "Hidden"); + Clist_HideContact(hContact2, false); } db_free(&dbv); } diff --git a/protocols/YAMN/src/proto/pop3/pop3comm.cpp b/protocols/YAMN/src/proto/pop3/pop3comm.cpp index 93f7885135..2eb6f725f7 100644 --- a/protocols/YAMN/src/proto/pop3/pop3comm.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3comm.cpp @@ -289,10 +289,10 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) g_plugin.setWord(Finder->hContact, "Status", ID_STATUS_ONLINE); db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message")); if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) - db_unset(Finder->hContact, "CList", "Hidden"); + Clist_HideContact(Finder->hContact, false); if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT)) - db_set_b(Finder->hContact, "CList", "Hidden", 1); + Clist_HideContact(Finder->hContact); } db_free(&dbv); } diff --git a/protocols/YAMN/src/services.cpp b/protocols/YAMN/src/services.cpp index 771367d479..0ba33321ee 100644 --- a/protocols/YAMN/src/services.cpp +++ b/protocols/YAMN/src/services.cpp @@ -427,16 +427,13 @@ void CreateServiceFunctions(void) CreateServiceFunction(MS_YAMN_CLISTCONTEXTAPP, ContactApplication); } -//Function to put all enabled contact to the Online status +// Function to put all enabled contact to the Online status void RefreshContact(void) { CAccount *Finder; for (Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { if (Finder->hContact != NULL) { - if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) - db_unset(Finder->hContact, "CList", "Hidden"); - else - db_set_b(Finder->hContact, "CList", "Hidden", 1); + Clist_HideContact(Finder->hContact, !(Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)); } else if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) { Finder->hContact = db_add_contact(); |