summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-05-18 17:21:08 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-05-18 17:21:08 +0000
commita1d6cb7bdc354be0968c6ba5ac4615e14a90eead (patch)
treea1ed17002c33644b3362e6c1e6572f3fa7ef17d7 /plugins/MirOTR
parentfef6b799309b5b9d7cbb2845fa27b777477e2a61 (diff)
these tons of code aren't needed anymore...
git-svn-id: http://svn.miranda-ng.org/main/trunk@16850 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/src/utils.cpp58
1 files changed, 9 insertions, 49 deletions
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index 234f21cd1c..9d2d30a9ac 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -91,37 +91,13 @@ void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20])
*p = '\0';
}
-char* contact_get_id(MCONTACT hContact, bool bNameOnError) {
- char* pszUniqueID = NULL;
- CONTACTINFO ci;
- memset(&ci, 0, sizeof(ci));
- ci.cbSize = sizeof(ci);
- ci.hContact = hContact;
- ci.dwFlag = CNF_UNIQUEID;
-
- if (CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci) == 0)
- {
- if (ci.type == CNFT_ASCIIZ) {
- pszUniqueID = (char*)ci.pszVal; // MS_CONTACT_GETCONTACTINFO uses mir_alloc
- } else if (ci.type == CNFT_DWORD) {
- pszUniqueID = (char*)mir_alloc(15);
- if (pszUniqueID)
- mir_snprintf(pszUniqueID, 15, ("%u"), ci.dVal);
- } else if (ci.type == CNFT_WORD) {
- pszUniqueID = (char*)mir_alloc(15);
- if (pszUniqueID)
- mir_snprintf(pszUniqueID, 15, ("%u"), ci.wVal);
- } else if (ci.type == CNFT_BYTE) {
- pszUniqueID = (char*)mir_alloc(15);
- if (pszUniqueID)
- mir_snprintf(pszUniqueID, 15, ("%u"), ci.bVal);
- }
- }
- if (!pszUniqueID && bNameOnError) {
- const TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
- if (name) pszUniqueID = mir_t2a(name);
- }
- return pszUniqueID;
+char* contact_get_id(MCONTACT hContact, bool bNameOnError)
+{
+ ptrT pszUniqueID(Contact_GetInfo(CNF_UNIQUEID, hContact));
+ if (!pszUniqueID && bNameOnError)
+ pszUniqueID = mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+
+ return mir_t2a(pszUniqueID);
}
__inline const TCHAR* contact_get_nameT(MCONTACT hContact) {
@@ -130,24 +106,8 @@ __inline const TCHAR* contact_get_nameT(MCONTACT hContact) {
TCHAR* ProtoGetNickname(const char* proto)
{
- CONTACTINFO ci = {sizeof(ci)};
- ci.dwFlag = CNF_TCHAR | CNF_NICK;
- ci.szProto = (char*)proto;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
- switch (ci.type) {
- case CNFT_ASCIIZ:
- return ci.pszVal;
- case CNFT_DWORD:
- mir_free(ci.pszVal);
- ci.pszVal=(TCHAR*)mir_alloc(12*sizeof(TCHAR)); // long can only have up to 11 characters (unsigned = 10)
- if(ci.pszVal)
- _ltot(ci.dVal, ci.pszVal, 10);
- return ci.pszVal;
- default:
- mir_free(ci.pszVal);
- }
- }
- return mir_tstrdup(_T(""));
+ TCHAR *p = Contact_GetInfo(CNF_NICK, NULL, proto);
+ return (p != NULL) ? p : mir_tstrdup(_T(""));
}
void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTACT hContact) {