summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-08-13 21:59:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-08-13 21:59:05 +0300
commitf62e0732f2702118879b2d56eec836ab8d1337b9 (patch)
tree52c7a8a5482131586ebc89222e2d420b54c611d1
parentf17466bd1efebfb4c1f9031b11bc40fcf51ef53a (diff)
minor code cleaning
-rwxr-xr-xplugins/Msg_Export/src/utils.cpp39
1 files 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<wstring, string::size_type, less<wstring> > 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)