unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdIRC, StdCtrls, ExtCtrls, ComCtrls, IdContext;
type
TForm3 =
class(TForm)
Button1: TButton;
Label1: TLabel;
Button2: TButton;
Timer1: TTimer;
RichEdit1: TRichEdit;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure OnRaw(ASender: TIdContext; AIn: Boolean;
const AMessage:
String);
private
{ Private-Deklarationen }
FIRC: TIdIRC;
public
{ Public-Deklarationen }
end;
var
Form3: TForm3;
const
IRC_CHANNEL = '
#nonamegame';
implementation
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
FIRC.Host := '
irc.quakenet.org';
FIRC.Port := 6667;
FIRC.Nickname := '
DerDieMuhkuh';
FIRC.Connect;
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
FIRC.Join(IRC_CHANNEL);
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
FIRC := TIdIRC.Create(
nil);
FIRC.OnRaw := OnRaw;
end;
procedure TForm3.FormDestroy(Sender: TObject);
begin
if (FIRC.Connected)
then
begin
FIRC.Disconnect();
end;
FIRC.Free;
end;
procedure TForm3.OnRaw(ASender: TIdContext; AIn: Boolean;
const AMessage:
String);
begin
RichEdit1.Lines.Add(AMessage);
end;
procedure TForm3.Timer1Timer(Sender: TObject);
begin
if (FIRC.Connected)
then
Label1.Caption := '
Online'
else
Label1.Caption := '
Offline';
end;
end.