From a4ab663c9a1b58c1f1f9243899d2d9fe065667ec Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 May 2016 10:42:05 +0000 Subject: fixes #733: (MsgExport : write JabberID to exported history log as UIN field, for example) git-svn-id: http://svn.miranda-ng.org/main/trunk@16845 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Msg_Export/src/Version.h | 2 +- plugins/Msg_Export/src/utils.cpp | 44 ++++++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/plugins/Msg_Export/src/Version.h b/plugins/Msg_Export/src/Version.h index b70d3bcc9e..a32d1345ec 100644 --- a/plugins/Msg_Export/src/Version.h +++ b/plugins/Msg_Export/src/Version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 1 #define __RELEASE_NUM 1 -#define __BUILD_NUM 5 +#define __BUILD_NUM 6 #include diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index e8130b86dd..42df6bda09 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -973,8 +973,23 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) for (int nCur = 0; nCur < 9; nCur++) ReplaceAll(output, pszReplaceList[nCur], _DBGetString(hContact, sProto.c_str(), pszReplaceListA[nCur], _T(""))); - mir_sntprintf(szTemp, _T("%d"), db_get_dw(hContact, sProto.c_str(), "UIN", 0)); - ReplaceAll(output, _T("%UIN%"), szTemp); + CONTACTINFO ci = {}; + ci.cbSize = sizeof(ci); + ci.hContact = hContact; + ci.szProto = (char*)sProto.c_str(); + ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR; + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { + switch (ci.type) { + case CNFT_ASCIIZ: + ReplaceAll(output, _T("%UIN%"), ci.pszVal); + mir_free(ci.pszVal); + break; + case CNFT_DWORD: + mir_sntprintf(szTemp, _T("%u"), ci.dVal); + ReplaceAll(output, _T("%UIN%"), szTemp); + break; + } + } mir_sntprintf(szTemp, _T("%d"), db_get_w(hContact, sProto.c_str(), "Age", 0)); ReplaceAll(output, _T("%Age%"), szTemp); @@ -991,24 +1006,19 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) } } - int nIndent; - { // Get time stamp - - nIndent = mir_sntprintf(szTemp, _T("%-*s"), - nFirstColumnWidth, - dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); + // Get time stamp + int nIndent = mir_sntprintf(szTemp, _T("%-*s"), nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); - TimeZone_ToStringT(dbei.timestamp, sTimeFormat.c_str(), &szTemp[nIndent], _countof(szTemp) - nIndent - 2); + TimeZone_ToStringT(dbei.timestamp, sTimeFormat.c_str(), &szTemp[nIndent], _countof(szTemp) - nIndent - 2); - nIndent = (int)mir_tstrlen(szTemp); - szTemp[nIndent++] = ' '; + nIndent = (int)mir_tstrlen(szTemp); + szTemp[nIndent++] = ' '; - // Write first part of line with name and timestamp - if (!bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, nIndent)) { - DisplayErrorDialog(LPGENT("Failed to write timestamp and username to file :\n"), sFilePath, &dbei); - CloseHandle(hFile); - return; - } + // Write first part of line with name and timestamp + if (!bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, nIndent)) { + DisplayErrorDialog(LPGENT("Failed to write timestamp and username to file :\n"), sFilePath, &dbei); + CloseHandle(hFile); + return; } if (dbei.pBlob != NULL && dbei.cbBlob >= 2) { -- cgit v1.2.3