Quote
On Tue, 20 Nov 2001 23:14:07 +0800, "wds" <wds...@sina.com> wrote:
> Hi,
> Is there anyone can tell me what is steps of using TIdIRC? I can not join
> the channel.
> Thanks
I haven't used TIdIRC, but I am writing (just for fun) an IRC Client
using the standard Delphi 4 TClientsocket (non-blocking). I'm not sure
what you mean by steps, but here is what I do to join a channel:
1. First you have to connect to an IRC server.
2. Once you connect to the server, you have to "register" your
connection by sending the following IRC protocol commands:
NICK <nick you want to use>
USER <username> <hostname> :<real name>
For example:
ClientSocket1.Socket.SendText('NICK ' + Nick_1 + Chr(10) +
Chr(13));
ClientSocket1.Socket.SendText('USER Ident_1 * * :John Doe' +
Chr(10) + Chr(13));
3. Subsequently, the server will send your Client a PING, to which you
must respond with a PONG. After that, the server will also send a
PING every 90 seconds or so.
For example:
if ('PING' = Copy(NewMsg,1,Pos(' ',NewMsg)-1)) then
begin
NewMsg[2] := 'O';
ClientSocket1.Socket.SendText(NewMsg);
ShowPing1 := True;
RichEdit1.Lines.Append('*** PING-PONG!');
end;
4. Once these steps are completed, you can send the command to the
IRC server to join a channel:
JOIN <channel>
For example:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
ClientSocket1.Socket.SendText('JOIN #funchat' + Chr(10) +
Chr(13));
end;
5. After that, you can send text to the channel or a person:
PRIVMSG <receiver> :<message>
For example:
procedure TForm1.OnKeyDown_Edit2(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=VK_RETURN) then
begin
ClientSocket1.Socket.SendText('PRIVMSG #funchat :' +
Edit2.Text + Chr(10) + Chr(13));
RichEdit1.Lines.Append(Nick1 + ': ' + Edit2.Text);
Edit2.Clear;
end;
end;
I suggest you read the IRC protocol RFC. Very Usefull!
Hope that helped a bit.
Bas
] Bas Ruiter
]
] lords...@home.nl
] http://members.home.nl/lordsnow
] wolfums @ IRC.Undernet #funchat #straycats