summaryrefslogtreecommitdiff
path: root/plugins/SecureIM/src/crypt_lists.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-01 16:58:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-01 16:58:02 +0300
commit6558159f70c242abf8d478c9661d5d349b5c416e (patch)
tree26199f05204c74b409955b18a201134980f2994d /plugins/SecureIM/src/crypt_lists.cpp
parent3ecac50fe24978aa1a3910f90505d9fb1276d7ca (diff)
SecureIM:
- fixes #2263 (SecureIM: вместо внутреннего имени выводить имя аккаунта); - major code cleaning; - version bump
Diffstat (limited to 'plugins/SecureIM/src/crypt_lists.cpp')
-rw-r--r--plugins/SecureIM/src/crypt_lists.cpp43
1 files changed, 10 insertions, 33 deletions
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);
}