Ok, here is the deal. I'm making an IRC bot(console app), when it recieves the numeric msg's from the server, such as 433, which means Nickname is already in use, it changes its nick. It recieves that msg in this form:
:Irc.Server.com 433 * mynickname :Nickname is aleady in use.
I check to see if the second word of the string = 433, if yes, then change nick.
I use this for many of the numeric responses.The problem is, that when it recieves that string as a single sentance like above, it works. But on most servers, they send a long string, such as a paragraph, and I cant check for the second word cause it only returns the second word of the string, not each sentance.
these long strings look like:
:my.server.name 254 nick 1 :channels formed
:my.server.name 255 nick :I have 2 clients and 0 servers
:my.server.name NOTICE nick :Highest connection count: 2 (2 clients)
:my.server.name 422 nick :MOTD File is missing
Now say I want to compare the second word to 422, if yes, then i want to join channel, but it compares 254 to 422 because its only comparing the second word of the string, not each sentance. I need these separated into single sentances. The code I am using is this:
if pos('433',str01) > 0 then
if errorcode(str01) = '433' then
if pos('422',str01) > 0 then
if errorcode(str01) = '422' then
send01:='JOIN ' + IRCChan + #32 + IRCKey + #10#13;
the errorcode function is
function errorCode(mystring: String): String; //thanks to Bruno
var tokens: TStringList;
tokens := TStringList.create;
code := tokens.Strings;
errorCode := code;
If anyone can help, I would be Very grateful. Im sorry but I only have 50 points left to give cause another question that I have here, I cant get removed and a refund of the points.