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/AvatarHistory/src/AvatarDlg.cpp | 6 +- plugins/AvatarHistory/src/stdafx.h | 1 + plugins/BasicHistory/src/BasicHistory.cpp | 5 +- plugins/BasicHistory/src/EventList.cpp | 2 +- plugins/BasicHistory/src/ExportManager.cpp | 4 +- plugins/BasicHistory/src/HistoryWindow.cpp | 4 +- plugins/Clist_modern/src/init.cpp | 3 - plugins/Clist_modern/src/modern_cachefuncs.cpp | 4 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 14 ++-- .../Clist_modern/src/modern_rowheight_funcs.cpp | 2 +- plugins/Clist_nicer/src/clcitems.cpp | 2 +- plugins/Clist_nicer/src/clcpaint.cpp | 2 +- plugins/Clist_nicer/src/init.cpp | 3 - plugins/CmdLine/src/mimcmd_handlers.cpp | 6 +- plugins/CmdLine/src/stdafx.h | 1 + plugins/Exchange/src/utils.cpp | 4 +- plugins/HistoryLinkListPlus/src/linklist.h | 1 + plugins/HistoryLinkListPlus/src/linklist_fct.cpp | 7 +- plugins/HistoryStats/src/mu_common.cpp | 8 --- plugins/HistoryStats/src/mu_common.h | 9 --- plugins/HistoryStats/src/statistic.cpp | 4 +- plugins/HistoryStats/src/stdafx.h | 1 + plugins/HistoryStats/src/utils.h | 3 - 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 +- plugins/Msg_Export/src/Glob.h | 1 + plugins/Msg_Export/src/utils.cpp | 7 +- plugins/Popup/src/headers.h | 1 + plugins/Popup/src/popup_wnd2.cpp | 12 +--- plugins/Scriver/src/msgdialog.cpp | 4 +- plugins/Scriver/src/msglog.cpp | 2 +- plugins/Scriver/src/srmm.cpp | 2 - plugins/SeenPlugin/src/seen.h | 1 + plugins/SeenPlugin/src/utils.cpp | 6 +- plugins/Spamotron/src/spamotron.cpp | 1 - plugins/TabSRMM/src/generic_msghandlers.cpp | 4 +- plugins/TabSRMM/src/infopanel.cpp | 2 +- plugins/TabSRMM/src/msgdlgutils.cpp | 2 +- plugins/TabSRMM/src/msglog.cpp | 4 +- plugins/TabSRMM/src/srmm.cpp | 2 - plugins/TipperYM/src/subst.cpp | 8 +-- plugins/TipperYM/src/tipper.cpp | 2 - plugins/TipperYM/src/translations.cpp | 50 +++++-------- plugins/UserInfoEx/src/commonheaders.cpp | 7 +- plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 82 +++++----------------- plugins/UserInfoEx/src/init.cpp | 5 +- plugins/UserInfoEx/src/psp_options.cpp | 14 +--- plugins/UserInfoEx/src/svc_contactinfo.cpp | 29 ++------ plugins/UserInfoEx/src/svc_timezone.cpp | 4 +- plugins/UserInfoEx/src/svc_timezone_old.cpp | 13 ---- plugins/UserInfoEx/src/svc_timezone_old.h | 1 - plugins/Utils/mir_buffer.h | 7 +- plugins/Variables/src/parse_miranda.cpp | 9 +-- plugins/Variables/src/variables.h | 1 + plugins/YAMN/src/browser/mailbrowser.cpp | 2 +- plugins/YAMN/src/yamn.h | 1 + 60 files changed, 140 insertions(+), 346 deletions(-) (limited to 'plugins') diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index dd425345d6..3a791498cc 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -438,11 +438,7 @@ int FillAvatarListFromDB(HWND list, MCONTACT hContact) // Get time TCHAR date[64]; - DBTIMETOSTRINGT tts = {0}; - tts.szFormat = _T("d s"); - tts.szDest = date; - tts.cbDest = SIZEOF(date); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)dbei.timestamp, (LPARAM)&tts); + TimeZone_ToStringT(dbei.timestamp, _T("d s"), date, SIZEOF(date)); // Get file in disk TCHAR path[MAX_PATH]; diff --git a/plugins/AvatarHistory/src/stdafx.h b/plugins/AvatarHistory/src/stdafx.h index 4bf6f2395f..27a584f5a1 100644 --- a/plugins/AvatarHistory/src/stdafx.h +++ b/plugins/AvatarHistory/src/stdafx.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index a52f719a5b..c3cd59d45b 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -59,7 +59,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -TIME_API tmi = { 0 }; int hLangpack = 0; extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) @@ -256,10 +255,10 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { + mir_getLP(&pluginInfo); + hTaskMainMenu = NULL; DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&g_hMainThread,0,FALSE,DUPLICATE_SAME_ACCESS); - mir_getTMI(&tmi); - mir_getLP(&pluginInfo); hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index c1c707561e..9bbd8ab243 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -366,7 +366,7 @@ void EventList::AddGroup(const EventIndex& ev) TCHAR eventText[256]; int i; eventText[0] = 0; - tmi.printTimeStamp(NULL, data.timestamp, _T("d t"), eventText, 64, 0); + TimeZone_PrintTimeStamp(NULL, data.timestamp, _T("d t"), eventText, 64, 0); std::wstring time = eventText; std::wstring user; if (data.isMe) diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 36fc670db7..a1049d87d7 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -333,9 +333,9 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst } } - tmi.printTimeStamp(NULL, data.timestamp, longFormatDate, str , MAXSELECTSTR, 0); + TimeZone_PrintTimeStamp(NULL, data.timestamp, longFormatDate, str , MAXSELECTSTR, 0); std::wstring longDate = str; - tmi.printTimeStamp(NULL, data.timestamp, formatDate, str , MAXSELECTSTR, 0); + TimeZone_PrintTimeStamp(NULL, data.timestamp, formatDate, str , MAXSELECTSTR, 0); std::wstring shortDate = str; std::wstring user; diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index e01294de40..5fe89953f7 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1487,7 +1487,7 @@ void HistoryWindow::SelectEventGroup(int sel) } } - tmi.printTimeStamp(NULL, data.timestamp, formatDate, str, MAXSELECTSTR, 0); + TimeZone_PrintTimeStamp(NULL, data.timestamp, formatDate, str, MAXSELECTSTR, 0); *strLen = (unsigned int)mir_tstrlen(str) * sizeof(TCHAR); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); @@ -2147,7 +2147,7 @@ void HistoryWindow::FormatQuote(std::wstring& quote, const MessageData& md, cons else quote += contactName; TCHAR str[32]; - tmi.printTimeStamp(NULL, md.timestamp, _T("d t"), str, 32, 0); + TimeZone_PrintTimeStamp(NULL, md.timestamp, _T("d t"), str, 32, 0); quote += _T(", "); quote += str; quote += _T("\n"); diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index a676957105..87d62a98b8 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -40,8 +40,6 @@ CLIST_INTERFACE corecli = { 0 }; CLUIDATA g_CluiData = { 0 }; int hLangpack; -TIME_API tmi; - static HRESULT SubclassClistInterface(); static HRESULT CreateHookableEvents(); int EventArea_UnloadModule(); @@ -77,7 +75,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" __declspec(dllexport) int CListInitialise() { mir_getLP(&pluginInfo); - mir_getTMI(&tmi); g_dwMainThreadID = GetCurrentThreadId(); g_hMirApp = GetModuleHandleA("mir_app.dll"); diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 218618edc2..f5128356ef 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -58,7 +58,7 @@ void Cache_GetTimezone(ClcData *dat, MCONTACT hContact) if (dat && dat->hWnd == pcli->hwndContactTree) { DWORD flags = dat->contact_time_show_only_if_different ? TZF_DIFONLY : 0; - pdnce->hTimeZone = tmi.createByContact(hContact, 0, flags); + pdnce->hTimeZone = TimeZone_CreateByContact(hContact, 0, flags); } } @@ -496,7 +496,7 @@ int Cache_GetLineText( if (pdnce->hTimeZone) { // Get pdnce time text[0] = 0; - tmi.printDateTime(pdnce->hTimeZone, _T("t"), text, text_size, 0); + TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), text, text_size, 0); } return TEXT_CONTACT_TIME; diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 7c707492fe..a621838d29 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1108,7 +1108,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact TCHAR buf[70] = _T(""); mir_free_and_nil(pdnce->szSecondLineText); - tmi.printDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); + TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); pdnce->szSecondLineText = mir_tstrdup(buf); } @@ -1136,7 +1136,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact TCHAR buf[70] = _T(""); mir_free(pdnce->szThirdLineText); - tmi.printDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); + TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); pdnce->szThirdLineText = mir_tstrdup(buf); } @@ -1417,7 +1417,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact case TC_TIME: TCHAR szResult[80]; - if (!tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { + if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { // Select font ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL); ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), &p_rect, DT_NOPREFIX | DT_SINGLELINE | (dat->text_rtl ? DT_RTLREADING : 0)); @@ -2163,7 +2163,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT if (Drawing->type == CLCIT_CONTACT && dat->contact_time_show && pdnce->hTimeZone) { TCHAR szResult[80]; - if (!tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { + if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { SIZE text_size; RECT rc; @@ -2351,7 +2351,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT if (dat->second_line_type == TEXT_CONTACT_TIME && pdnce->hTimeZone) { // Get contact time TCHAR buf[70] = _T(""); - tmi.printDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); + TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); mir_free(pdnce->szSecondLineText); pdnce->szSecondLineText = mir_tstrdup(buf); } @@ -2385,7 +2385,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT if (dat->third_line_type == TEXT_CONTACT_TIME && pdnce->hTimeZone) { // Get contact time TCHAR buf[70] = _T(""); - tmi.printDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); + TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0); mir_free(pdnce->szThirdLineText); pdnce->szThirdLineText = mir_tstrdup(buf); } @@ -2818,7 +2818,7 @@ void CLCPaint::_DrawContactTime(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R if (!pdnce) return; - if (!tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { + if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { // Select font ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL); ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), prcItem, DT_NOPREFIX | DT_SINGLELINE); diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index bc2aee1df6..5766aa8e08 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -288,7 +288,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i if (item == -1) { TCHAR szResult[80]; - if (!tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { + if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { SIZE text_size = { 0 }; RECT rc = { 0 }; // Select font diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index c171a09813..332632a305 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -38,7 +38,7 @@ static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c) DWORD flags = 0; if (cfg::dat.bShowLocalTimeSelective) flags |= TZF_DIFONLY; - c->hTimeZone = tmi.createByContact(hContact, 0, flags); + c->hTimeZone = TimeZone_CreateByContact(hContact, 0, flags); } //routines for managing adding/removal of items in the list, including sorting diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 9d5e5946b3..6f8ee502a7 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -1110,7 +1110,7 @@ bgskipped: int fHeight = 0; TCHAR szResult[80]; - if (tmi.printDateTime(cEntry->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) + if (TimeZone_PrintDateTime(cEntry->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) goto nodisplay; COLORREF oldColor = GetTextColor(hdcMem); diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 4545f578bb..8cf100d225 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -37,8 +37,6 @@ extern HICON overlayicons[10]; extern int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam); extern int SetHideOffline(WPARAM wParam, LPARAM lParam); -TIME_API tmi; - HMENU BuildGroupPopupMenu(ClcGroup *group); ClcContact *CreateClcContact(void); CListEvent *fnCreateEvent(void); @@ -126,7 +124,6 @@ static int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hConta extern "C" int __declspec(dllexport) CListInitialise() { mir_getLP(&pluginInfo); - mir_getTMI(&tmi); mir_getCLI(); coreCli = *pcli; diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 6931db6137..7c18db81fd 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1458,11 +1458,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r void AddHistoryEvent(DBEVENTINFO *dbEvent, char *contact, PReply reply) { char timestamp[256]; - DBTIMETOSTRING tts = {0}; - tts.szDest = timestamp; - tts.cbDest = sizeof(timestamp); - tts.szFormat = "D, s"; - CallService(MS_DB_TIME_TIMESTAMPTOSTRING, dbEvent->timestamp,(LPARAM) &tts); + TimeZone_ToString(dbEvent->timestamp, "D, s", timestamp, sizeof(timestamp)); char *sender = (dbEvent->flags & DBEF_SENT) ? Translate("[me]") : contact; char *message = DbGetEventTextA(dbEvent,CP_ACP); diff --git a/plugins/CmdLine/src/stdafx.h b/plugins/CmdLine/src/stdafx.h index bc9af0e5ea..58df317ad2 100644 --- a/plugins/CmdLine/src/stdafx.h +++ b/plugins/CmdLine/src/stdafx.h @@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_message.h" #include "m_ignore.h" #include "m_string.h" +#include "m_timezones.h" #include "m_crashdumper.h" #include "m_statusplugins.h" diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index e89a170732..2344840601 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -116,7 +116,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, dbv.type = DBVT_ASCIIZ; if (db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) { res = 0; - int tmp = mir_tstrlen(dbv.ptszVal); + size_t tmp = mir_tstrlen(dbv.ptszVal); len = (tmp < size - 1) ? tmp : size - 1; _tcsncpy(szResult, dbv.ptszVal, len); szResult[len] = '\0'; @@ -124,7 +124,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, } else { res = 1; - int tmp = mir_tstrlen(szError); + size_t tmp = mir_tstrlen(szError); len = (tmp < size - 1) ? tmp : size - 1; _tcsncpy(szResult, szError, len); szResult[len] = '\0'; diff --git a/plugins/HistoryLinkListPlus/src/linklist.h b/plugins/HistoryLinkListPlus/src/linklist.h index 6bd8bdde50..867e5a8e7d 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.h +++ b/plugins/HistoryLinkListPlus/src/linklist.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index b2524bb251..8948ececc7 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -41,7 +41,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) static LPCTSTR hyperlinkSubstrings[] = { _T(".com"),_T(".net"),_T(".org"),_T(".co.uk"),_T(".ru") }; - DBTIMETOSTRINGT dbtimestring; + LISTELEMENT *newElement, *actualElement; BYTE type = LINK_UNKNOWN; int direction, isLink, linkFound = 0; @@ -149,10 +149,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) _tcsncpy_s(link, word, ((wordlen > LINK_MAX) ? LINK_MAX : wordlen)); } - dbtimestring.szFormat = _T("d-t"); - dbtimestring.szDest = dbdate; - dbtimestring.cbDest = SIZEOF(dbdate); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT,(WPARAM)dbei->timestamp, (LPARAM)&dbtimestring); + TimeZone_ToStringT(dbei->timestamp, _T("d-t"), dbdate, SIZEOF(dbdate)); date_ptr = _tcstok_s(dbdate, _T("-"), &tok_ctx); time_ptr = _tcstok_s(NULL, _T("-"), &tok_ctx); _tcsncpy_s(date, date_ptr, _TRUNCATE); diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index 971a525ae3..5e435604ac 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -104,14 +104,6 @@ namespace mu } } - namespace db_time - { - DWORD timestampToLocal(DWORD timestamp) - { - return static_cast(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, static_cast(timestamp), 0)); - } - } - /* * icolib */ diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index 6786201805..99f4c6985b 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -41,15 +41,6 @@ namespace mu int getCount(); } - /* - * db_time - */ - - namespace db_time - { - DWORD timestampToLocal(DWORD timestamp); - } - /* * icolib */ diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index f2a5fceaf3..c0207baac8 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -434,7 +434,7 @@ bool Statistic::stepReadDB() // filter logged status messages from tabSRMM if (dbei.eventType == etMessage) { // convert to local time (everything in this plugin is done in local time) - DWORD localTimestamp = utils::toLocalTime(dbei.timestamp); + DWORD localTimestamp = TimeZone_ToLocal(dbei.timestamp); if (localTimestamp >= m_TimeMin && localTimestamp <= m_TimeMax) { if (dbei.flags & DBEF_UTF) { @@ -1235,7 +1235,7 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN m_nFirstTime(0), m_nLastTime(0) { - m_TimeStarted = utils::toLocalTime(time(NULL)); + m_TimeStarted = TimeZone_ToLocal(time(NULL)); m_MSecStarted = GetTickCount(); m_AverageMinTime = settings.m_AverageMinTime * 24 * 60 * 60; // calculate seconds from days } diff --git a/plugins/HistoryStats/src/stdafx.h b/plugins/HistoryStats/src/stdafx.h index 0b8e3d16c6..4b623bc649 100644 --- a/plugins/HistoryStats/src/stdafx.h +++ b/plugins/HistoryStats/src/stdafx.h @@ -66,6 +66,7 @@ #include // not used #include #include +#include #include // not used, depends on m_protosvc.h #include // depends on m_protosvc.h diff --git a/plugins/HistoryStats/src/utils.h b/plugins/HistoryStats/src/utils.h index 8c2160dee6..cbd42f240b 100644 --- a/plugins/HistoryStats/src/utils.h +++ b/plugins/HistoryStats/src/utils.h @@ -38,9 +38,6 @@ namespace utils ext::string toLowerCase(const ext::string& text); ext::string toUpperCase(const ext::string& text); - // time conversion - inline DWORD toLocalTime(DWORD gmtTimestamp) { return mu::db_time::timestampToLocal(gmtTimestamp); } - // version conversion DWORD dottedToVersion(ext::string version); ext::string versionToDotted(DWORD version); 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 diff --git a/plugins/Msg_Export/src/Glob.h b/plugins/Msg_Export/src/Glob.h index 1f59deeb5f..3d21adb29e 100755 --- a/plugins/Msg_Export/src/Glob.h +++ b/plugins/Msg_Export/src/Glob.h @@ -38,6 +38,7 @@ using namespace std; #include #include #include +#include #include #include diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 755193bddd..65b86fc401 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -1134,12 +1134,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); - DBTIMETOSTRINGT dbtts; - dbtts.cbDest = SIZEOF(szTemp) - nIndent - 2; - dbtts.szDest = &szTemp[nIndent]; - dbtts.szFormat = (TCHAR*)sTimeFormat.c_str(); - - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, dbei.timestamp, (LPARAM)&dbtts); + TimeZone_ToStringT(dbei.timestamp, sTimeFormat.c_str(), &szTemp[nIndent], SIZEOF(szTemp) - nIndent - 2); nIndent = (int)mir_tstrlen(szTemp); szTemp[nIndent++] = ' '; diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index ce6142318a..56b8d1b625 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -83,6 +83,7 @@ http://miranda-ng.org/distr/ #include #include #include +#include #include #include diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 2d45ac3553..f1183f6dd4 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -751,16 +751,10 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) m_lpzSkin = mir_a2t(ppd->lpzSkin); if (m_options->DisplayTime) { - if (ppd->dwTimestamp) { - DBTIMETOSTRINGT dbtts; - dbtts.szFormat = _T("t"); - dbtts.szDest = m_time; - dbtts.cbDest = SIZEOF(m_time); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ppd->dwTimestamp, (LPARAM)&dbtts); - } - else { + if (ppd->dwTimestamp) + TimeZone_ToStringT(ppd->dwTimestamp, _T("t"), m_time, SIZEOF(m_time)); + else GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time)); - } } else m_time[0] = 0; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index c0f45ade83..995921af6d 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1367,8 +1367,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } else if (dat->lastMessage) { TCHAR date[64], time[64]; - tmi.printTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0); - tmi.printTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0); + TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0); + TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0); mir_sntprintf(szText, TranslateT("Last message received on %s at %s."), date, time); sbd.pszText = szText; } diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 86a2751f2c..537673b5a2 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -425,7 +425,7 @@ TCHAR* TimestampToString(DWORD dwFlags, time_t check, int mode) mir_tstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? _T("s") : _T("t")); } if (format[0] != '\0') { - tmi.printTimeStamp(NULL, check, format, str, SIZEOF(str), 0); + TimeZone_PrintTimeStamp(NULL, check, format, str, SIZEOF(str), 0); mir_tstrncat(szResult, str, SIZEOF(szResult) - mir_tstrlen(szResult)); } return szResult; diff --git a/plugins/Scriver/src/srmm.cpp b/plugins/Scriver/src/srmm.cpp index 33d51c4722..371dccf22e 100644 --- a/plugins/Scriver/src/srmm.cpp +++ b/plugins/Scriver/src/srmm.cpp @@ -27,7 +27,6 @@ int OnLoadModule(void); int OnUnloadModule(void); int hLangpack; -TIME_API tmi; HINSTANCE g_hInst; CLIST_INTERFACE *pcli; @@ -63,7 +62,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRMM, extern "C" __declspec(dllexport) int Load(void) { // set the memory manager - mir_getTMI(&tmi); mir_getLP(&pluginInfo); mir_getCLI(); diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h index 6f2273546b..4a83833fe6 100644 --- a/plugins/SeenPlugin/src/seen.h +++ b/plugins/SeenPlugin/src/seen.h @@ -41,6 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index ea0df3cb61..6a1818d295 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -105,7 +105,7 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st) DWORD res = db_get_dw(hcontact, S_MOD, "seenTS", 0); if (res) { if (st) { - ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, res, 0), 10000000) + NUM100NANOSEC; + ll = UInt32x32To64(TimeZone_ToLocal(res), 10000000) + NUM100NANOSEC; ft.dwLowDateTime = (DWORD)ll; ft.dwHighDateTime = (DWORD)(ll >> 32); FileTimeToSystemTime(&ft, st); @@ -127,7 +127,7 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st) ll -= NUM100NANOSEC; ll /= 10000000; //perform LOCALTOTIMESTAMP - res = (DWORD)ll - CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, 0, 0); + res = (DWORD)ll - TimeZone_ToLocal(0); //nevel look for Year/Month/Day/Hour/Minute/Second again db_set_dw(hcontact, S_MOD, "seenTS", res); } @@ -406,7 +406,7 @@ void DBWriteTimeTS(DWORD t, MCONTACT hcontact) { SYSTEMTIME st; FILETIME ft; - ULONGLONG ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, t, 0), 10000000) + NUM100NANOSEC; + ULONGLONG ll = UInt32x32To64(TimeZone_ToLocal(t), 10000000) + NUM100NANOSEC; ft.dwLowDateTime = (DWORD)ll; ft.dwHighDateTime = (DWORD)(ll >> 32); FileTimeToSystemTime(&ft, &st); diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index 87172f6092..89f62764ce 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -54,7 +54,6 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) DBEVENTINFO *dbei = (DBEVENTINFO *)lParam; char *msgblob; POPUPDATAT ppdp = {0}; - DBTIMETOSTRING tts = {0}; char protoOption[256] = {0}; int buflen = MAX_BUFFER_LENGTH; TCHAR buf[MAX_BUFFER_LENGTH]; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index bd339bb0eb..13e8eaa563 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1053,10 +1053,10 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) mir_sntprintf(szBuf, SIZEOF(szBuf), _T("UID: %s"), dat->cache->getUIN()); else if (dat->lastMessage) { TCHAR date[64], time[64]; - tmi.printTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0); + TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0); if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR && mir_tstrlen(date) > 6) date[mir_tstrlen(date) - 5] = 0; - tmi.printTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0); + TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0); mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Last received: %s at %s"), date, time); } else szBuf[0] = 0; diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 345b527901..747e5682bf 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -543,7 +543,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) TCHAR szResult[80]; szResult[0] = 0; if (m_dat->hTimeZone) { - tmi.printDateTime(m_dat->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0); + TimeZone_PrintDateTime(m_dat->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0); GetTextExtentPoint32(hdc, szResult, (int)mir_tstrlen(szResult), &sTime); } diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 62c18f8d36..8da7eac733 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1383,7 +1383,7 @@ void TSAPI LoadOwnAvatar(TWindowData *dat) void TSAPI LoadTimeZone(TWindowData *dat) { if (dat) - dat->hTimeZone = tmi.createByContact(dat->hContact, 0, TZF_KNOWNONLY); + dat->hTimeZone = TimeZone_CreateByContact(dat->hContact, 0, TZF_KNOWNONLY); } // paste contents of the clipboard into the message input area and send it immediately diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index dc39ec3eed..a04ee564cd 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -367,7 +367,7 @@ static TCHAR* Template_MakeRelativeDate(HANDLE hTimeZone, time_t check, TCHAR co else szFormat = _T("d"); - tmi.printTimeStamp(hTimeZone, check, szFormat, szResult, SIZEOF(szResult), 0); + TimeZone_PrintTimeStamp(hTimeZone, check, szFormat, szResult, SIZEOF(szResult), 0); } return szResult; } @@ -496,7 +496,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, // templated code starts here if (dwEffectiveFlags & MWF_LOG_SHOWTIME) { hTimeZone = ((dat->dwFlags & MWF_LOG_LOCALTIME) && !isSent) ? dat->hTimeZone : NULL; - time_t local_time = tmi.timeStampToTimeZoneTimeStamp(hTimeZone, dbei.timestamp); + time_t local_time = TimeZone_UtcToLocal(hTimeZone, dbei.timestamp); event_time = *gmtime(&local_time); } diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index dc4c16ab31..cd460b4856 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -36,7 +36,6 @@ LOGFONT lfDefault = { 0 }; */ int hLangpack; -TIME_API tmi = { 0 }; CLIST_INTERFACE *pcli; PLUGININFOEX pluginInfo = { @@ -74,7 +73,6 @@ extern "C" int __declspec(dllexport) Load(void) } mir_getCLI(); - mir_getTMI(&tmi); mir_getLP(&pluginInfo); SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfDefault), &lfDefault, FALSE); diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 15310e474d..0d97d50af1 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -134,12 +134,8 @@ DWORD LastMessageTimestamp(MCONTACT hContact, bool received) void FormatTimestamp(DWORD ts, char *szFormat, TCHAR *buff, int bufflen) { TCHAR swzForm[16]; - DBTIMETOSTRINGT dbt = {0}; - dbt.cbDest = bufflen; - dbt.szDest = buff; a2t(szFormat, swzForm, 16); - dbt.szFormat = swzForm; - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt); + TimeZone_ToStringT(ts, swzForm, buff, bufflen); } bool Uid(MCONTACT hContact, char *szProto, TCHAR *buff, int bufflen) @@ -280,7 +276,7 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff } } else if (!mir_tstrcmp(swzRawSpec, _T("time"))) { - if (tmi.printDateTime && !tmi.printDateTimeByContact(hContact, _T("t"), buff, bufflen, TZF_KNOWNONLY)) + if (!printDateTimeByContact(hContact, _T("t"), buff, bufflen, TZF_KNOWNONLY)) return true; } else if (!mir_tstrcmp(swzRawSpec, _T("uidname"))) { diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index a8c6e68194..bc94a4a38c 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -37,7 +37,6 @@ TCHAR SKIN_FOLDER[256]; CLIST_INTERFACE *pcli = NULL; FI_INTERFACE *fii = NULL; -TIME_API tmi; int hLangpack; PLUGININFOEX pluginInfoEx = @@ -299,7 +298,6 @@ extern "C" int __declspec(dllexport) Load(void) CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fii); mir_getLP(&pluginInfoEx); mir_getCLI(); - mir_getTMI(&tmi); iCodePage = Langpack_GetDefaultCodePage(); diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index 12ac692831..e492d4bbf8 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -70,59 +70,43 @@ TCHAR *NullTranslation(MCONTACT hContact, const char *szModuleName, const char * return NULL; } -TCHAR *TimestampToShortDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR* TimestampToShortDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); - if (ts == 0) return 0; + if (ts == 0) + return 0; - DBTIMETOSTRINGT dbt = {0}; - dbt.cbDest = bufflen; - dbt.szDest = buff; - dbt.szFormat = _T("d"); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt); - return buff; + return TimeZone_ToStringT(ts, _T("d"), buff, bufflen); } -TCHAR *TimestampToLongDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR* TimestampToLongDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); - if (ts == 0) return 0; + if (ts == 0) + return 0; - DBTIMETOSTRINGT dbt = {0}; - dbt.cbDest = bufflen; - dbt.szDest = buff; - dbt.szFormat = _T("D"); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt); - return buff; + return TimeZone_ToStringT(ts, _T("D"), buff, bufflen); } -TCHAR *TimestampToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR* TimestampToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); - if (ts == 0) return 0; + if (ts == 0) + return 0; - DBTIMETOSTRINGT dbt = {0}; - dbt.cbDest = bufflen; - dbt.szDest = buff; - dbt.szFormat = _T("s"); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt); - return buff; + return TimeZone_ToStringT(ts, _T("s"), buff, bufflen); } -TCHAR *TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR* TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); - if (ts == 0) return 0; + if (ts == 0) + return 0; - DBTIMETOSTRINGT dbt = {0}; - dbt.cbDest = bufflen; - dbt.szDest = buff; - dbt.szFormat = _T("t"); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt); - return buff; + return TimeZone_ToStringT(ts, _T("t"), buff, bufflen); } -TCHAR *TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); DWORD t = (DWORD)time(0); diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp index 8eb7699f3a..9b4d77bff0 100644 --- a/plugins/UserInfoEx/src/commonheaders.cpp +++ b/plugins/UserInfoEx/src/commonheaders.cpp @@ -22,10 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" // global: -HINSTANCE ghInst = NULL; -TIME_API tmi; //timezone interface -FI_INTERFACE *FIP = NULL; //freeimage interface -CLIST_INTERFACE *pcli = NULL; +HINSTANCE ghInst = NULL; +FI_INTERFACE *FIP = NULL; //freeimage interface +CLIST_INTERFACE *pcli = NULL; MGLOBAL myGlobals; pfnDwmIsCompositionEnabled dwmIsCompositionEnabled; diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index 7159718a51..52dd6b0d1b 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -49,27 +49,14 @@ static INT_PTR EnumNamesProc(CTimeZone *pTimeZone, int index, LPARAM lParam) **/ CBaseCtrl* CTzCombo::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) { - CTzCombo *ctrl = NULL; HWND hCtrl = GetDlgItem(hDlg, idCtrl); - ctrl = new CTzCombo(hDlg, idCtrl, pszSetting); + CTzCombo *ctrl = new CTzCombo(hDlg, idCtrl, pszSetting); if (ctrl) { - //use new core tz interface - if (tmi.prepareList) { - //set the adress of our timezone handle as itemdata - //caller can obtain the handle htz to extract all relevant information - ctrl->_curSel = 0; - tmi.prepareList(NULL, NULL, hCtrl, TZF_PLF_CB); - } - //fallback use old UIEX method - else { - ctrl->_curSel = ComboBox_AddString(hCtrl, TranslateT("")); - if (SUCCEEDED(ctrl->_curSel)) { - ComboBox_SetItemData(hCtrl, ctrl->_curSel, NULL); - } - ComboBox_SetCurSel(hCtrl, ctrl->_curSel); - EnumTimeZones(EnumNamesProc, (LPARAM)hCtrl); - } + //set the adress of our timezone handle as itemdata + //caller can obtain the handle htz to extract all relevant information + ctrl->_curSel = 0; + TimeZone_PrepareList(NULL, NULL, hCtrl, TZF_PLF_CB); } return (ctrl); } @@ -130,7 +117,7 @@ int CTzCombo::Find(LPTIME_ZONE_INFORMATION pTimeZone) const int nItemCount = ComboBox_GetCount(_hwnd); for (nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++) { - if (pTimeZone == tmi.getTzi((HANDLE)ComboBox_GetItemData(_hwnd, nItemIndex))) + if (pTimeZone == TimeZone_GetInfo((HANDLE)ComboBox_GetItemData(_hwnd, nItemIndex))) return nItemIndex; } return CB_ERR; @@ -160,31 +147,10 @@ void CTzCombo::Release() BOOL CTzCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) { if (!_Flags.B.hasChanged) { - //use new core tz interface to change the cbbox - if (tmi.storeListResults) { - _curSel = CB_ERR; -// _curSel = tmi.selectListItem(hContact, _hwnd, TZF_PLF_CB); - //dident work well, coz no fallback to proto setting. - //we use saver way by getTziByContact - LPTIME_ZONE_INFORMATION pTimeZone; - pTimeZone = tmi.getTziByContact(hContact); - ComboBox_SetCurSel(_hwnd, Find(pTimeZone)); - _curSel = ComboBox_GetCurSel(_hwnd); - } - //fallback use old UIEX method - else { - CTimeZone *pTimeZone; - _curSel = CB_ERR; - _Flags.W = GetContactTimeZoneCtrl(hContact, pszProto, &pTimeZone); - if (_Flags.W) { - ComboBox_SetCurSel(_hwnd, Find(pTimeZone)); - _curSel = ComboBox_GetCurSel(_hwnd); - } - if (_curSel == CB_ERR) { - ComboBox_SetCurSel(_hwnd, NULL); - _curSel = ComboBox_GetCurSel(_hwnd); - } - } + LPTIME_ZONE_INFORMATION pTimeZone; + pTimeZone = getTziByContact(hContact); + ComboBox_SetCurSel(_hwnd, Find(pTimeZone)); + _curSel = ComboBox_GetCurSel(_hwnd); SendMessage(GetParent(_hwnd), WM_TIMER, 0, 0); } return _Flags.B.hasChanged; @@ -205,28 +171,12 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) const char* pszModule = hContact ? USERINFO : pszProto; if (_Flags.B.hasCustom || !hContact) { //use new core tz interface - if (tmi.storeListResults) { - tmi.storeListResults(hContact, NULL, _hwnd, TZF_PLF_CB); - if (!hContact) { - _Flags.B.hasCustom = 0; - _Flags.B.hasProto = 1; - } - _Flags.B.hasChanged = 0; - } - //fallback use old UIEX method - else { - const CTimeZone* pTimeZone = (CTimeZone*)ComboBox_GetItemData(_hwnd, _curSel); - if (PtrIsValid(pTimeZone)) { - db_set_ts(hContact, USERINFO, SET_CONTACT_TIMEZONENAME, pTimeZone->ptszName); - db_set_b(hContact, pszModule, SET_CONTACT_TIMEZONE, pTimeZone->ToMirandaTimezone()); - - if (!hContact) { - _Flags.B.hasCustom = 0; - _Flags.B.hasProto = 1; - } - _Flags.B.hasChanged = 0; - } + TimeZone_StoreListResult(hContact, NULL, _hwnd, TZF_PLF_CB); + if (!hContact) { + _Flags.B.hasCustom = 0; + _Flags.B.hasProto = 1; } + _Flags.B.hasChanged = 0; } if (_Flags.B.hasChanged) @@ -275,5 +225,5 @@ void CTzCombo::OnChangedByUser(WORD wChangedMsg) **/ void CTzCombo::GetTime(LPTSTR szTime, int cchTime) { - tmi.printDateTime((HANDLE)ComboBox_GetItemData(_hwnd, _curSel), _T("t"), szTime, cchTime, 0); + TimeZone_PrintDateTime((HANDLE)ComboBox_GetItemData(_hwnd, _curSel), _T("t"), szTime, cchTime, 0); } diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index ab35aa96e5..77324e2eee 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -170,9 +170,6 @@ extern "C" int __declspec(dllexport) Load(void) // init clist interface mir_getCLI(); - // init new miranda timezone interface - mir_getTMI(&tmi); - // init freeimage interface INT_PTR result = CALLSERVICE_NOTFOUND; if (ServiceExists(MS_IMG_GETINTERFACE)) @@ -196,7 +193,7 @@ extern "C" int __declspec(dllexport) Load(void) IcoLib_LoadModule(); SvcFlagsLoadModule(); - tmi.getTimeZoneTime ? SvcTimezoneLoadModule() : SvcTimezoneLoadModule_old(); + SvcTimezoneLoadModule(); SvcContactInfoLoadModule(); SvcEMailLoadModule(); SvcRefreshContactInfoLoadModule(); diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 2d0b2c20c0..4c71f2c8e2 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -418,13 +418,8 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam DBGetCheckBtn(hDlg, CHECK_OPT_BUTTONICONS, SET_ICONS_BUTTONS, TRUE); DBGetCheckBtn(hDlg, CHECK_OPT_METASCAN, SET_META_SCAN, TRUE); DBGetCheckBtn(hDlg, CHECK_OPT_SREMAIL_ENABLED, SET_EXTENDED_EMAILSERVICE, TRUE); - if (tmi.getTimeZoneTime) { - CheckDlgButton(hDlg, CHECK_OPT_AUTOTIMEZONE, BST_CHECKED); - EnableWindow(GetDlgItem(hDlg, CHECK_OPT_AUTOTIMEZONE), FALSE); - } - else { - DBGetCheckBtn(hDlg, CHECK_OPT_AUTOTIMEZONE, SET_OPT_AUTOTIMEZONE, TRUE); - } + CheckDlgButton(hDlg, CHECK_OPT_AUTOTIMEZONE, BST_CHECKED); + EnableWindow(GetDlgItem(hDlg, CHECK_OPT_AUTOTIMEZONE), FALSE); bInitialized = 1; break; @@ -435,11 +430,6 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam DBWriteCheckBtn(hDlg, CHECK_OPT_METASCAN, SET_META_SCAN); DBWriteCheckBtn(hDlg, CHECK_OPT_SREMAIL_ENABLED, SET_EXTENDED_EMAILSERVICE); - if (!tmi.getTimeZoneTime) { - DBWriteCheckBtn(hDlg, CHECK_OPT_AUTOTIMEZONE, SET_OPT_AUTOTIMEZONE); - if (IsDlgButtonChecked(hDlg, CHECK_OPT_AUTOTIMEZONE)) - SvcTimezoneSyncWithWindows(); - } } break; diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index 3c53c8e23e..662d300256 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -563,11 +563,10 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) break; case CNF_TIMEZONE: - //use new core tz interface - if (tmi.prepareList) { - HANDLE hTz = tmi.createByContact(ci->hContact, 0, TZF_KNOWNONLY); + { + HANDLE hTz = TimeZone_CreateByContact(ci->hContact, 0, TZF_KNOWNONLY); if (hTz) { - LPTIME_ZONE_INFORMATION tzi = tmi.getTzi(hTz); + LPTIME_ZONE_INFORMATION tzi = TimeZone_GetInfo(hTz); int offset = tzi->Bias + tzi->StandardBias; char str[80]; @@ -577,27 +576,9 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) return 0; } ci->pszVal = NULL; + ci->type = (ci->pszVal != NULL) ? CNFT_ASCIIZ : 0; + result = ci->type == 0; } - //fallback use old UIEX method - else { - CTimeZone* ptz = GetContactTimeZone(ci->hContact, ci->szProto); - if (ptz) { - if (ci->dwFlag & CNF_UNICODE) - ci->pszVal = (LPTSTR)mir_t2u(ptz->ptszDisplay); - else - ci->pszVal = (LPTSTR)mir_t2a(ptz->ptszDisplay); - } - else { - /* If a timezone does not exist in CTzMgr, it is a invalid timezone, - because Windows and CTzMgr know all existing timezones and it - would not be shown anywhere anyway as UserInfoEx displays only - known windows timezones in the details dialog! - */ - ci->pszVal = NULL; - } - } - ci->type = (ci->pszVal != NULL) ? CNFT_ASCIIZ : 0; - result = ci->type == 0; break; // diff --git a/plugins/UserInfoEx/src/svc_timezone.cpp b/plugins/UserInfoEx/src/svc_timezone.cpp index 4b4ccd4053..29605c9c1d 100644 --- a/plugins/UserInfoEx/src/svc_timezone.cpp +++ b/plugins/UserInfoEx/src/svc_timezone.cpp @@ -42,7 +42,7 @@ INT_PTR GetContactTimeZoneInformation(WPARAM wParam, LPARAM lParam) if (lParam == NULL) return (1); //use new core tz interface - LPTIME_ZONE_INFORMATION pTimeZoneInformation = tmi.getTzi(tmi.createByContact(wParam, 0, 0)); + LPTIME_ZONE_INFORMATION pTimeZoneInformation = TimeZone_GetInfo(TimeZone_CreateByContact(wParam, 0, 0)); if (pTimeZoneInformation == NULL) return (1); memcpy((void *)lParam, pTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); @@ -62,7 +62,7 @@ INT_PTR GetContactLocalTime(WPARAM wParam, LPARAM lParam) { //use new core tz interface LPSYSTEMTIME pSystemTime = (LPSYSTEMTIME)lParam; - return (INT_PTR)tmi.getTimeZoneTimeByContact(wParam, pSystemTime); + return (INT_PTR)getTimeZoneTimeByContact(wParam, pSystemTime); } /*********************************************************************************************************** diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp index b859507240..05809e970b 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp @@ -590,16 +590,3 @@ INT_PTR GetContactLocalTime_old(WPARAM wParam, LPARAM lParam) /*********************************************************************************************************** * initialization ***********************************************************************************************************/ - -/** -* This function initially loads the module upon startup. -**/ - -void SvcTimezoneLoadModule_old() -{ - TzMgr.Init(); - CreateServiceFunction(MS_USERINFO_TIMEZONEINFO, GetContactTimeZoneInformation); - CreateServiceFunction(MS_USERINFO_LOCALTIME, GetContactLocalTime); - if (db_get_b(NULL, MODNAME, SET_OPT_AUTOTIMEZONE, TRUE)) - SvcTimezoneSyncWithWindows(); -} diff --git a/plugins/UserInfoEx/src/svc_timezone_old.h b/plugins/UserInfoEx/src/svc_timezone_old.h index 040f272ec6..a28e16a071 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.h +++ b/plugins/UserInfoEx/src/svc_timezone_old.h @@ -88,6 +88,5 @@ INT_PTR GetContactTimeZoneInformation_old(WPARAM wParam, LPARAM lParam); INT_PTR GetContactLocalTime_old(WPARAM wParam, LPARAM lParam); void SvcTimezoneSyncWithWindows(); -void SvcTimezoneLoadModule_old(); #endif /* _SVC_TIMEZONE_H_OLD */ \ No newline at end of file diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h index eb7b084579..4aa0a2602e 100644 --- a/plugins/Utils/mir_buffer.h +++ b/plugins/Utils/mir_buffer.h @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. #include #include +#include template static inline size_t __blen(const T *str) @@ -467,11 +468,7 @@ static void ReplaceVars(Buffer *buffer, MCONTACT hContact, TCHAR **variab else if (foundLen == 6 && _tcsncmp(&buffer->str[j], _T("%date%"), 6) == 0) { TCHAR tmp[128]; - DBTIMETOSTRINGT tst = {0}; - tst.szFormat = _T("d s"); - tst.szDest = tmp; - tst.cbDest = SIZEOF(tmp); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM) time(NULL), (LPARAM) &tst); + TimeZone_ToStringT(time(NULL), _T("d s"), tmp, SIZEOF(tmp)); buffer->replace(j, i + 1, tmp); } else diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 2710effbf0..bd07c2c23d 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -712,14 +712,7 @@ static TCHAR *parseMirDateString(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE; TCHAR ret[128]; - DBTIMETOSTRINGT tst = { 0 }; - tst.szFormat = _T("d s"); - tst.szDest = ret; - tst.cbDest = SIZEOF(ret); - if (CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)time(NULL), (LPARAM)&tst)) - return NULL; - - return mir_tstrdup(ret); + return mir_tstrdup(TimeZone_ToStringT(time(NULL), _T("d s"), ret, SIZEOF(ret))); } static TCHAR *parseMirandaCoreVar(ARGUMENTSINFO *ai) diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h index 4d65579e74..49b4bbba01 100644 --- a/plugins/Variables/src/variables.h +++ b/plugins/Variables/src/variables.h @@ -44,6 +44,7 @@ #include #include #include +#include #include diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 590dc5a25b..5aeb0eda6c 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1063,7 +1063,7 @@ ULONGLONG MimeDateToFileTime(char *datein) char *day = 0, *month = 0, *year = 0, *time = 0, *shift = 0; SYSTEMTIME st; ULONGLONG res = 0; - int wShiftSeconds = CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, 0, 0); + int wShiftSeconds = TimeZone_ToLocal(0); GetLocalTime(&st); //datein = "Xxx, 1 Jan 2060 5:29:1 +0530 XXX"; //datein = "Xxx, 1 Jan 2060 05:29:10 "; diff --git a/plugins/YAMN/src/yamn.h b/plugins/YAMN/src/yamn.h index 29955fcc7c..11f8ae0569 100644 --- a/plugins/YAMN/src/yamn.h +++ b/plugins/YAMN/src/yamn.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3