Indy IdIRC - 不加入聊天室

时间:2015-04-06 09:04:31

标签: indy irc lazarus freepascal fpc

我想使用TIdIRC + Lazarus加入IRC会议室。我很讨厌this讨论。

这是我的代码:

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;      

打印日志消息"Connected !"。由于这将在IdIRC1.Connect()退出后发生,并且发现IdIRC1.Connected为真,我假设已建立连接。

但是,IdIRC1.Join()未连接。

Edit2.Text设为'#Orcan';而Edit4.Text设置为''(空字符串)。

我收到一条错误消息:

Project has raised Exception class EIdConnClosedGracefully with the message :
Connection Closed gracefully 

我同时从同一台计算机登录到irc.freenode.net,该程序应该使用konversations连接到该程序。在用户列表中,使用预设昵称的程序不会显示。

我做错了什么?

0 个答案:

没有答案