Home arrow Delphi-Kylix arrow Page 4 - Building an IRC Client
DELPHI-KYLIX

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 / 7
January 22, 2007
TABLE OF CONTENTS:
  1. · Building an IRC Client
  2. · Procedures
  3. · More Procedures
  4. · Sending Messages
  5. · Processing Server Commands

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building an IRC Client - Sending Messages
(Page 4 of 5 )

Below I've listed the code for one of two options that enable you to send a new message. The other is the button with the caption "Say something." The difference between the two is that this particular option enables you to send a message by pressing the return key.

procedure TForm1.FormDestroy(Sender: TObject);

begin

free;//frees all objects that is created.

end;

procedure TForm1.IdIRC1Connected(Sender: TObject);

begin

Memo1.Lines.Add(' You are connected!');

end;

procedure TForm1.IdIRC1CTCPQuery(ASender: TIdContext;
ANicknameFrom, AHost,

  ANicknameTo, AChannel, ACommand, AParams: String);

begin

memo1.lines.Add('To '+ANickNameto+' Channel: '+AChannel+'Command
'+ACommand+'Aparams '+Aparams);

end;

This event is fired when you receive a C(lient) T(o) C(lient) query. Again, you can show as much or as little information about this query as you like. You have the following information at your disposal: receiver's nickname, hostname, channel name, sender's nickname and the command that the client used for the query.

procedure TForm1.IdIRC1Notice(ASender: TIdContext; const
ANicknameFrom,

  AHost, ANicknameTo, ANotice: String);

begin

memo1.lines.add(ANotice);

end;

This event handles what you do when you receive a notice. There is a great deal of information available about the notice.  I only added the actual content of the notice.  

procedure TForm1.IdIRC1ServerStatsReceived(ASender: TIdContext;

  AStatus: TStrings);

  var

  i:integer;

begin

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

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

end;

end;

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

  AChannel, ATopic: String);

begin

memo1.Lines.add(ATopic+'===> '+AChannel)

end;

procedure TForm1.IdIRC1Raw(ASender: TIdContext; AIn: Boolean;

  AMessage: String);

begin

memo1.Lines.Add(Amessage);

end;


blog comments powered by Disqus
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...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



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