From 7e7e825f9db54674870e289eb6505427dd8a542c Mon Sep 17 00:00:00 2001 From: sje Date: Tue, 22 May 2007 14:17:51 +0000 Subject: added timezone translation git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@177 4f64403b-2f21-0410-a795-97e2b3489a10 --- tipper/common.h | 1 + tipper/m_tipper.h | 2 +- tipper/tipper.mdsp | 7 +-- tipper/tipper_8.sln | 3 ++ tipper/tipper_8.vcproj | 133 ++++++++++++++++++++++++++++++++++++++++++++++++ tipper/translations.cpp | 31 ++++++++++- tipper/version.h | 2 +- 7 files changed, 173 insertions(+), 6 deletions(-) diff --git a/tipper/common.h b/tipper/common.h index fa8541c..3cf7253 100644 --- a/tipper/common.h +++ b/tipper/common.h @@ -39,6 +39,7 @@ #define MIRANDA_VER 0x0600 // for tabbed options +#include #include #include #include diff --git a/tipper/m_tipper.h b/tipper/m_tipper.h index 790ec26..e5a5a16 100644 --- a/tipper/m_tipper.h +++ b/tipper/m_tipper.h @@ -38,4 +38,4 @@ typedef struct { #define MS_AWAY_GETPROTOSTATUSMESSAGET MS_AWAY_GETPROTOSTATUSMESSAGEW #else #define MS_AWAY_GETPROTOSTATUSMESSAGET MS_AWAY_GETPROTOSTATUSMESSAGE -#endif \ No newline at end of file +#endif diff --git a/tipper/tipper.mdsp b/tipper/tipper.mdsp index 01d8952..aa71f20 100644 --- a/tipper/tipper.mdsp +++ b/tipper/tipper.mdsp @@ -104,7 +104,8 @@ extraResourceOptions= 1=resource.rc [Other] [History] -message_pump.cpp,4377 -tipper.cpp,1265 +version.h,586 popwin.cpp,2562 -version.h,820 +tipper.cpp,1265 +message_pump.cpp,4377 +m_tipper.h,1664 diff --git a/tipper/tipper_8.sln b/tipper/tipper_8.sln index ef56c93..467d54a 100644 --- a/tipper/tipper_8.sln +++ b/tipper/tipper_8.sln @@ -6,11 +6,14 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Release (ansi)|Win32 = Release (ansi)|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {2C818919-A38F-44FF-BD91-A6A204AC592A}.Debug|Win32.ActiveCfg = Debug|Win32 {2C818919-A38F-44FF-BD91-A6A204AC592A}.Debug|Win32.Build.0 = Debug|Win32 + {2C818919-A38F-44FF-BD91-A6A204AC592A}.Release (ansi)|Win32.ActiveCfg = Release (ansi)|Win32 + {2C818919-A38F-44FF-BD91-A6A204AC592A}.Release (ansi)|Win32.Build.0 = Release (ansi)|Win32 {2C818919-A38F-44FF-BD91-A6A204AC592A}.Release|Win32.ActiveCfg = Release|Win32 {2C818919-A38F-44FF-BD91-A6A204AC592A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection diff --git a/tipper/tipper_8.vcproj b/tipper/tipper_8.vcproj index 51e763e..9a2c9c1 100644 --- a/tipper/tipper_8.vcproj +++ b/tipper/tipper_8.vcproj @@ -180,6 +180,91 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + + @@ -208,6 +293,14 @@ UsePrecompiledHeader="2" /> + + + + + + + + + + + + + + + + + + diff --git a/tipper/translations.cpp b/tipper/translations.cpp index 17ce9b1..7dcc1fe 100644 --- a/tipper/translations.cpp +++ b/tipper/translations.cpp @@ -550,6 +550,31 @@ TCHAR *empty_xStatus_name_to_default_name(HANDLE hContact, const char *module_na return buff; } +TCHAR *timezone_to_time(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { + int timezone = DBGetContactSettingByte(hContact,module_name,setting_name,256); + if(timezone==256 || (char)timezone==-100) { + return 0; + } + + TIME_ZONE_INFORMATION tzi; + FILETIME ft; + LARGE_INTEGER lift; + SYSTEMTIME st; + + timezone=(char)timezone; + GetSystemTimeAsFileTime(&ft); + if(GetTimeZoneInformation(&tzi) == TIME_ZONE_ID_DAYLIGHT) + timezone += tzi.DaylightBias / 30; + + lift.QuadPart = *(__int64*)&ft; + lift.QuadPart -= (__int64)timezone * BIGI(30) * BIGI(60) * BIGI(10000000); + *(__int64*)&ft = lift.QuadPart; + FileTimeToSystemTime(&ft, &st); + GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buff, bufflen); + + return buff; +} + int ServiceAddTranslation(WPARAM wParam, LPARAM lParam) { if(!lParam) return 1; @@ -562,7 +587,7 @@ int ServiceAddTranslation(WPARAM wParam, LPARAM lParam) { void InitTranslations() { next_func_id = DBGetContactSettingDword(0, MODULE, "NextFuncId", 1); -#define INT_TRANS_COUNT 18 +#define INT_TRANS_COUNT 19 DBVTranslation internal_translations[INT_TRANS_COUNT] = { { (TranslateFunc*)null_translation, @@ -635,6 +660,10 @@ void InitTranslations() { { (TranslateFunc*)seconds_to_time_difference, _T("DWORD seconds to time difference") + }, + { + (TranslateFunc*)timezone_to_time, + _T("BYTE timezone to time") } }; diff --git a/tipper/version.h b/tipper/version.h index 28f3f31..85f17ca 100644 --- a/tipper/version.h +++ b/tipper/version.h @@ -4,7 +4,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 4 #define __RELEASE_NUM 0 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -- cgit v1.2.3