summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-06-27 21:23:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-06-27 21:23:35 +0300
commit44525f461757fc859616fda16820351b07238842 (patch)
tree117ad05514eed381fc13dcf8befcf0ff06023e57 /plugins
parent810ed4dea67b54a18f6ec3f5273d2f8efe08708c (diff)
manual access to CList/Group restricted
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp4
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp4
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp20
-rw-r--r--plugins/NewXstatusNotify/src/popup.cpp4
-rw-r--r--plugins/QuickContacts/src/dialog.cpp10
-rw-r--r--plugins/SeenPlugin/src/utils.cpp12
-rwxr-xr-xplugins/StopSpamMod/src/stopspam.cpp6
-rw-r--r--plugins/StopSpamPlus/src/services.cpp2
-rw-r--r--plugins/TabSRMM/src/utils.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp2
-rw-r--r--plugins/Variables/src/contact.cpp2
11 files changed, 29 insertions, 39 deletions
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 9fd277cb48..d9e9c35246 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -446,10 +446,10 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat)
}
if (g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
- ptrW tszGroup(g_plugin.getWStringA(hContact, "Group"));
+ ptrW tszGroup(Clist_GetGroup(hContact));
if (tszGroup != nullptr) {
wchar_t szGroupMask[256];
- mir_snwprintf(szGroupMask, L"%s|", tszGroup);
+ mir_snwprintf(szGroupMask, L"%s|", tszGroup.get());
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (wcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (wcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0));
}
else if (g_CluiData.filterFlags & CLVM_INCLUDED_UNGROUPED)
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index 87255a4556..023ba9a40d 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -405,10 +405,10 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, struct ClcData
}
if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) {
- ptrW tszGroup(g_plugin.getWStringA(hContact, "Group"));
+ ptrW tszGroup(Clist_GetGroup(hContact));
if (tszGroup != NULL) {
wchar_t szGroupMask[256];
- mir_snwprintf(szGroupMask, L"%s|", tszGroup);
+ mir_snwprintf(szGroupMask, L"%s|", tszGroup.get());
int bHasGroup = wcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0;
filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | bHasGroup) : (filterResult & bHasGroup);
}
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 3534f2ea7f..8c88700675 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -441,15 +441,8 @@ tstring CAppletManager::GetContactDisplayname(MCONTACT hContact, bool bShortened
//************************************************************************
tstring CAppletManager::GetContactGroup(MCONTACT hContact)
{
- DBVARIANT dbv;
- int res = db_get_ws(hContact, "CList", "Group", &dbv);
-
- tstring strGroup = L"";
- if (!res)
- strGroup = dbv.pwszVal;
-
- db_free(&dbv);
- return strGroup;
+ ptrW wszGroup(Clist_GetGroup(hContact));
+ return (wszGroup) ? wszGroup : L"";
}
//************************************************************************
@@ -1654,11 +1647,10 @@ int CAppletManager::HookSettingChanged(WPARAM hContact, LPARAM lParam)
}
else if (!strcmp(dbcws->szSetting, "Group")) {
Event.eType = EVENT_CONTACT_GROUP;
- DBVARIANT dbv;
- int res = db_get_ws(hContact, "CList", "Group", &dbv);
- if (!res)
- Event.strValue = dbv.pwszVal;
- db_free(&dbv);
+
+ ptrW wszGroup(Clist_GetGroup(hContact));
+ if (wszGroup)
+ Event.strValue = wszGroup;
}
else return 0;
}
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp
index db5724b5c6..f34743fc1e 100644
--- a/plugins/NewXstatusNotify/src/popup.cpp
+++ b/plugins/NewXstatusNotify/src/popup.cpp
@@ -30,9 +30,9 @@ void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const wchar
// add group name to popup title
if (opt.ShowGroup) {
- ptrW tszGroup(db_get_wsa(hContact, "CList", "Group"));
+ ptrW tszGroup(Clist_GetGroup(hContact));
if (tszGroup)
- buf.AppendFormat(L" (%s)", tszGroup);
+ buf.AppendFormat(L" (%s)", tszGroup.get());
}
wcsncpy_s(ppd.lpwzContactName, buf, _TRUNCATE);
wcsncpy_s(ppd.lpwzText, stzText, _TRUNCATE);
diff --git a/plugins/QuickContacts/src/dialog.cpp b/plugins/QuickContacts/src/dialog.cpp
index c0f386018a..36e198c813 100644
--- a/plugins/QuickContacts/src/dialog.cpp
+++ b/plugins/QuickContacts/src/dialog.cpp
@@ -190,13 +190,9 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
c_struct *contact = new c_struct();
if (opts.group_append) {
- DBVARIANT dbv;
- if (db_get_ws(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0) {
- if (dbv.pwszVal != nullptr)
- mir_wstrncpy(contact->szgroup, dbv.pwszVal, _countof(contact->szgroup));
-
- db_free(&dbv);
- }
+ ptrW wszGroup(Clist_GetGroup(hMeta == NULL ? hContact : hMeta));
+ if (wszGroup)
+ wcsncpy_s(contact->szgroup, wszGroup, _TRUNCATE);
}
// Make contact name
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 27c20abc76..a5ccd6ef54 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -272,11 +272,13 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact)
goto LBL_noData;
case 'G':
- if (!db_get_ws(hcontact, "CList", "Group", &dbv)) {
- wcsncpy(szdbsetting, dbv.pwszVal, _countof(szdbsetting));
- db_free(&dbv);
- charPtr = szdbsetting;
- goto LBL_charPtr;
+ {
+ ptrW wszGroup(Clist_GetGroup(hcontact));
+ if (wszGroup) {
+ wcsncpy_s(szdbsetting, wszGroup, _TRUNCATE);
+ charPtr = szdbsetting;
+ goto LBL_charPtr;
+ }
}
break;
diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp
index c9b460211c..b3035150e4 100755
--- a/plugins/StopSpamMod/src/stopspam.cpp
+++ b/plugins/StopSpamMod/src/stopspam.cpp
@@ -46,7 +46,7 @@ int OnDbEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (gbHideContacts)
db_set_b(hcntct, "CList", "Hidden", 1);
if (gbSpecialGroup)
- db_set_ws(hcntct, "CList", "Group", gbSpammersGroup.c_str());
+ Clist_SetGroup(hcntct, gbSpammersGroup.c_str());
BYTE msg = 1;
if (gbIgnoreURL) {
wchar_t* EventText = ReqGetText(&dbei); //else return NULL
@@ -183,7 +183,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l)
CallProtoService(dbei->szModule, "/GrantAuth", hContact, 0);
// add contact to server list and local group
if (gbAutoAddToServerList) {
- db_set_ws(hContact, "CList", "Group", gbAutoAuthGroup.c_str());
+ Clist_SetGroup(hContact, gbAutoAuthGroup.c_str());
db_unset(hContact, "CList", "NotOnList");
}
@@ -272,7 +272,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l)
if (gbHideContacts)
db_set_b(hContact, "CList", "Hidden", 1);
if (gbSpecialGroup)
- db_set_ws(hContact, "CList", "Group", gbSpammersGroup.c_str());
+ Clist_SetGroup(hContact, gbSpammersGroup.c_str());
db_set_b(hContact, "CList", "NotOnList", 1);
// save first message from contact
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp
index 0c640fee6a..05fd78bc3d 100644
--- a/plugins/StopSpamPlus/src/services.cpp
+++ b/plugins/StopSpamPlus/src/services.cpp
@@ -25,7 +25,7 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam)
{
for (MCONTACT hContact = db_find_first(); hContact;) {
MCONTACT hNext = db_find_next(hContact);
- ptrW szGroup(db_get_wsa(hContact, "CList", "Group"));
+ 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"))))) {
char *szProto = GetContactProto(hContact);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 3311f2272f..1304d29ec7 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -294,7 +294,7 @@ bool CTabBaseDlg::FormatTitleBar(const wchar_t *szFormat, CMStringW &dest)
case 'g':
{
- ptrW tszGroup(db_get_wsa(m_hContact, "CList", "Group"));
+ ptrW tszGroup(Clist_GetGroup(m_hContact));
if (tszGroup != nullptr)
dest.Append(tszGroup);
}
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
index 717203bab7..36896aa558 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
@@ -257,7 +257,7 @@ MCONTACT CExImContactBase::toDB()
// add group
if (_pszGroup) {
ptrW ptszGroup(mir_utf8decodeW(_pszGroup));
- db_set_ws(_hContact, MOD_CLIST, "Group", ptszGroup);
+ Clist_SetGroup(_hContact, ptszGroup);
Clist_GroupCreate(NULL, ptszGroup);
}
}
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 411df6581b..8c8144a665 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -150,7 +150,7 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
return nullptr;
case CCNF_GROUP:
- if ((res = db_get_wsa(hContact, "CList", "Group")) != nullptr)
+ if ((res = Clist_GetGroup(hContact)) != nullptr)
return res;
break;