Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - Building an IRC Client
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Building an IRC Client
By: Leidago
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2007-01-22

    Table of Contents:
  • Building an IRC Client
  • Procedures
  • More Procedures
  • Sending Messages
  • Processing Server Commands

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building an IRC Client - More Procedures


    (Page 3 of 5 )

    The Say() procedure enables you to send a message either to the channel or to another user:

    procedure TForm1.Button2Click(Sender: TObject);

    begin

    idIRC1.Say(edit3.text, Memo2.Text);

    Memo1.Lines.Add(IdIRC1.Nickname + ': '+Memo2.Text);

    Memo2.Lines.Clear;

    end;

    With the following code you just display the message from the administrator:

    procedure TForm1.IdIRC1AdminInfoReceived(ASender: TIdContext;

      AAdminInfo: TStrings);

    var

      i:integer;

    begin

    for i:= 0 to AAdminInfo.Count-1 do begin

    memo1.lines.add(AAdminInfo.Strings[i]);

    end;

    end;

    Notice that the message is in a TStrings object. This requires us to loop through the object and then display the information contained within it in a memo.

    procedure TForm1.IdIRC1Connect(Sender: TObject);

    begin

    Memo1.Lines.Add('Connection ok'); //this just confirms that we
    are connected

    end;

    procedure TForm1.IdIRC1Status(ASender: TObject; const AStatus:
    TIdStatus;

      const AStatusText: String);

    begin

    memo1.Lines.Add(AStatusText);

    end;

    The status procedure keeps us up to date on what the client is doing.

    procedure TForm1.IdIRC1Join(ASender: TIdContext; ANickname,
    AHost,

      AChannel: String);

    begin

    Memo1.Lines.Add('Join :' +AChannel+'NickName '+ANickName+' Host
    '+AHost);

    end;

    This event is fired when a new user joins a channel. How much information you want about a user is up to you, but you can get the user's host name, the channel that the user joined and the user's nickname. I just added it all to the memo.

    procedure TForm1.Memo2KeyDown(Sender: TObject; var Key: Word;

      Shift: TShiftState);

    var

    i : integer;

    begin

    if Key = VK_RETURN then

    begin

    idIRC1.Say(edit3.text, Memo2.Text);

    Memo1.Lines.Add(IdIRC1.Nickname + ': '+Memo2.Text);

    Memo2.Lines.Clear;

    end;

    end;

    More Delphi-Kylix Articles
    More By Leidago


       · Nothing that others will say will get listed :), nor is the onChannelMessage event...
       · I've not had a chance to test the app with the latest version of the Indy. When i...
     

    DELPHI-KYLIX ARTICLES

    - Loading an XML Document into the DOM
    - Delphi Wrapper Classes and XML
    - Delphi and the DOM
    - Delphi and XML
    - Internet Access: Client Service
    - Finishing the Client for an Internet Access ...
    - The Client for an Internet Access Control Ap...
    - User Management for an Internet Access Contr...
    - Important Procedures for an Internet Access ...
    - Server Code for an Internet Access Control A...
    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek