Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 02-02-2005, 05:15 PM   #1 (permalink)
 
Newb Techie

Join Date: Feb 2005

Posts: 2

Nathalie

Default [Delphi] Indy IRC Parsing

Hi there.

I'm in the process of making an IRC client in Delphi 7, using the Indy Client component for IRC.

I've got as far with the display as being able to see the raw data by using:

Code:
procedure TfrmMain.ircMainMessage(Sender: TObject; AUser: TIdIRCUser;
  AChannel: TIdIRCChannel; Content: String);
begin
rtfIRC.Lines.Append(ircMain.ReadLn());
end;
However this isn't what I want to be seeing.

How could I possibly parse this to display similarly to:

<Username> Message

And how would I also go about parsing actions differently?

Thanks in advance,
Nathalie L. Agôn
Nathalie is offline  
Old 02-02-2005, 07:07 PM   #2 (permalink)
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

I don't know delphi, or that component you're using but I do know you could do something like:
Code:
rtfIRC.Lines.Append("<" + UserVarHere + "> " + ircMain.ReadLn());

__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline  
Old 02-03-2005, 12:08 PM   #3 (permalink)
 
Newb Techie

Join Date: Feb 2005

Posts: 2

Nathalie

Default

Thanks for trying, but the thing is, the username AND the message, are stored within the ReadLn() function.

My friend whos never used Delphi, told me how to parse it using Visual Basic, and said I should try coding it for Delphi, but I didn't have a clue. It was something about splitting the raw code up and replacing stuff I don't need.

These are two lines from the channel I'm in and I'm wanting to be able to parse it differently.

:djnutta!Liek@RSIRC-407FE81F.cable.ubr04.dudl.blueyonder.co.uk PRIVMSG #optirunescape :its got on pic of me and i look like a pillock -_-
:Mrs_Skipppppppyy!nla@RSIRC-EDF01EBD.range81-154.btcentralplus.com PRIVMSG #optirunescape :ACTION wants to see
:Mrs_Skipppppppyy!nla@RSIRC-EDF01EBD.range81-154.btcentralplus.com PRIVMSG #optirunescape :I just crashed everything
PING :irc.rstoolkit.com

I'd like to be able to parse that to show normal data.

Also, I've found that the client seems to freeze when using ReadLn() until a second line has been said, yet when it unfreezes from a second line, the first line doesn't appear. Any idea why? :\
Nathalie is offline  
Old 02-03-2005, 02:34 PM   #4 (permalink)
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

Again, I've never used delphi, so you'd have to check for certain methods....In c# (which is very similar to delphi) you'd do:

Code:
string line = ircMain.ReadLn();
string usrName = line.SubString(0,line.IndexOf("!"));
string msg = line.SubString(line.IndexOf(":"),line.Length - 1);
rtfIRC.Lines.Append("<"+usrName+"> " + msg);
I'm not sure why it's freezing though...
__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On