irc chat.....

  • Thread starter Thread starter Supra
  • Start date Start date
S

Supra

How do i parse the first nick before exclamation only. i am working
on irc chat similar to PIRCH or MIRC. I can only do this in vb6
here is debug.writeline:

[email protected] PRIVMSG #india :any1
seen a-kash?

eLif^^`[email protected] JOIN #india

Dim str As String = "[email protected]
PRIVMSG #india :any1 seen a-kash?"
Dim intI As Integer = str.IndexOf("!")
str = str.Substring(intI - 6)
TextBox1.AppendText(str)

i can't get nick name. i need first nick Picota , etc.
 
Supra said:
How do i parse the first nick before exclamation only. i am working
on irc chat similar to PIRCH or MIRC. I can only do this in vb6
here is debug.writeline:

What do you mean by that? That you know how to do it in VB6 but not in
VB.Net or that you're looking for a VB6 answer? In the latter case,
you're in the wrong group.

For VB6 I suggest you check out the Mid function.

For .Net there are a couple of ways of doing this, the most clean one
would be to use regular expressions :
Regex("([\\w\\-\\[\\]\\`_\\^\\{\\|\\}]+![\\~\\w]+@[\\w\\.\\-]+)",
RegexOptions.Compiled | RegexOptions.Singleline);

But considering the 'slowness' of regex in the framework atm and the
amount of privmsg you will receive on busy channels, i think you're
better of using simple string manipulations like you did.
[email protected] PRIVMSG #india :any1
seen a-kash?

eLif^^`[email protected] JOIN #india

Dim str As String = "[email protected]
PRIVMSG #india :any1 seen a-kash?"
Dim intI As Integer = str.IndexOf("!")

Next I would check if you have a result, things like PRIVMSG in irc can
be send from a server directly (though highly unlikely). If they are
send from a server there will be no "!" in them. So you will have no
real nick. So you should check that intI > -1
str = str.Substring(intI - 6)

Here you would need to use the overloaded version of the Substring
functionality

Dim nick As String = str.Substring(0, intI)
TextBox1.AppendText(str)

i can't get nick name. i need first nick Picota , etc.

Yves
 
did u read rfc 1459.
the server sent 5 agruements: nick, nick's ip, PRIVMSG, channel, message..
u r simply wrong. the server must sent "!" to channel or Private channel
or dcc..
i am not thinking about vb6. I am thinking real vb.net not using mid,
left or right.
btw, i haven't tried regual expression. i am reading book "The
programming visual basic.net
by francesco balena" but i'm only into chapter 2
regards chapter 2.
regards

Yves said:
Supra said:
How do i parse the first nick before exclamation only. i am
working on irc chat similar to PIRCH or MIRC. I can only do this in vb6
here is debug.writeline:


What do you mean by that? That you know how to do it in VB6 but not in
VB.Net or that you're looking for a VB6 answer? In the latter case,
you're in the wrong group.

For VB6 I suggest you check out the Mid function.

For .Net there are a couple of ways of doing this, the most clean one
would be to use regular expressions :
Regex("([\\w\\-\\[\\]\\`_\\^\\{\\|\\}]+![\\~\\w]+@[\\w\\.\\-]+)",
RegexOptions.Compiled | RegexOptions.Singleline);

But considering the 'slowness' of regex in the framework atm and the
amount of privmsg you will receive on busy channels, i think you're
better of using simple string manipulations like you did.
[email protected] PRIVMSG #india :any1
seen a-kash?

eLif^^`[email protected] JOIN #india

Dim str As String = "[email protected]
PRIVMSG #india :any1 seen a-kash?"
Dim intI As Integer = str.IndexOf("!")


Next I would check if you have a result, things like PRIVMSG in irc
can be send from a server directly (though highly unlikely). If they
are send from a server there will be no "!" in them. So you will have
no real nick. So you should check that intI > -1
str = str.Substring(intI - 6)


Here you would need to use the overloaded version of the Substring
functionality

Dim nick As String = str.Substring(0, intI)
TextBox1.AppendText(str)

i can't get nick name. i need first nick Picota , etc.

Yves
 
Back
Top