Building an IRC Client
(Page 1 of 5 )
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.
IRC Client
In the previous two articles we discussed what an IRC client is and how it works. We also looked at the IRC protocol from the point of view of the RFC in which it is defined. Then we considered how we can implement such a client in Delphi and looked at what components we can use to fulfill that aim. We then decided to use a component called idIRCClient with which to create a IRC client. In the last article we looked at how much of the protocol this component can implement and found that it implements most of the commands required to create a client application. In this article we are going to focus on creating an IRC client from scratch.
What you need
To build this client I'm using Delphi 7 and indy version 10.1.5. I unfortunately don't know if this application will work on any other version of Delphi as I don't have access to those versions. So it will be up to you to test them. Your indy version will have to be the one I have or newer, because the versions are constantly updated and the implementations do not remain the same.
The Application
On the question of how many of the commands to implement to have a comfortably working client, I will implement as many of the commands as possible and also give pointers on how to implement others. The reason for this is that many IRC servers will accept and work comfortably with clients that have a minimal implementation and others won't. So in effect, the more commands you implement the more your client will be able to work with all kinds of IRC servers and networks. When you've finished writing your application, try to connect to as many IRC servers/networks as possible, because some will not accept you, and others will.
Here is a quick summary of how a client works:
- Default port is set to 6667.
- You need a (unique) nick name to connect to a IRC network.
- Some networks will require you to register, so you will need a username and password.
- You need the name of the IRC network, i.e irc.ukchatterbox.com and the name of the channel, i.e #talkmore.
Start up Delphi, create a new application, and drop the following components:
- idIRCClient - available from the Indy Client tab
- Three editboxes - available from the Standard tab. These will be used to receive user info, such as the nickname.
- Two memo components - available from the Standard tab. These will be used to both display and accept user input.
- Three buttons (captions, Connect/Say something, and Join) - available from the Standard tab.
- Five tlabels - available from the Standard tab
Arrange them so they look something like this:

Next: Procedures >>
More Delphi-Kylix Articles
More By Leidago