Home arrow Delphi-Kylix arrow Page 2 - Building an IRC Client

Building an IRC Client

If you have ever wanted to build your own IRC client, keep reading. In this third part of a three-part article series, you will learn how to build an IRC client in Delphi from scratch, with assistance from Indy. While not all possible commands will be implemented, you will learn enough to add to and modify the code as you see fit.

Author Info:
By: Leidago
Rating: 5 stars5 stars5 stars5 stars5 stars / 13
January 22, 2007
  1. · Building an IRC Client
  2. · Procedures
  3. · More Procedures
  4. · Sending Messages
  5. · Processing Server Commands

print this article

Building an IRC Client - Procedures
(Page 2 of 5 )

Below are the procedures used to implement the IRC client application commands. I will not explain all the procedures as most of them are blindingly obvious. Just remember that whenever you receive a list of anything, it will usually be sent in the form of Tstrings. To access information that is in a TString object we need a loop.

The first procedure deals with how to connect to an IRC network:

procedure TForm1.Button1Click(Sender: TObject);


IdIRC1.Host := 'efnet.xs4all.nl';

  IdIRC1.Port := 6667;

  IdIRC1.Nickname := edit1.Text;//insert your nickname here


    IdIRC1.AltNickname:=' JoeB';




    if not idIRC1.Connected then


        MessageDlg('Error connecting to ' + idIRC1.Host, mtError,
[mbOK], 0);




  MessageDlg('Connected to ' + idIRC1.Host, mtInformation,
[mbOK], 0);



The code shows how to set your nickname, hostname and all the other important connection details for the client to connect successfully to a server. I cannot overemphasize the importance of entering a unique nickname when connecting to a server. This is the only way that an IRC network can identify you.

This procedure deals with how to handle a private message:

procedure TForm1.IdIRC1PrivateMessage(ASender: TIdContext;

  const ANicknameFrom, AHost, ANicknameTo, AMessage: String);


memo1.Lines.Add('' +AnicknameFrom+' The host'+Ahost+' To
name:'+AnicknameTo+' The message '+AMessage);


Basically all I did here was display the message received in a tmemo. I've included a lot of little details that you probably don't need to see, but you can decide which ones you want to display.

blog comments powered by Disqus

- 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...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials