summary refs log blame commit diff stats
path: root/win32/installer/hexchat-x86.skel.iss
blob: 10e9d277b58f80d6802bd72608514ac4bed8cee4 (plain) (tree)





















                                                       
              






















                                                                                                                      
                                                                                                  
                                                                                                             


                                                                                                                                    



                                                                                                                                                      
















                                                                                                                                                                                     
                                                                                                                                                                                                        
                                                                                                                                                                      


                                                                                                                                                                                                      

       








                                                                                                                         
 












                                                                                                                                       
                                                                                



                                                                                  
                                                                                
                                                                               









                                                                                                                  
                                                                                                                                                 



















                                                                                                                                                       
                                                                                                                      
                                                                                                            
                                                                                                   

                                                                                                          
                                                                                                     
                                                                                                            
 

                                                                                                                 
                                                                                                    






                                                                                      
                                                                                                                                 
















































































                                                                                                                                                
AppName=HexChat (x86)
AppPublisher=HexChat
AppPublisherURL=http://www.hexchat.org/
AppCopyright=Copyright (C) 1998-2010 Peter Zelezny
AppSupportURL=https://github.com/hexchat/hexchat/issues
AppUpdatesURL=http://www.hexchat.org/home/downloads
LicenseFile=share\doc\hexchat\COPYING
UninstallDisplayIcon={app}\hexchat.exe
UninstallDisplayName=HexChat (x86)
DefaultDirName={pf}\HexChat
DefaultGroupName=HexChat
DisableProgramGroupPage=yes
SolidCompression=yes
Compression=lzma2/ultra64
SourceDir=..\rel
OutputDir=..
FlatComponentsList=no
PrivilegesRequired=none
ShowComponentSizes=no
CreateUninstallRegKey=not IsTaskSelected('portable')
Uninstallable=not IsTaskSelected('portable')
ArchitecturesAllowed=x86 x64
MinVersion=6.0

[Types]
Name: "normal"; Description: "Normal Installation"
Name: "minimal"; Description: "Minimal Installation"
Name: "custom"; Description: "Custom Installation"; Flags: iscustom

[Components]
Name: "libs"; Description: "HexChat"; Types: normal minimal custom; Flags: fixed
Name: "gtktheme"; Description: "GTK+ Theme"; Types: normal custom; Flags: disablenouninstallwarning
Name: "xctext"; Description: "HexChat-Text"; Types: custom; Flags: disablenouninstallwarning
Name: "xtm"; Description: "HexChat Theme Manager (Requires .NET 4.0)"; Types: custom; Flags: disablenouninstallwarning
Name: "translations"; Description: "Translations"; Types: normal custom; Flags: disablenouninstallwarning
;obs Name: "gtkengines"; Description: "GTK+ Engines"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\dns"; Description: "DNS"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\doat"; Description: "Do At"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\exec"; Description: "Exec"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\fishlim"; Description: "FiSHLiM"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\mpcinfo"; Description: "mpcInfo"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\sysinfo"; Description: "SysInfo"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\upd"; Description: "Update Checker"; Types: normal custom; Flags: disablenouninstallwarning
Name: "plugins\winamp"; Description: "Winamp"; Types: custom; Flags: disablenouninstallwarning
Name: "langs"; Description: "Language Interfaces"; Types: custom; Flags: disablenouninstallwarning
Name: "langs\perl"; Description: "Perl (requires Perl 5.18)"; Types: custom; Flags: disablenouninstallwarning
Name: "langs\python"; Description: "Python Interface"; Types: custom; Flags: disablenouninstallwarning
Name: "langs\python\python2"; Description: "Python (requires Python 2.7)"; Types: custom; Flags: disablenouninstallwarning exclusive
Name: "langs\python\python3"; Description: "Python (requires Python 3.3)"; Types: custom; Flags: disablenouninstallwarning exclusive

[Tasks]
Name: portable; Description: "Yes"; GroupDescription: "Portable Install (no Registry entries, no Start Menu icons, no uninstaller):"; Flags: unchecked

[Registry]
Root: HKCR; Subkey: "irc"; ValueType: none; ValueName: ""; ValueData: ""; Flags: deletekey uninsdeletekey; Tasks: not portable
Root: HKCR; Subkey: "irc"; ValueType: string; ValueName: ""; ValueData: "URL:IRC Protocol"; Flags: uninsdeletevalue; Tasks: not portable
Root: HKCR; Subkey: "irc"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Flags: uninsdeletevalue; Tasks: not portable
Root: HKCR; Subkey: "irc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\hexchat.exe,0"; Flags: uninsdeletevalue; Tasks: not portable
Root: HKCR; Subkey: "irc\shell"; ValueType: string; ValueName: ""; ValueData: "open"; Flags: uninsdeletevalue; Tasks: not portable
Root: HKCR; Subkey: "irc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: "{app}\hexchat.exe --url=""%1"""; Flags: uninsdeletevalue; Tasks: not portable

Root: HKCR; Subkey: ".hct"; ValueType: none; ValueName: ""; ValueData: ""; Flags: deletekey uninsdeletekey; Components:xtm; Tasks: not portable
Root: HKCR; Subkey: ".hct"; ValueType: string; ValueName: ""; ValueData: "HexChat Theme File"; Flags: uninsdeletevalue; Components:xtm; Tasks: not portable
Root: HKCR; Subkey: ".hct"; ValueType: string; ValueName: "HexChat Theme File"; ValueData: ""; Flags: uninsdeletevalue; Components:xtm; Tasks: not portable
Root: HKCR; Subkey: ".hct\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\thememan.exe,0"; Flags: uninsdeletevalue; Components:xtm; Tasks: not portable
Root: HKCR; Subkey: ".hct\shell"; ValueType: string; ValueName: ""; ValueData: "open"; Flags: uninsdeletevalue; Components:xtm; Tasks: not portable
Root: HKCR; Subkey: ".hct\shell\open\command"; ValueType: string; ValueName: ""; ValueData: "{app}\thememan.exe ""%1"""; Flags: uninsdeletevalue; Components:xtm; Tasks: not portable

[Run]
Filename: "{app}\hexchat.exe"; Description: "Run HexChat after closing the Wizard"; Flags: nowait postinstall skipifsilent
Filename: "http://www.microsoft.com/en-us/download/details.aspx?id=30679"; Description: "Download Visual C++ 2012 Update 1 Redistributable"; Flags: shellexec runasoriginaluser postinstall skipifsilent
Filename: "http://docs.hexchat.org/en/latest/changelog.html"; Description: "See what's changed"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked
Filename: "http://hexchat.org/downloads.html"; Description: "Download Perl"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked; Components: langs\perl and not langs\python
Filename: "http://hexchat.org/downloads.html"; Description: "Download Python"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked; Components: langs\python and not langs\perl
Filename: "http://hexchat.org/downloads.html"; Description: "Download Perl and Python"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked; Components: langs\perl and langs\python

[Files]
Source: "portable-mode"; DestDir: "{app}"; Tasks: portable

Source: "changelog.url"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "readme.url"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "cert.pem"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "etc\gtk-2.0\gtkrc"; DestDir: "{app}\etc\gtk-2.0"; Flags: ignoreversion; Components: gtktheme
;Source: "etc\gtk-2.0\gtkrc"; DestDir: "{app}\etc\gtk-2.0"; Flags: ignoreversion; Components: libs and not gtkengines
Source: "share\xml\*"; DestDir: "{app}\share\xml"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
Source: "share\doc\*"; DestDir: "{app}\share\doc"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs

Source: "share\locale\*"; DestDir: "{app}\share\locale"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: translations

Source: "atk-1.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "cairo.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "fontconfig.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gdk_pixbuf-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gdk-win32-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gio-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "glib-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gmodule-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gobject-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gthread-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gtk-win32-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "harfbuzz.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "iconv.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libenchant.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libintl.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libpng16.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libxml2.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "pango-1.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "pangocairo-1.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "pangoft2-1.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "pangowin32-1.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "pixman-1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs

