Browse Source

Initial import

master
wiz78 3 years ago
parent
commit
bf4c063787
100 changed files with 10280 additions and 0 deletions
  1. 2
    0
      .gitignore
  2. 44
    0
      OrionIRC/About.cpp
  3. BIN
      OrionIRC/About.dfm
  4. 34
    0
      OrionIRC/About.h
  5. 114
    0
      OrionIRC/Alias.cpp
  6. 39
    0
      OrionIRC/Alias.h
  7. 141
    0
      OrionIRC/AliasesMgr.cpp
  8. 44
    0
      OrionIRC/AliasesMgr.h
  9. 52
    0
      OrionIRC/AskRemoveWnd.cpp
  10. BIN
      OrionIRC/AskRemoveWnd.dfm
  11. 35
    0
      OrionIRC/AskRemoveWnd.h
  12. 92
    0
      OrionIRC/BufferSearchWnd.cpp
  13. BIN
      OrionIRC/BufferSearchWnd.dfm
  14. 38
    0
      OrionIRC/BufferSearchWnd.h
  15. 219
    0
      OrionIRC/ChanListWnd.cpp
  16. BIN
      OrionIRC/ChanListWnd.dfm
  17. 67
    0
      OrionIRC/ChanListWnd.h
  18. 210
    0
      OrionIRC/ChanPropWnd.cpp
  19. BIN
      OrionIRC/ChanPropWnd.dfm
  20. 71
    0
      OrionIRC/ChanPropWnd.h
  21. 1538
    0
      OrionIRC/ChanWnd.cpp
  22. BIN
      OrionIRC/ChanWnd.dfm
  23. 248
    0
      OrionIRC/ChanWnd.h
  24. 195
    0
      OrionIRC/Changes.txt
  25. 132
    0
      OrionIRC/ColorSet.cpp
  26. 40
    0
      OrionIRC/ColorSet.h
  27. 858
    0
      OrionIRC/Commands.cpp
  28. 17
    0
      OrionIRC/Commands.h
  29. 83
    0
      OrionIRC/DCCChatOfferWnd.cpp
  30. BIN
      OrionIRC/DCCChatOfferWnd.dfm
  31. 44
    0
      OrionIRC/DCCChatOfferWnd.h
  32. 81
    0
      OrionIRC/DCCMgr.cpp
  33. 31
    0
      OrionIRC/DCCMgr.h
  34. 270
    0
      OrionIRC/DCCMgrWnd.cpp
  35. BIN
      OrionIRC/DCCMgrWnd.dfm
  36. 73
    0
      OrionIRC/DCCMgrWnd.h
  37. 72
    0
      OrionIRC/DCCSendOfferWnd.cpp
  38. BIN
      OrionIRC/DCCSendOfferWnd.dfm
  39. 53
    0
      OrionIRC/DCCSendOfferWnd.h
  40. 486
    0
      OrionIRC/DCCTransfer.cpp
  41. 76
    0
      OrionIRC/DCCTransfer.h
  42. 62
    0
      OrionIRC/DNSReq.cpp
  43. 33
    0
      OrionIRC/DNSReq.h
  44. 155
    0
      OrionIRC/DblClickAction.cpp
  45. 48
    0
      OrionIRC/DblClickAction.h
  46. 48
    0
      OrionIRC/EditAliasWnd.cpp
  47. BIN
      OrionIRC/EditAliasWnd.dfm
  48. 43
    0
      OrionIRC/EditAliasWnd.h
  49. 34
    0
      OrionIRC/EditNotifyWnd.cpp
  50. BIN
      OrionIRC/EditNotifyWnd.dfm
  51. 33
    0
      OrionIRC/EditNotifyWnd.h
  52. 288
    0
      OrionIRC/Eyelin.cpp
  53. 64
    0
      OrionIRC/Eyelin.h
  54. 35
    0
      OrionIRC/FavWnd.cpp
  55. BIN
      OrionIRC/FavWnd.dfm
  56. 39
    0
      OrionIRC/FavWnd.h
  57. 59
    0
      OrionIRC/Favourite.cpp
  58. 35
    0
      OrionIRC/Favourite.h
  59. 89
    0
      OrionIRC/FavouritesMgr.cpp
  60. 29
    0
      OrionIRC/FavouritesMgr.h
  61. 187
    0
      OrionIRC/FavouritesWnd.cpp
  62. BIN
      OrionIRC/FavouritesWnd.dfm
  63. 51
    0
      OrionIRC/FavouritesWnd.h
  64. 83
    0
      OrionIRC/FileFilter.cpp
  65. 48
    0
      OrionIRC/FileFilter.h
  66. 113
    0
      OrionIRC/FileFilterMgr.cpp
  67. 34
    0
      OrionIRC/FileFilterMgr.h
  68. 48
    0
      OrionIRC/FileFilterWnd.cpp
  69. BIN
      OrionIRC/FileFilterWnd.dfm
  70. 44
    0
      OrionIRC/FileFilterWnd.h
  71. 5
    0
      OrionIRC/FileProps/.cvsignore
  72. 82
    0
      OrionIRC/FileProps/FileProps.cpp
  73. 5
    0
      OrionIRC/FileProps/FileProps.def
  74. 121
    0
      OrionIRC/FileProps/FileProps.dsp
  75. 29
    0
      OrionIRC/FileProps/FileProps.h
  76. 109
    0
      OrionIRC/FileProps/FileProps.rc
  77. 3
    0
      OrionIRC/FileProps/FilePropsTest/.cvsignore
  78. 100
    0
      OrionIRC/FileProps/FilePropsTest/FilePropsTest.dsp
  79. 9
    0
      OrionIRC/FileProps/FilePropsTest/Main.cpp
  80. 8
    0
      OrionIRC/FileProps/FilePropsTest/_BldNum.h
  81. 8
    0
      OrionIRC/FileProps/_BldNum.h
  82. 15
    0
      OrionIRC/FileProps/resource.h
  83. 235
    0
      OrionIRC/Filter.cpp
  84. 100
    0
      OrionIRC/Filter.h
  85. 126
    0
      OrionIRC/FilterMgr.cpp
  86. 36
    0
      OrionIRC/FilterMgr.h
  87. 172
    0
      OrionIRC/FilterWnd.cpp
  88. BIN
      OrionIRC/FilterWnd.dfm
  89. 76
    0
      OrionIRC/FilterWnd.h
  90. 153
    0
      OrionIRC/Hostmask.cpp
  91. 50
    0
      OrionIRC/Hostmask.h
  92. 97
    0
      OrionIRC/Hotspot.cpp
  93. 33
    0
      OrionIRC/Hotspot.h
  94. 75
    0
      OrionIRC/IRCChanData.cpp
  95. 47
    0
      OrionIRC/IRCChanData.h
  96. 389
    0
      OrionIRC/IRCEdit.cpp
  97. 72
    0
      OrionIRC/IRCEdit.h
  98. 783
    0
      OrionIRC/IRCList.cpp
  99. 141
    0
      OrionIRC/IRCList.h
  100. 0
    0
      OrionIRC/IRCListRow.cpp

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@

.DS_Store

+ 44
- 0
OrionIRC/About.cpp View File

