From 73d7e5e2de6d267bc439ed82e1fae8caff142881 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Tue, 25 Jan 2011 22:29:53 +0100 Subject: [PATCH] some cosmetics on xtray and support for channel message alerts --- plugins/xtray/callbacks.cpp | 7 +++++- plugins/xtray/resource.rc | 45 +++++++++++++++---------------------- plugins/xtray/utility.cpp | 7 ++++-- plugins/xtray/xtray.cpp | 3 ++- plugins/xtray/xtray.h | 3 +++ 5 files changed, 34 insertions(+), 31 deletions(-) diff --git a/plugins/xtray/callbacks.cpp b/plugins/xtray/callbacks.cpp index e9be49dd..636c114e 100644 --- a/plugins/xtray/callbacks.cpp +++ b/plugins/xtray/callbacks.cpp @@ -61,7 +61,7 @@ int event_cb(char *word[], void *userdata) { int iEvent = (int)userdata; - if(iEvent > 10) + if(iEvent > 10 && iEvent != 21) return XCHAT_EAT_NONE; /***************************************************************************************/ @@ -92,6 +92,11 @@ int event_cb(char *word[], void *userdata) _snprintf(szName, 64, "Hilight"); dwInfoFlags = NIIF_INFO; break; + case CHAN_MESSAGE: + _snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]); + _snprintf(szName, 64, "Channel Message"); + dwInfoFlags = NIIF_INFO; + break; case CHAN_TOPIC_CHANGE: _snprintf(szInfo, 512, "%s has changed the topic to %s", word[1], word[2]); _snprintf(szName, 64, "Topic Change: %s", word[3]); diff --git a/plugins/xtray/resource.rc b/plugins/xtray/resource.rc index fa6a6646..906cf591 100644 --- a/plugins/xtray/resource.rc +++ b/plugins/xtray/resource.rc @@ -33,26 +33,17 @@ STYLE DS_SETFONT | DS_SETFOREGROUND | WS_CHILD FONT 8, "Tahoma", 0, 0, 0x0 BEGIN GROUPBOX "XChat Events",IDC_STATIC,5,5,205,77 - CONTROL "Server Notice",9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 145,32,55,10 - CONTROL "Topic Change",3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 145,18,55,10 - 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 "CTCP",6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,32,69, - 10 - CONTROL "Invite",2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,46, - 69,10 - CONTROL "Highlight",1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70, - 60,69,10 + 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 @@ -106,9 +97,9 @@ BEGIN 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.3 PR",IDC_STATIC,170,105,33,8,0,WS_EX_RIGHT - LTEXT "Compiled On: ",IDC_STATIC,110,116,46,8 - LTEXT "10/08/16",IDC_STATIC,174,117,30,8 + LTEXT "1.2.4",IDC_STATIC,170,105,33,8,0,WS_EX_RIGHT + LTEXT "Compiled In: ",IDC_STATIC,110,117,54,8 + LTEXT "2011",IDC_STATIC,170,117,33,8,0,WS_EX_RIGHT LTEXT "Version Number:",IDC_STATIC,110,105,54,8 END @@ -228,8 +219,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2,3,0 - PRODUCTVERSION 1,2,3,0 + FILEVERSION 1,2,4,0 + PRODUCTVERSION 1,2,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -246,12 +237,12 @@ BEGIN BEGIN VALUE "CompanyName", "SinisterDevelopments" VALUE "FileDescription", "X-Tray" - VALUE "FileVersion", "1, 2, 3, 0" + 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, 3, 0" + VALUE "ProductVersion", "1, 2, 4, 0" END END BLOCK "VarFileInfo" diff --git a/plugins/xtray/utility.cpp b/plugins/xtray/utility.cpp index 93f445fe..60f3f2f0 100644 --- a/plugins/xtray/utility.cpp +++ b/plugins/xtray/utility.cpp @@ -207,17 +207,18 @@ void LoadPrefs() // 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("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("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); @@ -263,6 +264,7 @@ void CheckPrefs(HWND hwnd, int iDlg) SetOption(hwnd, SERV_KILLED, SERV_KILLED); SetOption(hwnd, SERV_NOTICE, SERV_NOTICE); SetOption(hwnd, SERV_DISCONNECT, SERV_DISCONNECT); + SetOption(hwnd, CHAN_MESSAGE, CHAN_MESSAGE); } break; case IDD_ALERTS: @@ -353,6 +355,7 @@ void SetDialog(HWND hwnd, int iDlg) SetCheck(hwnd, SERV_KILLED, SERV_KILLED); SetCheck(hwnd, SERV_NOTICE, SERV_NOTICE); SetCheck(hwnd, SERV_DISCONNECT, SERV_DISCONNECT); + SetCheck(hwnd, CHAN_MESSAGE, CHAN_MESSAGE); } break; case IDD_SETTINGS: diff --git a/plugins/xtray/xtray.cpp b/plugins/xtray/xtray.cpp index 8364952c..a7c8c8bd 100644 --- a/plugins/xtray/xtray.cpp +++ b/plugins/xtray/xtray.cpp @@ -75,7 +75,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl *plugin_name = "X-Tray"; *plugin_desc = "Minimize XChat to the Windows system tray"; - *plugin_version = "1.2.3 PR"; + *plugin_version = "1.2.4"; /***************************************************************************************************************************/ /************************* Load our preferances from xTray.ini *************************************************************/ @@ -135,6 +135,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl /************************* Set our hooks and save them for later so we can unhook them *************************************/ /***************************************************************************************************************************/ g_vHooks.push_back(xchat_hook_print(ph, "Channel Msg Hilight", XCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT)); + g_vHooks.push_back(xchat_hook_print(ph, "Channel Message", XCHAT_PRI_NORM, event_cb, (void *)CHAN_MESSAGE)); g_vHooks.push_back(xchat_hook_print(ph, "Topic Change", XCHAT_PRI_NORM, event_cb, (void *)CHAN_TOPIC_CHANGE)); g_vHooks.push_back(xchat_hook_print(ph, "Channel Action Hilight", XCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT)); g_vHooks.push_back(xchat_hook_print(ph, "Channel INVITE", XCHAT_PRI_NORM, event_cb, (void *)CHAN_INVITE)); diff --git a/plugins/xtray/xtray.h b/plugins/xtray/xtray.h index 21ec67a2..56323cf2 100644 --- a/plugins/xtray/xtray.h +++ b/plugins/xtray/xtray.h @@ -51,6 +51,9 @@ extern struct _xchat_plugin *ph; #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