summaryrefslogtreecommitdiff
path: root/plugins/Msg_Export/src/utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-05-18 10:42:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-05-18 10:42:05 +0000
commita4ab663c9a1b58c1f1f9243899d2d9fe065667ec (patch)
treea2caa4a0bbf5e20806beeb0ac6fbe947f5fa6a20 /plugins/Msg_Export/src/utils.cpp
parentc1fe671e216c15ac541a05ce8d73213837033426 (diff)
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
Diffstat (limited to 'plugins/Msg_Export/src/utils.cpp')
-rwxr-xr-xplugins/Msg_Export/src/utils.cpp44
1 files changed, 27 insertions, 17 deletions
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) {