Source: "lib\enchant\libenchant_myspell.dll"; DestDir: "{app}\lib\enchant"; Flags: ignoreversion; Components: libs

Source: "lib\gtk-2.0\i686-pc-vs10\engines\libwimp.dll"; DestDir: "{app}\lib\gtk-2.0\i686-pc-vs10\engines"; Flags: ignoreversion; Components: libs

;obs Source: "etc\gtkpref.png"; DestDir: "{app}\etc"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libclearlooks.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libcrux-engine.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libglide.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libhcengine.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libindustrial.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libmist.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libmurrine.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libredmond95.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "lib\gtk-2.0\2.10.0\engines\libthinice.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\engines"; Flags: ignoreversion; Components: gtkengines
;obs Source: "plugins\hcgtkpref.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: gtkengines
;obs Source: "share\themes\*"; DestDir: "{app}\share\themes"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: gtkengines
;obs Source: "gtk2-prefs.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: gtkengines

Source: "plugins\hcchecksum.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\checksum
Source: "plugins\hcdns.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\dns
Source: "plugins\hcdoat.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\doat
Source: "plugins\hcexec.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\exec
Source: "plugins\hcfishlim.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\fishlim
Source: "share\music.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\winamp or plugins\mpcinfo
Source: "plugins\hcmpcinfo.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\mpcinfo
Source: "share\download.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\upd
Source: "plugins\hcupd.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\upd
Source: "plugins\hcwinamp.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\winamp
Source: "share\system.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\sysinfo
Source: "plugins\hcsysinfo.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\sysinfo

Source: "plugins\hcpython2.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\python\python2
Source: "plugins\hcpython3.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\python\python3
Source: "plugins\hcperl.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\perl

Source: "hexchat.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "hexchat-text.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: xctext
Source: "thememan.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: xtm

[Icons]
Name: "{group}\HexChat (x86)"; Filename: "{app}\hexchat.exe"; Tasks: not portable
Name: "{group}\HexChat (x86) Safe Mode"; Filename: "{app}\hexchat.exe"; Parameters: "--no-auto --no-plugins"; Tasks: not portable
Name: "{group}\HexChat (x86) ChangeLog"; Filename: "{app}\changelog.url"; IconFilename: "{sys}\shell32.dll"; IconIndex: 165; Tasks: not portable
Name: "{group}\HexChat (x86) ReadMe"; Filename: "{app}\readme.url"; IconFilename: "{sys}\shell32.dll"; IconIndex: 23; Tasks: not portable
Name: "{group}\HexChat-Text (x86)"; Filename: "{app}\hexchat-text.exe"; Components: xctext; Tasks: not portable
Name: "{group}\HexChat Theme Manager (x86)"; Filename: "{app}\thememan.exe"; Components: xtm; Tasks: not portable
Name: "{group}\Uninstall HexChat (x86)"; Filename: "{uninstallexe}"; Tasks: not portable

[Messages]
BeveledLabel= HexChat

[Code]
/////////////////////////////////////////////////////////////////////
procedure InitializeWizard;
begin
	WizardForm.LicenseAcceptedRadio.Checked := True;
end;


/////////////////////////////////////////////////////////////////////
// these are required for x86->x64 or reverse upgrades
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
	sUnInstPath: String;
	sUnInstallString: String;
begin
	sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\HexChat (x86)_is1');
	sUnInstallString := '';
	if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
		RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
	Result := sUnInstallString;
end;


/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
	Result := (GetUninstallString() <> '');
end;


/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
	sUnInstallString: String;
	iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString

	// default return value
	Result := 0;

	// get the uninstall string of the old app
	sUnInstallString := GetUninstallString();
	if sUnInstallString <> '' then begin
		sUnInstallString := RemoveQuotes(sUnInstallString);
		if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
			Result := 3
		else
			Result := 2;
	end else
		Result := 1;
end;

