I want to join an IRC room, using TIdIRC
+ Lazarus. I am familair with this discussion.
This is my code :
procedure TForm1.Button4Click(Sender: TObject);
begin
if Edit3.Text = '' then
begin
log('ERROR : Nick unknown, specify a Nick (look for the textbox saying ''Nick'' and replace it)', Memo3);
log('ERROR : Also provide Real Name and Alt Nic', Memo3);
Edit3.Text:= 'Nick';
Edit6.Text:= 'Real Name';
end
else
if Edit6.Text = '' then
begin
log('ERROR : Real Name unknown, provide Real Name', Memo3);
end
else
begin
IdIRC1.Host:=Edit1.Text;
IdIRC1.Port:=StrToInt(Edit5.Text);
IdIRC1.Nickname:=Edit4.Text;
IdIRC1.Username:=Edit4.Text;
IdIRC1.RealName:=Edit6.Text;
IdIRC1.AltNickname:=Edit7.Text;
log('Attempting to connect .. ', Memo1);
IdIRC1.Connect;
if IdIRC1.Connected then
begin
log('Connected ! ' , Memo1);
{Trying to join a channel .. }
if Edit4.Text = '' then
begin
IdIRC1.Join(Edit2.Text);
// IdIRC1.OnJoin:=;
log('channel joined', Memo1);
end
else
begin
IdIRC1.Join(Edit2.Text, Edit4.Text);
log('channel joined with password', Memo1);
end;
end
else
begin
end;
end;
begin
end;
end;
The log message "Connected !"
is printed. Since this will happen after IdIRC1.Connect()
is exited, and IdIRC1.Connected
is found to be true, I am assuming that connection was established.
However, IdIRC1.Join()
is not connecting.
Edit2.Text
is set to '#Orcan'
; while Edit4.Text
is set to ''
(an empty string).
I am recieving an error message:
Project has raised Exception class EIdConnClosedGracefully with the message :
Connection Closed gracefully
I am at the same time, from the same computer, logged in to irc.freenode.net , where the program is supposed to connect to, using konversations. In the user list the program, using the preset nick name, does not show up.
What am I doing wrong?