diff options
-rw-r--r-- | include/m_clist.h | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 10 | ||||
-rw-r--r-- | plugins/IEView/src/HTMLBuilder.cpp | 9 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendlater.cpp | 4 | ||||
-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 |
8 files changed, 18 insertions, 32 deletions
diff --git a/include/m_clist.h b/include/m_clist.h index a27b0ac292..37d8520cbd 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -484,6 +484,7 @@ EXTERN_C MIR_APP_DLL(int) Clist_ContactCompare(MCONTACT hContact1, MCONTACT hCon // returns a static display name for a contact
#define GCDNF_NOMYHANDLE 1 // will never return the user's custom name
+#define GCDNF_NOUNKNOWN 2 // will return nullptr instead of "Unknown contact"
#define GCDNF_NOCACHE 4 // will not use the cache
EXTERN_C MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode = 0);
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index aa6993c247..130a01bfc9 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -25,8 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "modern_awaymsg.h"
-CMStringW UnknownConctactTranslatedName;
-
void cliFreeCacheItem(ClcCacheEntry *p)
{
mir_free_and_nil(p->szSecondLineText);
@@ -55,8 +53,11 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) }
if (pdnce->tszName == nullptr) {
- pdnce->tszName = Clist_GetContactDisplayName(pdnce->hContact, GCDNF_NOCACHE);
- pdnce->m_bIsUnknown = !mir_wstrcmp(pdnce->tszName, UnknownConctactTranslatedName);
+ pdnce->tszName = Clist_GetContactDisplayName(pdnce->hContact, GCDNF_NOCACHE | GCDNF_NOUNKNOWN);
+ if (!pdnce->tszName) {
+ pdnce->m_bIsUnknown = true;
+ pdnce->tszName = TranslateT("(Unknown contact)");
+ }
}
if (pdnce->m_iStatus == 0) //very strange look status sort is broken let always reread status
@@ -191,7 +192,6 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) int OnLoadLangpack(WPARAM, LPARAM)
{
- UnknownConctactTranslatedName = TranslateT("(Unknown contact)");
if (!MirandaLoading())
ApplyViewMode(g_CluiData.current_viewmode);
return 0;
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index bb9aeae778..a0ad5d7528 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -167,17 +167,12 @@ wchar_t* HTMLBuilder::getContactName(MCONTACT hContact, const char *szProto) if (str != nullptr)
return str;
- str = Clist_GetContactDisplayName(hContact);
- if (str != nullptr)
- return mir_wstrdup(str);
-
- return mir_wstrdup(TranslateT("(Unknown contact)"));
+ return mir_wstrdup(Clist_GetContactDisplayName(hContact));
}
char* HTMLBuilder::getEncodedContactName(MCONTACT hContact, const char *szProto)
{
- ptrW name(getContactName(hContact, szProto));
- return encodeUTF8(hContact, (name != NULL) ? name : TranslateT("(Unknown contact)"), ENF_NAMESMILEYS, true);
+ return encodeUTF8(hContact, ptrW(getContactName(hContact, szProto)), ENF_NAMESMILEYS, true);
}
void HTMLBuilder::appendEventNew(IEView *view, IEVIEWEVENT *event)
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 425e4d3bee..4e91949a22 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -349,7 +349,7 @@ wstring GetFilePathFromUser(MCONTACT hContact) // Here we will try to avoid the (Unknown contact) in cases where the protocol for
// this user has been removed.
- if (bNickUsed && (wcsstr(Clist_GetContactDisplayName(hContact), TranslateT("(Unknown contact)")) != nullptr))
+ if (bNickUsed && Clist_GetContactDisplayName(hContact, GCDNF_NOMYHANDLE) == nullptr)
return sPrevFileName; // Then the filename must have changed from a correct path to one including the (Unknown contact)
// file name has changed
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 1956cb660b..f2490ce868 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -200,11 +200,9 @@ struct CSendLaterJob : public MZeroedObject * show a popup notification, unless they are disabled
*/
if (fShowPopup) {
- wchar_t *tszName = Clist_GetContactDisplayName(hContact);
-
POPUPDATAW ppd;
ppd.lchContact = hContact;
- wcsncpy_s(ppd.lpwzContactName, (tszName ? tszName : TranslateT("'(Unknown contact)'")), _TRUNCATE);
+ wcsncpy_s(ppd.lpwzContactName, Clist_GetContactDisplayName(hContact), _TRUNCATE);
ptrW msgPreview(Utils::GetPreviewWithEllipsis(reinterpret_cast<wchar_t *>(&pBuf[mir_strlen((char *)pBuf) + 1]), 100));
if (fSuccess)
mir_snwprintf(ppd.lpwzText, TranslateT("A send later job completed successfully.\nThe original message: %s"), msgPreview);
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;
}
|