/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
	if not (IsTaskSelected('portable')) then
	begin
		if (CurStep=ssInstall) then
		begin
			if (IsUpgrade()) then
			begin
				UnInstallOldVersion();
			end;
			DeleteFile(ExpandConstant('{app}\portable-mode'));
		end;
	end;
end;
id='n598' href='#n598'>598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734























                                                                                
 
                            
                     

                     

















                                                        
                                              








                                                                                                  

                                                                                                  





                                                                                                  
                                         

























                                                                                                                                
                                                                                                  



                                                                               
                                                                                                        

















                                                                                                          
                                                                                           




































                                                                                                         
                                                                                                                                                                 
                                                                                                         
                                                      












                                                                                                 
                                                                     

                                                                                      


                                              
                                              
                                              
                                 








                                                               
                                              



















                                                                                                   
                                














                                                                                  
                                                                         































                                                                                         
                                                                     








                                                                                      
                                                                         































                                                                                                                                      
                                                                                 











































                                                                                                                                       
                                                                                                           























                                                                                                                                 



                                                                            




                                                                                
                                                         










                                                         
                                                         



                       
                                                 





                                    
                                                                                     
 
                                                                  
                                  
                                                                


                                     
                                                        
































































































































































































































































































































                                                                                                                   
/* X-Tray
 * Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
 *
 * 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 <windows.h>
#include <stdio.h>
#include <commctrl.h>
#include <tchar.h>

#include "hexchat-plugin.h"
#include "utility.h"
#include "hextray.h"
#include "hexchat.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("HexChat [")))
	{
		g_hXchatWnd = hWnd;
		return false;
	}
	
	return true;
}

/***********************************************************************************************/
/******* our HexChat 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 HEXCHAT_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<<PREF_OSBWM))) && (g_dwPrefs & (1<<PREF_AMAE)) && (g_dwPrefs & (1<<iEvent)))
	{	
		/*********************************/
		/*********** Our Buffers *********/
		/*********************************/
		char			szInfo[512];
		char			szName[64];
		DWORD			dwInfoFlags;
		int iTime		= g_iTime*1000;
		char *szTemp	= NULL;

		if(g_dwPrefs & (1<<PREF_KAOI))
		{
			iTime = 0;
		}

		switch(iEvent)
		{
		case CHAN_HILIGHT:
			_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
			_snprintf(szName, 64, "Highlight: %s", hexchat_get_info (ph, "channel"));
			dwInfoFlags = NIIF_INFO;
			break;
		case CHAN_MESSAGE:
			_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
			_snprintf(szName, 64, "Channel Message: %s", hexchat_get_info (ph, "channel"));
			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]);
			dwInfoFlags = NIIF_INFO;
			break;
		case CHAN_INVITE:
			_snprintf(szInfo, 512, "%s has invited you into %s", word[1], word[2]);
			_snprintf(szName, 64, "Invite");
			dwInfoFlags = NIIF_INFO;
			break;
		case CHAN_KICKED:
			_snprintf(szInfo, 512, "Kicked from %s by %s:\r\n%s", word[2], word[3], word[4]);
			_snprintf(szName, 64, "Kick");
			dwInfoFlags = NIIF_WARNING;
			break;
		case CHAN_BANNED:
			_snprintf(szInfo, 512, "Cannot join %s You are banned.", word[1]);
			_snprintf(szName, 64, "Banned");
			dwInfoFlags = NIIF_WARNING;
			break;
		case CTCP_GENERIC:
			_snprintf(szInfo, 512, "%s:\r\nCTCP %s", word[2], word[1]);
			_snprintf(szName, 64, "CTCP");
			dwInfoFlags = NIIF_INFO;
			break;
		case PMSG_RECEIVE:
			_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
			_snprintf(szName, 64, "Private Message");
			dwInfoFlags = NIIF_INFO;
			break;
		case SERV_DISCONNECT:
			_snprintf(szInfo, 512, "Disconnected\r\nError: %s", word[1]);
			_snprintf(szName, 64, "Disconnect");
			dwInfoFlags = NIIF_ERROR;
			break;
		case SERV_KILLED:
			_snprintf(szInfo, 512, "Killed(%s(%s))", word[1], word[2]);
			_snprintf(szName, 64, "Server Admin has killed you");
			dwInfoFlags = NIIF_ERROR;
			break;
		case SERV_NOTICE:
			_snprintf(szInfo, 512, "Notice:\r\n%s: %s", word[1], word[2]);
			_snprintf(szName, 64, "Notice");
			dwInfoFlags = NIIF_INFO;
			break;
		case 11:
			_snprintf(szInfo, 512, ":\r\n%s: %s", word[1], word[2]);
			_snprintf(szName, 64, "Notice");
			dwInfoFlags = NIIF_INFO;
			break;
		}

		/**************************************************************************************/
		/***** Use windows instead of balloons, and if its a window should we keep it open ****/
		/***** indefinitely?															   ****/
		/**************************************************************************************/
		szTemp = hexchat_strip_color(szInfo);

		if(g_dwPrefs & (1<<PREF_UWIOB))
		{
			sdSystemAlert((HINSTANCE)g_hInstance, IDD_ALERT, szTemp, szName, iTime);
		}
		else
		{
			ShowBalloon(g_hXchatWnd, 1, szTemp, szName, iTime, dwInfoFlags);
		}

		free(szTemp);
	}

	if(g_dwPrefs & (1<<PREF_BLINK) && (g_dwPrefs & (1<<iEvent)))
	{
		BlinkIcon(g_hXchatWnd, 1, g_hIcons[0], g_hIcons[(iEvent+1)], 700, 5);
	}

	/***********************************/
	/***** pass the events to HexChat **/
	/***********************************/
	return HEXCHAT_EAT_NONE;
}

