From 5bbcac14ebe80a1b6e7a0bb0444d84ed623dae58 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 4 Sep 2015 18:35:51 +0000 Subject: menu uid git-svn-id: http://svn.miranda-ng.org/main/trunk@15201 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/addcontact.cpp | 43 +++++++++++++++++++++--------------------- src/mir_app/src/meta_menu.cpp | 1 + 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index ce8557285e..550e7fd395 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -24,6 +24,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +static TCHAR* sttDecodeString(DWORD dwFlags, MAllStrings &src) +{ + if (dwFlags & PSR_UNICODE) + return mir_u2t(src.w); + + if (dwFlags & PSR_UTF8) + return mir_utf8decodeT(src.a); + + return mir_a2t(src.a); +} + class CAddContactDlg : public CDlgBase { ADDCONTACTSTRUCT m_acs; @@ -49,17 +60,6 @@ public: m_btnOk.OnClick = Callback(this, &CAddContactDlg::OnOk); m_acs = *acs; - if (m_acs.psr) { - PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)mir_alloc(m_acs.psr->cbSize); - memcpy(psr, m_acs.psr, m_acs.psr->cbSize); - psr->nick.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->nick.t) : mir_a2t((char*)psr->nick.t); - psr->firstName.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->firstName.t) : mir_a2t((char*)psr->firstName.t); - psr->lastName.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->lastName.t) : mir_a2t((char*)psr->lastName.t); - psr->email.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->email.t) : mir_a2t((char*)psr->email.t); - psr->id.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->id.t) : mir_a2t((char*)psr->id.t); - psr->flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR; - m_acs.psr = psr; - } } void OnInitDialog() @@ -96,9 +96,16 @@ public: isSet = 1; } } - if (!isSet) { - szName = (m_acs.handleType == HANDLE_EVENT) ? (tmpStr = mir_a2t(szUin)) : - (m_acs.psr->id.t ? m_acs.psr->id.t : m_acs.psr->nick.t); + if (!isSet) + { + if (m_acs.handleType == HANDLE_EVENT) + szName = mir_a2t(szUin); + else + { + szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->id); + if (!szName) + szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->nick); + } } } @@ -150,14 +157,6 @@ public: void OnDestroy() { Window_FreeIcon_IcoLib(m_hwnd); - - if (m_acs.psr) { - mir_free(m_acs.psr->nick.t); - mir_free(m_acs.psr->firstName.t); - mir_free(m_acs.psr->lastName.t); - mir_free(m_acs.psr->email.t); - mir_free(m_acs.psr); - } } void OnAuthClicked(CCtrlButton*) diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 86dbbd1b8d..4b64449f69 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -409,6 +409,7 @@ void InitMenus() mi.name.a = LPGEN("Subcontacts"); hMenuRoot = Menu_AddContactMenuItem(&mi); + UNSET_UID(mi); mi.flags |= CMIF_SYSTEM; mi.root = hMenuRoot; for (int i = 0; i < MAX_CONTACTS; i++) { -- cgit v1.2.3