From 083471eb212e87fac834638fbc49787bba0c4678 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 6 Mar 2021 13:55:18 +0300 Subject: less shit with this "(Unknown contact)" --- plugins/Clist_modern/src/modern_clistsettings.cpp | 10 +++++----- plugins/IEView/src/HTMLBuilder.cpp | 9 ++------- plugins/Msg_Export/src/utils.cpp | 2 +- plugins/TabSRMM/src/sendlater.cpp | 4 +--- 4 files changed, 9 insertions(+), 16 deletions(-) (limited to 'plugins') 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(&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); -- cgit v1.2.3