@@ -0,0 +1,44 @@
/* $Id: About.cpp,v 1.7 2003/08/01 20:22:01 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <shellapi.h>
#include "About.h"
#include "Version.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Placemnt"
#pragma resource "*.dfm"
TAboutWin *AboutWin;
//---------------------------------------------------------------------------
__fastcall TAboutWin::TAboutWin(TComponent* Owner)
: TForm(Owner)
{
Ver->Caption = "v" + Version.GetVersionStr();
Build->Caption = Format( "Release: %d Build: %d",
ARRAYOFCONST(( Version.GetRelease(), Version.GetBuild() )));
Copyright->Caption = "Copyright " + Version.GetCopyright();
}
//---------------------------------------------------------------------------
void __fastcall TAboutWin::HomepageClick(TObject *Sender)
{
ShellExecute( Handle, "open", "http://tellini.info/index_en.html", NULL, NULL, FALSE );
}
//---------------------------------------------------------------------------
void __fastcall TAboutWin::OrionHotspotClick(TObject *Sender)
{
ShellExecute( Handle, "open", "http://tellini.info/software/orion/", NULL, NULL, FALSE );
}
//---------------------------------------------------------------------------
void __fastcall TAboutWin::OkClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TAboutWin::FormShow(TObject *Sender)
{
Caption = "About - " + Version.GetProductName();
}
//---------------------------------------------------------------------------

BIN
OrionIRC/About.dfm View File


+ 34
- 0
OrionIRC/About.h View File

@@ -0,0 +1,34 @@
/* $Id: About.h,v 1.6 2003/04/15 20:56:21 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef AboutH
#define AboutH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include "Placemnt.hpp"
//---------------------------------------------------------------------------
class TAboutWin : public TForm
{
__published: // IDE-managed Components
TFormStorage *FormStorage1;
TLabel *Copyright;
TLabel *Ver;
TImage *Image1;
TLabel *Homepage;
TLabel *Build;
TLabel *OrionHotspot;
void __fastcall HomepageClick(TObject *Sender);
void __fastcall OkClick(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall OrionHotspotClick(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TAboutWin(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TAboutWin *AboutWin;
//---------------------------------------------------------------------------
#endif

+ 114
- 0
OrionIRC/Alias.cpp View File

@@ -0,0 +1,114 @@
/* $Id: Alias.cpp,v 1.2 2005/04/08 17:31:58 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Alias.h"
#include "Commands.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
TAlias::TAlias()
{
}
//---------------------------------------------------------------------------
TAlias::TAlias( const TAlias *copy )
{
*this = *copy;
}
//---------------------------------------------------------------------------
TAlias &TAlias::operator =( const TAlias& rhs )
{
Name = rhs.Name;
Command = rhs.Command;
return( *this );
}
//---------------------------------------------------------------------------
void TAlias::Load( TRegistry *reg, AnsiString key )
{
if( reg->OpenKey( key, false )) {
Name = reg->ReadString( "Name" );
Command = reg->ReadString( "Command" );
reg->CloseKey();
}
}
//---------------------------------------------------------------------------
void TAlias::Save( TRegistry *reg, AnsiString key )
{
if( reg->OpenKey( key, true )) {
try {
reg->WriteString( "Name", Name );
reg->WriteString( "Command", Command );
}
catch(...) {
}
reg->CloseKey();
}
}
//---------------------------------------------------------------------------
void TAlias::Invoke( TServerWin *server, TChanWin *channel,
AnsiString args, TStringList *words )
{
AnsiString cmd, tmp = Command;
while( int pos = tmp.Pos( "%" )) {
cmd += tmp.SubString( 1, pos - 1 );
if( pos + 1 <= tmp.Length() ) {
switch( tmp[ ++pos ] ) {
case '%':
cmd += "%";
break;
case 's':
cmd += args;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': {
AnsiString num = GetNum( tmp, pos );
int idx = num.ToIntDef( 1 );
if(( idx > 0 ) && ( idx <= words->Count ))
cmd += words->Strings[ idx - 1 ];
pos += num.Length() - 1;
} break;
}
}
tmp.Delete( 1, pos );
}
HandleCommand( server, channel, cmd + tmp );
}
//---------------------------------------------------------------------------
AnsiString TAlias::GetNum( AnsiString str, int pos )
{
int start = pos;
while(( pos <= str.Length() ) && isdigit( str[ pos ] ))
pos++;
return( str.SubString( start, pos - start ));
}
//---------------------------------------------------------------------------

+ 39
- 0
OrionIRC/Alias.h View File

@@ -0,0 +1,39 @@
/* $Id: Alias.h,v 1.1 2005/01/23 19:16:43 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef AliasH
#define AliasH
//---------------------------------------------------------------------------
#include <registry.hpp>
class TServerWin;
class TChanWin;
class TAlias
{
public:
TAlias();
TAlias( const TAlias *copy );
TAlias& operator =( const TAlias& rhs );
AnsiString GetName( void ) const { return( Name ); }
AnsiString GetCommand( void ) const { return( Command ); }
void SetName( AnsiString str ) { Name = str; }
void SetCommand( AnsiString str ) { Command = str; }
void Load( TRegistry *reg, AnsiString key );
void Save( TRegistry *reg, AnsiString key );
void Invoke( TServerWin *server, TChanWin *channel,
AnsiString args, TStringList *words );
private:
AnsiString Name;
AnsiString Command;
AnsiString GetNum( AnsiString str, int pos );
};
#endif

+ 141
- 0
OrionIRC/AliasesMgr.cpp View File

@@ -0,0 +1,141 @@
/* $Id: AliasesMgr.cpp,v 1.1 2005/01/23 19:16:43 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "AliasesMgr.h"
#include "Alias.h"
#include "ServerWnd.h"
#include "irc.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#define MAX_RECURSION 100
//---------------------------------------------------------------------------
AliasesMgr::AliasesMgr() : Aliases( 127 )
{
Records = new TList();
Recursion = 0;
}
//---------------------------------------------------------------------------
AliasesMgr::~AliasesMgr()
{
Clear();
delete Records;
}
//---------------------------------------------------------------------------
AliasesMgr& AliasesMgr::operator =( const AliasesMgr& rhs )
{
Clear();
for( int i = 0; i < rhs.GetCount(); i++ )
Add( new TAlias( rhs.Get( i )));
return( *this );
}
//---------------------------------------------------------------------------
int AliasesMgr::GetCount( void ) const
{
return( Records->Count );
}
//---------------------------------------------------------------------------
TAlias *AliasesMgr::Get( int i ) const
{
TAlias *ret = NULL;
if( i < GetCount() )
ret = reinterpret_cast<TAlias *>( Records->Items[ i ]);
return( ret );
}
//---------------------------------------------------------------------------
void AliasesMgr::Clear( void )
{
for( int i = 0; i < GetCount(); i++ )
delete Get( i );
Records->Clear();
}
//---------------------------------------------------------------------------
void AliasesMgr::Add( TAlias *rec )
{
Records->Add( rec );
}
//---------------------------------------------------------------------------
void AliasesMgr::Load( TRegistry *reg, AnsiString key )
{
if( reg->OpenKey( key, false )) {
int num = 0;
try{ num = reg->ReadInteger( "Count" ); } catch(...) {}
reg->CloseKey();
for( int i = 0; i < num; i++ ) {
TAlias *rec = new TAlias();
rec->Load( reg, key + "\\Record" + IntToStr( i ));
Add( rec );
}
ReHash();
}
}
//---------------------------------------------------------------------------
void AliasesMgr::Save( TRegistry *reg, AnsiString key )
{
if( reg->OpenKey( key, true )) {
try{
reg->WriteInteger( "Count", GetCount() );
}
catch(...) {
}
reg->CloseKey();
for( int i = 0; i < GetCount(); i++ )
Get( i )->Save( reg, key + "\\Record" + IntToStr( i ));
}
}
//---------------------------------------------------------------------------
void AliasesMgr::ReHash( void )
{
Aliases.Clear();
for( int i = 0; i < GetCount(); i++ ) {
TAlias *rec = Get( i );
Aliases.Add( rec->GetName().LowerCase().c_str(), rec );
}
}
//---------------------------------------------------------------------------
bool AliasesMgr::Invoke( TServerWin *server, TChanWin *channel,
AnsiString cmd, AnsiString args, TStringList *words )
{
bool ret = false;
if( ++Recursion > MAX_RECURSION ) {
server->DisplayOnActiveWin( NULL, "Recursion too deep while invoking an alias!", IRC_ERROR );
} else {
TAlias *rec = reinterpret_cast<TAlias *>( Aliases.FindData( cmd.LowerCase().c_str() ));
if( rec ) {
rec->Invoke( server, channel, args, words );
ret = true;
}
}
Recursion--;
return( ret );
}
//---------------------------------------------------------------------------

+ 44
- 0
OrionIRC/AliasesMgr.h View File

@@ -0,0 +1,44 @@
/* $Id: AliasesMgr.h,v 1.1 2005/01/23 19:16:43 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef AliasesMgrH
#define AliasesMgrH
//---------------------------------------------------------------------------
#include <registry.hpp>
#include "WizStrHash.h"
class TAlias;
class TServerWin;
class TChanWin;
class AliasesMgr
{
public:
AliasesMgr();
~AliasesMgr();
AliasesMgr& operator =( const AliasesMgr& rhs );
int GetCount( void ) const;
TAlias *Get( int i ) const;
void Clear( void );
void Add( TAlias *rec );
void Load( TRegistry *reg, AnsiString key );
void Save( TRegistry *reg, AnsiString key );
void ReHash( void );
bool Invoke( TServerWin *server, TChanWin *channel,
AnsiString cmd, AnsiString args, TStringList *words );
private:
TList *Records;
WizStrHash Aliases;
int Recursion;
};
#endif

+ 52
- 0
OrionIRC/AskRemoveWnd.cpp View File

@@ -0,0 +1,52 @@
/* $Id: AskRemoveWnd.cpp,v 1.2 2003/05/06 14:45:50 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "AskRemoveWnd.h"
#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TAskRemoveWin *AskRemoveWin;
//---------------------------------------------------------------------------
__fastcall TAskRemoveWin::TAskRemoveWin(TComponent* Owner)
: TForm(Owner)
{
ReturnCode = ARR_CANCEL;
}
//---------------------------------------------------------------------------
void __fastcall TAskRemoveWin::CancelClick(TObject *Sender)
{
ReturnCode = ARR_CANCEL;
}
//---------------------------------------------------------------------------
void __fastcall TAskRemoveWin::RemoveClick(TObject *Sender)
{
ReturnCode = ARR_YES;
}
//---------------------------------------------------------------------------
void __fastcall TAskRemoveWin::NoClick(TObject *Sender)
{
ReturnCode = ARR_NO;
}
//---------------------------------------------------------------------------
void __fastcall TAskRemoveWin::YesAllClick(TObject *Sender)
{
ReturnCode = ARR_YES_ALL;
}
//---------------------------------------------------------------------------
int __fastcall TAskRemoveWin::Execute( void )
{
ShowModal();
return( ReturnCode );
}
//---------------------------------------------------------------------------
void __fastcall TAskRemoveWin::FormShow(TObject *Sender)
{
Top = MainWin->Top + (( MainWin->Height - Height ) / 2 );
Left = MainWin->Left + (( MainWin->Width - Width ) / 2 );
}
//---------------------------------------------------------------------------

BIN
OrionIRC/AskRemoveWnd.dfm View File


+ 35
- 0
OrionIRC/AskRemoveWnd.h View File

@@ -0,0 +1,35 @@
//---------------------------------------------------------------------------
#ifndef AskRemoveWndH
#define AskRemoveWndH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TAskRemoveWin : public TForm
{
__published: // IDE-managed Components
TLabel *Msg;
TButton *Cancel;
TButton *Yes;
TButton *YesAll;
TButton *No;
void __fastcall CancelClick(TObject *Sender);
void __fastcall RemoveClick(TObject *Sender);
void __fastcall NoClick(TObject *Sender);
void __fastcall YesAllClick(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
private: // User declarations
int ReturnCode;
public: // User declarations
__fastcall TAskRemoveWin(TComponent* Owner);
int __fastcall Execute( void );
};
enum { ARR_YES_ALL = 0, ARR_YES, ARR_CANCEL, ARR_NO };
//---------------------------------------------------------------------------
extern PACKAGE TAskRemoveWin *AskRemoveWin;
//---------------------------------------------------------------------------
#endif

+ 92
- 0
OrionIRC/BufferSearchWnd.cpp View File

@@ -0,0 +1,92 @@
/* $Id: BufferSearchWnd.cpp,v 1.1 2005/02/20 18:41:02 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <pcre.h>
#include "BufferSearchWnd.h"
#include "SearchResultsWnd.h"
#include "Main.h"
#include "IRCList.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Placemnt"
#pragma resource "*.dfm"
TBufferSearchWin *BufferSearchWin;
//---------------------------------------------------------------------------
__fastcall TBufferSearchWin::TBufferSearchWin( TComponent *Owner, TIRCList *list )
: TForm(Owner)
{
List = list;
}
//---------------------------------------------------------------------------
void __fastcall TBufferSearchWin::OkClick(TObject *Sender)
{
try {
pcre *re = NULL;
pcre_extra *rex = NULL;
TList *results = new TList();
if( RegExp->Checked )
PrepareRegExp( &re, &rex );
DoSearch( re, rex, results );
pcre_free( re );
pcre_free( rex );
if( results->Count == 0 )
ShowMessage( "No results" );
else {
TSearchResultsWin *wnd = new TSearchResultsWin( MainWin, results );
wnd->Caption = "Search results for \"" + TextToFind->Text + "\"";
wnd->Show();
}
}
catch( const char *str ) {
ShowMessage( str );
ModalResult = mrNone;
}
}
//---------------------------------------------------------------------------
void __fastcall TBufferSearchWin::PrepareRegExp( pcre **re, pcre_extra **rex )
{
const char *error;
int erroff;
*re = pcre_compile( TextToFind->Text.c_str(),
PCRE_CASELESS | PCRE_UNGREEDY,
&error, &erroff, NULL );
if( !*re )
throw "Unparsable regular expression!";
*rex = pcre_study( *re, 0, &error );
}
//---------------------------------------------------------------------------
void __fastcall TBufferSearchWin::DoSearch( pcre *re, pcre_extra *rex, TList *results )
{
int i = 0;
if( RegExp->Checked ) {
while( IRCListRow *row = List->GetRow( i++ )) {
AnsiString str = row->GetText();
if( pcre_exec( re, rex, str.c_str(), str.Length(), 0, 0, NULL, 0 ) >= 0 )
results->Add( row );
}
} else {
AnsiString needle = TextToFind->Text.LowerCase();
while( IRCListRow *row = List->GetRow( i++ )) {
if( row->GetText().LowerCase().Pos( needle ) != 0 )
results->Add( row );
}
}
}
//---------------------------------------------------------------------------

BIN
OrionIRC/BufferSearchWnd.dfm View File


+ 38
- 0
OrionIRC/BufferSearchWnd.h View File

@@ -0,0 +1,38 @@
/* $Id: BufferSearchWnd.h,v 1.1 2005/02/20 18:41:02 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef BufferSearchWndH
#define BufferSearchWndH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "Placemnt.hpp"
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TIRCList;
class TBufferSearchWin : public TForm
{
__published: // IDE-managed Components
TBevel *Bevel1;
TButton *Ok;
TButton *Cancel;
TFormStorage *FormStorage1;
TLabel *Label1;
TEdit *TextToFind;
TCheckBox *RegExp;
void __fastcall OkClick(TObject *Sender);
private: // User declarations
TIRCList *List;
void __fastcall PrepareRegExp( pcre **re, pcre_extra **rex );
void __fastcall DoSearch( pcre *re, pcre_extra *rex, TList *results );
public: // User declarations
__fastcall TBufferSearchWin( TComponent *Owner, TIRCList *list );
};
//---------------------------------------------------------------------------
extern PACKAGE TBufferSearchWin *BufferSearchWin;
//---------------------------------------------------------------------------
#endif

+ 219
- 0
OrionIRC/ChanListWnd.cpp View File

@@ -0,0 +1,219 @@
/* $Id: ChanListWnd.cpp,v 1.1 2005/08/19 14:53:03 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ChanListWnd.h"
#include "ServerWnd.h"
#include "IRCUtils.h"
//---------------------------------------------------------------------------
class TChanInfo
{
public:
TChanInfo( AnsiString channel, int users, AnsiString topic )
{
Channel = channel;
Users = users;
Topic = topic;
}
AnsiString Channel;
int Users;
AnsiString Topic;
};
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "EnhListView"
#pragma link "ExtListView"
#pragma link "Placemnt"
#pragma link "RXSpin"
#pragma resource "*.dfm"
TChanListWin *ChanListWin;
//---------------------------------------------------------------------------
__fastcall TChanListWin::TChanListWin( TServerWin *Owner )
: TForm(Owner)
{
Server = Owner;
Channels = new TList();
VisibleChannels = new TList();
SortAsc = List->CurrentSortAscending;
SortCol = List->LastColumnClicked;
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::FormDestroy(TObject *Sender)
{
Clear();
delete Channels;
delete VisibleChannels;
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::Clear( void )
{
List->Items->BeginUpdate();
List->Items->Clear();
List->Items->EndUpdate();
for( int i = 0; i < Channels->Count; i++ )
delete reinterpret_cast<TChanInfo *>( Channels->Items[ i ] );
Channels->Clear();
VisibleChannels->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::ListDblClick(TObject *Sender)
{
int idx = List->ELV_GetNextItem( -1, sdAll, TItemStates() << isFocused );
if(( idx >= 0 ) && ( idx < VisibleChannels->Count ))
Server->SendCmd( "JOIN " + reinterpret_cast<TChanInfo *>( VisibleChannels->Items[ idx ] )->Channel );
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::RefreshClick(TObject *Sender)
{
Server->SendCmd( "LIST" );
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::BeginList( void )
{
Clear();
Show();
BringToFront();
Enabled = false;
SaveCursor = Cursor;
Cursor = crHourGlass;
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::AddItem( AnsiString channel, int users, AnsiString topic )
{
Channels->Add( new TChanInfo( channel, users, IRCUtils::StripCodes( topic )));
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::EndList( void )
{
FilterClick( Filter );
Cursor = SaveCursor;
Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::FilterClick(TObject *Sender)
{
AnsiString name = ChanName->Text.LowerCase();
AnsiString topic = Topic->Text.LowerCase();
List->Items->BeginUpdate();
List->Items->Clear();
VisibleChannels->Clear();
for( int i = 0; i < Channels->Count; i++ ) {
TChanInfo *ch = reinterpret_cast<TChanInfo *>( Channels->Items[ i ] );
bool add;
add = ch->Users >= MinUsers->Value;
if( add )
add = ch->Users <= MaxUsers->Value;
if( add && !name.IsEmpty() )
add = ch->Channel.LowerCase().Pos( name ) > 0;
if( add && !topic.IsEmpty() )
add = ch->Topic.LowerCase().Pos( topic ) > 0;
if( add )
VisibleChannels->Add( ch );
}
SortChannels();
List->SetItemCountEx( VisibleChannels->Count, TLVItemCountFlags() << lvsicfNoScroll );
List->Items->EndUpdate();
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::ListVMGetItemInfo( TObject *Sender, int Item,
int SubItem, TLVVMMaskItems &Mask, int &Image, int &Param,
int &State, int &StateMask, int &Indent, AnsiString &Text )
{
TChanInfo *ch = reinterpret_cast<TChanInfo *>( VisibleChannels->Items[ Item ] );
if( Mask.Contains( lvifText )) {
switch( SubItem ) {
case 0:
Text = ch->Channel;
break;
case 1:
Text = IntToStr( ch->Users );
break;
case 2:
Text = ch->Topic;
break;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::ListColumnClick( TObject *Sender, TListColumn *Column )
{
if( SortCol == Column->Index )
SortAsc = !SortAsc;
else {
SortAsc = true;
SortCol = Column->Index;
}
List->CurrentSortAscending = SortAsc;
SortChannels();
}
//---------------------------------------------------------------------------
static int __fastcall CmpChan( void *Item1, void *Item2 )
{
return( reinterpret_cast<TChanInfo *>( Item1 )->Channel.AnsiCompareIC( reinterpret_cast<TChanInfo *>( Item2 )->Channel ));
}
static int __fastcall CmpUsers( void *Item1, void *Item2 )
{
return( reinterpret_cast<TChanInfo *>( Item1 )->Users - reinterpret_cast<TChanInfo *>( Item2 )->Users );
}
static int __fastcall CmpTopic( void *Item1, void *Item2 )
{
return( reinterpret_cast<TChanInfo *>( Item1 )->Topic.AnsiCompareIC( reinterpret_cast<TChanInfo *>( Item2 )->Topic ));
}
static int __fastcall CmpChanDesc( void *Item1, void *Item2 )
{
return( reinterpret_cast<TChanInfo *>( Item2 )->Channel.AnsiCompareIC( reinterpret_cast<TChanInfo *>( Item1 )->Channel ));
}
static int __fastcall CmpUsersDesc( void *Item1, void *Item2 )
{
return( reinterpret_cast<TChanInfo *>( Item2 )->Users - reinterpret_cast<TChanInfo *>( Item1 )->Users );
}
static int __fastcall CmpTopicDesc( void *Item1, void *Item2 )
{
return( reinterpret_cast<TChanInfo *>( Item2 )->Topic.AnsiCompareIC( reinterpret_cast<TChanInfo *>( Item1 )->Topic ));
}
//---------------------------------------------------------------------------
void __fastcall TChanListWin::SortChannels( void )
{
static const TListSortCompare cmps[ 2 ][ 3 ] = {
{ CmpChan, CmpUsers, CmpTopic },
{ CmpChanDesc, CmpUsersDesc, CmpTopicDesc }
};
List->Items->BeginUpdate();
VisibleChannels->Sort( cmps[ SortAsc ? 0 : 1 ][ SortCol ] );
List->Items->EndUpdate();
}
//---------------------------------------------------------------------------

BIN
OrionIRC/ChanListWnd.dfm View File


+ 67
- 0
OrionIRC/ChanListWnd.h View File

@@ -0,0 +1,67 @@
/* $Id: ChanListWnd.h,v 1.1 2005/08/19 14:53:03 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef ChanListWndH
#define ChanListWndH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "EnhListView.hpp"
#include "ExtListView.hpp"
#include "Placemnt.hpp"
#include <ComCtrls.hpp>
#include "RXSpin.hpp"
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TServerWin;
class TChanListWin : public TForm
{
__published: // IDE-managed Components
TFormStorage *FormStorage1;
TdfsExtListView *List;
TPanel *PanelButtons;
TButton *Refresh;
TLabel *Label1;
TEdit *ChanName;
TLabel *Label2;
TRxSpinEdit *MinUsers;
TLabel *Label3;
TRxSpinEdit *MaxUsers;
TButton *Filter;
TLabel *Label4;
TEdit *Topic;
void __fastcall ListDblClick(TObject *Sender);
void __fastcall RefreshClick(TObject *Sender);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall FilterClick(TObject *Sender);
void __fastcall ListVMGetItemInfo(TObject *Sender, int Item, int SubItem,
TLVVMMaskItems &Mask, int &Image, int &Param, int &State,
int &StateMask, int &Indent, AnsiString &Text);
void __fastcall ListColumnClick(TObject *Sender, TListColumn *Column);
private: // User declarations
TServerWin *Server;
TCursor SaveCursor;
TList *Channels;
TList *VisibleChannels;
bool SortAsc;
int SortCol;
void __fastcall SortChannels( void );
public: // User declarations
__fastcall TChanListWin( TServerWin *Owner );
void __fastcall Clear( void );
void __fastcall BeginList( void );
void __fastcall AddItem( AnsiString channel, int users, AnsiString topic );
void __fastcall EndList( void );
};
//---------------------------------------------------------------------------
extern PACKAGE TChanListWin *ChanListWin;
//---------------------------------------------------------------------------
#endif

+ 210
- 0
OrionIRC/ChanPropWnd.cpp View File

@@ -0,0 +1,210 @@
/* $Id: ChanPropWnd.cpp,v 1.3 2003/05/10 13:32:45 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ChanPropWnd.h"
#include "ChanWnd.h"
#include "ServerWnd.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Placemnt"
#pragma link "RXSpin"
#pragma resource "*.dfm"
TChanPropWin *ChanPropWin;
//---------------------------------------------------------------------------
__fastcall TChanPropWin::TChanPropWin( TComponent* Owner, TChanWin *channel )
: TForm(Owner)
{
Channel = channel;
}
//---------------------------------------------------------------------------
void __fastcall TChanPropWin::FormShow(TObject *Sender)
{
TServerWin *server = Channel->GetServerWin();
Pages->ActivePage = Page1;
NoExtMsgs->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_NO_MSGS );
Moderated->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_MODERATED );
InviteOnly->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_INVITE );
Secret->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_SECRET );
Private->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_PRIVATE );
TopicProt->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_TOPIC_PROT );
AnonOps->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_ANONYMOUS );
AnonOps->Enabled = server->Session.ChanModes.Pos( "a" ) > 0;
Quiet->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_QUIET );
Quiet->Enabled = server->Session.ChanModes.Pos( "q" ) > 0;
Reop->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_REOP );
Reop->Enabled = server->Session.ChanModes.Pos( "r" ) > 0;
LimitUsers->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_LIMIT );
UseKeyword->Checked = Channel->ChanData.Modes.IsSet( IRC_CHAN_MODE_KEY );
UserLimit->Value = Channel->ChanData.Limit;
Keyword->Text = Channel->ChanData.Keyword;
TopicSetBy->Caption = Channel->ChanData.TopicSetBy;
TopicSetTime->Caption = Channel->ChanData.TopicSetTime;
Keyword->Enabled = UseKeyword->Checked;
UserLimit->Enabled = LimitUsers->Checked;
Topic->Items->Assign( Channel->ChanData.Topics );
if( Topic->Items->Count )
Topic->ItemIndex = 0;
server->SendUrgCmd( "MODE " + Channel->GetChannel() + " +b" );
if( server->Session.ChanModes.Pos( "e" ))
server->SendUrgCmd( "MODE " + Channel->GetChannel() + " +e" );
if( server->Session.ChanModes.Pos( "I" ))
server->SendUrgCmd( "MODE " + Channel->GetChannel() + " +I" );
}
//---------------------------------------------------------------------------
void __fastcall TChanPropWin::UseKeywordClick(TObject *Sender)
{
Keyword->Enabled = UseKeyword->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TChanPropWin::LimitUsersClick(TObject *Sender)
{
UserLimit->Enabled = LimitUsers->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TChanPropWin::OkClick(TObject *Sender)
{
BitField flags;
int changed, numchanged;
TServerWin *server = Channel->GetServerWin();
AnsiString plus, minus, set;
static const struct {
unsigned int Flag;
const char *Mode;
} Modes[] = {
{ IRC_CHAN_MODE_NO_MSGS, "n" },
{ IRC_CHAN_MODE_MODERATED, "m" },
{ IRC_CHAN_MODE_INVITE, "i" },
{ IRC_CHAN_MODE_SECRET, "s" },
{ IRC_CHAN_MODE_PRIVATE, "p" },
{ IRC_CHAN_MODE_TOPIC_PROT, "t" },
{ IRC_CHAN_MODE_ANONYMOUS, "a" },
{ IRC_CHAN_MODE_QUIET, "q" },
{ IRC_CHAN_MODE_REOP, "r" },
};
#define NUM_MODES ( sizeof( Modes ) / sizeof( Modes[0] ))
flags.Set( IRC_CHAN_MODE_NO_MSGS, NoExtMsgs->Checked );
flags.Set( IRC_CHAN_MODE_MODERATED, Moderated->Checked );
flags.Set( IRC_CHAN_MODE_INVITE, InviteOnly->Checked );
flags.Set( IRC_CHAN_MODE_SECRET, Secret->Checked );
flags.Set( IRC_CHAN_MODE_PRIVATE, Private->Checked );
flags.Set( IRC_CHAN_MODE_TOPIC_PROT, TopicProt->Checked );
flags.Set( IRC_CHAN_MODE_ANONYMOUS, AnonOps->Checked );
flags.Set( IRC_CHAN_MODE_QUIET, Quiet->Checked );
flags.Set( IRC_CHAN_MODE_REOP, Reop->Checked );
flags.Set( IRC_CHAN_MODE_LIMIT, LimitUsers->Checked );
flags.Set( IRC_CHAN_MODE_KEY, UseKeyword->Checked );
changed = flags.Get() ^ Channel->ChanData.Modes.Get();
for( int i = 0; i < NUM_MODES; i++ )
if( changed & Modes[ i ].Flag ) {
if( flags.IsSet( Modes[ i ].Flag ))
plus += Modes[ i ].Mode;
else
minus += Modes[ i ].Mode;
}
numchanged = plus.Length() + minus.Length();
for( int i = 1; i <= numchanged; ) {
set = "";
for( int j = 0; ( i <= numchanged ) && ( j < server->Session.ModesCount ); i++ ) {
if( i > plus.Length() )
set += "-" + AnsiString( minus[ i - plus.Length() ]);
else
set += "+" + AnsiString( plus[ i ]);
}
server->SendCmd( "MODE " + Channel->GetChannel() + " " + set );
}
if(( changed & IRC_CHAN_MODE_LIMIT ) ||
( UserLimit->Value != Channel->ChanData.Limit )) {
if( flags.IsSet( IRC_CHAN_MODE_LIMIT ))
server->SendCmd( "MODE " + Channel->GetChannel() + " +l " + IntToStr( UserLimit->Value ));
else
server->SendCmd( "MODE " + Channel->GetChannel() + " -l" );
}
if(( changed & IRC_CHAN_MODE_KEY ) ||
( Keyword->Text != Channel->ChanData.Keyword )) {
if( flags.IsSet( IRC_CHAN_MODE_KEY )) {
if(!( changed & IRC_CHAN_MODE_KEY ))
server->SendCmd( "MODE " + Channel->GetChannel() + " -k " + Channel->ChanData.Keyword );
server->SendCmd( "MODE " + Channel->GetChannel() + " +k " + Keyword->Text );
} else
server->SendCmd( "MODE " + Channel->GetChannel() + " -k " + Channel->ChanData.Keyword );
}
set = "";
if( Channel->ChanData.Topics->Count )
set = Channel->ChanData.Topics->Strings[ 0 ];
if( Topic->Text.AnsiCompare( set ))
server->SendCmd( "TOPIC " + Channel->GetChannel() + " :" + Topic->Text );
ProcessList( Bans, "b" );
ProcessList( Excepts, "e" );
ProcessList( Invites, "I" );
}
//---------------------------------------------------------------------------
void __fastcall TChanPropWin::AddListItem( TIRCChanList list, AnsiString item,
AnsiString setby, AnsiString settime )
{
TListView *lw;
TListItem *li;
switch( list ) {
case IRC_CHAN_LIST_BAN:
lw = Bans;
break;
case IRC_CHAN_LIST_EXCEPT:
lw = Excepts;
break;
case IRC_CHAN_LIST_INVITE:
lw = Invites;
break;
}
li = lw->Items->Add();
li->Caption = item;
li->Checked = true;
li->SubItems->Add( setby );
li->SubItems->Add( settime );
}
//---------------------------------------------------------------------------
void __fastcall TChanPropWin::ProcessList( TListView *list, AnsiString flag )
{
TServerWin *server = Channel->GetServerWin();
for( int i = 0; i < list->Items->Count; i++ ) {
TListItem *item = list->Items->Item[ i ];
if( !item->Checked )
server->SendCmd( "MODE " + Channel->GetChannel() + " -" + flag + " " + item->Caption );
}
}
//---------------------------------------------------------------------------

BIN
OrionIRC/ChanPropWnd.dfm View File


+ 71
- 0
OrionIRC/ChanPropWnd.h View File

@@ -0,0 +1,71 @@
/* $Id: ChanPropWnd.h,v 1.2 2003/05/10 13:32:45 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef ChanPropWndH
#define ChanPropWndH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Placemnt.hpp>
#include <ExtCtrls.hpp>
#include <ComCtrls.hpp>
#include <RXSpin.hpp>
//---------------------------------------------------------------------------
#include "irc.h"
class TChanWin;
class TChanPropWin : public TForm
{
__published: // IDE-managed Components
TBevel *Bevel1;
TButton *Ok;
TButton *Cancel;
TFormStorage *FormStorage1;
TPageControl *Pages;
TTabSheet *Page1;
TTabSheet *TabSheet2;
TTabSheet *ExceptionPage;
TTabSheet *InvitePage;
TLabel *Label12;
TBevel *Bevel5;
TComboBox *Topic;
TLabel *Label1;
TLabel *TopicSetBy;
TLabel *Label2;
TLabel *TopicSetTime;
TBevel *Bevel2;
TLabel *Label3;
TCheckBox *NoExtMsgs;
TCheckBox *Secret;
TCheckBox *Private;
TCheckBox *InviteOnly;
TCheckBox *Moderated;
TCheckBox *TopicProt;
TCheckBox *AnonOps;
TCheckBox *UseKeyword;
TEdit *Keyword;
TCheckBox *LimitUsers;
TRxSpinEdit *UserLimit;
TCheckBox *Quiet;
TCheckBox *Reop;
TListView *Bans;
TListView *Excepts;
TListView *Invites;
void __fastcall FormShow(TObject *Sender);
void __fastcall UseKeywordClick(TObject *Sender);
void __fastcall LimitUsersClick(TObject *Sender);
void __fastcall OkClick(TObject *Sender);
private: // User declarations
TChanWin *Channel;
void __fastcall ProcessList( TListView *list, AnsiString flag );
public: // User declarations
__fastcall TChanPropWin(TComponent* Owner, TChanWin *channel);
void __fastcall AddListItem( TIRCChanList list, AnsiString item, AnsiString setby, AnsiString settime );
};
//---------------------------------------------------------------------------
extern PACKAGE TChanPropWin *ChanPropWin;
//---------------------------------------------------------------------------
#endif

+ 1538
- 0
OrionIRC/ChanWnd.cpp
File diff suppressed because it is too large
View File


BIN
OrionIRC/ChanWnd.dfm View File


+ 248
- 0
OrionIRC/ChanWnd.h View File

@@ -0,0 +1,248 @@
/* $Id: ChanWnd.h,v 1.41 2005/09/09 22:52:50 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef ChanWndH
#define ChanWndH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Placemnt.hpp>
#include <Menus.hpp>
#include <Buttons.hpp>
#include <DropPIDLTarget.hpp>
#include <DropSource.h>
#include <DropTarget.h>
#include <DropURLTarget.hpp>
//---------------------------------------------------------------------------
#include "IRCList.h"
#include "IRCParser.h"
#include "irc.h"
#include "Hostmask.h"
#include "Logger.h"
class TIRCList;
class TIRCEdit;
class TIRCTopic;
class TServerWin;
class TChanPropWin;
class TUser;
class TChanWin : public TForm
{
__published: // IDE-managed Components
TPanel *PanelBottom;
TPanel *PanelDisplay;
TPanel *PanelRight;
TSplitter *Splitter1;
TListBox *Users;
TPanel *PanelRightTop;
TLabel *UsersStats;
TFormStorage *FormStorage1;
TImageList *UserPics;
TPopupMenu *UserListMenu;
TMenuItem *Operatorcommands1;
TMenuItem *N1;
TMenuItem *Openaquery1;
TMenuItem *DCCSendfile1;
TMenuItem *DCCChat1;
TMenuItem *N2;
TMenuItem *Whois1;
TMenuItem *DNSMenu;
TMenuItem *N3;
TMenuItem *Ignore1;
TMenuItem *Addtonotifylist1;
TMenuItem *N4;
TMenuItem *Slap1;
TMenuItem *CTCP1;
TMenuItem *Version;
TMenuItem *ClientInfo;
TMenuItem *Finger;
TMenuItem *N5;
TMenuItem *Time;
TMenuItem *Ping;
TMenuItem *N6;
TMenuItem *Op;
TMenuItem *Deop;
TMenuItem *Voice;
TMenuItem *Unvoice;
TMenuItem *N7;
TMenuItem *KickMenu;
TPanel *PanelTopic;
TPopupMenu *TopicPopup;
TMenuItem *CopyTopicToClipboard;
TPopupMenu *ChanPopup;
TMenuItem *Properties1;
TMenuItem *N8;
TMenuItem *Leaverejoin1;
TMenuItem *Clearbuffer1;
TMenuItem *N9;
TMenuItem *Addtofavorites1;
TMenuItem *N10;
TMenuItem *Closewindow1;
TPanel *PanelModes;
TSpeedButton *ModeN;
TSpeedButton *ModeS;
TSpeedButton *ModeM;
TSpeedButton *ModeT;
TSpeedButton *ModeA;
TSpeedButton *ModeL;
TSpeedButton *ModeK;
TSpeedButton *ModeI;
TSpeedButton *ModeR;
TSpeedButton *ModeQ;
TSpeedButton *ModeP;
TMenuItem *N11;
TMenuItem *LogMenu;
TDropPIDLTarget *DropPIDLTarget;
TDropURLTarget *DropURLTargetInput;
TDropURLTarget *DropURLTarget;
TMenuItem *Savebuffer1;
TMenuItem *MenuEyelin;
TPanel *PanelNick;
TImage *StatusLed;
TLabel *NickLabel;
TMenuItem *N12;
TMenuItem *Search1;
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall FormActivate(TObject *Sender);
void __fastcall UsersDrawItem(TWinControl *Control, int Index,
TRect &Rect, TOwnerDrawState State);
void __fastcall Whois1Click(TObject *Sender);
void __fastcall VersionClick(TObject *Sender);
void __fastcall Openaquery1Click(TObject *Sender);
void __fastcall OpClick(TObject *Sender);
void __fastcall Slap1Click(TObject *Sender);
void __fastcall UsersMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall UsersMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall CopyTopicToClipboardClick(TObject *Sender);
void __fastcall DCCChat1Click(TObject *Sender);
void __fastcall DCCSendfile1Click(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall DNSMenuClick(TObject *Sender);
void __fastcall Closewindow1Click(TObject *Sender);
void __fastcall Properties1Click(TObject *Sender);
void __fastcall Clearbuffer1Click(TObject *Sender);
void __fastcall Leaverejoin1Click(TObject *Sender);
void __fastcall ModeNClick(TObject *Sender);
void __fastcall ModeSClick(TObject *Sender);
void __fastcall ModeTClick(TObject *Sender);
void __fastcall ModeMClick(TObject *Sender);
void __fastcall ModeIClick(TObject *Sender);
void __fastcall ModePClick(TObject *Sender);
void __fastcall ModeRClick(TObject *Sender);
void __fastcall ModeAClick(TObject *Sender);
void __fastcall ModeQClick(TObject *Sender);
void __fastcall ModeKClick(TObject *Sender);
void __fastcall ModeLClick(TObject *Sender);
void __fastcall PanelModesResize(TObject *Sender);
void __fastcall Addtofavorites1Click(TObject *Sender);
void __fastcall LogMenuClick(TObject *Sender);
void __fastcall DropPIDLTargetDrop(TObject *Sender,
TShiftState ShiftState, tagPOINT &Point, int &Effect);
void __fastcall DropPIDLTargetGetDropEffect(TObject *Sender,
TShiftState ShiftState, tagPOINT &Point, int &Effect);
void __fastcall DropURLTargetDrop(TObject *Sender, TShiftState ShiftState,
tagPOINT &Point, int &Effect);
void __fastcall DropURLTargetInputDrop(TObject *Sender,
TShiftState ShiftState, tagPOINT &Point, int &Effect);
void __fastcall DropURLTargetInputGetDropEffect(TObject *Sender,
TShiftState ShiftState, tagPOINT &Point, int &Effect);
void __fastcall DropURLTargetGetDropEffect(TObject *Sender,
TShiftState ShiftState, tagPOINT &Point, int &Effect);
void __fastcall KickMenuClick(TObject *Sender);
void __fastcall Addtonotifylist1Click(TObject *Sender);
void __fastcall Ignore1Click(TObject *Sender);
void __fastcall Savebuffer1Click(TObject *Sender);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall MenuEyelinClick(TObject *Sender);
void __fastcall PanelBottomResize(TObject *Sender);
void __fastcall Search1Click(TObject *Sender);
void __fastcall UsersDblClick(TObject *Sender);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift);
void __fastcall FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
private: // User declarations
TIRCList *Display;
TIRCEdit *Input;
TIRCTopic *Topic;
AnsiString Channel;
TServerWin *Server;
TSpeedButton *TaskbarButton;
bool StillIn;
bool NamesDone;
TChanPropWin *Properties;
Logger Log;
Graphics::TBitmap *StatusLedBitmap;
void __fastcall OnCommand( System::TObject *Sender, AnsiString msg );
void __fastcall OnMessage( System::TObject *Sender, AnsiString msg );
void __fastcall DisplayDblClick( TObject *Sender );
void __fastcall ClearUsers( void );
void __fastcall AddUser( AnsiString user );
void __fastcall RemoveUser( AnsiString user );
void __fastcall RemoveUser( int idx );
AnsiString __fastcall GetNick( int index );
void __fastcall SortUsers( void );
void __fastcall UpdateUserStats( void );
void __fastcall KickUsers( AnsiString reason );
void __fastcall SetModeButtons( void );
void __fastcall DisplayEvent( int ev, AnsiString msg, TIRCEvent type );
void __fastcall SetFonts( void );
void __fastcall LayoutModes( void );
void __fastcall UpdateNickLabel( void );
static int __fastcall NickSortAlpha( void *Item1, void *Item2 );
static int __fastcall NickSortModes( void *Item1, void *Item2 );
static int __fastcall GetModePri( TUser *user );
public: // User declarations
TIRCChanData ChanData;
__fastcall TChanWin( TComponent* Owner, TServerWin *server, AnsiString channel );
void __fastcall AddRow( const char *nick, AnsiString msg, TIRCEvent type, bool skipfilters = false );
void __fastcall EditProperties( System::TObject *Sender );
TIRCList * __fastcall GetDisplay( void ) { return( Display ); }
AnsiString __fastcall GetChannel( void ) { return( Channel ); }
TServerWin * __fastcall GetServerWin( void ) { return( Server ); }
TChanPropWin * __fastcall GetChanPropWin( void ) { return( Properties ); }
void __fastcall CloseNow( void );
void __fastcall ShowDisabled( bool disabled );
void __fastcall Joined( void );
void __fastcall UpdateNames( AnsiString list );
void __fastcall EndOfNames( void );
void __fastcall ModeChange( IRCParser& parser, bool change );
void __fastcall NickChange( AnsiString oldnick, AnsiString newnick );
void __fastcall SetUserHost( AnsiString nick, AnsiString host );
TUser * __fastcall GetUser( AnsiString nick );
TUser * __fastcall GetUser( int idx );
void __fastcall UserJoin( HostMask& mask );
void __fastcall UserPart( HostMask& mask, AnsiString reason, bool quit );
void __fastcall Say( AnsiString msg );
void __fastcall Kick( HostMask& mask, AnsiString user, AnsiString reason );
AnsiString __fastcall GetTopic( void ) const;
void __fastcall SetTopic( AnsiString topic );
void __fastcall SetTopicSetBy( AnsiString str ) { ChanData.TopicSetBy = str; }
void __fastcall SetTopicSetTime( AnsiString str ) { ChanData.TopicSetTime = str; }
void __fastcall PrefsChanged( void );
};
//---------------------------------------------------------------------------
extern PACKAGE TChanWin *ChanWin;
//---------------------------------------------------------------------------
#endif

+ 195
- 0
OrionIRC/Changes.txt View File

@@ -0,0 +1,195 @@
----------------------------------------------------------------------
Orion - Changelog
----------------------------------------------------------------------
©2003-2006 by Simone Tellini
http://tellini.info
----------------------------------------------------------------------
IMPORTANT: I've began adding scripting support to Orion. It will
---------- actually be very cool, but (big "but" :) I need help to
make it accessible: i.e. I need some volunteers to write
the documentation. Also, one or two scripters who would
like to help with beta-testing and suggestions are welcome.
If you wish to collaborate, write to <orion@tellini.info>
Version 1.8
-----------
- Fixed parsing of commands entered with too many spaces between the
arguments (e.g. "/SERVER irc.foo.bar" didn't work).
- URL Catcher: truncates the ini file when updating.
- URL Catcher: fixed error when loading saved URL's containing an empty
address field.
Version 1.7
-----------
- When using /QUERY, a /WHO is performed to get the right capitalization
of the nick to set in the query caption and log name (of course, it only
works if the server supports /WHO ;-)
- "Flash status bar button" didn't work for DCC chat sessions. Fixed.
- Added the "Server->Channel list..." menu item.
- Added /LIST command.
- Added option to sort the tab bar by several criteria.
- It's now possible to use ALT + <num> (where <num> is between 1 and 0)
to activate the first ten windows. When ALT is pressed, the numbers
of the windows will be shown in the tab bar.
- URL Catcher: pressing CTRL-A will select all the items in the list.
- URL Catcher: enabled the Clear button.
Version 1.6
-----------
- Unrecognized modes will be shown as "<source> sets mode <mode>".
- Half-Ops are recognized. They will be marked by a half-green,
half-yellow dot.
- URL catcher: URL's which differ only for a trailing slash are
considered the same, thus only the first will be saved.
- Added local output during /cycle.
- Made the default hostmask used by /ignore more precise.
- Ignore list: hostmasks added via /ignore or using the context menu
weren't saved unless you opened and closed the Ignore window. Fixed.
- Ignore list: the value for Exclude wasn't saved nor initialized
correctly.
- Options: added setting to compose the name of log files.
- Input box: pressing Home, End, Ctrl, Shift or Alt while navigating
through the history list won't restart from the last typed entry.
- Input box: when pasting several lines, they will be added to the history
list.
- Input box: entering the first character of the channel name (eg. #) and
pressing Tab will complete it (if you're in a channel, of course).
- PRIVMSG's sent to unknown targets (e.g. @#channel, +#channel or anything
else which may arrive) are not discarded.
- Query window: fixed access violation which could happen after terminating
a DCC Chat session.
- Options: in Appearance/Colours it's now possible to configure styles
(bold, italic) for events.
- Filters: added option to flash the status bar button.
- Options: added option to flash the status bar button when receiving private
messages.
- Options: added configuration of double click events (under "Miscellaneous")
Version 1.5
-----------
- Added local output for /msg and /page.
- Fixed /quote which has been broken in 1.4.
- Added option to disable the lag-meter.
- Added "Search" item to the messages context menu: it searches in the
back buffer.
- Added option to choose how to sort the nick list.
- Servers configuration: fixed Connect button not activating when
adding a new item and filling the Host box.
- Aliases without parameters (%s, %1, etc...) didn't work. Fixed.
- When Orion is minimised in the system tray and you receive a private
message, its icon will blink.
- Added option to restore Orion automatically when receiving a private
message.
- When receiving a file via DCC, Orion will tag it with a comment
with the sender's nick. It works only on Windows 2000/XP or higher,
only on NTFS partitions and only for certain file types.
- Options: sounds can be configured for certain events.
- Pressing PageUp/PageDown in windows scrolls buffer up/down.
- Input box: ESC clears the text.
- Input box: Ctrl + Backspace deletes text to the left of cursor.
- Input box: Ctrl + Delete deletes text to the right of cursor.
- Fixed drawing problems with color codes followed by extended ASCII
characters (e.g. cyrillic).
- Server settings: added Invites, Notices and Notifications among the
events which can be configured.
- Server tab changes color to red when it receives new messages.
- Improved the URL catcher.
Version 1.4
-----------
- Added support for Eyelin (http://www.eyelin.net/).
- Options: added configurable aliases for commands.
- Added nick and status next to the input box in the channel windows.
- Fixed PING reply to show "0 secs" instead of nothing when ping'ing an
user.
- Notices sent to unknown targets will be displayed nevertheless.
Version 1.3
-----------
- Added option to strip colors from incoming messages.
- Added option to limit the DCC port range.
- Added support for UnrealIRCd & and ~ user modes. Channel admins will
be shown in the list with a blue dot, channel owners with a red one.
- Added the /USERIP command (available only on some servers, eg. those
running Unreal IRCd).
- Added the /KNOCK command (available only on some servers, eg. those
running Unreal IRCd).
- Added the /DCCALLOW command (available only on some servers, eg. those
running Unreal IRCd).
- Server settings: added option to choose where to display certain events
(joins, parts...) which can be a nuisance on large channels.
- Fixed /WHOIS not reporting the real name of the user.
- If a server forced a channel join on connection, the result of the
initial /WHO of the channel wasn't hidden. Fixed.
- Improved the URL catching routine which could be way too slow under
certain conditions.
- Worked around yet another BCB3 bug which caused serious slow-down
when loading the catched URL's on startup.
- Forms will be correctly maximised on start if you left them maximised
when closing the program.
- When kicked out from a channel or disconnected from the server, the
channel input bar will change color to gray.
- Added "Clear buffer" to the status window popup menu.
- Fixed status window not updating its title/switchbar button after a
/SERVER command.
- Implemented the code behind the "Ignore" button in the DCC Chat request
window. It had no effect whatsoever so far. Whoops.
- Fixed a couple of bugs regarding notifications.
- Server settings weren't applied if reconnecting with the "Switch server"
button.
- Fixed hotspots not working correctly with control codes (i.e. you could
see a "Click here to..." hint misplaced respect the corresponding URL or
channel name if the line had colours in it).
Version 1.2
-----------
- Added "Clear buffer" to the query window popup menu.
- Fixed the "Edit" button for DCC Send filters in the options.
Version 1.1
-----------
- Servers config: added commands to be execute on connection.
- Added "Save buffer..." menu item on channels/queries/servers.
- Fixed lagmeter not being updated correctly when reconnecting to
a server after a connection loss.
- Fixed message displayed when a user added/removed more than one
ban/exception/invite at once.
- Fixed /msg.
- Implemented /ignore.
- Finished the Ignore menu item on the user list and the
Ignore button in query windows.
- Auto-rejoin works even when kicked from a keyword protected
channel.
- /nick now passes extra parameters to the server (useful to
send /nick <nick> <pwd> on Unreal ircd servers).
- Fixed the URL catcher not to eat an awful lot of CPU cycles
on certain complex URL's.
- Added option to ask for comfirmation before quitting.
- Server messages parsing now accepts '\n' too instead of '\r\n' as
line terminator, thus avoiding problems with servers which don't
comply strictly with the IRC RFC (Irssi proxy, for one).
- Small fixes here and there.
Version 1.0
-----------
- Initial release.

+ 132
- 0
OrionIRC/ColorSet.cpp View File

@@ -0,0 +1,132 @@
/* $Id: ColorSet.cpp,v 1.5 2005/06/04 17:40:54 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ColorSet.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
ColorSet::ColorSet()
{
Colors[ IRC_NORMAL ] = (TColor)0;
Colors[ IRC_MSG ] = (TColor)0;
Colors[ IRC_OWN_MSG ] = (TColor)0;
Colors[ IRC_JOIN ] = (TColor)16711935;
Colors[ IRC_PART ] = (TColor)32768;
Colors[ IRC_QUIT ] = (TColor)8388608;
Colors[ IRC_CTCP ] = (TColor)16711680;
Colors[ IRC_DCC ] = (TColor)8388608;
Colors[ IRC_DCC_CHAT ] = (TColor)0;
Colors[ IRC_ERROR ] = (TColor)8388608;
Colors[ IRC_NICK ] = (TColor)32768;
Colors[ IRC_MOTD ] = (TColor)0;
Colors[ IRC_ACTION ] = (TColor)8388736;
Colors[ IRC_WALLOP ] = (TColor)128;
Colors[ IRC_TOPIC ] = (TColor)32768;
Colors[ IRC_KICK ] = (TColor)8388736;
Colors[ IRC_MODE ] = (TColor)32768;
Colors[ IRC_NOTIFY ] = (TColor)33023;
Colors[ IRC_NOTICE ] = (TColor)128;
Colors[ IRC_INVITE ] = (TColor)16711680;
Colors[ IRC_WHOIS ] = (TColor)0;
Colors[ IRC_HIGHLIGHT ] = (TColor)255;
Colors[ IRC_LOCAL ] = (TColor)0;
Colors[ IRC_BACKGROUND ] = (TColor)0xffffff;
Colors[ IRC_NICK_BACKGROUND ] = (TColor)0xdddddd;
Colors[ IRC_TIMESTAMP_BACKGROUND ] = (TColor)0xcccccc;
Colors[ IRC_NICK_COLUMN ] = clBlack;
Colors[ IRC_TIMESTAMP_COLUMN ] = clBlack;
Colors[ IRC_EVENT ] = clBlack;
Colors[ IRC_SCRIPT ] = (TColor)0x222222;
memset( Styles, 0, sizeof( Styles ));
}
//---------------------------------------------------------------------------
TColor ColorSet::GetColor( TIRCEvent type )
{
return( Colors[ type ]);
}
//---------------------------------------------------------------------------
void ColorSet::SetColor( TIRCEvent type, TColor col )
{
Colors[ type ] = col;
}
//---------------------------------------------------------------------------
bool ColorSet::IsBold( TIRCEvent type ) const
{
return( Styles[ type ] & S_BOLD );
}
//---------------------------------------------------------------------------
void ColorSet::SetBold( TIRCEvent type, bool set )
{
if( set )
Styles[ type ] |= S_BOLD;
else
Styles[ type ] &= ~S_BOLD;
}
//---------------------------------------------------------------------------
bool ColorSet::IsItalic( TIRCEvent type ) const
{
return( Styles[ type ] & S_ITALIC );
}
//---------------------------------------------------------------------------
void ColorSet::SetItalic( TIRCEvent type, bool set )
{
if( set )
Styles[ type ] |= S_ITALIC;
else
Styles[ type ] &= ~S_ITALIC;
}
//---------------------------------------------------------------------------
void ColorSet::Save( TRegistry *reg, AnsiString key )
{
if( reg->OpenKey( key, true )) {
try {
for( int i = 0; i < IRC_NUM_EVENTS; i++ ) {
reg->WriteInteger( "Color" + IntToStr( i ), Colors[ i ]);
reg->WriteInteger( "Style" + IntToStr( i ), Styles[ i ]);
}
}
catch(...) {
}
reg->CloseKey();
}
}
//---------------------------------------------------------------------------
void ColorSet::Load( TRegistry *reg, AnsiString key )
{
if( reg->OpenKey( key, false )) {
for( int i = 0; i < IRC_NUM_EVENTS; i++ ) {
try { Colors[ i ] = (TColor)reg->ReadInteger( "Color" + IntToStr( i )); } catch(...) {}
try { Styles[ i ] = (char)reg->ReadInteger( "Style" + IntToStr( i )); } catch(...) {}
}
reg->CloseKey();
}
}
//---------------------------------------------------------------------------
void ColorSet::Save( TIniFile *ini, AnsiString section )
{
for( int i = 0; i < IRC_NUM_EVENTS; i++ ) {
ini->WriteInteger( section, "Color" + IntToStr( i ), Colors[ i ]);
ini->WriteInteger( section, "Style" + IntToStr( i ), Styles[ i ]);
}
}
//---------------------------------------------------------------------------
void ColorSet::Load( TIniFile *ini, AnsiString section )
{
for( int i = 0; i < IRC_NUM_EVENTS; i++ ) {
Colors[ i ] = (TColor)ini->ReadInteger( section, "Color" + IntToStr( i ), Colors[ i ]);
Styles[ i ] = (char)ini->ReadInteger( section, "Style" + IntToStr( i ), Styles[ i ]);
}
}
//---------------------------------------------------------------------------

+ 40
- 0
OrionIRC/ColorSet.h View File

@@ -0,0 +1,40 @@
/* $Id: ColorSet.h,v 1.3 2005/06/04 17:40:54 wiz Exp $ */
//---------------------------------------------------------------------------
#ifndef ColorSetH
#define ColorSetH
//---------------------------------------------------------------------------
#include <registry.hpp>
#include "irc.h"
class ColorSet
{
private:
enum { S_BOLD = (1 << 0),
S_ITALIC = (1 << 1) };
public:
ColorSet();
TColor GetColor( TIRCEvent type );
void SetColor( TIRCEvent type, TColor col );
bool IsBold( TIRCEvent type ) const;
void SetBold( TIRCEvent type, bool set );
bool IsItalic( TIRCEvent type ) const;
void SetItalic( TIRCEvent type, bool set );
void Save( TRegistry *reg, AnsiString key );
void Load( TRegistry *reg, AnsiString key );
void Save( TIniFile *reg, AnsiString section );
void Load( TIniFile *reg, AnsiString section );
private:
TColor Colors[ IRC_NUM_EVENTS ];
char Styles[ IRC_NUM_EVENTS ];
};
#endif

