summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-12-04 16:08:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-12-04 16:08:03 +0300
commit3bb16e798cb51d5764aacbefd4edf26f52d8c4f0 (patch)
tree59dbb53fc9496d660ec2ef2846a4eab0f1720b88 /plugins/UserInfoEx
parent3216d8df5cb355f34c82ed10b7e40bab7525b697 (diff)
GetContactProto: useless duplicate function replaced with standard Proto_GetBaseAccountName
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp2
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp73
2 files changed, 39 insertions, 36 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index 3f439e7f92..cc162d86ff 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -44,7 +44,7 @@ static LIST<MsgWndData> gMsgWndList(10, NumericKeySortT);
static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM)
{
WORD countryNumber;
- char *pszProto = GetContactProto(wParam);
+ char *pszProto = Proto_GetBaseAccountName(wParam);
/* UserinfoEx */
if (countryNumber = db_get_w(wParam, USERINFO, SET_CONTACT_ORIGIN_COUNTRY, 0))
return countryNumber;
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index 0533f11e57..86817fcb89 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -641,7 +641,7 @@ class CAnnivList
* @retval TRUE if successful
* @retval FALSE if failed
**/
- BYTE AddRow(MCONTACT hContact, LPCSTR pszProto, MAnnivDate &ad, MTime &mtNow, WORD wDaysBefore)
+ BYTE AddRow(MCONTACT hContact, LPCSTR pszProto, MAnnivDate &ad, MTime &mtNow, int wDaysBefore)
{
wchar_t szText[MAX_PATH];
int diff, iItem = -1;
@@ -702,54 +702,57 @@ class CAnnivList
// This method clears the list and adds contacts again, according to the current filter settings.
void RebuildList()
{
- LPSTR pszProto;
- MTime mtNow;
MAnnivDate ad;
int i = 0;
DWORD age = 0;
- WORD wDaysBefore = g_plugin.getWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
- WORD numMale = 0;
- WORD numFemale = 0;
- WORD numContacts = 0;
- WORD numBirthContacts = 0;
+ int wDaysBefore = g_plugin.getWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
+ int numMale = 0;
+ int numFemale = 0;
+ int numContacts = 0;
+ int numBirthContacts = 0;
ShowWindow(_hList, SW_HIDE);
DeleteAllItems();
+
+ MTime mtNow;
mtNow.GetLocalTime();
// insert the items into the list
for (auto &hContact : Contacts()) {
- // ignore meta subcontacts here, as they are not interesting.
- if (!db_mc_isSub(hContact)) {
- // filter protocol
- pszProto = Proto_GetBaseAccountName(hContact);
- if (pszProto) {
- numContacts++;
- switch (GenderOf(hContact, pszProto)) {
- case 'M':
- numMale++;
- break;
- case 'F':
- numFemale++;
- }
-
- if (!ad.DBGetBirthDate(hContact, pszProto)) {
- age += ad.Age(&mtNow);
- numBirthContacts++;
+ // ignore metacontacts here, as they are not interesting.
+ if (db_mc_isMeta(hContact))
+ continue;
+
+ // filter protocol
+ char *pszProto = Proto_GetBaseAccountName(hContact);
+ if (!pszProto)
+ continue;
+
+ numContacts++;
+ switch (GenderOf(hContact, pszProto)) {
+ case 'M':
+ numMale++;
+ break;
+ case 'F':
+ numFemale++;
+ }
- // add birthday
- if ((_filter.bFilterIndex != FILTER_ANNIV) && (!_filter.pszProto || !_strcmpi(pszProto, _filter.pszProto)))
- AddRow(hContact, pszProto, ad, mtNow, wDaysBefore);
- }
+ if (!ad.DBGetBirthDate(hContact, pszProto)) {
+ age += ad.Age(&mtNow);
+ numBirthContacts++;
- // add anniversaries
- if (_filter.bFilterIndex != FILTER_BIRTHDAY && (!_filter.pszProto || !_strcmpi(pszProto, _filter.pszProto)))
- for (i = 0; !ad.DBGetAnniversaryDate(hContact, i); i++)
- if (!_filter.pszAnniv || !mir_wstrcmpi(_filter.pszAnniv, ad.Description()))
- AddRow(hContact, pszProto, ad, mtNow, wDaysBefore);
- }
+ // add birthday
+ if ((_filter.bFilterIndex != FILTER_ANNIV) && (!_filter.pszProto || !_strcmpi(pszProto, _filter.pszProto)))
+ AddRow(hContact, pszProto, ad, mtNow, wDaysBefore);
}
+
+ // add anniversaries
+ if (_filter.bFilterIndex != FILTER_BIRTHDAY && (!_filter.pszProto || !_strcmpi(pszProto, _filter.pszProto)))
+ for (i = 0; !ad.DBGetAnniversaryDate(hContact, i); i++)
+ if (!_filter.pszAnniv || !mir_wstrcmpi(_filter.pszAnniv, ad.Description()))
+ AddRow(hContact, pszProto, ad, mtNow, wDaysBefore);
}
+
ListView_SortItemsEx(_hList, (CMPPROC)cmpProc, this);
ShowWindow(_hList, SW_SHOW);