diff options
-rw-r--r-- | worldtime_protocol/WorldTime.rc | 182 | ||||
-rw-r--r-- | worldtime_protocol/common.h | 38 | ||||
-rw-r--r-- | worldtime_protocol/icon_proto.ico | bin | 0 -> 1078 bytes | |||
-rw-r--r-- | worldtime_protocol/options.cpp | 330 | ||||
-rw-r--r-- | worldtime_protocol/options.h | 18 | ||||
-rw-r--r-- | worldtime_protocol/resource.h | 53 | ||||
-rw-r--r-- | worldtime_protocol/time_convert.cpp | 210 | ||||
-rw-r--r-- | worldtime_protocol/time_convert.h | 32 | ||||
-rw-r--r-- | worldtime_protocol/time_display.cpp | 221 | ||||
-rw-r--r-- | worldtime_protocol/time_display.h | 14 | ||||
-rw-r--r-- | worldtime_protocol/timezone.cpp | 70 | ||||
-rw-r--r-- | worldtime_protocol/timezone.h | 44 | ||||
-rw-r--r-- | worldtime_protocol/timezone_list.cpp | 81 | ||||
-rw-r--r-- | worldtime_protocol/timezone_list.h | 24 | ||||
-rw-r--r-- | worldtime_protocol/worldtimeproto.cpp | 456 | ||||
-rw-r--r-- | worldtime_protocol/worldtimeproto.dsp | 177 | ||||
-rw-r--r-- | worldtime_protocol/worldtimeproto.dsw | 29 | ||||
-rw-r--r-- | worldtime_protocol/worldtimeproto.h | 42 | ||||
-rw-r--r-- | worldtime_protocol/worldtimeproto.plg | 25 | ||||
-rw-r--r-- | worldtime_protocol/worldtimeproto.sln | 20 | ||||
-rw-r--r-- | worldtime_protocol/worldtimeproto.vcproj | 423 |
21 files changed, 2489 insertions, 0 deletions
diff --git a/worldtime_protocol/WorldTime.rc b/worldtime_protocol/WorldTime.rc new file mode 100644 index 0000000..f236f13 --- /dev/null +++ b/worldtime_protocol/WorldTime.rc @@ -0,0 +1,182 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_DIALOG1 DIALOG 0, 0, 327, 255
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Configuration",IDC_STATIC,7,7,313,241
+ GROUPBOX "Interface",IDC_STATIC,28,17,273,91
+ GROUPBOX "Times",IDC_STATIC,28,110,272,129
+ LISTBOX IDC_LIST_TIMES2,53,126,221,80,LBS_NOINTEGRALHEIGHT |
+ WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Remove",IDC_BTN_REM,191,215,42,16,WS_DISABLED
+ CONTROL "Format Date",IDC_CHK_FORMAT,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,38,36,62,10
+ EDITTEXT IDC_ED_FORMAT,209,35,78,12,ES_AUTOHSCROLL
+ CTEXT "and Time",IDC_STATIC,162,36,43,8
+ EDITTEXT IDC_ED_DATE_FORMAT,107,35,51,12,ES_AUTOHSCROLL
+ PUSHBUTTON "Edit",IDC_BTN_EDIT,142,215,42,16,WS_DISABLED
+ PUSHBUTTON "Add",IDC_BTN_ADD,93,215,42,16
+ LTEXT "%n = label",IDC_STATIC,230,55,67,8
+ LTEXT "%d = date",IDC_STATIC,230,71,67,8
+ LTEXT "%t = time",IDC_STATIC,230,63,67,8
+ LTEXT "Contact List:",IDC_STATIC,66,69,52,8
+ EDITTEXT IDC_ED_CLIST_FORMAT,123,66,98,14,ES_AUTOHSCROLL
+ CONTROL "Hide in status bar and status menu (requires restart - uncheck to set icons)",
+ IDC_CHK_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,90,
+ 261,10
+ LTEXT "%o = offset",IDC_STATIC,230,79,67,8
+END
+
+IDD_DIALOG2 DIALOG 0, 0, 296, 174
+STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Time Details"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,95,153,50,14,WS_DISABLED
+ PUSHBUTTON "Cancel",IDCANCEL,150,153,50,14
+ LISTBOX IDC_LIST_TIMES,43,39,208,46,LBS_NOINTEGRALHEIGHT |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_ED_DISP,43,92,208,14,ES_AUTOHSCROLL | ES_READONLY
+ LTEXT "Label:",IDC_STATIC,68,131,20,8
+ EDITTEXT IDC_ED_LABEL,94,129,133,14,ES_AUTOHSCROLL | WS_DISABLED
+ CONTROL "Alphabetical",IDC_RAD_ALPHA,"Button",BS_AUTORADIOBUTTON,
+ 88,25,55,10
+ CONTROL "Geographical",IDC_RAD_GEO,"Button",BS_AUTORADIOBUTTON,
+ 151,25,58,10
+ LTEXT "Sort Order:",IDC_STATIC,44,25,35,8
+END
+
+IDD_DISPLAY DIALOGEX 0, 0, 163, 66
+STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
+ WS_THICKFRAME
+EXSTYLE WS_EX_TOOLWINDOW
+CAPTION "Time"
+FONT 16, "Tahoma", 0, 0, 0x0
+BEGIN
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_DIALOG1, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 320
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 248
+ END
+
+ IDD_DIALOG2, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 289
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 167
+ END
+
+ IDD_DISPLAY, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 156
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 59
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON_PROTO ICON "icon_proto.ico"
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/worldtime_protocol/common.h b/worldtime_protocol/common.h new file mode 100644 index 0000000..da1e9da --- /dev/null +++ b/worldtime_protocol/common.h @@ -0,0 +1,38 @@ +#ifndef _COMMON_H
+#define _COMMON_H
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define VC_EXTRALEAN
+
+#define _WIN32_WINNT 0x0400
+#include <windows.h>
+#include <prsht.h>
+#include <winsock2.h>
+#include <winsock.h>
+#include <shellapi.h>
+#include <commdlg.h>
+
+#define PROTO "WorldTime"
+
+#include <stdio.h>
+
+#include "../../include/newpluginapi.h"
+#include "../../include/statusmodes.h"
+#include "../../include/m_options.h"
+#include "../../include/m_langpack.h"
+#include "../../include/m_popup.h"
+#include "../../include/m_system.h"
+#include "../../include/m_skin.h"
+#include "../../include/m_netlib.h"
+#include "../../include/m_database.h"
+#include "../../include/m_protocols.h"
+#include "../../include/m_protomod.h"
+#include "../../include/m_protosvc.h"
+#include "../../include/m_ignore.h"
+#include "../../include/m_clist.h"
+#include "../../include/m_clui.h"
+#include "../../include/m_utils.h"
+
+extern HINSTANCE hInst;
+
+#endif
diff --git a/worldtime_protocol/icon_proto.ico b/worldtime_protocol/icon_proto.ico Binary files differnew file mode 100644 index 0000000..49090ae --- /dev/null +++ b/worldtime_protocol/icon_proto.ico diff --git a/worldtime_protocol/options.cpp b/worldtime_protocol/options.cpp new file mode 100644 index 0000000..9e2c750 --- /dev/null +++ b/worldtime_protocol/options.cpp @@ -0,0 +1,330 @@ +#include "common.h"
+#include "options.h"
+
+bool set_format = false, hide_proto = false;
+TCHAR format_string[512], date_format_string[512], clist_format_string[512];
+
+ITEMLIST temp_listbox_items;
+
+void fill_timezone_list_control(HWND hwndDlg) {
+ int index = 0;
+
+ HWND hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
+ SendMessage(hw, LB_RESETCONTENT, 0, 0);
+
+ if(IsDlgButtonChecked(hwndDlg, IDC_RAD_ALPHA)) {
+
+ for(TimeList::iterator i = timezone_list.begin(); i != timezone_list.end(); i++, index++) {
+ SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->tcName);
+ SendMessage(hw, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i->list_index);
+ }
+ } else {
+ for(TimeList::iterator i = geo_timezone_list.begin(); i != geo_timezone_list.end(); i++, index++) {
+ SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->tcName);
+ SendMessage(hw, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i->list_index);
+ }
+ }
+}
+
+LISTITEM add_edit_item;
+
+BOOL CALLBACK DlgProcOptsEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ HWND hw;
+ int sel;
+ char buf[MAX_NAME_LENGTH];
+
+ switch ( msg ) {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault( hwndDlg );
+
+ CheckDlgButton(hwndDlg, IDC_RAD_ALPHA, 1);
+ CheckDlgButton(hwndDlg, IDC_RAD_GEO, 0);
+
+ fill_timezone_list_control(hwndDlg);
+
+ if(add_edit_item.timezone_list_index != -1) {
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
+ SendMessage(hw, LB_SELECTSTRING, (WPARAM)-1, (LPARAM)timezone_list[add_edit_item.timezone_list_index].tcName);
+ SetDlgItemText(hwndDlg, IDC_ED_LABEL, add_edit_item.pszText);
+
+ hw = GetDlgItem(hwndDlg, IDC_ED_LABEL);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+
+ hw = GetDlgItem(hwndDlg, IDC_ED_DISP);
+ SetWindowText(hw, timezone_list[add_edit_item.timezone_list_index].tcDisp);
+ }
+ }
+ break;
+
+ case WM_COMMAND:
+ if (HIWORD( wParam ) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_TIMES) {
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
+ sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
+ if(sel != LB_ERR) {
+ hw = GetDlgItem(hwndDlg, IDC_ED_LABEL);
+ EnableWindow(hw, sel != -1);
+ if(sel == -1)
+ add_edit_item.timezone_list_index = -1;
+ else {
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
+ add_edit_item.timezone_list_index = (int)SendMessage(hw, LB_GETITEMDATA, sel, 0);
+
+ hw = GetDlgItem(hwndDlg, IDC_ED_DISP);
+ SetWindowText(hw, timezone_list[add_edit_item.timezone_list_index].tcDisp);
+ }
+ }
+ }
+
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ switch( LOWORD( wParam )) {
+ case IDC_ED_LABEL:
+ GetDlgItemText(hwndDlg, IDC_ED_LABEL, buf, MAX_NAME_LENGTH);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, (strlen(buf) > 0));
+ strncpy(add_edit_item.pszText, buf, MAX_NAME_LENGTH);
+ }
+ }
+
+ if ( HIWORD( wParam ) == BN_CLICKED ) {
+ switch( LOWORD( wParam )) {
+ case IDC_RAD_ALPHA:
+ CheckDlgButton(hwndDlg, IDC_RAD_GEO, 0);
+ fill_timezone_list_control(hwndDlg);
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
+ SendMessage(hw, LB_SELECTSTRING, (WPARAM)-1, (LPARAM)timezone_list[add_edit_item.timezone_list_index].tcName);
+ break;
+ case IDC_RAD_GEO:
+ CheckDlgButton(hwndDlg, IDC_RAD_ALPHA, 0);
+ fill_timezone_list_control(hwndDlg);
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
+ SendMessage(hw, LB_SELECTSTRING, (WPARAM)-1, (LPARAM)timezone_list[add_edit_item.timezone_list_index].tcName);
+ break;
+ case IDOK:
+ EndDialog(hwndDlg, IDOK);
+ break;
+ case IDCANCEL:
+ EndDialog(hwndDlg, IDCANCEL);
+ break;
+ }
+ }
+ break;
+ }
+ return FALSE;
+}
+
+static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+
+ HWND hw;
+ int sel, index;
+
+ switch ( msg ) {
+ case WM_INITDIALOG: {
+ TranslateDialogDefault( hwndDlg );
+
+ load_listbox_items();
+ temp_listbox_items = listbox_items;
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
+
+ index = 0;
+ for(ITEMLIST::iterator ili = temp_listbox_items.begin(); ili != temp_listbox_items.end(); ili++, index++) {
+ sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)&ili->pszText);
+ }
+
+ bool set_format = (DBGetContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", 0) == 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_FORMAT, set_format ? 1 : 0);
+ bool hide_proto = (DBGetContactSettingByte(NULL, "WorldTime", "HideProtocol", 0) == 1);
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDE, hide_proto ? 1 : 0);
+ DBVARIANT dbv;
+ if(!DBGetContactSetting(NULL, "WorldTime", "TimeFormat", &dbv))
+ strcpy(format_string, dbv.pszVal);
+ DBFreeVariant(&dbv);
+ SetDlgItemText(hwndDlg, IDC_ED_FORMAT, format_string);
+ if(!DBGetContactSetting(NULL, "WorldTime", "DateFormat", &dbv))
+ strcpy(date_format_string, dbv.pszVal);
+ DBFreeVariant(&dbv);
+ SetDlgItemText(hwndDlg, IDC_ED_DATE_FORMAT, date_format_string);
+ if(!DBGetContactSetting(NULL, "WorldTime", "CListFormat", &dbv))
+ strcpy(clist_format_string, dbv.pszVal);
+ DBFreeVariant(&dbv);
+ SetDlgItemText(hwndDlg, IDC_ED_CLIST_FORMAT, clist_format_string);
+
+ if(!set_format) {
+ hw = GetDlgItem(hwndDlg, IDC_ED_FORMAT);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_ED_DATE_FORMAT);
+ EnableWindow(hw, FALSE);
+ }
+
+ return TRUE;
+ }
+ case WM_COMMAND:
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ switch( LOWORD( wParam )) {
+ case IDC_ED_FORMAT:
+ case IDC_ED_DATE_FORMAT:
+ case IDC_ED_CLIST_FORMAT:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+
+ if (HIWORD( wParam ) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_TIMES2) {
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
+ sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
+ if(sel != LB_ERR) {
+ hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
+ EnableWindow(hw, sel != -1);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
+ EnableWindow(hw, sel != -1);
+ }
+ }
+
+ if ( HIWORD( wParam ) == BN_CLICKED ) {
+ switch( LOWORD( wParam )) {
+ case IDC_BTN_EDIT:
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
+ sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
+ if(sel != LB_ERR && sel != -1) {
+
+ add_edit_item = temp_listbox_items[sel];
+ if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndDlg, DlgProcOptsEdit) == IDOK) {
+ temp_listbox_items[sel] = add_edit_item;
+
+ SendMessage(hw, LB_DELETESTRING, (WPARAM)sel, (LPARAM)0);
+ SendMessage(hw, LB_INSERTSTRING, (WPARAM)sel, (LPARAM)add_edit_item.pszText);
+ SendMessage(hw, LB_SETCURSEL, (WPARAM)sel, 0);
+
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ }
+ }
+ break;
+
+ case IDC_BTN_ADD:
+
+ add_edit_item.pszText[0] = '\0';
+ add_edit_item.timezone_list_index = -1;
+ add_edit_item.hContact = 0;
+
+ if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndDlg, DlgProcOptsEdit) == IDOK) {
+ temp_listbox_items.push_back(add_edit_item);
+
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
+ sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)add_edit_item.pszText);
+ SendMessage(hw, LB_SETCURSEL, (WPARAM)sel, 0);
+
+ hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
+ EnableWindow(hw, TRUE);
+
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ }
+ break;
+
+ case IDC_BTN_REM:
+ hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
+ sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
+ if(sel != LB_ERR) {
+ SendMessage(hw, LB_DELETESTRING, (WPARAM)sel, 0);
+
+ {
+ ITEMLIST::iterator i = temp_listbox_items.begin();
+ for(int j = 0; j < sel; j++)
+ i++;
+ temp_listbox_items.erase(i);
+ }
+
+ hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
+ EnableWindow(hw, FALSE);
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ }
+ break;
+ case IDC_CHK_FORMAT:
+ hw = GetDlgItem(hwndDlg, IDC_ED_FORMAT);
+ EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_FORMAT));
+ hw = GetDlgItem(hwndDlg, IDC_ED_DATE_FORMAT);
+ EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_FORMAT));
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ break;
+ case IDC_CHK_HIDE:
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ break;
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
+ set_format = IsDlgButtonChecked(hwndDlg, IDC_CHK_FORMAT) == BST_CHECKED;
+ DBWriteContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", set_format ? 1 : 0);
+ hide_proto = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE) == BST_CHECKED;
+ DBWriteContactSettingByte(NULL, "WorldTime", "HideProtocol", hide_proto ? 1 : 0);
+
+ char buf[512];
+ GetDlgItemText(hwndDlg, IDC_ED_FORMAT, buf, 512);
+ DBWriteContactSettingString(NULL, "WorldTime", "TimeFormat", buf);
+ strncpy(format_string, buf, 512);
+
+ GetDlgItemText(hwndDlg, IDC_ED_DATE_FORMAT, buf, 512);
+ DBWriteContactSettingString(NULL, "WorldTime", "DateFormat", buf);
+ strncpy(date_format_string, buf, 512);
+
+ GetDlgItemText(hwndDlg, IDC_ED_CLIST_FORMAT, buf, 512);
+ DBWriteContactSettingString(NULL, "WorldTime", "CListFormat", buf);
+ strncpy(clist_format_string, buf, 512);
+
+ listbox_items = temp_listbox_items;
+ save_listbox_items();
+ temp_listbox_items = listbox_items; // copy back new hContact values
+
+ return TRUE;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+int OptInit(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.cbSize = sizeof(odp);
+ odp.position = -790000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG1);
+ odp.pszTitle = Translate("World Time");
+ odp.pszGroup = Translate("Plugins");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.nIDBottomSimpleControl = IDC_PPM;
+ odp.pfnDlgProc = DlgProcOpts;
+ CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+
+ return 0;
+}
+
+void LoadOptions() {
+ set_format = (DBGetContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", 0) == 1);
+ hide_proto = (DBGetContactSettingByte(NULL, "WorldTime", "HideProtocol", 0) == 1);
+
+ DBVARIANT dbv;
+ if(!DBGetContactSetting(NULL, "WorldTime", "TimeFormat", &dbv)) {
+ strncpy(format_string, dbv.pszVal, 512);
+ } else
+ strcpy(format_string, "HH:mm");
+ DBFreeVariant(&dbv);
+ if(!DBGetContactSetting(NULL, "WorldTime", "DateFormat", &dbv)) {
+ strncpy(date_format_string, dbv.pszVal, 512);
+ } else
+ strcpy(date_format_string, "d/M");
+ DBFreeVariant(&dbv);
+
+ if(!DBGetContactSetting(NULL, "WorldTime", "CListFormat", &dbv)) {
+ strncpy(clist_format_string, dbv.pszVal, 512);
+ } else
+ strcpy(clist_format_string, "%n: %t %d");
+ DBFreeVariant(&dbv);
+}
diff --git a/worldtime_protocol/options.h b/worldtime_protocol/options.h new file mode 100644 index 0000000..501582f --- /dev/null +++ b/worldtime_protocol/options.h @@ -0,0 +1,18 @@ +#ifndef _OPTIONS_INC
+#define _OPTIONS_INC
+
+#include "resource.h"
+
+#include "timezone.h"
+#include "timezone_list.h"
+
+extern bool set_format, hide_proto;
+extern TCHAR format_string[512], date_format_string[512], clist_format_string[512];
+extern LISTITEM add_edit_item;
+
+BOOL CALLBACK DlgProcOptsEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+int OptInit(WPARAM wParam,LPARAM lParam);
+
+void LoadOptions();
+
+#endif
diff --git a/worldtime_protocol/resource.h b/worldtime_protocol/resource.h new file mode 100644 index 0000000..90294d3 --- /dev/null +++ b/worldtime_protocol/resource.h @@ -0,0 +1,53 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by WorldTime.rc
+//
+#define IDD_DIALOG1 101
+#define IDI_ICON_SUN 104
+#define IDI_ICON_MOON 105
+#define IDR_CONTEXT 111
+#define IDD_DIALOG2 112
+#define IDI_ICON_PROTO 113
+#define IDD_DISPLAY 114
+#define IDC_PPM 1001
+#define IDC_PT 1002
+#define IDC_CHECK1 1005
+#define IDC_CHECKPOPUP 1005
+#define IDC_CHK_FORMAT 1005
+#define IDC_BUTTONEDIT 1006
+#define IDC_CHK_ICONS 1006
+#define IDC_BUTTONRELOAD 1007
+#define IDC_CHK_LOG 1008
+#define IDC_ED_FILENAME 1009
+#define IDC_CHECKPOPUP2 1010
+#define IDC_CHK_MINMAX 1011
+#define IDC_CHK_BLOCK 1012
+#define IDC_LIST_TIMES 1012
+#define IDC_ED_DISP 1013
+#define IDC_ED_LABEL 1014
+#define IDC_BTN_ADD 1015
+#define IDC_LIST_TIMES2 1016
+#define IDC_BTN_REM 1017
+#define IDC_RAD_ALPHA 1018
+#define IDC_BTN_EDIT 1018
+#define IDC_RAD_GEO 1019
+#define IDC_ED_FORMAT 1020
+#define IDC_ED_DATE_FORMAT 1021
+#define IDC_BTN_UP 1022
+#define IDC_BTN_DOWN 1023
+#define IDC_CHK_HIDEMENU 1024
+#define IDC_BTN_SHOW 1025
+#define IDC_ED_CLIST_FORMAT 1026
+#define IDC_CHK_HIDE 1027
+#define POPUP_TESTING 40001
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 115
+#define _APS_NEXT_COMMAND_VALUE 40002
+#define _APS_NEXT_CONTROL_VALUE 1031
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/worldtime_protocol/time_convert.cpp b/worldtime_protocol/time_convert.cpp new file mode 100644 index 0000000..571adf3 --- /dev/null +++ b/worldtime_protocol/time_convert.cpp @@ -0,0 +1,210 @@ +#include "common.h"
+#include "time_convert.h"
+
+void ConvertToAbsolute (const SYSTEMTIME * pstLoc, const SYSTEMTIME * pstDst, SYSTEMTIME * pstDstAbs)
+{
+ static int iDays [12] = { 31, 28, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31 } ;
+ int iDay ;
+
+ // Set up the aboluste date structure except for wDay, which we must find
+
+ pstDstAbs->wYear = pstLoc->wYear ; // Notice from local date/time
+ pstDstAbs->wMonth = pstDst->wMonth ;
+ pstDstAbs->wDayOfWeek = pstDst->wDayOfWeek ;
+
+ pstDstAbs->wHour = pstDst->wHour ;
+ pstDstAbs->wMinute = pstDst->wMinute ;
+ pstDstAbs->wSecond = pstDst->wSecond ;
+ pstDstAbs->wMilliseconds = pstDst->wMilliseconds ;
+
+ // Fix the iDays array for leap years
+
+ if ((pstLoc->wYear % 4 == 0) && ((pstLoc->wYear % 100 != 0) ||
+ (pstLoc->wYear % 400 == 0)))
+ {
+ iDays[1] = 29 ;
+ }
+
+ // Find a day of the month that falls on the same
+ // day of the week as the transition.
+
+ // Suppose today is the 20th of the month (pstLoc->wDay = 20)
+ // Suppose today is a Wednesday (pstLoc->wDayOfWeek = 3)
+ // Suppose the transition occurs on a Friday (pstDst->wDayOfWeek = 5)
+ // Then iDay = 31, meaning that the 31st falls on a Friday
+ // (The 7 is this formula avoids negatives.)
+
+ iDay = pstLoc->wDay + pstDst->wDayOfWeek + 7 - pstLoc->wDayOfWeek ;
+
+ // Now shrink iDay to a value between 1 and 7.
+
+ iDay = (iDay - 1) % 7 + 1 ;
+
+ // Now iDay is a day of the month ranging from 1 to 7.
+ // Recall that the wDay field of the structure can range
+ // from 1 to 5, 1 meaning "first", 2 meaning "second",
+ // and 5 meaning "last".
+ // So, increase iDay so it's the proper day of the month.
+
+ iDay += 7 * (pstDst->wDay - 1) ;
+
+ // Could be that iDay overshot the end of the month, so
+ // fix it up using the number of days in each month
+
+ if (iDay > iDays[pstDst->wMonth - 1])
+ iDay -= 7 ;
+
+ // Assign that day to the structure.
+
+ pstDstAbs->wDay = iDay ;
+}
+
+BOOL LocalGreaterThanTransition (const SYSTEMTIME * pstLoc, const SYSTEMTIME * pstTran)
+{
+ FILETIME ftLoc, ftTran ;
+ LARGE_INTEGER liLoc, liTran ;
+ SYSTEMTIME stTranAbs ;
+
+ // Easy case: Just compare the two months
+
+ if (pstLoc->wMonth != pstTran->wMonth)
+ return (pstLoc->wMonth > pstTran->wMonth) ;
+
+ // Well, we're in a transition month. That requires a bit more work.
+
+ // Check if pstDst is in absolute or day-in-month format.
+ // (See documentation of TIME_ZONE_INFORMATION, StandardDate field.)
+
+ if (pstTran->wYear) // absolute format (haven't seen one yet!)
+ {
+ stTranAbs = * pstTran ;
+ }
+ else // day-in-month format
+ {
+ ConvertToAbsolute (pstLoc, pstTran, &stTranAbs) ;
+ }
+
+ // Now convert both date/time structures to large integers & compare
+
+ SystemTimeToFileTime (pstLoc, &ftLoc) ;
+ liLoc = * (LARGE_INTEGER *) (void *) &ftLoc ;
+
+ SystemTimeToFileTime (&stTranAbs, &ftTran) ;
+ liTran = * (LARGE_INTEGER *) (void *) &ftTran ;
+
+ return (liLoc.QuadPart > liTran.QuadPart) ;
+}
+
+BOOL MySystemTimeToTzSpecificLocalTime(const TIME_ZONE_INFORMATION *ptzi, const SYSTEMTIME *pstUtc, SYSTEMTIME *pstLoc) {
+ // st is UTC
+
+ FILETIME ft ;
+ LARGE_INTEGER li ;
+ SYSTEMTIME stDst ;
+
+ // If we're running under NT, just call the real function
+
+ if (!(0x80000000 & GetVersion()))
+ return SystemTimeToTzSpecificLocalTime ((TIME_ZONE_INFORMATION *) ptzi, (SYSTEMTIME *) pstUtc, pstLoc) ;
+
+ // Convert time to a LARGE_INTEGER and subtract the bias
+
+ SystemTimeToFileTime (pstUtc, &ft) ;
+ li = * (LARGE_INTEGER *) (void *) &ft;
+ li.QuadPart -= (LONGLONG) 600000000 * ptzi->Bias ;
+
+ // Convert to a local date/time before application of daylight saving time.
+ // The local date/time must be used to determine when the conversion occurs.
+
+ ft = * (FILETIME *) (void *) &li ;
+ FileTimeToSystemTime (&ft, pstLoc) ;
+
+ // Find the time assuming Daylight Saving Time
+
+ li.QuadPart -= (LONGLONG) 600000000 * ptzi->DaylightBias ;
+ ft = * (FILETIME *) (void *) &li ;
+ FileTimeToSystemTime (&ft, &stDst) ;
+
+ // Now put li back the way it was
+
+ li.QuadPart += (LONGLONG) 600000000 * ptzi->DaylightBias ;
+
+ if (ptzi->StandardDate.wMonth) // ie, daylight savings time
+ {
+ // Northern hemisphere
+
+ if ((ptzi->DaylightDate.wMonth < ptzi->StandardDate.wMonth) &&
+
+ (stDst.wMonth >= pstLoc->wMonth) && // avoid the end of year problem
+
+ LocalGreaterThanTransition (pstLoc, &ptzi->DaylightDate) &&
+ !LocalGreaterThanTransition (&stDst, &ptzi->StandardDate))
+ {
+ li.QuadPart -= (LONGLONG) 600000000 * ptzi->DaylightBias ;
+ }
+ // Southern hemisphere
+
+ else if ((ptzi->StandardDate.wMonth < ptzi->DaylightDate.wMonth) &&
+ (!LocalGreaterThanTransition (&stDst, &ptzi->StandardDate) ||
+ LocalGreaterThanTransition (pstLoc, &ptzi->DaylightDate)))
+ {
+ li.QuadPart -= (LONGLONG) 600000000 * ptzi->DaylightBias ;
+ }
+ else
+ {
+ li.QuadPart -= (LONGLONG) 600000000 * ptzi->StandardBias ;
+ }
+ }
+
+ ft = * (FILETIME *) (void *) &li ;
+ FileTimeToSystemTime (&ft, pstLoc) ;
+ return TRUE ;
+}
+
+VOID MyGetSystemTime(LPSYSTEMTIME lpSystemTime) {
+ //TIME_ZONE_INFORMATION tzi;
+ //FILETIME ft;
+ //LARGE_INTEGER li;
+
+ GetSystemTime(lpSystemTime);
+ //GetTimeZoneInformation(&tzi);
+
+
+ /*
+ // this condition occurs when 'automaticall adjust for daylight savings' is off, but the timezone info
+ // says it is daylight savings time. The following attempts to correct for this, but assumes that the user
+ // has corrected for DST by changing their clock time rather than their timezone. This is invalid so
+ // it has been removed
+
+ if(tzi.StandardDate.wMonth != 0 && tzi.DaylightBias == 0 && tzi.StandardBias == 0) {
+ if ((tzi.DaylightDate.wMonth < tzi.StandardDate.wMonth) &&
+
+ LocalGreaterThanTransition (lpSystemTime, &tzi.DaylightDate) &&
+ !LocalGreaterThanTransition (lpSystemTime, &tzi.StandardDate))
+ {
+ // add one hour to the system time
+ SystemTimeToFileTime(lpSystemTime, &ft);
+ li = * (LARGE_INTEGER *) (void *) &ft;
+ li.QuadPart += (LONGLONG) 600000000 * 60;
+ ft = * (FILETIME *) (void *) &li ;
+ FileTimeToSystemTime(&ft, lpSystemTime);
+ }
+ // Southern hemisphere
+
+ else if ((tzi.StandardDate.wMonth < tzi.DaylightDate.wMonth) &&
+ (!LocalGreaterThanTransition (lpSystemTime, &tzi.StandardDate) ||
+ LocalGreaterThanTransition (lpSystemTime, &tzi.DaylightDate)))
+ {
+ // add one hour to the system time
+ SystemTimeToFileTime(lpSystemTime, &ft);
+ li = * (LARGE_INTEGER *) (void *) &ft;
+ li.QuadPart += (LONGLONG) 600000000 * 60;
+ ft = * (FILETIME *) (void *) &li ;
+ FileTimeToSystemTime(&ft, lpSystemTime);
+ }
+
+ }
+ */
+}
+
diff --git a/worldtime_protocol/time_convert.h b/worldtime_protocol/time_convert.h new file mode 100644 index 0000000..33cd927 --- /dev/null +++ b/worldtime_protocol/time_convert.h @@ -0,0 +1,32 @@ +#ifndef _TIME_CONVERT_H
+#define _TIME_CONVERT_H
+
+/*
+
+ from http://cvs.sourceforge.net/viewcvs.py/tortoisecvs/TortoiseCVS/src/Utils/Attic/ClockRackCon.c?view=markup
+ (GPL)
+
+----------------------------------------------------------------
+ ClockRackCon.c -- Time-zone time conversion for ClockRack 1.1
+ (c) Ziff Davis Media, Inc.
+ All rights reserved.
+
+ First published in PC Magazine, US edition, September 1, 2000.
+
+ Programmed by Charles Petzold.
+
+ The entire function of this module is to implement the
+ MySystemTimeToTzSpecificLocalTime all because Windows 95 & 98
+ do not implement the NT function SystemTimeToTzSpecificLocalTime.
+ ---------------------------------------------------------------------
+
+
+*/
+
+BOOL LocalGreaterThanTransition (const SYSTEMTIME * pstLoc, const SYSTEMTIME * pstTran);
+
+BOOL MySystemTimeToTzSpecificLocalTime(const TIME_ZONE_INFORMATION *pTZI, const SYSTEMTIME *st, SYSTEMTIME *other_st);
+
+VOID MyGetSystemTime(LPSYSTEMTIME lpSystemTime);
+
+#endif
\ No newline at end of file diff --git a/worldtime_protocol/time_display.cpp b/worldtime_protocol/time_display.cpp new file mode 100644 index 0000000..2489c19 --- /dev/null +++ b/worldtime_protocol/time_display.cpp @@ -0,0 +1,221 @@ +#include "common.h"
+#include "time_display.h"
+
+#define ID_UPDATE_TIMER 101101
+#define UPDATE_TIMER 250
+
+#define WM_UPDATE_DATA (WM_USER + 10)
+
+extern HINSTANCE hInst;
+
+HFONT hBigFont = 0, hNormalFont = 0;
+
+void LoadFonts() {
+ if(!hBigFont) {
+ char facename[]="Tahoma";
+ LOGFONT logfont = {0};
+ memcpy(logfont.lfFaceName,facename,sizeof(facename));
+ logfont.lfWeight=FW_NORMAL;
+ logfont.lfHeight=-40;
+ hBigFont=CreateFontIndirect(&logfont);
+ }
+ if(!hNormalFont) {
+ char facename[]="Tahoma";
+ LOGFONT logfont = {0};
+ memcpy(logfont.lfFaceName,facename,sizeof(facename));
+ logfont.lfWeight=FW_NORMAL;
+ logfont.lfHeight=-12;
+ hNormalFont=CreateFontIndirect(&logfont);
+ }
+}
+
+void UnloadFonts() {
+ if(hBigFont) {
+ DeleteObject(hBigFont);
+ hBigFont = 0;
+ }
+ if(hNormalFont) {
+ DeleteObject(hNormalFont);
+ hNormalFont = 0;
+ }
+}
+
+typedef struct WindowData_tag {
+ HANDLE hContact;
+ int timezone_list_index;
+ char time_buff[32];
+ char date_buff[128];
+ char nick_buff[256];
+ TIME_ZONE_INFORMATION tzi;
+} WindowData;
+
+BOOL CALLBACK DlgProcDisplay(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ RECT r;
+ HDC hdc;
+ PAINTSTRUCT ps;
+ HFONT oldFont;
+
+ switch ( msg ) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault( hwndDlg );
+
+ SetTimer(hwndDlg, ID_UPDATE_TIMER, UPDATE_TIMER, 0);
+ return TRUE;
+
+ case WM_ERASEBKGND:
+ return TRUE;
+
+ case WM_PAINT:
+ if(GetUpdateRect(hwndDlg, &r, FALSE)) {
+ hdc = BeginPaint(hwndDlg, &ps);
+
+ GetClientRect(hwndDlg, &r);
+ FillRect(hdc, &r, GetSysColorBrush(COLOR_WINDOW));
+
+ WindowData *wd = (WindowData *)GetWindowLong(hwndDlg, GWL_USERDATA);
+ if(wd) {
+ RECT br = r, lr = r;
+ br.bottom -= (r.bottom - r.top) / 4;
+ oldFont = (HFONT)SelectObject(hdc, hBigFont);
+ DrawText(hdc, wd->time_buff, strlen(wd->time_buff), &br, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
+ SelectObject(hdc, hNormalFont);
+ lr.top = (r.bottom - r.top) * 3 / 4;
+ DrawText(hdc, wd->date_buff, strlen(wd->date_buff), &lr, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
+ SelectObject(hdc, oldFont);
+ }
+
+ EndPaint(hwndDlg, &ps);
+ }
+ return TRUE;
+
+ case WM_TIMER:
+ SendMessage(hwndDlg, WM_UPDATE_DATA, 0, 0);
+ return TRUE;
+
+ case WM_UPDATE_DATA:
+ {
+ SYSTEMTIME st, other_st;
+ WindowData *wd = (WindowData *)GetWindowLong(hwndDlg, GWL_USERDATA);
+
+ MyGetSystemTime(&st);
+ MySystemTimeToTzSpecificLocalTime(&wd->tzi, &st, &other_st);
+ //GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &other_st, 0, wd->time_buff, 32);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &other_st, 0, wd->time_buff, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &other_st, 0, wd->date_buff, 128);
+
+ if(IsIconic(hwndDlg)) {
+ char buff[255 + 32];
+ strcpy(buff, wd->nick_buff);
+ strcat(buff, " - ");
+ strcat(buff, wd->time_buff);
+ SetWindowText(hwndDlg, buff);
+ } else
+ SetWindowText(hwndDlg, wd->nick_buff);
+ }
+ InvalidateRect(hwndDlg, 0, FALSE);
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ return TRUE;
+
+ case WM_DESTROY:
+ {
+ KillTimer(hwndDlg, ID_UPDATE_TIMER);
+ WindowData *wd = (WindowData *)GetWindowLong(hwndDlg, GWL_USERDATA);
+ HANDLE hContact = wd->hContact;
+ if(CallService(MS_DB_CONTACT_IS, (WPARAM)hContact, 0))
+ Utils_SaveWindowPosition(hwndDlg, hContact, PROTO, "timewnd");
+ DBDeleteContactSetting(hContact, PROTO, "WindowHandle");
+ delete wd;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+
+int show_time(HANDLE hContact) {
+ HWND hwnd = (HWND)DBGetContactSettingDword(hContact, PROTO, "WindowHandle", 0);
+ if(hwnd) {
+ ShowWindow(hwnd, SW_SHOW);
+ SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ return 0;
+ }
+
+ hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DISPLAY), GetDesktopWindow(), DlgProcDisplay);
+
+ WindowData *wd = new WindowData;
+ wd->hContact = hContact;
+ wd->timezone_list_index = DBGetContactSettingDword(hContact, PROTO, "TimezoneListIndex", -1);
+ wd->time_buff[0] = 0;
+ wd->date_buff[0] = 0;
+
+ wd->tzi.Bias = timezone_list[wd->timezone_list_index].TZI.Bias;
+ wd->tzi.DaylightBias = timezone_list[wd->timezone_list_index].TZI.DaylightBias;
+ wd->tzi.DaylightDate = timezone_list[wd->timezone_list_index].TZI.DaylightDate;
+ wd->tzi.StandardBias = timezone_list[wd->timezone_list_index].TZI.StandardBias;
+ wd->tzi.StandardDate = timezone_list[wd->timezone_list_index].TZI.StandardDate;
+
+ DBVARIANT dbv;
+ if(!DBGetContactSetting(wd->hContact, PROTO, "Nick", &dbv)) {
+ strncpy(wd->nick_buff, dbv.pszVal, 255);
+ SetWindowText(hwnd, dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ DBWriteContactSettingDword(hContact, PROTO, "WindowHandle", (DWORD)hwnd);
+ SetWindowLong(hwnd, GWL_USERDATA, (LONG)wd);
+ SendMessage(hwnd, WM_UPDATE_DATA, 0, 0);
+
+ if(CallService(MS_DB_CONTACT_IS, (WPARAM)hContact, 0))
+ Utils_RestoreWindowPosition(hwnd, hContact, PROTO, "timewnd");
+
+ if(!IsWindowVisible(hwnd)) {
+ ShowWindow(hwnd, SW_SHOW);
+ SendMessage(hwnd, WM_UPDATE_DATA, 0, 0);
+ }
+
+ return 0;
+}
+
+// save window positions, close windows
+void time_windows_cleanup() {
+ HWND hwnd;
+ char *proto;
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ while ( hContact != NULL )
+ {
+ proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (proto && lstrcmp( PROTO, proto) == 0) {
+ if((hwnd = (HWND)DBGetContactSettingDword(hContact, PROTO, "WindowHandle", 0)) != 0) {
+ DestroyWindow(hwnd);
+ DBWriteContactSettingByte(hContact, PROTO, "WindowWasOpen", 1);
+ }
+ }
+
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+ UnloadFonts();
+}
+
+// restore windows that were open when cleanup was called last
+void time_windows_init() {
+ LoadFonts();
+
+ char *proto;
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ while ( hContact != NULL )
+ {
+ proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (proto && lstrcmp( PROTO, proto) == 0) {
+ if(DBGetContactSettingByte(hContact, PROTO, "WindowWasOpen", 0) != 0) {
+ show_time(hContact);
+ DBWriteContactSettingByte(hContact, PROTO, "WindowWasOpen", 0);
+ }
+ }
+
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+}
diff --git a/worldtime_protocol/time_display.h b/worldtime_protocol/time_display.h new file mode 100644 index 0000000..f671065 --- /dev/null +++ b/worldtime_protocol/time_display.h @@ -0,0 +1,14 @@ +#ifndef _TIME_DISPLAY_INC
+#define _TIME_DISPLAY_INC
+
+#include <map>
+#include "resource.h"
+
+#include "timezone_list.h"
+
+int show_time(HANDLE hContact);
+
+void time_windows_cleanup();
+void time_windows_init();
+
+#endif
diff --git a/worldtime_protocol/timezone.cpp b/worldtime_protocol/timezone.cpp new file mode 100644 index 0000000..ee4a8ed --- /dev/null +++ b/worldtime_protocol/timezone.cpp @@ -0,0 +1,70 @@ +#include "common.h"
+#include "timezone.h"
+
+TimeList timezone_list, geo_timezone_list;
+
+bool LS_TZREG::operator<(const LS_TZREG &other) {
+ //return Index < other.Index;
+ return TZI.Bias < other.TZI.Bias;
+}
+
+bool build_timezone_list() {
+ HKEY HKlmtz;
+ HKEY KKtz;
+ DWORD dwIndex = 0;
+ CHAR tcName[MAX_SIZE];
+ DWORD dwcbName = MAX_SIZE;
+ DWORD dwcbValue;
+ DWORD dwcbSTD;
+ DWORD dwcbDLT;
+ LS_TZREG Temp;
+ FILETIME ftLastWrite;
+ unsigned int list_index = 0;
+ bool win9x = false;
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TZREG, 0, KEY_ENUMERATE_SUB_KEYS, &HKlmtz) != ERROR_SUCCESS) {
+ win9x = true;
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TZREG_9X, 0, KEY_ENUMERATE_SUB_KEYS, &HKlmtz) != ERROR_SUCCESS)
+ return false;
+ }
+
+ while(RegEnumKeyEx(HKlmtz, dwIndex++, tcName, &dwcbName, NULL, NULL, NULL, &ftLastWrite) != ERROR_NO_MORE_ITEMS) {
+
+ if(RegOpenKeyEx(HKlmtz, tcName, 0,KEY_QUERY_VALUE, &KKtz) != ERROR_SUCCESS) {
+ RegCloseKey(HKlmtz);
+ return false;
+ }
+
+ strncpy(Temp.tcName, tcName, MAX_SIZE);
+ dwcbValue = MAX_SIZE;
+ RegQueryValueEx(KKtz,"Display",NULL,NULL,(BYTE*)Temp.tcDisp,&dwcbValue);
+ dwcbDLT = MAX_SIZE;
+ RegQueryValueEx(KKtz,"Dlt",NULL,NULL,(BYTE*)Temp.tcDLT,&dwcbDLT);
+ dwcbSTD = MAX_SIZE;
+ RegQueryValueEx(KKtz,"Std",NULL,NULL,(BYTE*)Temp.tcSTD,&dwcbSTD);
+ dwcbValue = MAX_SIZE;
+ RegQueryValueEx(KKtz,"MapID",NULL,NULL,(BYTE*)Temp.MapID,&dwcbValue);
+ if(!win9x) {
+ dwcbValue = sizeof(DWORD);
+ RegQueryValueEx(KKtz,"Index",NULL,NULL,(BYTE*)&Temp.Index,&dwcbValue);
+ }
+ dwcbValue = sizeof(Temp.TZI);
+ RegQueryValueEx(KKtz,"TZI",NULL,NULL,(BYTE*)&Temp.TZI,&dwcbValue);
+
+ RegCloseKey(KKtz);
+
+ Temp.list_index = list_index;
+ timezone_list.push_back(Temp);
+
+ dwcbName = MAX_SIZE;
+ list_index++;
+ }
+
+ RegCloseKey(HKlmtz);
+
+ geo_timezone_list = timezone_list;
+ std::sort(geo_timezone_list.begin(), geo_timezone_list.end());
+
+ return true;
+}
+
diff --git a/worldtime_protocol/timezone.h b/worldtime_protocol/timezone.h new file mode 100644 index 0000000..ddb9a52 --- /dev/null +++ b/worldtime_protocol/timezone.h @@ -0,0 +1,44 @@ +#ifndef _TIMEZONE_H
+#define _TIMEZONE_H
+
+#define TZREG "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"
+#define TZREG_9X "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones"
+//#define TZREG2 "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation"
+#define MAX_SIZE 512
+
+#include <vector>
+#include <algorithm>
+
+struct REG_TZI {
+ DWORD Bias;
+ DWORD StandardBias;
+ DWORD DaylightBias;
+ SYSTEMTIME StandardDate;
+ SYSTEMTIME DaylightDate;
+};
+
+
+struct LS_TZREG {
+ TCHAR tcName[MAX_SIZE];
+ TCHAR tcDisp[MAX_SIZE];
+ TCHAR tcDLT[MAX_SIZE];
+ TCHAR tcSTD[MAX_SIZE];
+ TCHAR MapID[MAX_SIZE];
+ DWORD Index;
+ DWORD ActiveTimeBias;
+ //TIME_ZONE_INFORMATION TZI;
+ REG_TZI TZI;
+
+ unsigned int list_index;
+
+ bool operator<(const LS_TZREG &other);
+};
+
+typedef std::vector< LS_TZREG > TimeList;
+
+extern TimeList timezone_list, geo_timezone_list;
+bool build_timezone_list();
+
+void convert_regdata_to_tzi(int vector_index);
+
+#endif
diff --git a/worldtime_protocol/timezone_list.cpp b/worldtime_protocol/timezone_list.cpp new file mode 100644 index 0000000..4927515 --- /dev/null +++ b/worldtime_protocol/timezone_list.cpp @@ -0,0 +1,81 @@ +#include "common.h"
+#include "timezone_list.h"
+
+#include <sstream>
+
+ITEMLIST listbox_items;
+
+void load_listbox_items() {
+
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ LISTITEM pa;
+ DBVARIANT dbv;
+ char *proto;
+
+ listbox_items.clear();
+ while ( hContact != NULL ) {
+ proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
+ if ( proto && !lstrcmp( PROTO, proto)) {
+ pa.hContact = hContact;
+ pa.timezone_list_index = DBGetContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", -1);
+ if(!DBGetContactSetting(pa.hContact, PROTO, "Nick", &dbv)) {
+ strncpy(pa.pszText, dbv.pszVal, MAX_NAME_LENGTH);
+ DBFreeVariant(&dbv);
+ }
+
+ listbox_items.push_back(pa);
+ }
+
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+}
+
+void save_listbox_items() {
+ bool is_contact;
+
+
+ for(ITEMLIST::iterator i = listbox_items.begin(); i != listbox_items.end(); i++) {
+ is_contact = (int)CallService(MS_DB_CONTACT_IS, (WPARAM)i->hContact, 0) == 1;
+
+ if(!is_contact) {
+ i->hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )i->hContact, ( LPARAM )PROTO );
+ CallService(MS_IGNORE_IGNORE, (WPARAM)i->hContact, (WPARAM)IGNOREEVENT_USERONLINE);
+ }
+
+ DBWriteContactSettingString(i->hContact, PROTO, "Nick", i->pszText);
+ DBWriteContactSettingDword(i->hContact, PROTO, "TimezoneListIndex", i->timezone_list_index);
+ DBWriteContactSettingWord(i->hContact, PROTO, "Status", ID_STATUS_ONLINE);
+ }
+
+ // remove contacts in DB that have been removed from the list
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ char *proto;
+ bool found;
+ while ( hContact != NULL ) {
+ proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
+ if ( proto && !lstrcmp( PROTO, proto)) {
+ found = false;
+ for(ITEMLIST::iterator i = listbox_items.begin(); i != listbox_items.end(); i++) {
+ if(i->hContact == hContact) {
+ found = true;
+ }
+ }
+
+ if(!found) {
+ // remove prot first, so that our contact deleted event handler (if present) isn't activated
+ HANDLE oldHContact = hContact;
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+
+ CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)oldHContact, (LPARAM)PROTO);
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)oldHContact, 0);
+ } else
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ } else
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+}
+
+
+
+
diff --git a/worldtime_protocol/timezone_list.h b/worldtime_protocol/timezone_list.h new file mode 100644 index 0000000..27168d3 --- /dev/null +++ b/worldtime_protocol/timezone_list.h @@ -0,0 +1,24 @@ +#ifndef _TIMEZONE_LIST_INC
+#define _TIMEZONE_LIST_INC
+
+#include "timezone.h"
+#include "time_convert.h"
+
+#define MAX_NAME_LENGTH 256
+
+typedef struct tagLISTITEM {
+ int cbSize;
+ HANDLE hContact;
+ char pszText[MAX_NAME_LENGTH];
+ int timezone_list_index;
+} LISTITEM;
+
+#include <vector>
+typedef std::vector<LISTITEM> ITEMLIST;
+
+extern ITEMLIST listbox_items;
+
+void load_listbox_items();
+void save_listbox_items();
+
+#endif
diff --git a/worldtime_protocol/worldtimeproto.cpp b/worldtime_protocol/worldtimeproto.cpp new file mode 100644 index 0000000..657c6ea --- /dev/null +++ b/worldtime_protocol/worldtimeproto.cpp @@ -0,0 +1,456 @@ +#include "common.h"
+#include "worldtimeproto.h"
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+
+HANDLE hContactDblClick = 0;
+HANDLE hMenuEdit;
+
+int previousMode,
+ mcStatus = ID_STATUS_OFFLINE;
+
+UINT id_timer = 0;
+
+// protocol related services
+int GetCaps(WPARAM wParam,LPARAM lParam)
+{
+ int ret = 0;
+ switch (wParam) {
+ case PFLAGNUM_1:
+ break;
+ case PFLAGNUM_2:
+ if(!hide_proto)
+ ret = PF2_ONLINE | PF2_LONGAWAY;
+ break;
+ case PFLAGNUM_3:
+ if(!hide_proto)
+ ret = PF2_ONLINE | PF2_LONGAWAY;
+ break;
+ case PFLAGNUM_4:
+ break;
+ case PFLAG_UNIQUEIDTEXT:
+ ret = (int) Translate(PROTO);
+ break;
+ case PFLAG_MAXLENOFMESSAGE:
+ ret = 2000;
+ break;
+ case PFLAG_UNIQUEIDSETTING:
+ ret = (int) "Nick";
+ break;
+ }
+ return ret;
+}
+
+/** Copy the name of the protocole into lParam
+* @param wParam : max size of the name
+* @param lParam : reference to a char *, which will hold the name
+*/
+int GetName(WPARAM wParam,LPARAM lParam)
+{
+ char *name = (char *)Translate(PROTO);
+ size_t size = min(strlen(name),wParam-1); // copy only the first size bytes.
+ if(strncpy((char *)lParam,name,size)==NULL)
+ return 1;
+ ((char *)lParam)[size]='\0';
+ return 0;
+}
+
+/** Loads the icon corresponding to the status
+* Called by the CList when the status changes.
+* @param wParam : one of the following values : \n
+ <tt>PLI_PROTOCOL | PLI_ONLINE | PLI_OFFLINE</tt>
+* @return an \c HICON in which the icon has been loaded.
+*/
+int LoadIcon(WPARAM wParam,LPARAM lParam)
+{
+
+ UINT id;
+ switch (wParam & 0xFFFF)
+ {
+ case PLI_PROTOCOL:
+ id = IDI_ICON_PROTO;
+ break;
+ case PLI_ONLINE:
+ id = IDI_ICON_PROTO;
+ break;
+ case PLI_OFFLINE:
+ id = IDI_ICON_PROTO;
+ break;
+ default:
+ return (int) (HICON) NULL;
+ }
+
+ return (int) LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON,
+ GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON),
+ GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ return 0;
+}
+
+
+/** Changes the status and notifies everybody
+* @param wParam : The new mode
+* @param lParam : Allways set to 0.
+*/
+int SetStatus(WPARAM wParam,LPARAM lParam)
+{
+ previousMode = mcStatus;
+ mcStatus = (int)wParam;
+ ProtoBroadcastAck(PROTO,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
+
+ return 0;
+}
+
+/** Returns the current status
+*/
+int GetStatus(WPARAM wParam,LPARAM lParam)
+{
+ return mcStatus;
+}
+
+// plugin stuff
+PLUGININFO pluginInfo={
+ sizeof(PLUGININFO),
+ "World Time Protocol",
+ PLUGIN_MAKE_VERSION(0, 0, 6, 0),
+ "Adds 'contacts' showing the time at specified locations around the world.",
+ "Scott Ellis",
+ "mail@scottellis.com.au",
+ "© 2005 Scott Ellis",
+ "http://www.scottellis.com.au/",
+ 0, //not transient
+ 0 //doesn't replace anything built-in
+};
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hInst=hinstDLL;
+ return TRUE;
+}
+
+extern "C" WORLDTIMEPROTO_API PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+
+int ContactDblClick(WPARAM wParam, LPARAM lParam) {
+ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if(proto && strcmp(proto, PROTO) == 0)
+ show_time((HANDLE)wParam);
+ return 0;
+}
+
+//////////////////////////////////////////////////////////
+/// Copied from MSN plugin - sent acks need to be from different thread :(
+//////////////////////////////////////////////////////////
+typedef struct tag_TFakeAckParams
+{
+ HANDLE hEvent;
+ HANDLE hContact;
+} TFakeAckParams;
+
+
+static DWORD CALLBACK sttFakeAckInfoSuccess( LPVOID param )
+{
+ TFakeAckParams *tParam = ( TFakeAckParams* )param;
+ WaitForSingleObject( tParam->hEvent, INFINITE );
+
+ Sleep( 100 );
+ ProtoBroadcastAck(PROTO, tParam->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, ( HANDLE )1, 0 );
+
+ CloseHandle( tParam->hEvent );
+ free(tParam);
+ return 0;
+}
+
+int GetInfo(WPARAM wParam, LPARAM lParam) {
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ DWORD dwThreadId;
+ HANDLE hEvent;
+ TFakeAckParams *tfap;
+
+ hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
+
+ tfap = (TFakeAckParams *)malloc(sizeof(TFakeAckParams));
+ tfap->hContact = ccs->hContact;
+ tfap->hEvent = hEvent;
+
+ CloseHandle( CreateThread( NULL, 0, sttFakeAckInfoSuccess, tfap, 0, &dwThreadId ));
+ SetEvent( hEvent );
+
+ return 0;
+}
+
+int EditContact(WPARAM wParam, LPARAM lParam) {
+ LISTITEM pa;
+ HWND hwndList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
+ DBVARIANT dbv;
+
+ pa.hContact = (HANDLE)wParam;
+ pa.timezone_list_index = DBGetContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", -1);
+ if(!DBGetContactSetting(pa.hContact, PROTO, "Nick", &dbv)) {
+ strncpy(pa.pszText, dbv.pszVal, MAX_NAME_LENGTH);
+ DBFreeVariant(&dbv);
+ }
+ add_edit_item = pa;
+ if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndList, DlgProcOptsEdit) == IDOK) {
+ pa = add_edit_item;
+
+ DBWriteContactSettingString(pa.hContact, PROTO, "Nick", pa.pszText);
+ DBWriteContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", pa.timezone_list_index);
+ DBWriteContactSettingWord(pa.hContact, PROTO, "Status", ID_STATUS_ONLINE);
+ return 0;
+ }
+ return 1;
+}
+
+HANDLE hServices[7];
+
+void CreatePluginServices() {
+ // protocol
+ hServices[0] = CreateProtoServiceFunction(PROTO,PS_GETCAPS, GetCaps);
+ hServices[1] = CreateProtoServiceFunction(PROTO,PS_GETNAME, GetName);
+ hServices[2] = CreateProtoServiceFunction(PROTO,PS_SETSTATUS, SetStatus);
+ hServices[3] = CreateProtoServiceFunction(PROTO,PS_GETSTATUS, GetStatus);
+ hServices[4] = CreateProtoServiceFunction(PROTO,PS_LOADICON,LoadIcon);
+ hServices[5] = CreateProtoServiceFunction(PROTO,PSS_GETINFO,GetInfo);
+
+ // menu
+ hServices[6] = CreateServiceFunction(PROTO "/Edit", EditContact);
+}
+
+void DestroyServiceFunctions() {
+ for(int i = 0; i < 7; i++)
+ DestroyServiceFunction(hServices[i]);
+}
+
+VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) {
+ SYSTEMTIME st, other_st;
+ TCHAR date_buf[512], time_buf[512];
+ std::string buf;
+
+ MyGetSystemTime(&st);
+
+ TIME_ZONE_INFORMATION here_tzi, tzi;
+ LISTITEM pa;
+ DBVARIANT dbv;
+ WORD status;
+ char *proto;
+
+
+ BOOL daylight_here = (GetTimeZoneInformation(&here_tzi) == TIME_ZONE_ID_DAYLIGHT);
+
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ while ( hContact != NULL ) {
+ proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
+ if ( proto && !lstrcmp( PROTO, proto)) {
+ pa.hContact = hContact;
+ pa.timezone_list_index = DBGetContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", -1);
+ if(!DBGetContactSetting(pa.hContact, PROTO, "Nick", &dbv)) {
+ strncpy(pa.pszText, dbv.pszVal, MAX_NAME_LENGTH);
+ DBFreeVariant(&dbv);
+ }
+ status = DBGetContactSettingWord(pa.hContact, PROTO, "Status", ID_STATUS_ONLINE);
+
+ tzi.Bias = timezone_list[pa.timezone_list_index].TZI.Bias;
+ tzi.DaylightBias = timezone_list[pa.timezone_list_index].TZI.DaylightBias;
+ tzi.DaylightDate = timezone_list[pa.timezone_list_index].TZI.DaylightDate;
+ tzi.StandardBias = timezone_list[pa.timezone_list_index].TZI.StandardBias;
+ tzi.StandardDate = timezone_list[pa.timezone_list_index].TZI.StandardDate;
+
+ MySystemTimeToTzSpecificLocalTime(&tzi, &st, &other_st);
+
+ if(set_format) {
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &other_st, format_string, time_buf, 512);
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, &other_st, date_format_string, date_buf, 512);
+ } else {
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &other_st, 0, time_buf, 512);
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, &other_st, 0, date_buf, 512);
+ }
+
+ std::string::size_type pos;
+ buf = clist_format_string;
+ pos = buf.find ("%n");
+ if(pos != std::string::npos)
+ buf.replace(pos, 2, pa.pszText);
+ pos = buf.find ("%t");
+ if(pos != std::string::npos)
+ buf.replace(pos, 2, time_buf);
+ pos = buf.find ("%d");
+ if(pos != std::string::npos)
+ buf.replace(pos, 2, date_buf);
+
+ pos = buf.find ("%o");
+ if(pos != std::string::npos) {
+ int other_offset, offset;
+
+ if(tzi.StandardDate.wMonth) {
+ if(tzi.DaylightDate.wMonth < tzi.StandardDate.wMonth) {
+ if(LocalGreaterThanTransition(&other_st, &tzi.DaylightDate)
+ && !LocalGreaterThanTransition(&other_st, &tzi.StandardDate))
+ {
+ other_offset = tzi.Bias + tzi.DaylightBias;
+ } else
+ other_offset = tzi.Bias;
+
+ } else {
+ if(!LocalGreaterThanTransition(&other_st, &tzi.StandardDate)
+ || LocalGreaterThanTransition(&other_st, &tzi.DaylightDate))
+ {
+ other_offset = tzi.Bias + tzi.DaylightBias;
+ } else
+ other_offset = tzi.Bias;
+ }
+ } else
+ other_offset = tzi.Bias;
+
+ char temp_buf[8];
+
+ unsigned char icq_offset = (unsigned char)((other_offset / 60) * 2) + (other_offset % 60) / 30;
+
+ if(DBGetContactSettingByte(pa.hContact, PROTO, "Timezone", 256) != icq_offset)
+ DBWriteContactSettingByte(pa.hContact, PROTO, "Timezone", icq_offset);
+
+ offset = here_tzi.Bias + (daylight_here ? here_tzi.DaylightBias : 0) - other_offset;
+ //if(offset > 12 * 60) offset -= 24 * 60;
+ //if(offset < -12 * 60) offset += 24 * 60;
+
+ mir_snprintf(temp_buf, sizeof(temp_buf), "%+g", offset/60.0);
+ buf.replace(pos, 2, temp_buf);
+ }
+
+ if(!DBGetContactSetting(pa.hContact, "CList", "MyHandle", &dbv)) {
+ // only write if times are different
+ if(strcmp(dbv.pszVal, buf.c_str()))
+ DBWriteContactSettingString(pa.hContact, "CList", "MyHandle", buf.c_str());
+ DBFreeVariant(&dbv);
+ } else
+ DBWriteContactSettingString(pa.hContact, "CList", "MyHandle", buf.c_str());
+
+ if(!DBGetContactSetting(pa.hContact, PROTO, "FirstName", &dbv)) {
+ // only write if times are different
+ if(strcmp(dbv.pszVal, time_buf))
+ DBWriteContactSettingString(pa.hContact, PROTO, "FirstName", time_buf);
+ DBFreeVariant(&dbv);
+ } else
+ DBWriteContactSettingString(pa.hContact, PROTO, "FirstName", time_buf);
+
+ if(set_format) {
+ if(!DBGetContactSetting(pa.hContact, PROTO, "LastName", &dbv)) {
+ // only write if times are different
+ if(strcmp(dbv.pszVal, date_buf))
+ DBWriteContactSettingString(pa.hContact, PROTO, "LastName", date_buf);
+ DBFreeVariant(&dbv);
+ } else
+ DBWriteContactSettingString(pa.hContact, PROTO, "LastName", date_buf);
+ } else
+ DBDeleteContactSetting(pa.hContact, PROTO, "LastName");
+
+ if(other_st.wHour >= 6 && other_st.wHour < 18) {
+ if(status != ID_STATUS_ONLINE)
+ DBWriteContactSettingWord(pa.hContact, PROTO, "Status", ID_STATUS_ONLINE);
+ } else {
+ if(status != ID_STATUS_NA)
+ DBWriteContactSettingWord(pa.hContact, PROTO, "Status", ID_STATUS_NA);
+ }
+ }
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+}
+
+int OnShutdown(WPARAM wParam, LPARAM lParam) {
+ time_windows_cleanup();
+ return 0;
+}
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
+
+ // for database editor++ ver 3+
+ if(ServiceExists("DBEditorpp/RegisterSingleModule"))
+ CallService("DBEditorpp/RegisterSingleModule",(WPARAM)PROTO,0);
+
+ //ignore status for all WORLD TIME contacts
+ {
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ char *proto;
+ while ( hContact != NULL )
+ {
+ proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
+ if ( proto && !lstrcmp( PROTO, proto)) {
+ CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
+ DBDeleteContactSetting(hContact, PROTO, "WindowHandle");
+ }
+
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+ }
+
+
+ hContactDblClick = HookEvent(ME_CLIST_DOUBLECLICKED, ContactDblClick);
+
+
+ {
+ CLISTMENUITEM menu;
+
+ ZeroMemory(&menu,sizeof(menu));
+ menu.cbSize=sizeof(menu);
+ menu.flags = CMIM_ALL;
+
+ menu.hIcon=LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_PROTO));
+
+ menu.position = -200000;
+ menu.pszName = (char *)Translate("Edit...");
+ menu.pszService=PROTO "/Edit";
+ menu.pszContactOwner = PROTO;
+ hMenuEdit = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
+
+ }
+
+ build_timezone_list();
+ time_windows_init();
+
+ id_timer = SetTimer(0, 0, 950, TimerProc);
+
+ return 0;
+}
+
+HANDLE hEventModulesLoaded, hEventOptInit, hEventPreShutdown;
+extern "C" WORLDTIMEPROTO_API int Load(PLUGINLINK *link)
+{
+ pluginLink=link;
+
+ previousMode = mcStatus = ID_STATUS_OFFLINE;
+
+ PROTOCOLDESCRIPTOR pd = {0};
+ pd.cbSize=sizeof(pd);
+ pd.szName=PROTO;
+ pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+
+ CreatePluginServices();
+
+ LoadOptions();
+
+ hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+
+ hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit);
+
+ hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
+
+ return 0;
+}
+
+extern "C" WORLDTIMEPROTO_API int Unload(void)
+{
+ UnhookEvent(hEventModulesLoaded);
+ UnhookEvent(hEventOptInit);
+ UnhookEvent(hEventPreShutdown);
+
+ KillTimer(0, id_timer);
+
+ DestroyServiceFunctions();
+
+ UnhookEvent(hContactDblClick);
+ return 0;
+}
diff --git a/worldtime_protocol/worldtimeproto.dsp b/worldtime_protocol/worldtimeproto.dsp new file mode 100644 index 0000000..3355c6c --- /dev/null +++ b/worldtime_protocol/worldtimeproto.dsp @@ -0,0 +1,177 @@ +# Microsoft Developer Studio Project File - Name="worldtimeproto" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=worldtimeproto - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "worldtimeproto.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "worldtimeproto.mak" CFG="worldtimeproto - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "worldtimeproto - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "worldtimeproto - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "worldtimeproto - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 2
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIMEPROTO_EXPORTS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIMEPROTO_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"
+# ADD RSC /l 0xc09 /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 wsock32.lib user32.lib gdi32.lib ws2_32.lib shell32.lib comdlg32.lib Advapi32.lib /nologo /base:"0x22080000" /dll /machine:I386 /out:"../../bin/release/plugins/worldtimeproto.dll"
+# SUBTRACT LINK32 /nodefaultlib
+
+!ELSEIF "$(CFG)" == "worldtimeproto - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 2
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIMEPROTO_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIMEPROTO_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"
+# ADD RSC /l 0xc09 /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib gdi32.lib ws2_32.lib shell32.lib comdlg32.lib Advapi32.lib /nologo /dll /debug /machine:I386 /out:"../../bin/debug/plugins/worldtimeproto.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "worldtimeproto - Win32 Release"
+# Name "worldtimeproto - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\options.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\time_convert.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\time_display.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\timezone.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\timezone_list.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\worldtimeproto.cpp
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\icon_proto.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\WorldTime.rc
+# End Source File
+# End Group
+# Begin Group "headers"
+
+# PROP Default_Filter "h"
+# Begin Source File
+
+SOURCE=.\common.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\time_convert.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\time_display.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\timezone.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\timezone_list.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\worldtimeproto.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/worldtime_protocol/worldtimeproto.dsw b/worldtime_protocol/worldtimeproto.dsw new file mode 100644 index 0000000..0befdc7 --- /dev/null +++ b/worldtime_protocol/worldtimeproto.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "worldtimeproto"=".\worldtimeproto.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/worldtime_protocol/worldtimeproto.h b/worldtime_protocol/worldtimeproto.h new file mode 100644 index 0000000..4e80710 --- /dev/null +++ b/worldtime_protocol/worldtimeproto.h @@ -0,0 +1,42 @@ +/*
+Based on the
+Miranda plugin template, originally by Richard Hughes
+http://miranda-icq.sourceforge.net/
+
+© 2004 Scott Ellis
+
+*/
+
+#ifndef _WORLDTIMEPROTO
+#define _WORLDTIMEPROTO
+
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the PINGPROTO_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// PINGPROTO_API functions as being imported from a DLL, wheras this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef WORLDTIMEPROTO_EXPORTS
+#define WORLDTIMEPROTO_API __declspec(dllexport)
+#else
+#define WORLDTIMEPROTO_API __declspec(dllimport)
+#endif
+
+#include "options.h"
+#include "timezone.h"
+#include "time_convert.h"
+#include "timezone_list.h"
+#include "time_display.h"
+
+#include <string>
+
+// globals
+extern PLUGINLINK *pluginLink;
+extern PLUGININFO pluginInfo;
+
+extern "C" WORLDTIMEPROTO_API PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion);
+extern "C" WORLDTIMEPROTO_API int Load(PLUGINLINK *link);
+extern "C" WORLDTIMEPROTO_API int Unload(void);
+
+#endif
diff --git a/worldtime_protocol/worldtimeproto.plg b/worldtime_protocol/worldtimeproto.plg new file mode 100644 index 0000000..e545d4e --- /dev/null +++ b/worldtime_protocol/worldtimeproto.plg @@ -0,0 +1,25 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: worldtimeproto - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+
+
+
+<h3>Results</h3>
+worldtimeproto.dll - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: worldtimeproto - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+
+
+
+<h3>Results</h3>
+worldtimeproto.dll - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/worldtime_protocol/worldtimeproto.sln b/worldtime_protocol/worldtimeproto.sln new file mode 100644 index 0000000..0e21399 --- /dev/null +++ b/worldtime_protocol/worldtimeproto.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "worldtimeproto", "worldtimeproto.vcproj", "{B88D386A-6914-4827-945C-11193421C0FF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B88D386A-6914-4827-945C-11193421C0FF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B88D386A-6914-4827-945C-11193421C0FF}.Debug|Win32.Build.0 = Debug|Win32
+ {B88D386A-6914-4827-945C-11193421C0FF}.Release|Win32.ActiveCfg = Release|Win32
+ {B88D386A-6914-4827-945C-11193421C0FF}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/worldtime_protocol/worldtimeproto.vcproj b/worldtime_protocol/worldtimeproto.vcproj new file mode 100644 index 0000000..d9cb03e --- /dev/null +++ b/worldtime_protocol/worldtimeproto.vcproj @@ -0,0 +1,423 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="worldtimeproto"
+ ProjectGUID="{B88D386A-6914-4827-945C-11193421C0FF}"
+ RootNamespace="worldtimeproto"
+ Keyword="MFCProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/worldtimeproto.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WORLDTIMEPROTO_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="3081"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ IgnoreImportLibrary="true"
+ AdditionalDependencies="user32.lib gdi32.lib ws2_32.lib shell32.lib comdlg32.lib Advapi32.lib"
+ OutputFile="../../bin/debug/plugins/worldtimeproto.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/worldtimeproto.pdb"
+ ImportLibrary=".\Debug/worldtimeproto.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/worldtimeproto.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/worldtimeproto.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WORLDTIMEPROTO_EXPORTS"
+ StringPooling="true"
+ ExceptionHandling="1"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="3081"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ IgnoreImportLibrary="true"
+ AdditionalDependencies="wsock32.lib user32.lib gdi32.lib ws2_32.lib shell32.lib comdlg32.lib Advapi32.lib"
+ OutputFile="../../bin/release/plugins/worldtimeproto.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ GenerateManifest="false"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Release/worldtimeproto.pdb"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ BaseAddress="0x22080000"
+ ImportLibrary=".\Release/worldtimeproto.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/worldtimeproto.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="options.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="resource.h"
+ >
+ </File>
+ <File
+ RelativePath="time_convert.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="time_display.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="timezone.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="timezone_list.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="worldtimeproto.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="icon_proto.ico"
+ >
+ </File>
+ <File
+ RelativePath="WorldTime.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="headers"
+ Filter="h"
+ >
+ <File
+ RelativePath="common.h"
+ >
+ </File>
+ <File
+ RelativePath="options.h"
+ >
+ </File>
+ <File
+ RelativePath="time_convert.h"
+ >
+ </File>
+ <File
+ RelativePath="time_display.h"
+ >
+ </File>
+ <File
+ RelativePath="timezone.h"
+ >
+ </File>
+ <File
+ RelativePath="timezone_list.h"
+ >
+ </File>
+ <File
+ RelativePath="worldtimeproto.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
|