From a9c8ab916b2106efce25b8b58ec850031a2dfbf3 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 13 Jul 2012 23:17:29 +0200 Subject: Rename X-Tray to HexTray --- plugins/hextray/bitmaps/sd.bmp | Bin 0 -> 32824 bytes plugins/hextray/callbacks.cpp | 734 +++++++++++++++++++++++++++++++ plugins/hextray/callbacks.h | 37 ++ plugins/hextray/hextray.vcxproj | 134 ++++++ plugins/hextray/hextray.vcxproj.filters | 109 +++++ plugins/hextray/hextray.vcxproj.user | 3 + plugins/hextray/icons/banned.ico | Bin 0 -> 1406 bytes plugins/hextray/icons/chan_msg.ico | Bin 0 -> 1406 bytes plugins/hextray/icons/disconnected.ico | Bin 0 -> 1406 bytes plugins/hextray/icons/hexchat.ico | Bin 0 -> 25670 bytes plugins/hextray/icons/highlight-1-3.ico | Bin 0 -> 1406 bytes plugins/hextray/icons/highlight.ico | Bin 0 -> 1406 bytes plugins/hextray/icons/kicked.ico | Bin 0 -> 1406 bytes plugins/hextray/icons/priv_msg-1-2-2.ico | Bin 0 -> 1406 bytes plugins/hextray/icons/sd.ico | Bin 0 -> 24358 bytes plugins/hextray/icons/server_notice.ico | Bin 0 -> 1406 bytes plugins/hextray/resource.h | 47 ++ plugins/hextray/resource.rc | 309 +++++++++++++ plugins/hextray/sdAlerts.cpp | 109 +++++ plugins/hextray/sdAlerts.h | 26 ++ plugins/hextray/sdTray.cpp | 207 +++++++++ plugins/hextray/sdTray.h | 39 ++ plugins/hextray/utility.cpp | 607 +++++++++++++++++++++++++ plugins/hextray/utility.h | 55 +++ plugins/hextray/xchat.cpp | 320 ++++++++++++++ plugins/hextray/xchat.h | 32 ++ plugins/hextray/xtray.cpp | 219 +++++++++ plugins/hextray/xtray.def | 3 + plugins/hextray/xtray.h | 77 ++++ plugins/xtray/bitmaps/sd.bmp | Bin 32824 -> 0 bytes plugins/xtray/callbacks.cpp | 734 ------------------------------- plugins/xtray/callbacks.h | 37 -- plugins/xtray/icons/banned.ico | Bin 1406 -> 0 bytes plugins/xtray/icons/chan_msg.ico | Bin 1406 -> 0 bytes plugins/xtray/icons/disconnected.ico | Bin 1406 -> 0 bytes plugins/xtray/icons/hexchat.ico | Bin 25670 -> 0 bytes plugins/xtray/icons/highlight-1-3.ico | Bin 1406 -> 0 bytes plugins/xtray/icons/highlight.ico | Bin 1406 -> 0 bytes plugins/xtray/icons/kicked.ico | Bin 1406 -> 0 bytes plugins/xtray/icons/priv_msg-1-2-2.ico | Bin 1406 -> 0 bytes plugins/xtray/icons/sd.ico | Bin 24358 -> 0 bytes plugins/xtray/icons/server_notice.ico | Bin 1406 -> 0 bytes plugins/xtray/resource.h | 47 -- plugins/xtray/resource.rc | 309 ------------- plugins/xtray/sdAlerts.cpp | 109 ----- plugins/xtray/sdAlerts.h | 26 -- plugins/xtray/sdTray.cpp | 207 --------- plugins/xtray/sdTray.h | 39 -- plugins/xtray/utility.cpp | 607 ------------------------- plugins/xtray/utility.h | 55 --- plugins/xtray/xchat.cpp | 320 -------------- plugins/xtray/xchat.h | 32 -- plugins/xtray/xtray.cpp | 219 --------- plugins/xtray/xtray.def | 3 - plugins/xtray/xtray.h | 77 ---- plugins/xtray/xtray.vcxproj | 134 ------ plugins/xtray/xtray.vcxproj.filters | 109 ----- plugins/xtray/xtray.vcxproj.user | 3 - src/common/util.c | 4 +- src/common/util.h | 2 +- src/common/xchat.c | 2 +- src/fe-gtk/maingui.c | 4 +- src/fe-gtk/plugin-tray.c | 4 +- src/fe-gtk/setup.c | 6 +- win32/copy/copy.vcxproj | 4 +- win32/hexchat.sln | 2 +- win32/installer/hexchat-x64.skel.iss | 4 +- win32/installer/hexchat-x86.skel.iss | 4 +- 68 files changed, 3085 insertions(+), 3085 deletions(-) create mode 100644 plugins/hextray/bitmaps/sd.bmp create mode 100644 plugins/hextray/callbacks.cpp create mode 100644 plugins/hextray/callbacks.h create mode 100644 plugins/hextray/hextray.vcxproj create mode 100644 plugins/hextray/hextray.vcxproj.filters create mode 100644 plugins/hextray/hextray.vcxproj.user create mode 100644 plugins/hextray/icons/banned.ico create mode 100644 plugins/hextray/icons/chan_msg.ico create mode 100644 plugins/hextray/icons/disconnected.ico create mode 100644 plugins/hextray/icons/hexchat.ico create mode 100644 plugins/hextray/icons/highlight-1-3.ico create mode 100644 plugins/hextray/icons/highlight.ico create mode 100644 plugins/hextray/icons/kicked.ico create mode 100644 plugins/hextray/icons/priv_msg-1-2-2.ico create mode 100644 plugins/hextray/icons/sd.ico create mode 100644 plugins/hextray/icons/server_notice.ico create mode 100644 plugins/hextray/resource.h create mode 100644 plugins/hextray/resource.rc create mode 100644 plugins/hextray/sdAlerts.cpp create mode 100644 plugins/hextray/sdAlerts.h create mode 100644 plugins/hextray/sdTray.cpp create mode 100644 plugins/hextray/sdTray.h create mode 100644 plugins/hextray/utility.cpp create mode 100644 plugins/hextray/utility.h create mode 100644 plugins/hextray/xchat.cpp create mode 100644 plugins/hextray/xchat.h create mode 100644 plugins/hextray/xtray.cpp create mode 100644 plugins/hextray/xtray.def create mode 100644 plugins/hextray/xtray.h delete mode 100644 plugins/xtray/bitmaps/sd.bmp delete mode 100644 plugins/xtray/callbacks.cpp delete mode 100644 plugins/xtray/callbacks.h delete mode 100644 plugins/xtray/icons/banned.ico delete mode 100644 plugins/xtray/icons/chan_msg.ico delete mode 100644 plugins/xtray/icons/disconnected.ico delete mode 100644 plugins/xtray/icons/hexchat.ico delete mode 100644 plugins/xtray/icons/highlight-1-3.ico delete mode 100644 plugins/xtray/icons/highlight.ico delete mode 100644 plugins/xtray/icons/kicked.ico delete mode 100644 plugins/xtray/icons/priv_msg-1-2-2.ico delete mode 100644 plugins/xtray/icons/sd.ico delete mode 100644 plugins/xtray/icons/server_notice.ico delete mode 100644 plugins/xtray/resource.h delete mode 100644 plugins/xtray/resource.rc delete mode 100644 plugins/xtray/sdAlerts.cpp delete mode 100644 plugins/xtray/sdAlerts.h delete mode 100644 plugins/xtray/sdTray.cpp delete mode 100644 plugins/xtray/sdTray.h delete mode 100644 plugins/xtray/utility.cpp delete mode 100644 plugins/xtray/utility.h delete mode 100644 plugins/xtray/xchat.cpp delete mode 100644 plugins/xtray/xchat.h delete mode 100644 plugins/xtray/xtray.cpp delete mode 100644 plugins/xtray/xtray.def delete mode 100644 plugins/xtray/xtray.h delete mode 100644 plugins/xtray/xtray.vcxproj delete mode 100644 plugins/xtray/xtray.vcxproj.filters delete mode 100644 plugins/xtray/xtray.vcxproj.user diff --git a/plugins/hextray/bitmaps/sd.bmp b/plugins/hextray/bitmaps/sd.bmp new file mode 100644 index 00000000..9d6b7f95 Binary files /dev/null and b/plugins/hextray/bitmaps/sd.bmp differ diff --git a/plugins/hextray/callbacks.cpp b/plugins/hextray/callbacks.cpp new file mode 100644 index 00000000..c7de9626 --- /dev/null +++ b/plugins/hextray/callbacks.cpp @@ -0,0 +1,734 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define _WIN32_IE 0x0601 + +#include +#include +#include +#include + +#include "xchat-plugin.h" +#include "utility.h" +#include "xtray.h" +#include "xchat.h" +#include "callbacks.h" +#include "resource.h" +#include "sdTray.h" +#include "sdAlerts.h" + +HWND g_hPrefTabEvents; +HWND g_hPrefTabSettings; +HWND g_hPrefTabAlerts; +HWND g_hPrefTabAbout; +bool g_bCanQuit; +int g_iIsActive = 1; + + +BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) +{ + TCHAR szTitle[10]; + GetWindowText(hWnd, szTitle, 9); + + if(_tcsstr(szTitle, _T("XChat ["))) + { + g_hXchatWnd = hWnd; + return false; + } + + return true; +} + +/***********************************************************************************************/ +/******* our xchat event call back, get the name and info for each event and save it ***********/ +/******* for our alerts later ***********/ +/***********************************************************************************************/ +int event_cb(char *word[], void *userdata) +{ + int iEvent = (int)userdata; + + if(iEvent > 10 && iEvent != 21) + return XCHAT_EAT_NONE; + + /***************************************************************************************/ + /***** if the window is minimized or if we're allowed to show alerts when its not **/ + /***** and if the option to show the specified alert is true and if we're even **/ + /***** allowed to show alerts at all then we show them (a bit confusing but it works) **/ + /***************************************************************************************/ + if(((g_iIsActive == 0) || !(g_dwPrefs & (1< 0) + { + xchat_set_context(ph, xchat_find_server(msg-1)); + + if(!xchat_get_info(ph, "away")) + { + xchat_away(g_szAway); + } + else + { + xchat_back(); + } + } + } + break; + } + + return 1; +} + +int CALLBACK PrefProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + TCITEM tci1; + TCITEM tci2; + TCITEM tci3; + TCITEM tci4; + + tci1.mask = TCIF_TEXT; + tci1.pszText = _T("Settings"); + tci1.cchTextMax = strlen("Settings"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 0, (LPARAM)&tci1); + + tci2.mask = TCIF_TEXT; + tci2.pszText = _T("Alerts"); + tci2.cchTextMax = strlen("Alerts"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 1, (LPARAM)&tci2); + + tci3.mask = TCIF_TEXT; + tci3.pszText = _T("Events"); + tci3.cchTextMax = strlen("Events"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 2, (LPARAM)&tci3); + + tci4.mask = TCIF_TEXT; + tci4.pszText = _T("About"); + tci4.cchTextMax = strlen("About"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 3, (LPARAM)&tci4); + + + /***********************************************************************************/ + /***********************************************************************************/ + /***********************************************************************************/ + + g_hPrefTabSettings = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_SETTINGS), + hWnd, + (DLGPROC)SettingsProc); + SetDialog(g_hPrefTabSettings, IDD_SETTINGS); + + g_hPrefTabAlerts = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_ALERTS), + hWnd, + (DLGPROC)AlertsProc); + SetDialog(g_hPrefTabAlerts, IDD_ALERTS); + + g_hPrefTabEvents = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_EVENTS), + hWnd, + (DLGPROC)EventsProc); + SetDialog(g_hPrefTabEvents, IDD_EVENTS); + + g_hPrefTabAbout = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_ABOUT), + hWnd, + (DLGPROC)AboutProc); + } + break; + case WM_SHOWWINDOW: + { + if(wparam) + { + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_SETCURSEL, 0, 0); + ShowWindow(g_hPrefTabSettings, SW_SHOW); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + } + break; + case WM_NOTIFY: + { + NMHDR *pData = (NMHDR *)lparam; + + switch(pData->code) + { + case TCN_SELCHANGE: + { + switch(SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_GETCURSEL, 0, 0)) + { + case 0: + { + ShowWindow(g_hPrefTabSettings, SW_SHOW); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + break; + case 1: + { + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_SHOW); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + break; + case 2: + { + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_SHOW); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + break; + case 3: + { + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_SHOW); + } + break; + } + } + break; + } + } + break; + case WM_CLOSE: + { + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + ShowWindow(hWnd, SW_HIDE); + return TRUE; + } + break; + case WM_COMMAND: + { + switch(wparam) + { + case IDC_PREF_OK: + { + CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); + CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); + CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); + + SavePrefs(0); + + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + ShowWindow(hWnd, SW_HIDE); + return TRUE; + } + break; + case IDC_PREF_CANCEL: + { + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + ShowWindow(hWnd, SW_HIDE); + return TRUE; + } + break; + case IDC_PREF_APPLY: + { + CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); + CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); + CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); + + SavePrefs(0); + return FALSE; + } + break; + } + } + break; + case WM_DESTROY: + { + SendMessage(g_hPrefTabEvents, WM_CLOSE, 0, 0); + SendMessage(g_hPrefTabSettings, WM_CLOSE, 0, 0); + SendMessage(g_hPrefTabAbout, WM_CLOSE, 0, 0); + SendMessage(g_hPrefTabAlerts, WM_CLOSE, 0, 0); + } + break; + } + + return FALSE; +} + +/****************************************************/ +/****************************************************/ +/****************************************************/ +LRESULT CALLBACK AlertsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch(msg) + { + case WM_CLOSE: + { + DestroyWindow(hWnd); + return TRUE; + break; + } + break; + case WM_COMMAND: + { + switch(LOWORD(wparam)) + { + case PREF_AMAE: + { + SetToggle(hWnd, PREF_OSBWM, PREF_AMAE, TRUE); + SetToggle(hWnd, PREF_UWIOB, PREF_AMAE, TRUE); + SetToggle(hWnd, PREF_KAOI, PREF_AMAE, TRUE); + + if(IsDlgButtonChecked(hWnd, PREF_AMAE)) + { + SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); + SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); + SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); + SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); + } + else + { + SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_AMAE, TRUE); + SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_AMAE, TRUE); + SetToggle(hWnd, IDC_ALERT_TIME, PREF_AMAE, TRUE); + SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_AMAE, TRUE); + } + } + break; + case PREF_UWIOB: + { + SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); + SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); + } + break; + case PREF_KAOI: + { + SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); + SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); + } + break; + } + break; + } + } + + return FALSE; +} + +/****************************************************/ +/****************************************************/ +/****************************************************/ +LRESULT CALLBACK AboutProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + + return FALSE; +} + +/*****************************************************/ +/** Process the events for our event dialog **********/ +/*****************************************************/ +LRESULT CALLBACK EventsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + + return FALSE; +} + +/*****************************************************/ +/** Process the events for our settings dialog this **/ +/** is alot more complicated because options are **/ +/** enabled/disabled based on the state of others **/ +/*****************************************************/ +LRESULT CALLBACK SettingsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + + return FALSE; +} + +/*****************************************************/ +/** this is the hotkey message processing function **/ +/** this window is always open and ready to be told **/ +/** if someone has hit the hotkey, if they did, we **/ +/** need to close out all of the tray alerts, for **/ +/** this I wrote sdCloseAlerts, more info there **/ +/*****************************************************/ +LRESULT CALLBACK HotKeyProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + else if(msg == WM_HOTKEY) + { + sdCloseAlerts(); + } + + return FALSE; +} + diff --git a/plugins/hextray/callbacks.h b/plugins/hextray/callbacks.h new file mode 100644 index 00000000..99cbae74 --- /dev/null +++ b/plugins/hextray/callbacks.h @@ -0,0 +1,37 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_CALLBACKS_H +#define _H_CALLBACKS_H + +int event_cb (char *word[], void *userdata); +int command_cb (char *word[], char *word_eol[], void *userdata); + +LRESULT CALLBACK WindowProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +BOOL CALLBACK EnumWindowsProc (HWND hWnd, LPARAM lParam); +LRESULT CALLBACK sdTrayProc (HWND hwnd, int msg); + +LRESULT CALLBACK AlertProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK HotKeyProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK EventsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK AboutProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK AlertsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +int CALLBACK PrefProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); + +#endif \ No newline at end of file diff --git a/plugins/hextray/hextray.vcxproj b/plugins/hextray/hextray.vcxproj new file mode 100644 index 00000000..884e3110 --- /dev/null +++ b/plugins/hextray/hextray.vcxproj @@ -0,0 +1,134 @@ + + + + + Release + Win32 + + + Release + x64 + + + + {3024CF36-85E5-4E00-9608-7002E2C7EF14} + Win32Proj + hextray + + + + DynamicLibrary + false + true + Unicode + WDK7 + + + DynamicLibrary + false + true + Unicode + WDK7 + + + + + + + + + + + + + + + false + $(SolutionDir)build\$(PlatformName)\bin + $(SolutionDir)build\$(PlatformName)\obj\$(ProjectName) + + + false + $(SolutionDir)build\$(PlatformName)\bin + $(SolutionDir)build\$(PlatformName)\obj\$(ProjectName) + + + + Level1 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;XTRAY_EXPORTS;_STL70_;_STATIC_CPPLIB;%(PreprocessorDefinitions) + true + ..;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + xtray.def + ntstc_msvcrt.lib;%(AdditionalDependencies) + + + + + Level1 + + + MaxSpeed + true + true + WIN32;_WIN64;NDEBUG;_WINDOWS;_USRDLL;XTRAY_EXPORTS;_STL70_;_STATIC_CPPLIB;%(PreprocessorDefinitions) + true + ..;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + xtray.def + ntstc_msvcrt.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/hextray/hextray.vcxproj.filters b/plugins/hextray/hextray.vcxproj.filters new file mode 100644 index 00000000..637a896d --- /dev/null +++ b/plugins/hextray/hextray.vcxproj.filters @@ -0,0 +1,109 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {448b49a5-e68b-451e-bfbc-0855da024b2e} + + + {8345128a-0635-43d6-9115-a85ad9c77ee2} + + + + + Resource Files + + + Resource Files\bitmaps + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + Resource Files\icons + + + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/plugins/hextray/hextray.vcxproj.user b/plugins/hextray/hextray.vcxproj.user new file mode 100644 index 00000000..695b5c78 --- /dev/null +++ b/plugins/hextray/hextray.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/hextray/icons/banned.ico b/plugins/hextray/icons/banned.ico new file mode 100644 index 00000000..fef8df8c Binary files /dev/null and b/plugins/hextray/icons/banned.ico differ diff --git a/plugins/hextray/icons/chan_msg.ico b/plugins/hextray/icons/chan_msg.ico new file mode 100644 index 00000000..793d050e Binary files /dev/null and b/plugins/hextray/icons/chan_msg.ico differ diff --git a/plugins/hextray/icons/disconnected.ico b/plugins/hextray/icons/disconnected.ico new file mode 100644 index 00000000..9063e7e3 Binary files /dev/null and b/plugins/hextray/icons/disconnected.ico differ diff --git a/plugins/hextray/icons/hexchat.ico b/plugins/hextray/icons/hexchat.ico new file mode 100644 index 00000000..73247fd0 Binary files /dev/null and b/plugins/hextray/icons/hexchat.ico differ diff --git a/plugins/hextray/icons/highlight-1-3.ico b/plugins/hextray/icons/highlight-1-3.ico new file mode 100644 index 00000000..a759145b Binary files /dev/null and b/plugins/hextray/icons/highlight-1-3.ico differ diff --git a/plugins/hextray/icons/highlight.ico b/plugins/hextray/icons/highlight.ico new file mode 100644 index 00000000..625cca9a Binary files /dev/null and b/plugins/hextray/icons/highlight.ico differ diff --git a/plugins/hextray/icons/kicked.ico b/plugins/hextray/icons/kicked.ico new file mode 100644 index 00000000..845a74e1 Binary files /dev/null and b/plugins/hextray/icons/kicked.ico differ diff --git a/plugins/hextray/icons/priv_msg-1-2-2.ico b/plugins/hextray/icons/priv_msg-1-2-2.ico new file mode 100644 index 00000000..7941ff77 Binary files /dev/null and b/plugins/hextray/icons/priv_msg-1-2-2.ico differ diff --git a/plugins/hextray/icons/sd.ico b/plugins/hextray/icons/sd.ico new file mode 100644 index 00000000..ca179621 Binary files /dev/null and b/plugins/hextray/icons/sd.ico differ diff --git a/plugins/hextray/icons/server_notice.ico b/plugins/hextray/icons/server_notice.ico new file mode 100644 index 00000000..ff765d87 Binary files /dev/null and b/plugins/hextray/icons/server_notice.ico differ diff --git a/plugins/hextray/resource.h b/plugins/hextray/resource.h new file mode 100644 index 00000000..b8008c2c --- /dev/null +++ b/plugins/hextray/resource.h @@ -0,0 +1,47 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDD_ALERTS 104 +#define IDD_EVENTS 105 +#define IDD_SETTINGS 106 +#define IDD_ALERT 107 +#define IDD_PREF 108 +#define IDD_ABOUT 109 +#define IDR_TRAY_MENU 110 +#define ICO_XCHAT 111 +#define ICO_BANNED 112 +#define ICO_CHANMSG 113 +#define ICO_DISCONNECTED 114 +#define ICO_HIGHLIGHT 115 +#define ICO_KICKED 116 +#define ICO_PMSG 117 +#define ICO_SNOTICE 118 +#define IDB_SD_LOGO 119 +#define IDC_PREF_OK 1014 +#define IDC_PREF_CANCEL 1015 +#define IDC_PREF_APPLY 1016 +#define IDC_AWAY_MSG 1017 +#define IDC_ALERT_TIME 1018 +#define IDC_TAB_CONTROL 1019 +#define IDC_ALERT_HOTKEY 1020 +#define IDC_ALERT_MSG 1021 +#define IDC_ALERT_HOTKEY_TEXT 1022 +#define IDC_ALERT_TIME_TEXT 1023 +#define ACT_EXIT 40001 +#define ACT_SETTINGS 40002 +#define ACT_AWAY 40003 +#define ACT_BACK 40004 +#define ACT_RESTORE 40005 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 120 +#define _APS_NEXT_COMMAND_VALUE 40006 +#define _APS_NEXT_CONTROL_VALUE 1024 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/hextray/resource.rc b/plugins/hextray/resource.rc new file mode 100644 index 00000000..d2a60911 --- /dev/null +++ b/plugins/hextray/resource.rc @@ -0,0 +1,309 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#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 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_EVENTS DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | DS_SETFOREGROUND | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + GROUPBOX "XChat Events",IDC_STATIC,5,5,205,77 + CONTROL "Banned",4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,18,49,10 + CONTROL "Kicked",5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,32,49,10 + CONTROL "Killed",8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,49,10 + CONTROL "Disconnect",10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,60,49,10 + CONTROL "Private Message",7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,18,69,10 + CONTROL "Channel Message",21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,32,69,10 + CONTROL "Highlight",1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,46,69,10 + CONTROL "CTCP",6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,60,69,10 + CONTROL "Topic Change",3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,18,55,10 + CONTROL "Server Notice",9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,32,55,10 + CONTROL "Invite",2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,46,55,10 +END + +IDD_SETTINGS DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + GROUPBOX "Options",IDC_STATIC,5,5,205,135 + CONTROL "Auto away on minimize",11,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,16,60,100,10 + CONTROL "Minimize XChat to the system tray",12,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,18,133,10 + CONTROL "Minimize to the tray instead of closing",17,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,32,174,9 + EDITTEXT IDC_AWAY_MSG,33,86,169,50,ES_AUTOHSCROLL + LTEXT "Away Msg:",IDC_STATIC,27,72,35,8 + CONTROL "Remove XChat from the taskbar (only show in tray)", + 20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,191,9 +END + +IDD_ALERT DIALOGEX 0, 0, 151, 28 +STYLE DS_LOCALEDIT | DS_SETFONT | DS_NOIDLEMSG | DS_CENTER | WS_CAPTION | + WS_SYSMENU +EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW +CAPTION "Event Name" +FONT 8, "Tahoma", 0, 0, 0x1 +BEGIN + LTEXT "Event Text",IDC_ALERT_MSG,3,0,147,27 +END + +IDD_PREF DIALOGEX 0, 0, 233, 190 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "HexTray Preferences" +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "Ok",IDC_PREF_OK,57,173,50,14 + PUSHBUTTON "Cancel",IDC_PREF_CANCEL,115,173,50,14 + PUSHBUTTON "Apply",IDC_PREF_APPLY,175,173,50,14 + CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",0x0,7,7,218,159 +END + +IDD_ABOUT DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + CONTROL 119,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN | + WS_BORDER,3,6,88,81 + CTEXT "HexTray\r\nBy: Michael Hotaling\r\n www.SinisterDevelopments.com", + IDC_STATIC,95,33,118,30 + LTEXT "Folken\r\nBasket\r\nDonatzsky\r\nDaemon404",IDC_STATIC, + 15,103,64,33 + GROUPBOX "Special Thanks To:",IDC_STATIC,3,91,89,50 + GROUPBOX "Version Information:",IDC_STATIC,101,92,109,49 + LTEXT "1.2.4",IDC_STATIC,170,105,33,8,0,WS_EX_RIGHT + LTEXT "Compiled In: ",IDC_STATIC,110,117,54,8 + LTEXT "2012",IDC_STATIC,170,117,33,8,0,WS_EX_RIGHT + LTEXT "Version Number:",IDC_STATIC,110,105,54,8 +END + +IDD_ALERTS DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + GROUPBOX "Alerts",IDC_STATIC,5,5,205,117 + CONTROL "Only show alerts while minimized",14,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,27,46,117,10 + CONTROL "Use tray alerts to notify me about events",13,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,32,152,10 + CONTROL "Use window instead of balloons",15,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,27,60,141,11 + EDITTEXT IDC_ALERT_TIME,137,101,61,12,ES_AUTOHSCROLL | ES_NUMBER, + WS_EX_RIGHT + LTEXT "Show alert for x seconds:",IDC_ALERT_TIME_TEXT,40,103, + 83,9 + CONTROL "Alert Hotkey",IDC_ALERT_HOTKEY,"msctls_hotkey32", + WS_BORDER | WS_TABSTOP,137,74,61,13 + LTEXT "Close all alerts hotkey:",IDC_ALERT_HOTKEY_TEXT,39,75, + 76,10 + CONTROL "Leave alerts open indefinately",16,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,27,88,115,11 + CONTROL "Blink Icon to alert me about events",18,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,18,127,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_EVENTS, DIALOG + BEGIN + BOTTOMMARGIN, 56 + END + + IDD_SETTINGS, DIALOG + BEGIN + BOTTOMMARGIN, 66 + END + + IDD_ALERT, DIALOG + BEGIN + RIGHTMARGIN, 150 + BOTTOMMARGIN, 26 + END + + IDD_PREF, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 232 + TOPMARGIN, 7 + BOTTOMMARGIN, 176 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 209 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + END + + IDD_ALERTS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 208 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "xtray.h\0" +END + +4 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,2,4,0 + PRODUCTVERSION 1,2,4,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "SinisterDevelopments" + VALUE "FileDescription", "HexTray" + VALUE "FileVersion", "1, 2, 4, 0" + VALUE "InternalName", "HexTray" + VALUE "LegalCopyright", "Copyright © 2005" + VALUE "OriginalFilename", "hextray.dll" + VALUE "ProductName", "HexTray - HexChat Win32 System Tray Plugin" + VALUE "ProductVersion", "1, 2, 4, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_TRAY_MENU MENU +BEGIN + POPUP "TRAY" + BEGIN + MENUITEM "Restore", ACT_RESTORE + MENUITEM SEPARATOR + MENUITEM "Away", 65535 + MENUITEM "Settings", ACT_SETTINGS + MENUITEM SEPARATOR + MENUITEM "Exit", ACT_EXIT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +ICO_XCHAT ICON "icons\\hexchat.ico" +ICO_BANNED ICON "icons\\banned.ico" +ICO_CHANMSG ICON "icons\\chan_msg.ico" +ICO_HIGHLIGHT ICON "icons\\highlight.ico" +ICO_KICKED ICON "icons\\kicked.ico" +ICO_PMSG ICON "icons\\priv_msg-1-2-2.ico" +ICO_SNOTICE ICON "icons\\server_notice.ico" +ICO_DISCONNECTED ICON "icons\\disconnected.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_SD_LOGO BITMAP "bitmaps\\sd.bmp" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +xtray.h +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/hextray/sdAlerts.cpp b/plugins/hextray/sdAlerts.cpp new file mode 100644 index 00000000..5e042806 --- /dev/null +++ b/plugins/hextray/sdAlerts.cpp @@ -0,0 +1,109 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include "utility.h" +#include "resource.h" +#include "sdAlerts.h" + +int g_iAlerts = 0; + +void sdSystemAlert(HINSTANCE hModule, UINT uiDialog, char *szMsg, char *szName, unsigned int iTime) +{ + TCHAR wszMsg[256]; + TCHAR wszName[64]; + + HWND hDialog; + RECT rcWorkArea, rcDlg; + int ixPos, iyPos; + int iNumPerCol; + + hDialog = CreateDialog(hModule, MAKEINTRESOURCE(uiDialog), NULL, (DLGPROC)sdAlertProc); + + SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0); + GetWindowRect(hDialog, &rcDlg); + + iNumPerCol = ((rcWorkArea.bottom - rcWorkArea.top) / (rcDlg.bottom - rcDlg.top)); + ixPos = rcWorkArea.right - (rcDlg.right - rcDlg.left) + 1; + iyPos = rcWorkArea.bottom - (rcDlg.bottom - rcDlg.top); + + if((g_iAlerts >= iNumPerCol) && (iNumPerCol > 0)) + { + ixPos -= ((g_iAlerts / iNumPerCol) * (rcDlg.right - rcDlg.left)); + iyPos -= ((g_iAlerts - (iNumPerCol * (g_iAlerts / iNumPerCol))) * (rcDlg.bottom - rcDlg.top)); + } + else + { + iyPos -= (g_iAlerts * (rcDlg.bottom - rcDlg.top)); + } + SetWindowPos(hDialog, HWND_TOPMOST, ixPos, iyPos, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); + + ConvertString(szName, wszName, 64); + ConvertString(szMsg, wszMsg, 256); + + SetWindowText(hDialog, wszName); + SetDlgItemText(hDialog, IDC_ALERT_MSG, wszMsg); + ShowWindow(hDialog, SW_SHOWNA); + + if(iTime > 0) + { + SetTimer(hDialog, 1, iTime, NULL); + } + + g_iAlerts++; +} + +void sdCloseAlerts() +{ + PostMessage(HWND_BROADCAST, RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows")), 0, 0); +} + +LRESULT CALLBACK sdAlertProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch(msg) + { + case WM_CLOSE: + if(g_iAlerts > 0){ g_iAlerts--; } + DestroyWindow(hwnd); + return TRUE; + break; + case WM_TIMER: + if(g_iAlerts > 0){ g_iAlerts--; } + AnimateWindow(hwnd, 600, AW_SLIDE | AW_HIDE | AW_VER_POSITIVE); + DestroyWindow(hwnd); + return TRUE; + break; + default: + if(msg == RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows"))) + { + if(g_iAlerts > 0){ g_iAlerts--; } + DestroyWindow(hwnd); + return TRUE; + } + break; + } + + return FALSE; +} + +int sdAlertNum() +{ + return g_iAlerts; +} \ No newline at end of file diff --git a/plugins/hextray/sdAlerts.h b/plugins/hextray/sdAlerts.h new file mode 100644 index 00000000..cd45a05b --- /dev/null +++ b/plugins/hextray/sdAlerts.h @@ -0,0 +1,26 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_SDALERTS_H +#define _H_SDALERTS_H + +void sdSystemAlert (HINSTANCE, UINT, char *, char *, UINT); +LRESULT CALLBACK sdAlertProc (HWND, UINT, WPARAM, LPARAM); +int sdAlertNum (); +void sdCloseAlerts (); +#endif \ No newline at end of file diff --git a/plugins/hextray/sdTray.cpp b/plugins/hextray/sdTray.cpp new file mode 100644 index 00000000..3a91a61b --- /dev/null +++ b/plugins/hextray/sdTray.cpp @@ -0,0 +1,207 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define _WIN32_IE 0x601 +#include +#include +#include +#include "sdTray.h" +#include "utility.h" + +HANDLE hThread; +iBlink *tData = NULL; + +int AddIcon(HWND hwnd, UINT id, HICON hicon, char *szTip, unsigned short flags, unsigned int cbMsg) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hIcon = hicon; + nidata.hWnd = hwnd; + nidata.uCallbackMessage = cbMsg; + nidata.uFlags = flags; + nidata.uID = id; + + if(szTip != NULL) + { + TCHAR *szTemp = new TCHAR[64]; + + ConvertString(szTip, szTemp, 64); + _tcsncpy(nidata.szTip, szTemp, 64); + + delete[] szTemp; + } + + return Shell_NotifyIcon(NIM_ADD, &nidata); +} + +int RemoveIcon(HWND hwnd, UINT id) +{ + if(hThread != NULL) + { + TerminateThread(hThread, 0); + hThread = NULL; + + delete tData; + } + + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + + return Shell_NotifyIcon(NIM_DELETE, &nidata); +} + +int SetIcon(HWND hwnd, UINT id, HICON hicon) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + nidata.hIcon = hicon; + nidata.uFlags = NIF_ICON; + + return Shell_NotifyIcon(NIM_MODIFY, &nidata); +} + +int SetTooltip(HWND hwnd, UINT id, char *szTip) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + nidata.uFlags = NIF_TIP; + + if(szTip != NULL) + { + TCHAR *szTemp = new TCHAR[64]; + ConvertString(szTip, szTemp, 64); + _tcsncpy(nidata.szTip, szTemp, 64); + delete[] szTemp; + } + + return Shell_NotifyIcon(NIM_MODIFY, &nidata); +} + +int ShowBalloon(HWND hwnd, UINT id, char *szInfo, char *szTitle, UINT time, UINT infoFlags) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + nidata.uFlags = NIF_INFO; + nidata.dwInfoFlags = infoFlags; + + if(time > 0) + nidata.uTimeout = time; + else + nidata.uTimeout = 500000; + + if(szInfo != NULL) + { + TCHAR *szTemp = new TCHAR[255]; + + ConvertString(szInfo, szTemp, 251); + szTemp[250] = 0; + + if(strlen(szInfo) > 255) + { + _sntprintf(szTemp, 255, _T("%s..."), szTemp); + } + _tcsncpy(nidata.szInfo, szTemp, 255); + + delete[] szTemp; + } + if(szTitle != NULL) + { + TCHAR *wszTitle = new TCHAR[64]; + ConvertString(szTitle, wszTitle, 64); + _tcsncpy(nidata.szInfoTitle, wszTitle, 64); + delete[] wszTitle; + } + + return Shell_NotifyIcon(NIM_MODIFY, &nidata); +} + + +DWORD WINAPI BlinkThread(LPVOID lpParam) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = tData->hwnd; + nidata.uID = tData->id; + nidata.uFlags = NIF_ICON; + + for(UINT i = 0; i < tData->num; i++) + { + nidata.hIcon = tData->hBlink; + Shell_NotifyIcon(NIM_MODIFY, &nidata); + + Sleep(tData->time); + + nidata.hIcon = tData->hBase; + Shell_NotifyIcon(NIM_MODIFY, &nidata); + + Sleep(tData->time); + } + + delete tData; + hThread = NULL; + + return 0; +} + +int BlinkIcon(HWND hwnd, UINT id, HICON hBase, HICON hBlink, UINT time, UINT num) +{ + if(hThread != NULL) + { + StopBlink(hwnd, id, hBase); + } + + DWORD dwThreadID; + tData = new iBlink; + + tData->hwnd = hwnd; + tData->id = id; + tData->hBase = hBase; + tData->hBlink = hBlink; + tData->time = time; + tData->num = num; + + hThread = CreateThread(NULL, 0, BlinkThread, tData, 0, &dwThreadID); + + return 0; +} + +void StopBlink(HWND hwnd, UINT id, HICON hBase) +{ + if(hThread != NULL) + { + TerminateThread(hThread, 0); + hThread = NULL; + + delete tData; + } + + SetIcon(hwnd, id, hBase); +} \ No newline at end of file diff --git a/plugins/hextray/sdTray.h b/plugins/hextray/sdTray.h new file mode 100644 index 00000000..68469fe0 --- /dev/null +++ b/plugins/hextray/sdTray.h @@ -0,0 +1,39 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_SDTRAY_H +#define _H_SDTRAY_H + +int AddIcon (HWND, UINT, HICON, char *, unsigned short, UINT); +int ShowBalloon (HWND, UINT, char *, char *, UINT, UINT); +int BlinkIcon (HWND, UINT, HICON, HICON, UINT, UINT); +int SetTooltip (HWND, UINT, char *); +int SetIcon (HWND, UINT, HICON); +void StopBlink (HWND, UINT, HICON); +int RemoveIcon (HWND, UINT); + +typedef struct IBLINK +{ + HICON hBase; + HICON hBlink; + HWND hwnd; + UINT id; + UINT time; + UINT num; +}iBlink; +#endif \ No newline at end of file diff --git a/plugins/hextray/utility.cpp b/plugins/hextray/utility.cpp new file mode 100644 index 00000000..66489bc0 --- /dev/null +++ b/plugins/hextray/utility.cpp @@ -0,0 +1,607 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "xchat-plugin.h" +#include "utility.h" +#include "xtray.h" +#include "callbacks.h" +#include "resource.h" + +TCHAR BACKUP_INI_FILE[] = _T(".\\plugins\\config\\xtray.conf"); +struct HOTKEY g_hHotKey; + +/* we need to convert ALT and SHIFT modifiers +// from +#define MOD_ALT 0x0001 +#define MOD_CONTROL 0x0002 +#define MOD_SHIFT 0x0004 +// from +#define HOTKEYF_SHIFT 0x01 +#define HOTKEYF_CONTROL 0x02 +#define HOTKEYF_ALT 0x04 +*/ + +WORD HotkeyfToMod(WORD modifiers) +{ + WORD newmods = 0; + + if (modifiers & HOTKEYF_SHIFT) + newmods |= MOD_SHIFT; + + if (modifiers & HOTKEYF_CONTROL) + newmods |= MOD_CONTROL; + + if (modifiers & HOTKEYF_ALT) + newmods |= MOD_ALT; + + return newmods; +} + +WORD ModToHotkeyf(WORD modifiers) +{ + WORD newmods = 0; + + if (modifiers & MOD_SHIFT) + newmods |= HOTKEYF_SHIFT; + + if (modifiers & MOD_CONTROL) + newmods |= HOTKEYF_CONTROL; + + if (modifiers & MOD_ALT) + newmods |= HOTKEYF_ALT; + + return newmods; +} + +void SavePrefs(int iDlg) +{ + /**************************************************************************************************/ + /********** allocate space for our string, and then set it to the currently logged on user ********/ + /**************************************************************************************************/ + DWORD dBuff = 257; + TCHAR szUser[257]; + + GetUserName(szUser, &dBuff); + + /**************************************************************************************************/ + /*********************** Test if the file exists, If it doesn't, Create It ************************/ + /**************************************************************************************************/ + TCHAR XTRAY_INI_FILE[1024]; + +#ifdef UNICODE + char temp[1024]; + TCHAR TEMP_INI_FILE[1024]; + + _snprintf(temp, 1024, "%s\\xtray.conf", xchat_get_info(ph, "xchatdir")); + ConvertString(temp, TEMP_INI_FILE, 1024); + + // ok this one is really ugly + // it checks to see if the file exists in two locations + // X-Chat default config dir, if that fails it trys xchat\plugins\config + // if neither one exists it tries to create it in + // X-Chat default config dir, if that fails it trys xchat\plugins\config + // In either case it writes \xFF\xFE to the file ( on creation ) + // so that we can save unicode away messages WritePrivateProfile doesn't + // do this for us, though I think it really should + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + else + { + HANDLE xTemp; + DWORD dwBytesTemp; + + if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); + } + CloseHandle(xTemp); + } + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + HANDLE xBackup; + DWORD dwBytesBackup; + + if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); + } + + CloseHandle(xBackup); + } + + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + } + } + } + +#else + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); +#endif + + WritePrivateProfileInt(szUser, _T("SETTINGS"), g_dwPrefs, XTRAY_INI_FILE); + WritePrivateProfileInt(szUser, _T("AOT"), g_iTime, XTRAY_INI_FILE); + WritePrivateProfileInt(szUser, _T("KEY"), g_hHotKey.key, XTRAY_INI_FILE); + WritePrivateProfileInt(szUser, _T("MOD"), g_hHotKey.mod, XTRAY_INI_FILE); + WritePrivateProfileString(szUser, _T("AWAY"), g_szAway, XTRAY_INI_FILE); +} + +void LoadPrefs() +{ + /**************************************************************************************************/ + /*********************** Our Settings Section *****************************************************/ + /**************************************************************************************************/ + DWORD dBuff = 257; + TCHAR szUser[257]; + + GetUserName(szUser, &dBuff); + + /**************************************************************************************************/ + /*********************** Test if the file exists, If it doesn't, Create It ************************/ + /**************************************************************************************************/ + TCHAR XTRAY_INI_FILE[1024]; + +#ifdef UNICODE + char temp[1024]; + TCHAR TEMP_INI_FILE[1024]; + + _snprintf(temp, 1024, "%s\\xtray.conf", xchat_get_info(ph, "xchatdir")); + ConvertString(temp, TEMP_INI_FILE, 1024); + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + else + { + HANDLE xTemp; + DWORD dwBytesTemp; + + if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); + } + + CloseHandle(xTemp); + } + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + HANDLE xBackup; + DWORD dwBytesBackup; + + if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); + } + + CloseHandle(xBackup); + } + + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + } + } + } + +#else + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); +#endif + + /**************************************************************************************************/ + /*************************** Get the value for each of our preferances ****************************/ + /**************************************************************************************************/ + g_dwPrefs = GetPrivateProfileInt(szUser, _T("SETTINGS"), 0, XTRAY_INI_FILE); + + // backwards compatability + // also allows us to set defaults if its a new installation + // disable topic change, channel message and server notice by default + if(g_dwPrefs == 0) + { + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("HILIGHT"), 1, XTRAY_INI_FILE)<<1); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("INVITE"), 1, XTRAY_INI_FILE)<<2); + /* g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOPIC"), 1, XTRAY_INI_FILE)<<3); */ + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("BANNED"), 1, XTRAY_INI_FILE)<<4); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KICKED"), 1, XTRAY_INI_FILE)<<5); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("CTCP"), 1, XTRAY_INI_FILE)<<6); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("PMSG"), 1, XTRAY_INI_FILE)<<7); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KILLED"), 1, XTRAY_INI_FILE)<<8); + /* g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("NOTICE"), 1, XTRAY_INI_FILE)<<9); */ + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("DISCONNECT"), 1, XTRAY_INI_FILE)<<10); + + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AOM"), 0, XTRAY_INI_FILE)<<11); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOT"), 1, XTRAY_INI_FILE)<<12); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AMAE"), 1, XTRAY_INI_FILE)<<13); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("OSBWM"), 0, XTRAY_INI_FILE)<<14); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("UWIOB"), 0, XTRAY_INI_FILE)<<15); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KAOI"), 0, XTRAY_INI_FILE)<<16); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("MIOC"), 0, XTRAY_INI_FILE)<<17); + } + + g_hHotKey.key = GetPrivateProfileInt(szUser, _T("KEY"), 84, XTRAY_INI_FILE); + g_hHotKey.mod = GetPrivateProfileInt(szUser, _T("MOD"), (MOD_CONTROL | MOD_SHIFT), XTRAY_INI_FILE); + g_iTime = GetPrivateProfileInt(szUser, _T("AOT"), 5, XTRAY_INI_FILE); + + GetPrivateProfileString(szUser, _T("AWAY"), _T(""), g_szAway, 1024, XTRAY_INI_FILE); + + /**************************************************************************************************/ + /******************************** Register our hotkey with windows ********************************/ + /**************************************************************************************************/ + if(g_dwPrefs & (1< + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_UTILITY_H +#define _H_UTILITY_H + +WORD HotkeyfToMod (WORD); +WORD ModToHotkeyf (WORD); + +int SetOption (HWND, unsigned int, unsigned int); +int SetCheck (HWND, unsigned int, unsigned int); +int SetToggle (HWND, unsigned int, unsigned int, bool); +void ErrorDebug (LPTSTR lpszFunction); +void SetDialog (HWND, int); +void CheckPrefs (HWND, int); +bool FileExists (TCHAR *); +DWORD WINAPI HoldCloseThread (LPVOID); +void SavePrefs (int); +void LoadPrefs (); +void HoldClose (); + +void ConvertString(const char *in, wchar_t *out, int size); +void ConvertString(const wchar_t *in, char *out, int size); +void ConvertString(const char *in, char *out, int size); + +int WritePrivateProfileIntA(char *, char *, int, char *); +int WritePrivateProfileIntW(wchar_t *, wchar_t *, int, wchar_t *); + +#ifdef UNICODE +#define WritePrivateProfileInt WritePrivateProfileIntW +#else +#define WritePrivateProfileInt WritePrivateProfileIntA +#endif + +struct HOTKEY +{ + WORD key; + WORD mod; +}; +#endif \ No newline at end of file diff --git a/plugins/hextray/xchat.cpp b/plugins/hextray/xchat.cpp new file mode 100644 index 00000000..47ce46a9 --- /dev/null +++ b/plugins/hextray/xchat.cpp @@ -0,0 +1,320 @@ +/* X-Tray + * Copyright (C) 1998, 2005 Peter Zelezny, Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include + +#include "xchat-plugin.h" +#include "xtray.h" +#include "resource.h" +#include "xchat.h" +#include "utility.h" + +// from util.c of xchat source code ( slightly modified to fit X-Tray Syntax ) +char *xchat_strip_color (char *text) +{ + int nc = 0; + int i = 0; + int col = 0; + int len = strlen(text); + char *new_str = (char *)malloc(len + 2); + + while (len > 0) + { + if ((col && isdigit(*text) && (nc < 2)) || (col && isdigit(*(text+1)) && (nc < 3) && (*text == ','))) + { + nc++; + + if(*text == ',') + { + nc = 0; + } + } + else + { + col = 0; + + switch (*text) + { + case '\003': /*ATTR_COLOR: */ + { + col = 1; + nc = 0; + } + break; + case '\007': /*ATTR_BEEP: */ + case '\017': /*ATTR_RESET: */ + case '\026': /*ATTR_REVERSE: */ + case '\002': /*ATTR_BOLD: */ + case '\037': /*ATTR_UNDERLINE: */ + break; + default: + { + new_str[i] = *text; + i++; + } + break; + } + } + + text++; + len--; + } + + new_str[i] = 0; + + return new_str; +} + +void check_special_chars (char *cmd) +{ + int occur = 0; + int len = strlen (cmd); + int i = 0, j = 0; + char *buf; + + if (!len) + return; + + buf = (char *)malloc (len + 1); + + if (buf) + { + while (cmd[j]) + { + switch (cmd[j]) + { + case '%': + { + occur++; + + switch (cmd[j + 1]) + { + case 'R': + buf[i] = '\026'; + break; + case 'U': + buf[i] = '\037'; + break; + case 'B': + buf[i] = '\002'; + break; + case 'C': + buf[i] = '\003'; + break; + case 'O': + buf[i] = '\017'; + break; + case '%': + buf[i] = '%'; + break; + default: + buf[i] = '%'; + j--; + break; + } + + j++; + } + break; + default: + { + buf[i] = cmd[j]; + } + break; + } + + j++; + i++; + } + + buf[i] = 0; + + if (occur) + strcpy (cmd, buf); + + free (buf); + } +} + +void xchat_globally_away(TCHAR *tszAway) +{ + char szTemp[512]; + char szAway[512]; + + ConvertString(tszAway, szAway, 512); + _snprintf(szTemp, 512, "ALLSERV AWAY %s\0", szAway); + check_special_chars(szTemp); + xchat_exec(szTemp); +} + +void xchat_away(TCHAR *tszAway) +{ + char szTemp[512]; + char szAway[512]; + + ConvertString(tszAway, szAway, 512); + _snprintf(szTemp, 512, szAway); + check_special_chars(szTemp); + xchat_commandf(ph, "AWAY %s\0", szTemp); +} + +void xchat_globally_back() +{ + std::vector xs; + std::vector::iterator xsi; + xchat_list *xl = xchat_list_get(ph, "channels"); + + if(xl) + { + while(xchat_list_next(ph, xl)) + { + xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); + + if((xsi == xs.end()) && + ((strlen(xchat_list_str(ph, xl, "server")) > 0) || + (strlen(xchat_list_str(ph, xl, "channel")) > 0))) + { + xs.push_back(xchat_list_int(ph, xl, "id")); + xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); + xchat_back(); + } + } + + xchat_list_free(ph, xl); + } +} + + + +void xchat_back() +{ + if(xchat_get_info(ph, "away")) + { + xchat_command(ph, "BACK"); + } +} + +HMENU setServerMenu() +{ + HMENU sTemp = CreateMenu(); + TCHAR wszServer[128]; + TCHAR wszNick[128]; + TCHAR wszMenuEntry[256]; + + std::vector xs; + std::vector::iterator xsi; + xchat_list *xl = xchat_list_get(ph, "channels"); + + AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away")); + AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back")); + AppendMenu(sTemp, MF_SEPARATOR, 0, NULL); + + if(xl) + { + while(xchat_list_next(ph, xl)) + { + xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); + + if( (xsi == xs.end()) && + ((strlen(xchat_list_str(ph, xl, "server")) > 0) || + (strlen(xchat_list_str(ph, xl, "channel")) > 0))) + { + xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); + xs.push_back(xchat_list_int(ph, xl, "id")); + + char *network = _strdup(xchat_list_str(ph, xl, "network")); + char *server = _strdup(xchat_list_str(ph, xl, "server")); + char *nick = _strdup(xchat_get_info(ph, "nick")); + + if(network != NULL) + { + ConvertString(network, wszServer, 128); + } + else + { + ConvertString(server, wszServer, 128); + } + + if(server != NULL) + { + ConvertString(nick, wszNick, 128); + _sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer); + + if(!xchat_get_info(ph, "away")) + { + AppendMenu(sTemp, MF_STRING, (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); + } + else + { + AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); + } + } + + free(network); + free(server); + free(nick); + } + } + + xchat_list_free(ph, xl); + } + + return sTemp; +} + +struct _xchat_context *xchat_find_server(int find_id) +{ + xchat_context *xc; + xchat_list *xl = xchat_list_get(ph, "channels"); + int id; + + if(!xl) + return NULL; + + while(xchat_list_next(ph, xl)) + { + id = xchat_list_int(ph, xl, "id"); + + if(id == -1) + { + return NULL; + } + else if(id == find_id) + { + xc = (xchat_context *)xchat_list_str(ph, xl, "context"); + + xchat_list_free(ph, xl); + + return xc; + } + } + + xchat_list_free(ph, xl); + + return NULL; +} + +void xchat_exec(char *command) +{ + xchat_set_context(ph, xchat_find_context(ph, NULL, NULL)); + xchat_command(ph, command); +} \ No newline at end of file diff --git a/plugins/hextray/xchat.h b/plugins/hextray/xchat.h new file mode 100644 index 00000000..76452aeb --- /dev/null +++ b/plugins/hextray/xchat.h @@ -0,0 +1,32 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_XCHAT_H +#define _H_XCHAT_H + +void xchat_exec (char *); +char *xchat_strip_color (char *); +void xchat_parse (char *); +struct _xchat_context *xchat_find_server (int); +void xchat_globally_away (TCHAR *); +void xchat_away (TCHAR *); +void xchat_globally_back (); +void xchat_back (); +HMENU setServerMenu (); + +#endif \ No newline at end of file diff --git a/plugins/hextray/xtray.cpp b/plugins/hextray/xtray.cpp new file mode 100644 index 00000000..69303fc5 --- /dev/null +++ b/plugins/hextray/xtray.cpp @@ -0,0 +1,219 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define _WIN32_IE 0x0601 + +#include +#include +#include +#include + +#include "xchat-plugin.h" +#include "resource.h" +#include "callbacks.h" +#include "utility.h" +#include "xtray.h" +#include "sdTray.h" +#include "sdAlerts.h" + +/*****************************************************/ +/**** Don't want to pollute the namespace do we? *****/ +/*****************************************************/ +std::list g_vHooks; + +/*****************************************************/ +/************ Global Identifiers *********************/ +/*****************************************************/ +WNDPROC g_hOldProc; +xchat_plugin *ph; + +/*****************************************************/ +/***************** Resources *************************/ +/*****************************************************/ +HWND g_hXchatWnd; +HWND g_hHotkeyWnd; +HWND g_hPrefDlg; +HMENU g_hTrayMenu; +HICON g_hIcons[11]; +HANDLE g_hInstance; +/*****************************************************/ +/***************** Preferences ***********************/ +/*****************************************************/ +unsigned int g_dwPrefs; +TCHAR g_szAway[512]; +int g_iTime; + + +BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpVoid) +{ + if((fdwReason == DLL_PROCESS_ATTACH) || (fdwReason == DLL_THREAD_ATTACH)) + { + g_hInstance = hModule; + } + + return TRUE; +} + +int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) +{ + ph = plugin_handle; + + *plugin_name = "X-Tray"; + *plugin_desc = "Minimize XChat to the Windows system tray"; + *plugin_version = "1.2.4"; + + /***************************************************************************************************************************/ + /************************* Load our preferances from xTray.ini *************************************************************/ + /***************************************************************************************************************************/ + LoadPrefs(); + + /***************************************************************************************************************************/ + /************************* Finds the xChat window and saves it for later use ***********************************************/ + /***************************************************************************************************************************/ + g_hXchatWnd = (HWND)xchat_get_info(ph, "win_ptr"); + + if(g_hXchatWnd == NULL) + { + EnumThreadWindows(GetCurrentThreadId(), EnumWindowsProc, 0); + } + + g_hOldProc = (WNDPROC)GetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC); + SetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC, (LONG_PTR)WindowProc); + + /***************************************************************************************************************************/ + /************************* Grab the xChat Icon, Load our menu, create the window to receive the hotkey messages ***********/ + /************************* and register the windows message so we know if explorer crashes ***********/ + /***************************************************************************************************************************/ + g_hTrayMenu = GetSubMenu(LoadMenu((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDR_TRAY_MENU)), 0); + g_hHotkeyWnd = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ALERT), NULL, (DLGPROC)HotKeyProc); + g_hPrefDlg = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_PREF), g_hXchatWnd, (DLGPROC)PrefProc); + + g_hIcons[0] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_XCHAT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[1] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_CHANMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[2] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_HIGHLIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[5] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_BANNED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[6] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_KICKED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[8] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_PMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[10]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_SNOTICE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[11]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_DISCONNECTED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + + /***************************************************************************************************************************/ + /************************* Add our icon to the tray ************************************************************************/ + /***************************************************************************************************************************/ + char szVersion[64]; + _snprintf(szVersion, 64, "HexChat %s", xchat_get_info(ph, "version")); + AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG); + + /***************************************************************************************************************************/ + /***************************************************************************************************************************/ + /***************************************************************************************************************************/ + if(g_dwPrefs & (1< + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _XTRAY_H +#define _XTRAY_H + +/******************** Globals *************************/ +extern HWND g_hXchatWnd; +extern HWND g_hHotkeyWnd; +extern HWND g_hPrefDlg; +extern HMENU g_hTrayMenu; +extern HICON g_hIcons[11]; +extern HANDLE g_hInstance; +extern unsigned int g_dwPrefs; +extern TCHAR g_szAway[512]; +extern int g_iTime; +extern WNDPROC g_hOldProc; +extern struct _xchat_plugin *ph; +/******************************************************/ + +/******************** Messages ************************/ +#define WM_TRAYMSG WM_APP +/******************************************************/ + +/********************* Events *************************/ +#define CHAN_HILIGHT 1 +#define CHAN_INVITE 2 +#define CHAN_TOPIC_CHANGE 3 +#define CHAN_BANNED 4 +#define CHAN_KICKED 5 + +#define CTCP_GENERIC 6 +#define PMSG_RECEIVE 7 + +#define SERV_KILLED 8 +#define SERV_NOTICE 9 +#define SERV_DISCONNECT 10 + +/* new events */ +#define CHAN_MESSAGE 21 + +#define PREF_AOM 11 // away on minimize +#define PREF_TOT 12 // Tray on Taskbar +#define PREF_AMAE 13 // alert me about events +#define PREF_OSBWM 14 // Only Show Balloon When Minimized +#define PREF_UWIOB 15 // Use Window Instead of Balloon +#define PREF_KAOI 16 // Keep alerts open indefinately +#define PREF_MIOC 17 // Minimize instead of close +#define PREF_BLINK 18 // blink icon +#define PREF_CICO 19 // change icon - not implemented +#define PREF_DNSIT 20 // Do not show in taskbar +/******************************************************/ +#endif + +#ifdef _WIN64 +/* use replacement with the same value, and use SetWindowLongPtr instead + of SetWindowLong. more info: + + http://msdn.microsoft.com/en-us/library/ms633591.aspx + http://msdn.microsoft.com/en-us/library/ms644898.aspx */ +#define GWL_HWNDPARENT GWLP_HWNDPARENT +#endif diff --git a/plugins/xtray/bitmaps/sd.bmp b/plugins/xtray/bitmaps/sd.bmp deleted file mode 100644 index 9d6b7f95..00000000 Binary files a/plugins/xtray/bitmaps/sd.bmp and /dev/null differ diff --git a/plugins/xtray/callbacks.cpp b/plugins/xtray/callbacks.cpp deleted file mode 100644 index c7de9626..00000000 --- a/plugins/xtray/callbacks.cpp +++ /dev/null @@ -1,734 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#define _WIN32_IE 0x0601 - -#include -#include -#include -#include - -#include "xchat-plugin.h" -#include "utility.h" -#include "xtray.h" -#include "xchat.h" -#include "callbacks.h" -#include "resource.h" -#include "sdTray.h" -#include "sdAlerts.h" - -HWND g_hPrefTabEvents; -HWND g_hPrefTabSettings; -HWND g_hPrefTabAlerts; -HWND g_hPrefTabAbout; -bool g_bCanQuit; -int g_iIsActive = 1; - - -BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) -{ - TCHAR szTitle[10]; - GetWindowText(hWnd, szTitle, 9); - - if(_tcsstr(szTitle, _T("XChat ["))) - { - g_hXchatWnd = hWnd; - return false; - } - - return true; -} - -/***********************************************************************************************/ -/******* our xchat event call back, get the name and info for each event and save it ***********/ -/******* for our alerts later ***********/ -/***********************************************************************************************/ -int event_cb(char *word[], void *userdata) -{ - int iEvent = (int)userdata; - - if(iEvent > 10 && iEvent != 21) - return XCHAT_EAT_NONE; - - /***************************************************************************************/ - /***** if the window is minimized or if we're allowed to show alerts when its not **/ - /***** and if the option to show the specified alert is true and if we're even **/ - /***** allowed to show alerts at all then we show them (a bit confusing but it works) **/ - /***************************************************************************************/ - if(((g_iIsActive == 0) || !(g_dwPrefs & (1< 0) - { - xchat_set_context(ph, xchat_find_server(msg-1)); - - if(!xchat_get_info(ph, "away")) - { - xchat_away(g_szAway); - } - else - { - xchat_back(); - } - } - } - break; - } - - return 1; -} - -int CALLBACK PrefProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - switch(msg) - { - case WM_INITDIALOG: - { - TCITEM tci1; - TCITEM tci2; - TCITEM tci3; - TCITEM tci4; - - tci1.mask = TCIF_TEXT; - tci1.pszText = _T("Settings"); - tci1.cchTextMax = strlen("Settings"); - SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 0, (LPARAM)&tci1); - - tci2.mask = TCIF_TEXT; - tci2.pszText = _T("Alerts"); - tci2.cchTextMax = strlen("Alerts"); - SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 1, (LPARAM)&tci2); - - tci3.mask = TCIF_TEXT; - tci3.pszText = _T("Events"); - tci3.cchTextMax = strlen("Events"); - SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 2, (LPARAM)&tci3); - - tci4.mask = TCIF_TEXT; - tci4.pszText = _T("About"); - tci4.cchTextMax = strlen("About"); - SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 3, (LPARAM)&tci4); - - - /***********************************************************************************/ - /***********************************************************************************/ - /***********************************************************************************/ - - g_hPrefTabSettings = CreateDialog((HINSTANCE)g_hInstance, - MAKEINTRESOURCE(IDD_SETTINGS), - hWnd, - (DLGPROC)SettingsProc); - SetDialog(g_hPrefTabSettings, IDD_SETTINGS); - - g_hPrefTabAlerts = CreateDialog((HINSTANCE)g_hInstance, - MAKEINTRESOURCE(IDD_ALERTS), - hWnd, - (DLGPROC)AlertsProc); - SetDialog(g_hPrefTabAlerts, IDD_ALERTS); - - g_hPrefTabEvents = CreateDialog((HINSTANCE)g_hInstance, - MAKEINTRESOURCE(IDD_EVENTS), - hWnd, - (DLGPROC)EventsProc); - SetDialog(g_hPrefTabEvents, IDD_EVENTS); - - g_hPrefTabAbout = CreateDialog((HINSTANCE)g_hInstance, - MAKEINTRESOURCE(IDD_ABOUT), - hWnd, - (DLGPROC)AboutProc); - } - break; - case WM_SHOWWINDOW: - { - if(wparam) - { - SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_SETCURSEL, 0, 0); - ShowWindow(g_hPrefTabSettings, SW_SHOW); - ShowWindow(g_hPrefTabAlerts, SW_HIDE); - ShowWindow(g_hPrefTabEvents, SW_HIDE); - ShowWindow(g_hPrefTabAbout, SW_HIDE); - } - } - break; - case WM_NOTIFY: - { - NMHDR *pData = (NMHDR *)lparam; - - switch(pData->code) - { - case TCN_SELCHANGE: - { - switch(SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_GETCURSEL, 0, 0)) - { - case 0: - { - ShowWindow(g_hPrefTabSettings, SW_SHOW); - ShowWindow(g_hPrefTabAlerts, SW_HIDE); - ShowWindow(g_hPrefTabEvents, SW_HIDE); - ShowWindow(g_hPrefTabAbout, SW_HIDE); - } - break; - case 1: - { - ShowWindow(g_hPrefTabSettings, SW_HIDE); - ShowWindow(g_hPrefTabAlerts, SW_SHOW); - ShowWindow(g_hPrefTabEvents, SW_HIDE); - ShowWindow(g_hPrefTabAbout, SW_HIDE); - } - break; - case 2: - { - ShowWindow(g_hPrefTabSettings, SW_HIDE); - ShowWindow(g_hPrefTabAlerts, SW_HIDE); - ShowWindow(g_hPrefTabEvents, SW_SHOW); - ShowWindow(g_hPrefTabAbout, SW_HIDE); - } - break; - case 3: - { - ShowWindow(g_hPrefTabSettings, SW_HIDE); - ShowWindow(g_hPrefTabAlerts, SW_HIDE); - ShowWindow(g_hPrefTabEvents, SW_HIDE); - ShowWindow(g_hPrefTabAbout, SW_SHOW); - } - break; - } - } - break; - } - } - break; - case WM_CLOSE: - { - ShowWindow(g_hPrefTabEvents, SW_HIDE); - ShowWindow(g_hPrefTabSettings, SW_HIDE); - ShowWindow(g_hPrefTabAlerts, SW_HIDE); - ShowWindow(g_hPrefTabAbout, SW_HIDE); - ShowWindow(hWnd, SW_HIDE); - return TRUE; - } - break; - case WM_COMMAND: - { - switch(wparam) - { - case IDC_PREF_OK: - { - CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); - CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); - CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); - - SavePrefs(0); - - ShowWindow(g_hPrefTabEvents, SW_HIDE); - ShowWindow(g_hPrefTabSettings, SW_HIDE); - ShowWindow(g_hPrefTabAlerts, SW_HIDE); - ShowWindow(g_hPrefTabAbout, SW_HIDE); - ShowWindow(hWnd, SW_HIDE); - return TRUE; - } - break; - case IDC_PREF_CANCEL: - { - ShowWindow(g_hPrefTabEvents, SW_HIDE); - ShowWindow(g_hPrefTabSettings, SW_HIDE); - ShowWindow(g_hPrefTabAlerts, SW_HIDE); - ShowWindow(g_hPrefTabAbout, SW_HIDE); - ShowWindow(hWnd, SW_HIDE); - return TRUE; - } - break; - case IDC_PREF_APPLY: - { - CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); - CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); - CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); - - SavePrefs(0); - return FALSE; - } - break; - } - } - break; - case WM_DESTROY: - { - SendMessage(g_hPrefTabEvents, WM_CLOSE, 0, 0); - SendMessage(g_hPrefTabSettings, WM_CLOSE, 0, 0); - SendMessage(g_hPrefTabAbout, WM_CLOSE, 0, 0); - SendMessage(g_hPrefTabAlerts, WM_CLOSE, 0, 0); - } - break; - } - - return FALSE; -} - -/****************************************************/ -/****************************************************/ -/****************************************************/ -LRESULT CALLBACK AlertsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - switch(msg) - { - case WM_CLOSE: - { - DestroyWindow(hWnd); - return TRUE; - break; - } - break; - case WM_COMMAND: - { - switch(LOWORD(wparam)) - { - case PREF_AMAE: - { - SetToggle(hWnd, PREF_OSBWM, PREF_AMAE, TRUE); - SetToggle(hWnd, PREF_UWIOB, PREF_AMAE, TRUE); - SetToggle(hWnd, PREF_KAOI, PREF_AMAE, TRUE); - - if(IsDlgButtonChecked(hWnd, PREF_AMAE)) - { - SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); - SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); - SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); - SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); - } - else - { - SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_AMAE, TRUE); - SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_AMAE, TRUE); - SetToggle(hWnd, IDC_ALERT_TIME, PREF_AMAE, TRUE); - SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_AMAE, TRUE); - } - } - break; - case PREF_UWIOB: - { - SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); - SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); - } - break; - case PREF_KAOI: - { - SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); - SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); - } - break; - } - break; - } - } - - return FALSE; -} - -/****************************************************/ -/****************************************************/ -/****************************************************/ -LRESULT CALLBACK AboutProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - if(msg == WM_CLOSE) - { - DestroyWindow(hWnd); - return true; - } - - return FALSE; -} - -/*****************************************************/ -/** Process the events for our event dialog **********/ -/*****************************************************/ -LRESULT CALLBACK EventsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - if(msg == WM_CLOSE) - { - DestroyWindow(hWnd); - return true; - } - - return FALSE; -} - -/*****************************************************/ -/** Process the events for our settings dialog this **/ -/** is alot more complicated because options are **/ -/** enabled/disabled based on the state of others **/ -/*****************************************************/ -LRESULT CALLBACK SettingsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - if(msg == WM_CLOSE) - { - DestroyWindow(hWnd); - return true; - } - - return FALSE; -} - -/*****************************************************/ -/** this is the hotkey message processing function **/ -/** this window is always open and ready to be told **/ -/** if someone has hit the hotkey, if they did, we **/ -/** need to close out all of the tray alerts, for **/ -/** this I wrote sdCloseAlerts, more info there **/ -/*****************************************************/ -LRESULT CALLBACK HotKeyProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - if(msg == WM_CLOSE) - { - DestroyWindow(hWnd); - return true; - } - else if(msg == WM_HOTKEY) - { - sdCloseAlerts(); - } - - return FALSE; -} - diff --git a/plugins/xtray/callbacks.h b/plugins/xtray/callbacks.h deleted file mode 100644 index 99cbae74..00000000 --- a/plugins/xtray/callbacks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _H_CALLBACKS_H -#define _H_CALLBACKS_H - -int event_cb (char *word[], void *userdata); -int command_cb (char *word[], char *word_eol[], void *userdata); - -LRESULT CALLBACK WindowProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -BOOL CALLBACK EnumWindowsProc (HWND hWnd, LPARAM lParam); -LRESULT CALLBACK sdTrayProc (HWND hwnd, int msg); - -LRESULT CALLBACK AlertProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -LRESULT CALLBACK HotKeyProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -LRESULT CALLBACK EventsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -LRESULT CALLBACK AboutProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -LRESULT CALLBACK AlertsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -LRESULT CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -int CALLBACK PrefProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); - -#endif \ No newline at end of file diff --git a/plugins/xtray/icons/banned.ico b/plugins/xtray/icons/banned.ico deleted file mode 100644 index fef8df8c..00000000 Binary files a/plugins/xtray/icons/banned.ico and /dev/null differ diff --git a/plugins/xtray/icons/chan_msg.ico b/plugins/xtray/icons/chan_msg.ico deleted file mode 100644 index 793d050e..00000000 Binary files a/plugins/xtray/icons/chan_msg.ico and /dev/null differ diff --git a/plugins/xtray/icons/disconnected.ico b/plugins/xtray/icons/disconnected.ico deleted file mode 100644 index 9063e7e3..00000000 Binary files a/plugins/xtray/icons/disconnected.ico and /dev/null differ diff --git a/plugins/xtray/icons/hexchat.ico b/plugins/xtray/icons/hexchat.ico deleted file mode 100644 index 73247fd0..00000000 Binary files a/plugins/xtray/icons/hexchat.ico and /dev/null differ diff --git a/plugins/xtray/icons/highlight-1-3.ico b/plugins/xtray/icons/highlight-1-3.ico deleted file mode 100644 index a759145b..00000000 Binary files a/plugins/xtray/icons/highlight-1-3.ico and /dev/null differ diff --git a/plugins/xtray/icons/highlight.ico b/plugins/xtray/icons/highlight.ico deleted file mode 100644 index 625cca9a..00000000 Binary files a/plugins/xtray/icons/highlight.ico and /dev/null differ diff --git a/plugins/xtray/icons/kicked.ico b/plugins/xtray/icons/kicked.ico deleted file mode 100644 index 845a74e1..00000000 Binary files a/plugins/xtray/icons/kicked.ico and /dev/null differ diff --git a/plugins/xtray/icons/priv_msg-1-2-2.ico b/plugins/xtray/icons/priv_msg-1-2-2.ico deleted file mode 100644 index 7941ff77..00000000 Binary files a/plugins/xtray/icons/priv_msg-1-2-2.ico and /dev/null differ diff --git a/plugins/xtray/icons/sd.ico b/plugins/xtray/icons/sd.ico deleted file mode 100644 index ca179621..00000000 Binary files a/plugins/xtray/icons/sd.ico and /dev/null differ diff --git a/plugins/xtray/icons/server_notice.ico b/plugins/xtray/icons/server_notice.ico deleted file mode 100644 index ff765d87..00000000 Binary files a/plugins/xtray/icons/server_notice.ico and /dev/null differ diff --git a/plugins/xtray/resource.h b/plugins/xtray/resource.h deleted file mode 100644 index b8008c2c..00000000 --- a/plugins/xtray/resource.h +++ /dev/null @@ -1,47 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDD_ALERTS 104 -#define IDD_EVENTS 105 -#define IDD_SETTINGS 106 -#define IDD_ALERT 107 -#define IDD_PREF 108 -#define IDD_ABOUT 109 -#define IDR_TRAY_MENU 110 -#define ICO_XCHAT 111 -#define ICO_BANNED 112 -#define ICO_CHANMSG 113 -#define ICO_DISCONNECTED 114 -#define ICO_HIGHLIGHT 115 -#define ICO_KICKED 116 -#define ICO_PMSG 117 -#define ICO_SNOTICE 118 -#define IDB_SD_LOGO 119 -#define IDC_PREF_OK 1014 -#define IDC_PREF_CANCEL 1015 -#define IDC_PREF_APPLY 1016 -#define IDC_AWAY_MSG 1017 -#define IDC_ALERT_TIME 1018 -#define IDC_TAB_CONTROL 1019 -#define IDC_ALERT_HOTKEY 1020 -#define IDC_ALERT_MSG 1021 -#define IDC_ALERT_HOTKEY_TEXT 1022 -#define IDC_ALERT_TIME_TEXT 1023 -#define ACT_EXIT 40001 -#define ACT_SETTINGS 40002 -#define ACT_AWAY 40003 -#define ACT_BACK 40004 -#define ACT_RESTORE 40005 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 120 -#define _APS_NEXT_COMMAND_VALUE 40006 -#define _APS_NEXT_CONTROL_VALUE 1024 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/xtray/resource.rc b/plugins/xtray/resource.rc deleted file mode 100644 index b786cfbd..00000000 --- a/plugins/xtray/resource.rc +++ /dev/null @@ -1,309 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#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 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_EVENTS DIALOGEX 8, 20, 216, 143 -STYLE DS_SETFONT | DS_SETFOREGROUND | WS_CHILD -FONT 8, "Tahoma", 0, 0, 0x0 -BEGIN - GROUPBOX "XChat Events",IDC_STATIC,5,5,205,77 - CONTROL "Banned",4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,18,49,10 - CONTROL "Kicked",5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,32,49,10 - CONTROL "Killed",8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,49,10 - CONTROL "Disconnect",10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,60,49,10 - CONTROL "Private Message",7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,18,69,10 - CONTROL "Channel Message",21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,32,69,10 - CONTROL "Highlight",1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,46,69,10 - CONTROL "CTCP",6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,60,69,10 - CONTROL "Topic Change",3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,18,55,10 - CONTROL "Server Notice",9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,32,55,10 - CONTROL "Invite",2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,46,55,10 -END - -IDD_SETTINGS DIALOGEX 8, 20, 216, 143 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "Tahoma", 0, 0, 0x0 -BEGIN - GROUPBOX "Options",IDC_STATIC,5,5,205,135 - CONTROL "Auto away on minimize",11,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,16,60,100,10 - CONTROL "Minimize XChat to the system tray",12,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,18,133,10 - CONTROL "Minimize to the tray instead of closing",17,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,32,174,9 - EDITTEXT IDC_AWAY_MSG,33,86,169,50,ES_AUTOHSCROLL - LTEXT "Away Msg:",IDC_STATIC,27,72,35,8 - CONTROL "Remove XChat from the taskbar (only show in tray)", - 20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,191,9 -END - -IDD_ALERT DIALOGEX 0, 0, 151, 28 -STYLE DS_LOCALEDIT | DS_SETFONT | DS_NOIDLEMSG | DS_CENTER | WS_CAPTION | - WS_SYSMENU -EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW -CAPTION "Event Name" -FONT 8, "Tahoma", 0, 0, 0x1 -BEGIN - LTEXT "Event Text",IDC_ALERT_MSG,3,0,147,27 -END - -IDD_PREF DIALOGEX 0, 0, 233, 190 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | - WS_SYSMENU -CAPTION "X-Tray Preferences" -FONT 8, "Tahoma", 0, 0, 0x0 -BEGIN - DEFPUSHBUTTON "Ok",IDC_PREF_OK,57,173,50,14 - PUSHBUTTON "Cancel",IDC_PREF_CANCEL,115,173,50,14 - PUSHBUTTON "Apply",IDC_PREF_APPLY,175,173,50,14 - CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",0x0,7,7,218,159 -END - -IDD_ABOUT DIALOGEX 8, 20, 216, 143 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "Tahoma", 0, 0, 0x0 -BEGIN - CONTROL 119,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN | - WS_BORDER,3,6,88,81 - CTEXT "X-Tray\r\nBy: Michael Hotaling\r\n www.SinisterDevelopments.com", - IDC_STATIC,95,33,118,30 - LTEXT "Folken\r\nBasket\r\nDonatzsky\r\nDaemon404",IDC_STATIC, - 15,103,64,33 - GROUPBOX "Special Thanks To:",IDC_STATIC,3,91,89,50 - GROUPBOX "Version Information:",IDC_STATIC,101,92,109,49 - LTEXT "1.2.4",IDC_STATIC,170,105,33,8,0,WS_EX_RIGHT - LTEXT "Compiled In: ",IDC_STATIC,110,117,54,8 - LTEXT "2012",IDC_STATIC,170,117,33,8,0,WS_EX_RIGHT - LTEXT "Version Number:",IDC_STATIC,110,105,54,8 -END - -IDD_ALERTS DIALOGEX 8, 20, 216, 143 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "Tahoma", 0, 0, 0x0 -BEGIN - GROUPBOX "Alerts",IDC_STATIC,5,5,205,117 - CONTROL "Only show alerts while minimized",14,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,27,46,117,10 - CONTROL "Use tray alerts to notify me about events",13,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,32,152,10 - CONTROL "Use window instead of balloons",15,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,27,60,141,11 - EDITTEXT IDC_ALERT_TIME,137,101,61,12,ES_AUTOHSCROLL | ES_NUMBER, - WS_EX_RIGHT - LTEXT "Show alert for x seconds:",IDC_ALERT_TIME_TEXT,40,103, - 83,9 - CONTROL "Alert Hotkey",IDC_ALERT_HOTKEY,"msctls_hotkey32", - WS_BORDER | WS_TABSTOP,137,74,61,13 - LTEXT "Close all alerts hotkey:",IDC_ALERT_HOTKEY_TEXT,39,75, - 76,10 - CONTROL "Leave alerts open indefinately",16,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,27,88,115,11 - CONTROL "Blink Icon to alert me about events",18,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,18,127,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_EVENTS, DIALOG - BEGIN - BOTTOMMARGIN, 56 - END - - IDD_SETTINGS, DIALOG - BEGIN - BOTTOMMARGIN, 66 - END - - IDD_ALERT, DIALOG - BEGIN - RIGHTMARGIN, 150 - BOTTOMMARGIN, 26 - END - - IDD_PREF, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 232 - TOPMARGIN, 7 - BOTTOMMARGIN, 176 - END - - IDD_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 209 - TOPMARGIN, 7 - BOTTOMMARGIN, 136 - END - - IDD_ALERTS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 208 - TOPMARGIN, 7 - BOTTOMMARGIN, 136 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "xtray.h\0" -END - -4 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2,4,0 - PRODUCTVERSION 1,2,4,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "SinisterDevelopments" - VALUE "FileDescription", "X-Tray" - VALUE "FileVersion", "1, 2, 4, 0" - VALUE "InternalName", "X-Tray" - VALUE "LegalCopyright", "Copyright © 2005" - VALUE "OriginalFilename", "xtray.dll" - VALUE "ProductName", "X-Tray - XChat Win32 System Tray Plugin" - VALUE "ProductVersion", "1, 2, 4, 0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_TRAY_MENU MENU -BEGIN - POPUP "TRAY" - BEGIN - MENUITEM "Restore", ACT_RESTORE - MENUITEM SEPARATOR - MENUITEM "Away", 65535 - MENUITEM "Settings", ACT_SETTINGS - MENUITEM SEPARATOR - MENUITEM "Exit", ACT_EXIT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -ICO_XCHAT ICON "icons\\hexchat.ico" -ICO_BANNED ICON "icons\\banned.ico" -ICO_CHANMSG ICON "icons\\chan_msg.ico" -ICO_HIGHLIGHT ICON "icons\\highlight.ico" -ICO_KICKED ICON "icons\\kicked.ico" -ICO_PMSG ICON "icons\\priv_msg-1-2-2.ico" -ICO_SNOTICE ICON "icons\\server_notice.ico" -ICO_DISCONNECTED ICON "icons\\disconnected.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_SD_LOGO BITMAP "bitmaps\\sd.bmp" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -xtray.h -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/xtray/sdAlerts.cpp b/plugins/xtray/sdAlerts.cpp deleted file mode 100644 index 5e042806..00000000 --- a/plugins/xtray/sdAlerts.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include "utility.h" -#include "resource.h" -#include "sdAlerts.h" - -int g_iAlerts = 0; - -void sdSystemAlert(HINSTANCE hModule, UINT uiDialog, char *szMsg, char *szName, unsigned int iTime) -{ - TCHAR wszMsg[256]; - TCHAR wszName[64]; - - HWND hDialog; - RECT rcWorkArea, rcDlg; - int ixPos, iyPos; - int iNumPerCol; - - hDialog = CreateDialog(hModule, MAKEINTRESOURCE(uiDialog), NULL, (DLGPROC)sdAlertProc); - - SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0); - GetWindowRect(hDialog, &rcDlg); - - iNumPerCol = ((rcWorkArea.bottom - rcWorkArea.top) / (rcDlg.bottom - rcDlg.top)); - ixPos = rcWorkArea.right - (rcDlg.right - rcDlg.left) + 1; - iyPos = rcWorkArea.bottom - (rcDlg.bottom - rcDlg.top); - - if((g_iAlerts >= iNumPerCol) && (iNumPerCol > 0)) - { - ixPos -= ((g_iAlerts / iNumPerCol) * (rcDlg.right - rcDlg.left)); - iyPos -= ((g_iAlerts - (iNumPerCol * (g_iAlerts / iNumPerCol))) * (rcDlg.bottom - rcDlg.top)); - } - else - { - iyPos -= (g_iAlerts * (rcDlg.bottom - rcDlg.top)); - } - SetWindowPos(hDialog, HWND_TOPMOST, ixPos, iyPos, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); - - ConvertString(szName, wszName, 64); - ConvertString(szMsg, wszMsg, 256); - - SetWindowText(hDialog, wszName); - SetDlgItemText(hDialog, IDC_ALERT_MSG, wszMsg); - ShowWindow(hDialog, SW_SHOWNA); - - if(iTime > 0) - { - SetTimer(hDialog, 1, iTime, NULL); - } - - g_iAlerts++; -} - -void sdCloseAlerts() -{ - PostMessage(HWND_BROADCAST, RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows")), 0, 0); -} - -LRESULT CALLBACK sdAlertProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - switch(msg) - { - case WM_CLOSE: - if(g_iAlerts > 0){ g_iAlerts--; } - DestroyWindow(hwnd); - return TRUE; - break; - case WM_TIMER: - if(g_iAlerts > 0){ g_iAlerts--; } - AnimateWindow(hwnd, 600, AW_SLIDE | AW_HIDE | AW_VER_POSITIVE); - DestroyWindow(hwnd); - return TRUE; - break; - default: - if(msg == RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows"))) - { - if(g_iAlerts > 0){ g_iAlerts--; } - DestroyWindow(hwnd); - return TRUE; - } - break; - } - - return FALSE; -} - -int sdAlertNum() -{ - return g_iAlerts; -} \ No newline at end of file diff --git a/plugins/xtray/sdAlerts.h b/plugins/xtray/sdAlerts.h deleted file mode 100644 index cd45a05b..00000000 --- a/plugins/xtray/sdAlerts.h +++ /dev/null @@ -1,26 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _H_SDALERTS_H -#define _H_SDALERTS_H - -void sdSystemAlert (HINSTANCE, UINT, char *, char *, UINT); -LRESULT CALLBACK sdAlertProc (HWND, UINT, WPARAM, LPARAM); -int sdAlertNum (); -void sdCloseAlerts (); -#endif \ No newline at end of file diff --git a/plugins/xtray/sdTray.cpp b/plugins/xtray/sdTray.cpp deleted file mode 100644 index 3a91a61b..00000000 --- a/plugins/xtray/sdTray.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#define _WIN32_IE 0x601 -#include -#include -#include -#include "sdTray.h" -#include "utility.h" - -HANDLE hThread; -iBlink *tData = NULL; - -int AddIcon(HWND hwnd, UINT id, HICON hicon, char *szTip, unsigned short flags, unsigned int cbMsg) -{ - NOTIFYICONDATA nidata; - - nidata.cbSize = NOTIFYICONDATA_V2_SIZE; - nidata.hIcon = hicon; - nidata.hWnd = hwnd; - nidata.uCallbackMessage = cbMsg; - nidata.uFlags = flags; - nidata.uID = id; - - if(szTip != NULL) - { - TCHAR *szTemp = new TCHAR[64]; - - ConvertString(szTip, szTemp, 64); - _tcsncpy(nidata.szTip, szTemp, 64); - - delete[] szTemp; - } - - return Shell_NotifyIcon(NIM_ADD, &nidata); -} - -int RemoveIcon(HWND hwnd, UINT id) -{ - if(hThread != NULL) - { - TerminateThread(hThread, 0); - hThread = NULL; - - delete tData; - } - - NOTIFYICONDATA nidata; - - nidata.cbSize = NOTIFYICONDATA_V2_SIZE; - nidata.hWnd = hwnd; - nidata.uID = id; - - return Shell_NotifyIcon(NIM_DELETE, &nidata); -} - -int SetIcon(HWND hwnd, UINT id, HICON hicon) -{ - NOTIFYICONDATA nidata; - - nidata.cbSize = NOTIFYICONDATA_V2_SIZE; - nidata.hWnd = hwnd; - nidata.uID = id; - nidata.hIcon = hicon; - nidata.uFlags = NIF_ICON; - - return Shell_NotifyIcon(NIM_MODIFY, &nidata); -} - -int SetTooltip(HWND hwnd, UINT id, char *szTip) -{ - NOTIFYICONDATA nidata; - - nidata.cbSize = NOTIFYICONDATA_V2_SIZE; - nidata.hWnd = hwnd; - nidata.uID = id; - nidata.uFlags = NIF_TIP; - - if(szTip != NULL) - { - TCHAR *szTemp = new TCHAR[64]; - ConvertString(szTip, szTemp, 64); - _tcsncpy(nidata.szTip, szTemp, 64); - delete[] szTemp; - } - - return Shell_NotifyIcon(NIM_MODIFY, &nidata); -} - -int ShowBalloon(HWND hwnd, UINT id, char *szInfo, char *szTitle, UINT time, UINT infoFlags) -{ - NOTIFYICONDATA nidata; - - nidata.cbSize = NOTIFYICONDATA_V2_SIZE; - nidata.hWnd = hwnd; - nidata.uID = id; - nidata.uFlags = NIF_INFO; - nidata.dwInfoFlags = infoFlags; - - if(time > 0) - nidata.uTimeout = time; - else - nidata.uTimeout = 500000; - - if(szInfo != NULL) - { - TCHAR *szTemp = new TCHAR[255]; - - ConvertString(szInfo, szTemp, 251); - szTemp[250] = 0; - - if(strlen(szInfo) > 255) - { - _sntprintf(szTemp, 255, _T("%s..."), szTemp); - } - _tcsncpy(nidata.szInfo, szTemp, 255); - - delete[] szTemp; - } - if(szTitle != NULL) - { - TCHAR *wszTitle = new TCHAR[64]; - ConvertString(szTitle, wszTitle, 64); - _tcsncpy(nidata.szInfoTitle, wszTitle, 64); - delete[] wszTitle; - } - - return Shell_NotifyIcon(NIM_MODIFY, &nidata); -} - - -DWORD WINAPI BlinkThread(LPVOID lpParam) -{ - NOTIFYICONDATA nidata; - - nidata.cbSize = NOTIFYICONDATA_V2_SIZE; - nidata.hWnd = tData->hwnd; - nidata.uID = tData->id; - nidata.uFlags = NIF_ICON; - - for(UINT i = 0; i < tData->num; i++) - { - nidata.hIcon = tData->hBlink; - Shell_NotifyIcon(NIM_MODIFY, &nidata); - - Sleep(tData->time); - - nidata.hIcon = tData->hBase; - Shell_NotifyIcon(NIM_MODIFY, &nidata); - - Sleep(tData->time); - } - - delete tData; - hThread = NULL; - - return 0; -} - -int BlinkIcon(HWND hwnd, UINT id, HICON hBase, HICON hBlink, UINT time, UINT num) -{ - if(hThread != NULL) - { - StopBlink(hwnd, id, hBase); - } - - DWORD dwThreadID; - tData = new iBlink; - - tData->hwnd = hwnd; - tData->id = id; - tData->hBase = hBase; - tData->hBlink = hBlink; - tData->time = time; - tData->num = num; - - hThread = CreateThread(NULL, 0, BlinkThread, tData, 0, &dwThreadID); - - return 0; -} - -void StopBlink(HWND hwnd, UINT id, HICON hBase) -{ - if(hThread != NULL) - { - TerminateThread(hThread, 0); - hThread = NULL; - - delete tData; - } - - SetIcon(hwnd, id, hBase); -} \ No newline at end of file diff --git a/plugins/xtray/sdTray.h b/plugins/xtray/sdTray.h deleted file mode 100644 index 68469fe0..00000000 --- a/plugins/xtray/sdTray.h +++ /dev/null @@ -1,39 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _H_SDTRAY_H -#define _H_SDTRAY_H - -int AddIcon (HWND, UINT, HICON, char *, unsigned short, UINT); -int ShowBalloon (HWND, UINT, char *, char *, UINT, UINT); -int BlinkIcon (HWND, UINT, HICON, HICON, UINT, UINT); -int SetTooltip (HWND, UINT, char *); -int SetIcon (HWND, UINT, HICON); -void StopBlink (HWND, UINT, HICON); -int RemoveIcon (HWND, UINT); - -typedef struct IBLINK -{ - HICON hBase; - HICON hBlink; - HWND hwnd; - UINT id; - UINT time; - UINT num; -}iBlink; -#endif \ No newline at end of file diff --git a/plugins/xtray/utility.cpp b/plugins/xtray/utility.cpp deleted file mode 100644 index 66489bc0..00000000 --- a/plugins/xtray/utility.cpp +++ /dev/null @@ -1,607 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include - -#include "xchat-plugin.h" -#include "utility.h" -#include "xtray.h" -#include "callbacks.h" -#include "resource.h" - -TCHAR BACKUP_INI_FILE[] = _T(".\\plugins\\config\\xtray.conf"); -struct HOTKEY g_hHotKey; - -/* we need to convert ALT and SHIFT modifiers -// from -#define MOD_ALT 0x0001 -#define MOD_CONTROL 0x0002 -#define MOD_SHIFT 0x0004 -// from -#define HOTKEYF_SHIFT 0x01 -#define HOTKEYF_CONTROL 0x02 -#define HOTKEYF_ALT 0x04 -*/ - -WORD HotkeyfToMod(WORD modifiers) -{ - WORD newmods = 0; - - if (modifiers & HOTKEYF_SHIFT) - newmods |= MOD_SHIFT; - - if (modifiers & HOTKEYF_CONTROL) - newmods |= MOD_CONTROL; - - if (modifiers & HOTKEYF_ALT) - newmods |= MOD_ALT; - - return newmods; -} - -WORD ModToHotkeyf(WORD modifiers) -{ - WORD newmods = 0; - - if (modifiers & MOD_SHIFT) - newmods |= HOTKEYF_SHIFT; - - if (modifiers & MOD_CONTROL) - newmods |= HOTKEYF_CONTROL; - - if (modifiers & MOD_ALT) - newmods |= HOTKEYF_ALT; - - return newmods; -} - -void SavePrefs(int iDlg) -{ - /**************************************************************************************************/ - /********** allocate space for our string, and then set it to the currently logged on user ********/ - /**************************************************************************************************/ - DWORD dBuff = 257; - TCHAR szUser[257]; - - GetUserName(szUser, &dBuff); - - /**************************************************************************************************/ - /*********************** Test if the file exists, If it doesn't, Create It ************************/ - /**************************************************************************************************/ - TCHAR XTRAY_INI_FILE[1024]; - -#ifdef UNICODE - char temp[1024]; - TCHAR TEMP_INI_FILE[1024]; - - _snprintf(temp, 1024, "%s\\xtray.conf", xchat_get_info(ph, "xchatdir")); - ConvertString(temp, TEMP_INI_FILE, 1024); - - // ok this one is really ugly - // it checks to see if the file exists in two locations - // X-Chat default config dir, if that fails it trys xchat\plugins\config - // if neither one exists it tries to create it in - // X-Chat default config dir, if that fails it trys xchat\plugins\config - // In either case it writes \xFF\xFE to the file ( on creation ) - // so that we can save unicode away messages WritePrivateProfile doesn't - // do this for us, though I think it really should - - if(FileExists(TEMP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); - } - else - { - if(FileExists(BACKUP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); - } - else - { - HANDLE xTemp; - DWORD dwBytesTemp; - - if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) - { - if(GetLastError() != ERROR_ALREADY_EXISTS) - { - WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); - } - CloseHandle(xTemp); - } - - if(FileExists(TEMP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); - } - else - { - HANDLE xBackup; - DWORD dwBytesBackup; - - if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) - { - if(GetLastError() != ERROR_ALREADY_EXISTS) - { - WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); - } - - CloseHandle(xBackup); - } - - if(FileExists(BACKUP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); - } - } - } - } - -#else - _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -#endif - - WritePrivateProfileInt(szUser, _T("SETTINGS"), g_dwPrefs, XTRAY_INI_FILE); - WritePrivateProfileInt(szUser, _T("AOT"), g_iTime, XTRAY_INI_FILE); - WritePrivateProfileInt(szUser, _T("KEY"), g_hHotKey.key, XTRAY_INI_FILE); - WritePrivateProfileInt(szUser, _T("MOD"), g_hHotKey.mod, XTRAY_INI_FILE); - WritePrivateProfileString(szUser, _T("AWAY"), g_szAway, XTRAY_INI_FILE); -} - -void LoadPrefs() -{ - /**************************************************************************************************/ - /*********************** Our Settings Section *****************************************************/ - /**************************************************************************************************/ - DWORD dBuff = 257; - TCHAR szUser[257]; - - GetUserName(szUser, &dBuff); - - /**************************************************************************************************/ - /*********************** Test if the file exists, If it doesn't, Create It ************************/ - /**************************************************************************************************/ - TCHAR XTRAY_INI_FILE[1024]; - -#ifdef UNICODE - char temp[1024]; - TCHAR TEMP_INI_FILE[1024]; - - _snprintf(temp, 1024, "%s\\xtray.conf", xchat_get_info(ph, "xchatdir")); - ConvertString(temp, TEMP_INI_FILE, 1024); - - if(FileExists(TEMP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); - } - else - { - if(FileExists(BACKUP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); - } - else - { - HANDLE xTemp; - DWORD dwBytesTemp; - - if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) - { - if(GetLastError() != ERROR_ALREADY_EXISTS) - { - WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); - } - - CloseHandle(xTemp); - } - - if(FileExists(TEMP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); - } - else - { - HANDLE xBackup; - DWORD dwBytesBackup; - - if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) - { - if(GetLastError() != ERROR_ALREADY_EXISTS) - { - WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); - } - - CloseHandle(xBackup); - } - - if(FileExists(BACKUP_INI_FILE)) - { - _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); - } - } - } - } - -#else - _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -#endif - - /**************************************************************************************************/ - /*************************** Get the value for each of our preferances ****************************/ - /**************************************************************************************************/ - g_dwPrefs = GetPrivateProfileInt(szUser, _T("SETTINGS"), 0, XTRAY_INI_FILE); - - // backwards compatability - // also allows us to set defaults if its a new installation - // disable topic change, channel message and server notice by default - if(g_dwPrefs == 0) - { - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("HILIGHT"), 1, XTRAY_INI_FILE)<<1); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("INVITE"), 1, XTRAY_INI_FILE)<<2); - /* g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOPIC"), 1, XTRAY_INI_FILE)<<3); */ - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("BANNED"), 1, XTRAY_INI_FILE)<<4); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KICKED"), 1, XTRAY_INI_FILE)<<5); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("CTCP"), 1, XTRAY_INI_FILE)<<6); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("PMSG"), 1, XTRAY_INI_FILE)<<7); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KILLED"), 1, XTRAY_INI_FILE)<<8); - /* g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("NOTICE"), 1, XTRAY_INI_FILE)<<9); */ - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("DISCONNECT"), 1, XTRAY_INI_FILE)<<10); - - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AOM"), 0, XTRAY_INI_FILE)<<11); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOT"), 1, XTRAY_INI_FILE)<<12); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AMAE"), 1, XTRAY_INI_FILE)<<13); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("OSBWM"), 0, XTRAY_INI_FILE)<<14); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("UWIOB"), 0, XTRAY_INI_FILE)<<15); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KAOI"), 0, XTRAY_INI_FILE)<<16); - g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("MIOC"), 0, XTRAY_INI_FILE)<<17); - } - - g_hHotKey.key = GetPrivateProfileInt(szUser, _T("KEY"), 84, XTRAY_INI_FILE); - g_hHotKey.mod = GetPrivateProfileInt(szUser, _T("MOD"), (MOD_CONTROL | MOD_SHIFT), XTRAY_INI_FILE); - g_iTime = GetPrivateProfileInt(szUser, _T("AOT"), 5, XTRAY_INI_FILE); - - GetPrivateProfileString(szUser, _T("AWAY"), _T(""), g_szAway, 1024, XTRAY_INI_FILE); - - /**************************************************************************************************/ - /******************************** Register our hotkey with windows ********************************/ - /**************************************************************************************************/ - if(g_dwPrefs & (1< - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _H_UTILITY_H -#define _H_UTILITY_H - -WORD HotkeyfToMod (WORD); -WORD ModToHotkeyf (WORD); - -int SetOption (HWND, unsigned int, unsigned int); -int SetCheck (HWND, unsigned int, unsigned int); -int SetToggle (HWND, unsigned int, unsigned int, bool); -void ErrorDebug (LPTSTR lpszFunction); -void SetDialog (HWND, int); -void CheckPrefs (HWND, int); -bool FileExists (TCHAR *); -DWORD WINAPI HoldCloseThread (LPVOID); -void SavePrefs (int); -void LoadPrefs (); -void HoldClose (); - -void ConvertString(const char *in, wchar_t *out, int size); -void ConvertString(const wchar_t *in, char *out, int size); -void ConvertString(const char *in, char *out, int size); - -int WritePrivateProfileIntA(char *, char *, int, char *); -int WritePrivateProfileIntW(wchar_t *, wchar_t *, int, wchar_t *); - -#ifdef UNICODE -#define WritePrivateProfileInt WritePrivateProfileIntW -#else -#define WritePrivateProfileInt WritePrivateProfileIntA -#endif - -struct HOTKEY -{ - WORD key; - WORD mod; -}; -#endif \ No newline at end of file diff --git a/plugins/xtray/xchat.cpp b/plugins/xtray/xchat.cpp deleted file mode 100644 index 47ce46a9..00000000 --- a/plugins/xtray/xchat.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* X-Tray - * Copyright (C) 1998, 2005 Peter Zelezny, Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include - -#include "xchat-plugin.h" -#include "xtray.h" -#include "resource.h" -#include "xchat.h" -#include "utility.h" - -// from util.c of xchat source code ( slightly modified to fit X-Tray Syntax ) -char *xchat_strip_color (char *text) -{ - int nc = 0; - int i = 0; - int col = 0; - int len = strlen(text); - char *new_str = (char *)malloc(len + 2); - - while (len > 0) - { - if ((col && isdigit(*text) && (nc < 2)) || (col && isdigit(*(text+1)) && (nc < 3) && (*text == ','))) - { - nc++; - - if(*text == ',') - { - nc = 0; - } - } - else - { - col = 0; - - switch (*text) - { - case '\003': /*ATTR_COLOR: */ - { - col = 1; - nc = 0; - } - break; - case '\007': /*ATTR_BEEP: */ - case '\017': /*ATTR_RESET: */ - case '\026': /*ATTR_REVERSE: */ - case '\002': /*ATTR_BOLD: */ - case '\037': /*ATTR_UNDERLINE: */ - break; - default: - { - new_str[i] = *text; - i++; - } - break; - } - } - - text++; - len--; - } - - new_str[i] = 0; - - return new_str; -} - -void check_special_chars (char *cmd) -{ - int occur = 0; - int len = strlen (cmd); - int i = 0, j = 0; - char *buf; - - if (!len) - return; - - buf = (char *)malloc (len + 1); - - if (buf) - { - while (cmd[j]) - { - switch (cmd[j]) - { - case '%': - { - occur++; - - switch (cmd[j + 1]) - { - case 'R': - buf[i] = '\026'; - break; - case 'U': - buf[i] = '\037'; - break; - case 'B': - buf[i] = '\002'; - break; - case 'C': - buf[i] = '\003'; - break; - case 'O': - buf[i] = '\017'; - break; - case '%': - buf[i] = '%'; - break; - default: - buf[i] = '%'; - j--; - break; - } - - j++; - } - break; - default: - { - buf[i] = cmd[j]; - } - break; - } - - j++; - i++; - } - - buf[i] = 0; - - if (occur) - strcpy (cmd, buf); - - free (buf); - } -} - -void xchat_globally_away(TCHAR *tszAway) -{ - char szTemp[512]; - char szAway[512]; - - ConvertString(tszAway, szAway, 512); - _snprintf(szTemp, 512, "ALLSERV AWAY %s\0", szAway); - check_special_chars(szTemp); - xchat_exec(szTemp); -} - -void xchat_away(TCHAR *tszAway) -{ - char szTemp[512]; - char szAway[512]; - - ConvertString(tszAway, szAway, 512); - _snprintf(szTemp, 512, szAway); - check_special_chars(szTemp); - xchat_commandf(ph, "AWAY %s\0", szTemp); -} - -void xchat_globally_back() -{ - std::vector xs; - std::vector::iterator xsi; - xchat_list *xl = xchat_list_get(ph, "channels"); - - if(xl) - { - while(xchat_list_next(ph, xl)) - { - xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); - - if((xsi == xs.end()) && - ((strlen(xchat_list_str(ph, xl, "server")) > 0) || - (strlen(xchat_list_str(ph, xl, "channel")) > 0))) - { - xs.push_back(xchat_list_int(ph, xl, "id")); - xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); - xchat_back(); - } - } - - xchat_list_free(ph, xl); - } -} - - - -void xchat_back() -{ - if(xchat_get_info(ph, "away")) - { - xchat_command(ph, "BACK"); - } -} - -HMENU setServerMenu() -{ - HMENU sTemp = CreateMenu(); - TCHAR wszServer[128]; - TCHAR wszNick[128]; - TCHAR wszMenuEntry[256]; - - std::vector xs; - std::vector::iterator xsi; - xchat_list *xl = xchat_list_get(ph, "channels"); - - AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away")); - AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back")); - AppendMenu(sTemp, MF_SEPARATOR, 0, NULL); - - if(xl) - { - while(xchat_list_next(ph, xl)) - { - xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); - - if( (xsi == xs.end()) && - ((strlen(xchat_list_str(ph, xl, "server")) > 0) || - (strlen(xchat_list_str(ph, xl, "channel")) > 0))) - { - xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); - xs.push_back(xchat_list_int(ph, xl, "id")); - - char *network = _strdup(xchat_list_str(ph, xl, "network")); - char *server = _strdup(xchat_list_str(ph, xl, "server")); - char *nick = _strdup(xchat_get_info(ph, "nick")); - - if(network != NULL) - { - ConvertString(network, wszServer, 128); - } - else - { - ConvertString(server, wszServer, 128); - } - - if(server != NULL) - { - ConvertString(nick, wszNick, 128); - _sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer); - - if(!xchat_get_info(ph, "away")) - { - AppendMenu(sTemp, MF_STRING, (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); - } - else - { - AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); - } - } - - free(network); - free(server); - free(nick); - } - } - - xchat_list_free(ph, xl); - } - - return sTemp; -} - -struct _xchat_context *xchat_find_server(int find_id) -{ - xchat_context *xc; - xchat_list *xl = xchat_list_get(ph, "channels"); - int id; - - if(!xl) - return NULL; - - while(xchat_list_next(ph, xl)) - { - id = xchat_list_int(ph, xl, "id"); - - if(id == -1) - { - return NULL; - } - else if(id == find_id) - { - xc = (xchat_context *)xchat_list_str(ph, xl, "context"); - - xchat_list_free(ph, xl); - - return xc; - } - } - - xchat_list_free(ph, xl); - - return NULL; -} - -void xchat_exec(char *command) -{ - xchat_set_context(ph, xchat_find_context(ph, NULL, NULL)); - xchat_command(ph, command); -} \ No newline at end of file diff --git a/plugins/xtray/xchat.h b/plugins/xtray/xchat.h deleted file mode 100644 index 76452aeb..00000000 --- a/plugins/xtray/xchat.h +++ /dev/null @@ -1,32 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _H_XCHAT_H -#define _H_XCHAT_H - -void xchat_exec (char *); -char *xchat_strip_color (char *); -void xchat_parse (char *); -struct _xchat_context *xchat_find_server (int); -void xchat_globally_away (TCHAR *); -void xchat_away (TCHAR *); -void xchat_globally_back (); -void xchat_back (); -HMENU setServerMenu (); - -#endif \ No newline at end of file diff --git a/plugins/xtray/xtray.cpp b/plugins/xtray/xtray.cpp deleted file mode 100644 index 69303fc5..00000000 --- a/plugins/xtray/xtray.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* X-Tray - * Copyright (C) 2005 Michael Hotaling - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#define _WIN32_IE 0x0601 - -#include -#include -#include -#include - -#include "xchat-plugin.h" -#include "resource.h" -#include "callbacks.h" -#include "utility.h" -#include "xtray.h" -#include "sdTray.h" -#include "sdAlerts.h" - -/*****************************************************/ -/**** Don't want to pollute the namespace do we? *****/ -/*****************************************************/ -std::list g_vHooks; - -/*****************************************************/ -/************ Global Identifiers *********************/ -/*****************************************************/ -WNDPROC g_hOldProc; -xchat_plugin *ph; - -/*****************************************************/ -/***************** Resources *************************/ -/*****************************************************/ -HWND g_hXchatWnd; -HWND g_hHotkeyWnd; -HWND g_hPrefDlg; -HMENU g_hTrayMenu; -HICON g_hIcons[11]; -HANDLE g_hInstance; -/*****************************************************/ -/***************** Preferences ***********************/ -/*****************************************************/ -unsigned int g_dwPrefs; -TCHAR g_szAway[512]; -int g_iTime; - - -BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpVoid) -{ - if((fdwReason == DLL_PROCESS_ATTACH) || (fdwReason == DLL_THREAD_ATTACH)) - { - g_hInstance = hModule; - } - - return TRUE; -} - -int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) -{ - ph = plugin_handle; - - *plugin_name = "X-Tray"; - *plugin_desc = "Minimize XChat to the Windows system tray"; - *plugin_version = "1.2.4"; - - /***************************************************************************************************************************/ - /************************* Load our preferances from xTray.ini *************************************************************/ - /***************************************************************************************************************************/ - LoadPrefs(); - - /***************************************************************************************************************************/ - /************************* Finds the xChat window and saves it for later use ***********************************************/ - /***************************************************************************************************************************/ - g_hXchatWnd = (HWND)xchat_get_info(ph, "win_ptr"); - - if(g_hXchatWnd == NULL) - { - EnumThreadWindows(GetCurrentThreadId(), EnumWindowsProc, 0); - } - - g_hOldProc = (WNDPROC)GetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC); - SetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC, (LONG_PTR)WindowProc); - - /***************************************************************************************************************************/ - /************************* Grab the xChat Icon, Load our menu, create the window to receive the hotkey messages ***********/ - /************************* and register the windows message so we know if explorer crashes ***********/ - /***************************************************************************************************************************/ - g_hTrayMenu = GetSubMenu(LoadMenu((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDR_TRAY_MENU)), 0); - g_hHotkeyWnd = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ALERT), NULL, (DLGPROC)HotKeyProc); - g_hPrefDlg = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_PREF), g_hXchatWnd, (DLGPROC)PrefProc); - - g_hIcons[0] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_XCHAT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - g_hIcons[1] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_CHANMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - g_hIcons[2] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_HIGHLIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - g_hIcons[5] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_BANNED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - g_hIcons[6] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_KICKED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - g_hIcons[8] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_PMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - g_hIcons[10]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_SNOTICE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - g_hIcons[11]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_DISCONNECTED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - - /***************************************************************************************************************************/ - /************************* Add our icon to the tray ************************************************************************/ - /***************************************************************************************************************************/ - char szVersion[64]; - _snprintf(szVersion, 64, "HexChat %s", xchat_get_info(ph, "version")); - AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG); - - /***************************************************************************************************************************/ - /***************************************************************************************************************************/ - /***************************************************************************************************************************/ - if(g_dwPrefs & (1< - * - * X-Tray is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * X-Tray is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with X-Tray; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _XTRAY_H -#define _XTRAY_H - -/******************** Globals *************************/ -extern HWND g_hXchatWnd; -extern HWND g_hHotkeyWnd; -extern HWND g_hPrefDlg; -extern HMENU g_hTrayMenu; -extern HICON g_hIcons[11]; -extern HANDLE g_hInstance; -extern unsigned int g_dwPrefs; -extern TCHAR g_szAway[512]; -extern int g_iTime; -extern WNDPROC g_hOldProc; -extern struct _xchat_plugin *ph; -/******************************************************/ - -/******************** Messages ************************/ -#define WM_TRAYMSG WM_APP -/******************************************************/ - -/********************* Events *************************/ -#define CHAN_HILIGHT 1 -#define CHAN_INVITE 2 -#define CHAN_TOPIC_CHANGE 3 -#define CHAN_BANNED 4 -#define CHAN_KICKED 5 - -#define CTCP_GENERIC 6 -#define PMSG_RECEIVE 7 - -#define SERV_KILLED 8 -#define SERV_NOTICE 9 -#define SERV_DISCONNECT 10 - -/* new events */ -#define CHAN_MESSAGE 21 - -#define PREF_AOM 11 // away on minimize -#define PREF_TOT 12 // Tray on Taskbar -#define PREF_AMAE 13 // alert me about events -#define PREF_OSBWM 14 // Only Show Balloon When Minimized -#define PREF_UWIOB 15 // Use Window Instead of Balloon -#define PREF_KAOI 16 // Keep alerts open indefinately -#define PREF_MIOC 17 // Minimize instead of close -#define PREF_BLINK 18 // blink icon -#define PREF_CICO 19 // change icon - not implemented -#define PREF_DNSIT 20 // Do not show in taskbar -/******************************************************/ -#endif - -#ifdef _WIN64 -/* use replacement with the same value, and use SetWindowLongPtr instead - of SetWindowLong. more info: - - http://msdn.microsoft.com/en-us/library/ms633591.aspx - http://msdn.microsoft.com/en-us/library/ms644898.aspx */ -#define GWL_HWNDPARENT GWLP_HWNDPARENT -#endif diff --git a/plugins/xtray/xtray.vcxproj b/plugins/xtray/xtray.vcxproj deleted file mode 100644 index 305b3845..00000000 --- a/plugins/xtray/xtray.vcxproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - Release - Win32 - - - Release - x64 - - - - {3024CF36-85E5-4E00-9608-7002E2C7EF14} - Win32Proj - xtray - - - - DynamicLibrary - false - true - Unicode - WDK7 - - - DynamicLibrary - false - true - Unicode - WDK7 - - - - - - - - - - - - - - - false - $(SolutionDir)build\$(PlatformName)\bin - $(SolutionDir)build\$(PlatformName)\obj\$(ProjectName) - - - false - $(SolutionDir)build\$(PlatformName)\bin - $(SolutionDir)build\$(PlatformName)\obj\$(ProjectName) - - - - Level1 - - - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;XTRAY_EXPORTS;_STL70_;_STATIC_CPPLIB;%(PreprocessorDefinitions) - true - ..;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - xtray.def - ntstc_msvcrt.lib;%(AdditionalDependencies) - - - - - Level1 - - - MaxSpeed - true - true - WIN32;_WIN64;NDEBUG;_WINDOWS;_USRDLL;XTRAY_EXPORTS;_STL70_;_STATIC_CPPLIB;%(PreprocessorDefinitions) - true - ..;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - xtray.def - ntstc_msvcrt.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/xtray/xtray.vcxproj.filters b/plugins/xtray/xtray.vcxproj.filters deleted file mode 100644 index 637a896d..00000000 --- a/plugins/xtray/xtray.vcxproj.filters +++ /dev/null @@ -1,109 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {448b49a5-e68b-451e-bfbc-0855da024b2e} - - - {8345128a-0635-43d6-9115-a85ad9c77ee2} - - - - - Resource Files - - - Resource Files\bitmaps - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - Resource Files\icons - - - - - Resource Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/plugins/xtray/xtray.vcxproj.user b/plugins/xtray/xtray.vcxproj.user deleted file mode 100644 index 695b5c78..00000000 --- a/plugins/xtray/xtray.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/common/util.c b/src/common/util.c index 27f0aa40..74146b21 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1885,10 +1885,10 @@ portable_mode () } int -xtray_mode () +hextray_mode () { #ifdef WIN32 - if ((_access( "plugins/xtray.dll", 0 )) != -1) + if ((_access( "plugins/hextray.dll", 0 )) != -1) { return 1; } diff --git a/src/common/util.h b/src/common/util.h index 82d74366..c2f1e118 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -58,6 +58,6 @@ guint32 str_ihash (const unsigned char *key); void safe_strcpy (char *dest, const char *src, int bytes_left); void canonalize_key (char *key); int portable_mode (); -int xtray_mode (); +int hextray_mode (); #endif diff --git a/src/common/xchat.c b/src/common/xchat.c index 1b9fd5a7..da33edbe 100644 --- a/src/common/xchat.c +++ b/src/common/xchat.c @@ -981,7 +981,7 @@ main (int argc, char *argv[]) * only works correctly when X-Tray is used, but it's not a big deal * since you can only minimize XChat to tray via the taskbar if you * use X-Tray*/ - if (xtray_mode ()) + if (hextray_mode ()) { /* FindWindow() doesn't support wildcards so we check all the open windows */ EnumWindows (enum_windows_impl, NULL); diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 62a35746..c764e04a 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -1287,7 +1287,7 @@ mg_open_quit_dialog (gboolean minimize_button) gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); - if (minimize_button && !xtray_mode ()) + if (minimize_button && !hextray_mode ()) { button = gtk_button_new_with_mnemonic (_("_Minimize to Tray")); gtk_widget_show (button); @@ -1586,7 +1586,7 @@ mg_create_alertmenu (session *sess, GtkWidget *menu) mg_perchan_menu_item (_("Beep on _Message"), submenu, &sess->alert_beep, prefs.input_beep_chans); - if (!xtray_mode ()) /*disable this context menu item when xtray is loaded */ + if (!hextray_mode ()) /*disable this context menu item when HexTray is loaded */ { mg_perchan_menu_item (_("Blink Tray _Icon"), submenu, &sess->alert_tray, prefs.input_tray_chans); } diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 145e5c95..0dcc8f7f 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -732,7 +732,7 @@ tray_apply_setup (void) } else { - if (prefs.gui_tray && !xtray_mode ()) + if (prefs.gui_tray && !hextray_mode ()) tray_init (); } } @@ -764,7 +764,7 @@ tray_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, xchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL); - if (prefs.gui_tray && !xtray_mode ()) + if (prefs.gui_tray && !hextray_mode ()) tray_init (); return 1; /* return 1 for success */ diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index ffe9f4f0..c11bb474 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -376,7 +376,7 @@ static const setting alert_settings[] = {ST_END, 0, 0, 0, 0, 0} }; -static const setting alert_settings_xtray[] = +static const setting alert_settings_hextray[] = { {ST_HEADER, N_("Alerts"),0,0,0}, @@ -1802,9 +1802,9 @@ setup_create_pages (GtkWidget *box) setup_add_page (cata[4], book, setup_create_page (tabs_settings)); setup_add_page (cata[5], book, setup_create_color_page ()); - if (xtray_mode ()) + if (hextray_mode ()) { - setup_add_page (cata[8], book, setup_create_page (alert_settings_xtray)); + setup_add_page (cata[8], book, setup_create_page (alert_settings_hextray)); } else { diff --git a/win32/copy/copy.vcxproj b/win32/copy/copy.vcxproj index 799ee8bf..a9db3e24 100644 --- a/win32/copy/copy.vcxproj +++ b/win32/copy/copy.vcxproj @@ -121,7 +121,7 @@ copy "$(OutDir)\xcpython.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xctcl.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcupd.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcxsasl.dll" "$(HexChatDest)\plugins" -copy "$(OutDir)\xtray.dll" "$(HexChatDest)\plugins" +copy "$(OutDir)\hextray.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcwinamp.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcwinsys.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcwmpa.dll" "$(HexChatDest)\plugins" @@ -204,7 +204,7 @@ copy "$(OutDir)\xcpython.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xctcl.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcupd.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcxsasl.dll" "$(HexChatDest)\plugins" -copy "$(OutDir)\xtray.dll" "$(HexChatDest)\plugins" +copy "$(OutDir)\hextray.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcwinamp.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcwinsys.dll" "$(HexChatDest)\plugins" copy "$(OutDir)\xcwmpa.dll" "$(HexChatDest)\plugins" diff --git a/win32/hexchat.sln b/win32/hexchat.sln index 3f223bad..13e10d3b 100644 --- a/win32/hexchat.sln +++ b/win32/hexchat.sln @@ -80,7 +80,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsys", "..\plugins\winsys EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xsasl", "..\plugins\xsasl\xsasl.vcxproj", "{18871EBA-AC85-4652-8919-EB8064B9A714}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xtray", "..\plugins\xtray\xtray.vcxproj", "{3024CF36-85E5-4E00-9608-7002E2C7EF14}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hextray", "..\plugins\hextray\hextray.vcxproj", "{3024CF36-85E5-4E00-9608-7002E2C7EF14}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wmpa", "..\plugins\wmpa\wmpa.vcxproj", "{E7F4DB0A-510D-41EF-B284-6E1DE1CC450D}" EndProject diff --git a/win32/installer/hexchat-x64.skel.iss b/win32/installer/hexchat-x64.skel.iss index 4f4613da..3d94ccb3 100644 --- a/win32/installer/hexchat-x64.skel.iss +++ b/win32/installer/hexchat-x64.skel.iss @@ -47,7 +47,7 @@ Name: "plugins\winamp"; Description: "Winamp"; Types: full custom; Flags: disabl Name: "plugins\winsys"; Description: "WinSys"; Types: full custom; Flags: disablenouninstallwarning Name: "plugins\wmpa"; Description: "Windows Media Player Announcer"; Types: full custom; Flags: disablenouninstallwarning Name: "plugins\xsasl"; Description: "X-SASL"; Types: full custom; Flags: disablenouninstallwarning -Name: "plugins\xtray"; Description: "X-Tray"; Types: full custom; Flags: disablenouninstallwarning +Name: "plugins\hextray"; Description: "HexTray"; Types: full custom; Flags: disablenouninstallwarning Name: "langs"; Description: "Language Interfaces"; Types: full custom; Flags: disablenouninstallwarning Name: "langs\lua"; Description: "Lua"; Types: full custom; Flags: disablenouninstallwarning Name: "langs\lua\luawdk"; Description: "Lua-WDK"; Types: full custom; Flags: disablenouninstallwarning @@ -173,7 +173,7 @@ Source: "plugins\xcwinamp.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Source: "etc\system.png"; DestDir: "{app}\etc"; Flags: ignoreversion; Components: plugins\winsys Source: "plugins\xcwinsys.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\winsys Source: "plugins\xcxsasl.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\xsasl -Source: "plugins\xtray.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\xtray +Source: "plugins\hextray.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\hextray Source: "plugins\xcwmpa.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\wmpa Source: "plugins\xclua.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\lua diff --git a/win32/installer/hexchat-x86.skel.iss b/win32/installer/hexchat-x86.skel.iss index afe7e6a9..c16ea7e0 100644 --- a/win32/installer/hexchat-x86.skel.iss +++ b/win32/installer/hexchat-x86.skel.iss @@ -46,7 +46,7 @@ Name: "plugins\winamp"; Description: "Winamp"; Types: full custom; Flags: disabl Name: "plugins\winsys"; Description: "WinSys"; Types: full custom; Flags: disablenouninstallwarning Name: "plugins\wmpa"; Description: "Windows Media Player Announcer"; Types: full custom; Flags: disablenouninstallwarning Name: "plugins\xsasl"; Description: "X-SASL"; Types: full custom; Flags: disablenouninstallwarning -Name: "plugins\xtray"; Description: "X-Tray"; Types: full custom; Flags: disablenouninstallwarning +Name: "plugins\hextray"; Description: "HexTray"; Types: full custom; Flags: disablenouninstallwarning Name: "langs"; Description: "Language Interfaces"; Types: full custom; Flags: disablenouninstallwarning Name: "langs\lua"; Description: "Lua"; Types: full custom; Flags: disablenouninstallwarning Name: "langs\lua\luawdk"; Description: "Lua-WDK"; Types: full custom; Flags: disablenouninstallwarning @@ -174,7 +174,7 @@ Source: "plugins\xcwinamp.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Source: "etc\system.png"; DestDir: "{app}\etc"; Flags: ignoreversion; Components: plugins\winsys Source: "plugins\xcwinsys.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\winsys Source: "plugins\xcxsasl.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\xsasl -Source: "plugins\xtray.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\xtray +Source: "plugins\hextray.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\hextray Source: "plugins\xcwmpa.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\wmpa Source: "plugins\xclua.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\lua -- cgit 1.4.1