From bf37d6655a27cc3ea5af5412c9717596c9d1c30f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 18:18:13 +0000 Subject: timezone api migrated to mir_core git-svn-id: http://svn.miranda-ng.org/main/trunk@14266 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/IEView/src/HistoryHTMLBuilder.cpp | 7 +----- plugins/IEView/src/MUCCHTMLBuilder.cpp | 36 ++++++++++++------------------ plugins/IEView/src/ScriverHTMLBuilder.cpp | 20 +++++------------ plugins/IEView/src/TabSRMMHTMLBuilder.cpp | 18 ++++++--------- plugins/IEView/src/TemplateHTMLBuilder.cpp | 21 ++++++----------- plugins/IEView/src/ieview_common.h | 2 +- 6 files changed, 36 insertions(+), 68 deletions(-) (limited to 'plugins/IEView/src') diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 513e8eb9ae..7938502f89 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -83,12 +83,7 @@ char *HistoryHTMLBuilder::timestampToString(time_t check) { static char szResult[512]; char str[80]; - DBTIMETOSTRING dbtts; - dbtts.cbDest = 70; - dbtts.szDest = str; - szResult[0] = '\0'; - dbtts.szFormat = (char *)"d t"; - CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM)& dbtts); + TimeZone_ToString(check, "d t", str, SIZEOF(str)); mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult)); mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500); return szResult; diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index c34e794f41..7ac74ea989 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -82,11 +82,7 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check) { static char szResult[512]; char str[80]; - - DBTIMETOSTRING dbtts; - - dbtts.cbDest = 70; - dbtts.szDest = str; + const char *szFormat; szResult[0] = '\0'; struct tm tm_now, tm_today; @@ -96,24 +92,20 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check) tm_today = tm_now; tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0; today = mktime(&tm_today); - if (dwData&IEEDD_MUCC_SHOW_DATE && dwData&IEEDD_MUCC_SHOW_TIME) { - if (dwData&IEEDD_MUCC_LONG_DATE) { - dbtts.szFormat = dwData&IEEDD_MUCC_SECONDS ? (char *)"D s" : (char *)"D t"; - } - else { - dbtts.szFormat = dwData&IEEDD_MUCC_SECONDS ? (char *)"d s" : (char *)"d t"; - } - } - else if (dwData&IEEDD_MUCC_SHOW_DATE) { - dbtts.szFormat = dwData&IEEDD_MUCC_LONG_DATE ? (char *)"D" : (char *)"d"; - } - else if (dwData&IEEDD_MUCC_SHOW_TIME) { - dbtts.szFormat = dwData&IEEDD_MUCC_SECONDS ? (char *)"s" : (char *)"t"; - } - else { - dbtts.szFormat = (char *)""; + if (dwData & IEEDD_MUCC_SHOW_DATE && dwData & IEEDD_MUCC_SHOW_TIME) { + if (dwData & IEEDD_MUCC_LONG_DATE) + szFormat = (dwData & IEEDD_MUCC_SECONDS) ? "D s" : "D t"; + else + szFormat = (dwData & IEEDD_MUCC_SECONDS) ? "d s" : "d t"; } - CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM)& dbtts); + else if (dwData & IEEDD_MUCC_SHOW_DATE) + szFormat = dwData & IEEDD_MUCC_LONG_DATE ? "D" : "d"; + else if (dwData & IEEDD_MUCC_SHOW_TIME) + szFormat = dwData & IEEDD_MUCC_SECONDS ? "s" : "t"; + else + szFormat = (char *)""; + + TimeZone_ToString(check, szFormat, str, SIZEOF(str)); mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult)); mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500); return szResult; diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 7e98f6a877..7143720889 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -120,19 +120,11 @@ void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) } } -char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mode) +char* ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mode) { - static char szResult[512]; + static char szResult[512]; szResult[0] = '\0'; char str[80]; - char format[20]; - DBTIMETOSTRING dbtts; - - szResult[0] = '\0'; - format[0] = '\0'; - - dbtts.cbDest = 70; - dbtts.szDest = str; - dbtts.szFormat = format; + char format[20]; format[0] = '\0'; if ((mode == 0 || mode == 1) && (dwFlags & SMF_LOG_SHOWDATE)) { struct tm tm_now, tm_today; @@ -163,13 +155,13 @@ char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod } } if (mode == 0 || mode == 2) { - if (mode == 0 && (dwFlags & SMF_LOG_SHOWDATE)) { + if (mode == 0 && (dwFlags & SMF_LOG_SHOWDATE)) mir_strcat(format, " "); - } + mir_strcat(format, (dwFlags & SMF_LOG_SHOWSECONDS) ? "s" : "t"); } if (format[0] != '\0') { - CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM)& dbtts); + TimeZone_ToString(check, format, str, SIZEOF(str)); mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult)); } mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500); diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index aa08a7b73a..5f02f33da0 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -155,18 +155,14 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG { static char szResult[512]; char str[80]; - - DBTIMETOSTRING dbtts; + const char *szFormat; struct tm tm_now, tm_today; time_t now = time(NULL); time_t today; - dbtts.cbDest = 70; - dbtts.szDest = str; - if (!isGroupBreak || !(dwFlags & MWF_LOG_SHOWDATES)) { - dbtts.szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? (char *)"s" : (char *)"t"; + szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? "s" : "t"; szResult[0] = '\0'; } else { @@ -176,24 +172,24 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG today = mktime(&tm_today); if (dwFlags & MWF_LOG_USERELATIVEDATES && check >= today) { - dbtts.szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? (char *)"s" : (char *)"t"; + szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? "s" : "t"; mir_strcpy(szResult, Translate("Today")); mir_strcat(szResult, ", "); } else if (dwFlags & MWF_LOG_USERELATIVEDATES && check > (today - 86400)) { - dbtts.szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? (char *)"s" : (char *)"t"; + szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? "s" : "t"; mir_strcpy(szResult, Translate("Yesterday")); mir_strcat(szResult, ", "); } else { if (dwFlags & MWF_LOG_LONGDATES) - dbtts.szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? (char *)"D s" : (char *)"D t"; + szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? "D s" : "D t"; else - dbtts.szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? (char *)"d s" : (char *)"d t"; + szFormat = (dwFlags & MWF_LOG_SHOWSECONDS) ? "d s" : "d t"; szResult[0] = '\0'; } } - CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM)& dbtts); + TimeZone_ToString(check, szFormat, str, SIZEOF(str)); mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult)); mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500); return szResult; diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index e63cfd2203..d7f5ecc85c 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -118,17 +118,12 @@ int TemplateHTMLBuilder::getFlags(ProtocolSettings * protoSettings) char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mode) { - static char szResult[512]; + static char szResult[512]; szResult[0] = '\0'; TCHAR str[300]; - DBTIMETOSTRINGT dbtts; - dbtts.cbDest = 70; - dbtts.szDest = str; - szResult[0] = '\0'; - if (mode) { //time - dbtts.szFormat = (dwFlags & Options::LOG_SHOW_SECONDS) ? _T("s") : _T("t"); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, check, (LPARAM)&dbtts); - } - else {//date + + if (mode) // time + TimeZone_ToStringT(check, (dwFlags & Options::LOG_SHOW_SECONDS) ? _T("s") : _T("t"), str, SIZEOF(str)); + else { // date struct tm tm_now, tm_today; time_t now = time(NULL); time_t today; @@ -140,10 +135,8 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo _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); - } + else + TimeZone_ToStringT(check, (dwFlags & Options::LOG_LONG_DATE) ? _T("D") : _T("d"), str, SIZEOF(str)); } mir_strncpy(szResult, T2Utf(str), 500); diff --git a/plugins/IEView/src/ieview_common.h b/plugins/IEView/src/ieview_common.h index 0edf01a964..2149316aa4 100644 --- a/plugins/IEView/src/ieview_common.h +++ b/plugins/IEView/src/ieview_common.h @@ -52,7 +52,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include - +#include #include #include #include -- cgit v1.2.3