From f156040507d1b569be0b9e4b1038aeb39feaeefc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 5 Nov 2012 15:39:00 +0000 Subject: introduced Unicode service for IEView date&time templates git-svn-id: http://svn.miranda-ng.org/main/trunk@2207 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/IEView/src/TemplateHTMLBuilder.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'plugins/IEView/src') diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index d070a8aa76..c28831bb8a 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -118,16 +118,16 @@ int TemplateHTMLBuilder::getFlags(ProtocolSettings * protoSettings) { char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mode) { static char szResult[512]; - char str[80]; - DBTIMETOSTRING dbtts; + TCHAR str[300]; + DBTIMETOSTRINGT dbtts; dbtts.cbDest = 70; dbtts.szDest = str; szResult[0] = '\0'; if (mode) { //time - dbtts.szFormat = (dwFlags & Options::LOG_SHOW_SECONDS) ? (char *)"s" : (char *)"t"; - CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts); - strncat(szResult, str, 500); - } else {//date + dbtts.szFormat = (dwFlags & Options::LOG_SHOW_SECONDS) ? _T("s") : _T("t"); + CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, check, (LPARAM)&dbtts); + } + else {//date struct tm tm_now, tm_today; time_t now = time(NULL); time_t today; @@ -135,17 +135,16 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo tm_today = tm_now; tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0; today = mktime(&tm_today); - if (dwFlags & Options::LOG_RELATIVE_DATE && check >= today) { - strcpy(szResult, Translate("Today")); - } else if(dwFlags & Options::LOG_RELATIVE_DATE && check > (today - 86400)) { - strcpy(szResult, Translate("Yesterday")); - } else { - dbtts.szFormat = (dwFlags & Options::LOG_LONG_DATE) ? (char *)"D" : (char *)"d"; - CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts); - strncat(szResult, str, 500); + if (dwFlags & Options::LOG_RELATIVE_DATE && check >= today) + _tcsncpy(str, TranslateT("Today"), SIZEOF(str)); + else if(dwFlags & Options::LOG_RELATIVE_DATE && check > (today - 86400)) + _tcsncpy(str, TranslateT("Yesterday"), SIZEOF(str)); + else { + dbtts.szFormat = (dwFlags & Options::LOG_LONG_DATE) ? _T("D") : _T("d"); + CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, check, (LPARAM) & dbtts); } } - Utils::UTF8Encode(szResult, szResult, 500); + Utils::UTF8Encode(str, szResult, 500); return szResult; } -- cgit v1.2.3