int command_cb(char *word[], char *word_eol[], void *userdata)
{
	char szInfo[512];
	char *szTemp	= NULL;
	int iTime		= g_iTime*1000;

	_snprintf(szInfo, 512, word_eol[2]);
	szTemp = hexchat_strip_color(szInfo);

	if(g_dwPrefs & (1<<PREF_KAOI))
	{
		iTime = 0;
	}

	if(((g_iIsActive == 0) || !(g_dwPrefs & (1<<PREF_OSBWM))) && (g_dwPrefs & (1<<PREF_AMAE)))
	{
		if(g_dwPrefs & (1<<PREF_UWIOB))
		{
			sdSystemAlert((HINSTANCE)g_hInstance, IDD_ALERT, szTemp, "Alert", iTime);
		}
		else
		{
			ShowBalloon(g_hXchatWnd, 1, szTemp, "Alert", iTime, NIIF_INFO);
		}
	}

	free(szTemp);

	return HEXCHAT_EAT_ALL;
}

LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	switch(msg)
	{
	case WM_CLOSE:
		{
			if((g_dwPrefs & (1<<PREF_MIOC)) && (g_bCanQuit == false))
			{
				/*******************************************/
				/**** to autoaway or not to autoaway...  ***/
				/*******************************************/
				if(g_dwPrefs & (1<<PREF_AOM))
				{
					hexchat_globally_away(g_szAway);
				}

				/**************************************************/
				/**** Win32 API call to hide the window and	     **/
				/**** save the fact that its minimized for later **/
				/**************************************************/
				g_iIsActive = 0;
				ShowWindow(hWnd, SW_HIDE);

				return 0;
			}
			else
			{
				if(g_hPrefDlg != NULL)
				{
					DestroyWindow(g_hPrefDlg);
				}

				StopBlink(hWnd, 1, g_hIcons[0]);
				
				if(sdAlertNum())
				{
					sdCloseAlerts();
					HoldClose();
					return 0;
				}
			}
		}
		break;
	case WM_SIZE:
		{
			/******************************************/
			/***** User wants to minimize HexChat, ****/
			/***** are we allowed to go to tray? ******/
			/******************************************/
			if((g_dwPrefs & (1<<PREF_TOT)) && (wparam == SIZE_MINIMIZED))
			{
				/*******************************************/
				/**** to autoaway or not to autoaway...  ***/
				/*******************************************/
				if(g_dwPrefs & (1<<PREF_AOM))
				{
					hexchat_globally_away(g_szAway);
				}

				/**************************************************/
				/**** Win32 API call to hide the window and	     **/
				/**** save the fact that its minimized for later **/
				/**************************************************/
				g_iIsActive = 0;
				ShowWindow(hWnd, SW_HIDE);
			}
		}
		break;
	/**********************************/
	/*** user clicked the tray icon ***/
	/**********************************/
	case WM_TRAYMSG:
		{
			switch(lparam)
			{
			case WM_LBUTTONDOWN:
				{
					if(!g_iIsActive)
					{
						/*********************************************************/
						/*** 0: its hiden, restore it and show it, if autoaway ***/
						/*** is on, set us as back							 ***/
						/*********************************************************/
						SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
						SetForegroundWindow(hWnd);
						g_iIsActive = 1;

						if(g_dwPrefs & (1<<PREF_AOM))
						{
							hexchat_globally_back();
						}
					}
					else
					{
						SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
					}
				}
				break;
			case WM_RBUTTONDOWN:
				{
					/******************************************/
					/*** user wants to see the menu find out **/
					/*** where the mouse is and show it	  **/
					/******************************************/
					POINT pt;
					int iRet;

					GetCursorPos(&pt);
					SetForegroundWindow(hWnd);

					ModifyMenu(g_hTrayMenu, 2, (MF_POPUP | MF_BYPOSITION), (UINT)setServerMenu(), _T("Away"));

					Sleep(175);

					iRet = TrackPopupMenuEx(g_hTrayMenu, (TPM_RETURNCMD | TPM_LEFTALIGN), pt.x, pt.y, hWnd, NULL);

					/***********************************/
					/*** nRet is the users selection, **/
					/*** process it				   **/
					/***********************************/
					sdTrayProc(hWnd, iRet);
				}
				break;
			}
		}
		break;
	default:
		{
			/*****************************************************/
			/*** the taskbar has been restarted, re-add our icon */
			/*****************************************************/
			if(msg == RegisterWindowMessage(_T("TaskbarCreated")))
			{
				char szVersion[64];
				_snprintf(szVersion, 64, "HexChat [%s]", hexchat_get_info(ph, "version"));
				AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG);
			}
		}
		break;
	}

	return CallWindowProc(g_hOldProc, hWnd, msg, wparam, lparam);
}

