From f62e0732f2702118879b2d56eec836ab8d1337b9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Aug 2018 21:59:05 +0300 Subject: minor code cleaning --- plugins/Msg_Export/src/utils.cpp | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 51d9991ed3..af5e7ea925 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -49,29 +49,22 @@ map > clFileTo1ColWidth; // default line width int nMaxLineWidth = 80; -const wchar_t *pszReplaceList[] = +struct { - L"%FirstName%", - L"%LastName%", - L"%e-mail%", - L"%Nick%", - L"%City%", - L"%State%", - L"%Phone%", - L"%Homepage%", - L"%About%" -}; -const char *pszReplaceListA[] = + const wchar_t *pField; + const char *pSetting; +} +static replaceList[] = { - "FirstName", - "LastName", - "e-mail", - "Nick", - "City", - "State", - "Phone", - "Homepage", - "About" + { L"%FirstName%", "FirstName" }, + { L"%LastName%", "LastName" }, + { L"%e-mail%", "e-mail" }, + { L"%Nick%", "Nick" }, + { L"%City%", "City" }, + { L"%State%", "State" }, + { L"%Phone%", "Phone" }, + { L"%Homepage%", "Homepage" }, + { L"%About%", "About" } }; // Alowes this plugin to replace the history function of miranda !! @@ -756,8 +749,8 @@ bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, wstring sFilePath, DBEVE string sProto = _DBGetStringA(hContact, "Protocol", "p", ""); ReplaceAll(output, L"%Proto%", _DBGetStringW(hContact, "Protocol", "p", L"")); - for (int nCur = 0; nCur < 9; nCur++) - ReplaceAll(output, pszReplaceList[nCur], _DBGetStringW(hContact, sProto.c_str(), pszReplaceListA[nCur], L"")); + for (auto &it : replaceList) + ReplaceAll(output, it.pField, _DBGetStringW(hContact, sProto.c_str(), it.pSetting, L"")); ptrW id(Contact_GetInfo(CNF_UNIQUEID, hContact, sProto.c_str())); if (id != NULL) -- cgit v1.2.3