diff options
author | George Hazan <ghazan@miranda.im> | 2021-03-06 13:55:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-03-06 13:55:18 +0300 |
commit | 083471eb212e87fac834638fbc49787bba0c4678 (patch) | |
tree | 55f0dd0b9812780b77346a5cd6c8d34ab2415f99 /src | |
parent | 90addbcbfc72fa396cf2fe89f245dbb0f7a14513 (diff) |
less shit with this "(Unknown contact)"
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clistsettings.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/meta_edit.cpp | 15 | ||||
-rw-r--r-- | src/mir_app/src/meta_utils.cpp | 4 |
3 files changed, 8 insertions, 16 deletions
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 2f4d0afc9a..e1c40fc99f 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -114,7 +114,7 @@ void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact) MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode)
{
if (hContact == 0)
- return TranslateT("(Unknown contact)");
+ return (mode & GCDNF_NOUNKNOWN) ? nullptr : TranslateT("(Unknown contact)");
ClcCacheEntry *cacheEntry = nullptr;
if (mode & GCDNF_NOCACHE)
@@ -132,6 +132,9 @@ MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode) return tszDisplayName.detach();
}
+ if (mode & GCDNF_NOUNKNOWN)
+ return nullptr;
+
ProtoChainSend(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
wchar_t *buffer = TranslateT("(Unknown contact)");
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 2a19733793..d39c66d6a5 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -51,13 +51,8 @@ static void FillContactList(HWND hList) for (int i = 0; i < g_data.num_contacts; i++) {
LvItem.iItem = i;
-
- wchar_t *ptszCDN = Clist_GetContactDisplayName(g_data.hContact[i]);
- if (ptszCDN == nullptr)
- ptszCDN = TranslateT("(Unknown contact)");
-
LvItem.iSubItem = 0; // clist display name
- LvItem.pszText = ptszCDN;
+ LvItem.pszText = Clist_GetContactDisplayName(g_data.hContact[i]);
ListView_InsertItem(hList, &LvItem);
LvItem.iSubItem = 1; // id
@@ -269,13 +264,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE;
case WMU_SETTITLE:
- {
- wchar_t *ptszCDN = Clist_GetContactDisplayName(lParam);
- if (ptszCDN == nullptr)
- ptszCDN = TranslateT("(Unknown contact)");
-
- SetDlgItemText(hwndDlg, IDC_ED_NAME, ptszCDN);
- }
+ SetDlgItemText(hwndDlg, IDC_ED_NAME, Clist_GetContactDisplayName(lParam));
return TRUE;
case WM_NOTIFY:
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index c2b2c05e48..f21b97da3b 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -423,8 +423,8 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact) }
}
else if (g_metaOptions.clist_contact_name == CNNT_DISPLAYNAME) {
- wchar_t *name = Clist_GetContactDisplayName(hContact);
- if (name && mir_wstrcmp(name, TranslateT("(Unknown contact)")) != 0) {
+ wchar_t *name = Clist_GetContactDisplayName(hContact, GCDNF_NOUNKNOWN);
+ if (name) {
db_set_ws(ccMeta->contactID, META_PROTO, "Nick", name);
return 0;
}
|