/****************************************************/
/*** process messages from the tray menu ************/
/****************************************************/
LRESULT CALLBACK sdTrayProc(HWND hWnd, int msg)
{
	switch(msg)
	{
	case ACT_EXIT:
		{
			g_bCanQuit = true;
			PostMessage(hWnd, WM_CLOSE, 0, 0);
		}
		break;
	case ACT_RESTORE:
		{
			/*************************************************/
			/** user wants us to restore the HexChat window **/
			/** and of autoaway is on, set as back ******** **/
			/*************************************************/
			SendMessage(g_hXchatWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
			SetForegroundWindow(hWnd);
			
			if((!g_iIsActive) && (g_dwPrefs & (1<<PREF_AOM)))
			{
				hexchat_globally_back();
				g_iIsActive = 1;
			}
		}
		break;
	case ACT_SETTINGS:
		{
			ShowWindow(g_hPrefDlg, SW_SHOW);
		}
		break;
	case ACT_AWAY:
		{
			hexchat_globally_away(g_szAway);
		}
		break;
	case ACT_BACK:
		{
			hexchat_globally_back();
		}
		break;
	default:
		{
			if(msg > 0)
			{
				hexchat_set_context(ph, hexchat_find_server(msg-1));

				if(!hexchat_get_info(ph, "away"))
				{
					hexchat_away(g_szAway);
				}
				else
				{
					hexchat_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;
}