Solved

How to create a Delphi IRC Client?

Posted on 1997-11-16
2
661 Views
Last Modified: 2010-04-04
Is there any way to create a delphi IRC client, I would like to find out how... thanks a lot!
0
Comment
Question by:sqz
2 Comments
 

Accepted Solution

by:
mgrendel earned 110 total points
ID: 1350660
Firstly, get the RFC specifications for IRC.  These are available at www.internic.com.  Then I would suggest you get dWinsock; a great shareware Winsock component package ( available at www.aait.com/dwinsock ).

After installing the components,  create an IRCChatClient of type TTextClient ( dWinsock ); ie.,

                         IRCChatClient : TTextClient ;

Then create a connection method, something like:

procedure MainForm.btnIRCConnectClick(Sender: TObject);
begin
   if not (IRCChatClient.Connected)  then
     with IRCChatClient  do begin
        Address := Server.Text;  { irc server address, using a
                                                 TEdit named Server }
        Port    := Port.Text;          { irc server port as a string i.e                                                   '6667', again using a TEdit }
        Open(TLineSocket);        { open the connection as a                                                             TLineSocket }
     end;
end;

This will establish a connection.  Using the RFC's, send the login info, which are 2 strings:

     "USER <nick> <localhost> <localIP> :<real name>"
      and
     "NICK <nick>"

Use something like the following procedure ( you'll need to declare a TMemo somewhere on your form to hold the text -
ChatArea : TMemo ; ):

procedure TForm1.IRCChatClient.Connect(Sender: TObject;                                                                Socket: TSocketBase);
var
   LocalIP : ShortString;
   sLogin    : string;
begin
     if Socket.Connected Then
       begin
          ChatArea.Lines.Add ( 'Connection accepted ...                      Logging to IRC server');
          LocalIP := IRCChatClient.LookUpAddrByNameStr                                        ( IRCChatClient.LocalHost ) ;
         sLogin := 'USER <nickname> ' + IRCChatClient.LocalHost                          + ' ' + LocalIP + ' ' + ':<real name>'#$A + 'NICK '                          + <nickname>';
         (Socket As TLineSocket).WriteLine(sLogin);
         Exit;
       end
     else
       begin
         ChatArea.Lines.Add('Error while connecting to server...');
         Socket.Close;
       end;
end;

That will get you started.  Use the RFC's to build a parser, ect to control your client.  Note you will need to PING alot - to keep the thing connected ;)

Hope that helps.
0
 

Author Comment

by:sqz
ID: 1350661
great help! let me know if you have any sources etc.. thanks!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 69
How to renew a Delphi rad-studio licence? 5 65
Dynamically Created Query 3 55
DBCtrlGrid, Delphi, Scroll 8 14
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question