From 6558159f70c242abf8d478c9661d5d349b5c416e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 1 Apr 2020 16:58:02 +0300 Subject: SecureIM: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fixes #2263 (SecureIM: вместо внутреннего имени выводить имя аккаунта); - major code cleaning; - version bump --- plugins/SecureIM/src/crypt_lists.cpp | 43 +++++++++--------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) (limited to 'plugins/SecureIM/src/crypt_lists.cpp') diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index d94b25875b..621101ee50 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -184,18 +184,14 @@ void addMsg2Queue(pUinKey ptr, WPARAM wParam, LPSTR szMsg) ptrMessage->Message = mir_strdup(szMsg); } -void getContactNameA(MCONTACT hContact, LPSTR szName) -{ - ptrA dn(mir_u2a(Clist_GetContactDisplayName(hContact))); - mir_strcpy(szName, dn); -} - -void getContactName(MCONTACT hContact, LPSTR szName) +void getContactUinA(MCONTACT hContact, LPSTR szUIN) { - mir_wstrcpy((LPWSTR)szName, Clist_GetContactDisplayName(hContact)); + wchar_t buf[NAMSIZE]; + getContactUin(hContact, buf); + strncpy_s(szUIN, NAMSIZE, _T2A(buf), _TRUNCATE); } -void getContactUinA(MCONTACT hContact, LPSTR szUIN) +void getContactUin(MCONTACT hContact, LPWSTR szUIN) { *szUIN = 0; @@ -203,29 +199,10 @@ void getContactUinA(MCONTACT hContact, LPSTR szUIN) if (!ptr) return; - DBVARIANT dbv_uniqueid; - LPCSTR uID = Proto_GetUniqueId(ptr->name); - if (uID && db_get(hContact, ptr->name, uID, &dbv_uniqueid) == 0) { - if (dbv_uniqueid.type == DBVT_WORD) - sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name); //!!!!!!!!!!! - else if (dbv_uniqueid.type == DBVT_DWORD) - sprintf(szUIN, "%u [%s]", (UINT)dbv_uniqueid.dVal, ptr->name); //!!!!!!!!!!! - else if (dbv_uniqueid.type == DBVT_BLOB) - sprintf(szUIN, "%s [%s]", dbv_uniqueid.pbVal, ptr->name); //!!!!!!!!!!! - else - sprintf(szUIN, "%s [%s]", dbv_uniqueid.pszVal, ptr->name); //!!!!!!!!!!! - } - else mir_strcpy(szUIN, " == = unknown == ="); - - db_free(&dbv_uniqueid); -} + auto *pa = Proto_GetAccount(ptr->name); + if (pa == nullptr) + return; -void getContactUin(MCONTACT hContact, LPSTR szUIN) -{ - getContactUinA(hContact, szUIN); - if (*szUIN) { - LPWSTR tmp = mir_a2u(szUIN); - mir_wstrcpy((LPWSTR)szUIN, tmp); - mir_free(tmp); - } + ptrW uid(Contact_GetInfo(CNF_UNIQUEID, hContact, pa->szModuleName)); + mir_snwprintf(szUIN, NAMSIZE, L"%s [%s]", uid.get(), pa->tszAccountName); } -- cgit v1.2.3