Solved

How to create a Delphi IRC Client?

Posted on 1997-11-16
2
690 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

617 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