+ 858
- 0
OrionIRC/Commands.cpp View File

@@ -0,0 +1,858 @@
/* $Id: Commands.cpp,v 1.54 2006/01/15 12:38:29 wiz Exp $ */
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Commands.h"
#include "Main.h"
#include "ServerWnd.h"
#include "ChanWnd.h"
#include "QueryWnd.h"
#include "Eyelin.h"
#include "Prefs.h"
#include "OrionScriptInterface.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
static void SplitWords( AnsiString cmd, TStringList *words );
static void CmdAway( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdBan( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdCall( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdClear( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdClearSendQ( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdCTCP( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdCycle( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdDCC( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdDCCAllow( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdDeop( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdDNS( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdIgnore( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdInvite( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdJoin( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdKick( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdKnock( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdList( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdMe( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdMode( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdMsg( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdNames( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdNick( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdNotice( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdNotify( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdNServer( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdOp( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdPage( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdPart( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdQuery( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdQuit( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdRaw( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdServer( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdSlap( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdTopic( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdUnban( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdUnvoice( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdUserIP( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdVoice( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdWho( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdWhois( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdWhowas( TServerWin *server, TChanWin *channel, TStringList *words );
static void CmdHelp( TServerWin *server, TChanWin *channel, TStringList *words );
static void SetUserModes( TServerWin *server, TChanWin *channel, TStringList *words,
AnsiString mode, AnsiString action );
typedef void ( *CmdHandler )( TServerWin *server, TChanWin *channel, TStringList *words );
#define C_NEED_SERVER (1 << 0)
#define C_NEED_CHAN (1 << 1)
#define C_ORIGINAL_ARGS (1 << 2)
static const struct Cmd {
const char *Cmd;
CmdHandler Handler;
short MinArgs;
unsigned int Flags;
const char *Help;
} CmdTable[] = {
{ "?", CmdHelp, 0, 0,
"/? [command], shows the help for [command], or the command list" },
{ "AWAY", CmdAway, 0, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/AWAY [away message], toggles away status" },
{ "BAN", CmdBan, 1, C_NEED_SERVER | C_NEED_CHAN,
"/BAN <mask> [<mask> <mask> ...], sets a ban for <mask>" },
{ "CALL", CmdCall, 1, C_ORIGINAL_ARGS,
"/CALL <function>, calls the script <function>" },
{ "CLEAR", CmdClear, 0, 0,
"/CLEAR, clears the buffer of the current window" },
{ "CLEARSENDQ", CmdClearSendQ, 0, 0,
"/CLEARSENDQ, clears the send queue for the server (useful if you pasted the whole English dictionary by mistake :)" },
{ "CTCP", CmdCTCP, 2, C_NEED_SERVER,
"/CTCP <target> <command> [args], sends a CTCP <command> to <target> with [args], if provided" },
{ "CYCLE", CmdCycle, 0, C_NEED_SERVER | C_NEED_CHAN,
"/CYCLE, leaves and joins again the current channel" },
{ "DCC", CmdDCC, 2, C_NEED_SERVER,
"/DCC SEND <nick> <file>, sends <file> to <nick> - /DCC CHAT <nick>, establishes a direct chat line with <nick>" },
{ "DCCALLOW", CmdDCCAllow, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/DCCALLOW [<+|->nick[,<+|->nick, ...]] [list] [help], specifies which people can send you files. See /DCCALLOW HELP for more info." },
{ "DEOP", CmdDeop, 1, C_NEED_SERVER | C_NEED_CHAN,
"/DEOP <nick> [<nick> <nick> ...], deops <nick>" },
{ "DNS", CmdDNS, 1, C_ORIGINAL_ARGS,
"/DNS <host or nick>, tries to resolve the hostname specified or associated with the specified nick" },
{ "HELP", CmdHelp, 0, 0,
"/HELP [command], shows the help for [command], or the command list" },
{ "IGNORE", CmdIgnore, 1, C_NEED_SERVER,
"/IGNORE <nick> [PUB] [MSG] [CTCP], ignores messages coming from <nick>. You can specify which type of messages should be ignored. A finer control is available through the ignore window." },
{ "INVITE", CmdInvite, 1, C_NEED_SERVER,
"/INVITE <nick> [channel], invites <nick> in the current channel, or in [channel]" },
{ "JOIN", CmdJoin, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/JOIN <channel>, enters the channel" },
{ "KICK", CmdKick, 1, C_NEED_SERVER | C_NEED_CHAN,
"/KICK <nick> [<reason>], kicks <nick> from the current channel" },
{ "KNOCK", CmdKnock, 1, C_NEED_SERVER,
"/KNOCK <channel> [<reason>], if <channel> is invite-only, asks its ops to be let in" },
{ "LEAVE", CmdPart, 0, C_NEED_SERVER,
"/LEAVE [channel] [part msg], leaves the channel specified, or the current one" },
{ "LIST", CmdList, 0, C_NEED_SERVER,
"/LIST, lists the channels available on the server" },
{ "ME", CmdMe, 1, C_NEED_SERVER | C_NEED_CHAN | C_ORIGINAL_ARGS,
"/ME <message>, says message prefixed by your nick" },
{ "MODE", CmdMode, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/MODE <channel> <mode> [nick], changes channel modes" },
{ "MSG", CmdMsg, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/MSG <target> <message>, sends <message> to <target>" },
{ "NAMES", CmdNames, 0, C_NEED_SERVER,
"/NAMES [channel], lists the users of [channel]" },
{ "NICK", CmdNick, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/NICK <new nick>, changes your current nickname" },
{ "NOTICE", CmdNotice, 2, C_NEED_SERVER,
"/NOTICE <target> <msg>, sends <msg> to <target> as a notice" },
{ "NOTIFY", CmdNotify, 1, C_NEED_SERVER,
"/NOTIFY <nick> [<nick> <nick> ...], adds <nick> to the list of nicks to monitor" },
{ "NSERVER", CmdNServer, 1, 0,
"/NSERVER <server> [<port>], connects to server <nick> on <port> in a new window" },
{ "OP", CmdOp, 1, C_NEED_SERVER | C_NEED_CHAN,
"/OP <nick> [<nick> <nick> ...], ops <nick>" },
{ "PAGE", CmdPage, 1, C_NEED_SERVER,
"/PAGE <nick>, sends a CTCP PAGE to <nick>" },
{ "PART", CmdPart, 0, C_NEED_SERVER,
"/PART [channel] [part msg], leaves the channel specified, or the current one" },
{ "QUERY", CmdQuery, 1, 0,
"/QUERY <nick>, opens a query to <nick>" },
{ "QUIT", CmdQuit, 0, C_NEED_SERVER,
"/QUIT [quit msg], disconnects from the server" },
{ "QUOTE", CmdRaw, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/QUOTE <command>, sends <command> as-is to the server" },
{ "RAW", CmdRaw, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/RAW <command>, sends <command> as-is to the server" },
{ "SERVER", CmdServer, 1, 0,
"/SERVER <server> [<port>], connects to server <nick> on <port>" },
{ "SLAP", CmdSlap, 1, C_NEED_SERVER | C_NEED_CHAN,
"/SLAP <nick>, slaps <nick>" },
{ "TOPIC", CmdTopic, 0, C_NEED_SERVER | C_NEED_CHAN | C_ORIGINAL_ARGS,
"/TOPIC [topic], sets channel topic" },
{ "UNBAN", CmdUnban, 1, C_NEED_SERVER | C_NEED_CHAN,
"/UNBAN <mask> [<mask> <mask> ...], removes the ban for <mask>" },
{ "UNVOICE", CmdUnvoice, 1, C_NEED_SERVER | C_NEED_CHAN,
"/UNVOICE <nick> [<nick> <nick> ...], removes voice from <nick>" },
{ "USERIP", CmdUserIP, 1, C_NEED_SERVER | C_ORIGINAL_ARGS,
"/USERIP <nick> [<nick> <nic