irc chat.....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Supra

    #1

    irc chat.....

    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 :

    Picota!lol@96.R ed-213-97-140.pooles.rima-tde.net PRIVMSG #india :any1
    seen a-kash?

    eLif^^`!~ltowhd @81.213.252.106 JOIN #india

    Dim str As String = "Picota!lol@96. Red-213-97-140.pooles.rima-tde.net
    PRIVMSG #india :any1 seen a-kash?"
    Dim intI As Integer = str.IndexOf("!" )
    str = str.Substring(i ntI - 6)
    TextBox1.Append Text(str)

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

  • Yves Dhondt

    #2
    Re: irc chat.....

    Supra wrote:
    [color=blue]
    > 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 :[/color]

    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.Co mpiled | RegexOptions.Si ngleline);

    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.
    [color=blue]
    >
    > Picota!lol@96.R ed-213-97-140.pooles.rima-tde.net PRIVMSG #india :any1
    > seen a-kash?
    >
    > eLif^^`!~ltowhd @81.213.252.106 JOIN #india
    >
    > Dim str As String = "Picota!lol@96. Red-213-97-140.pooles.rima-tde.net
    > PRIVMSG #india :any1 seen a-kash?"
    > Dim intI As Integer = str.IndexOf("!" )[/color]

    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
    [color=blue]
    > str = str.Substring(i ntI - 6)[/color]

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

    Dim nick As String = str.Substring(0 , intI)
    [color=blue]
    > TextBox1.Append Text(str)
    >
    > i can't get nick name. i need first nick Picota , etc.
    >[/color]

    Yves

    Comment

    • Supra

      #3
      Re: irc chat.....

      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 Dhondt wrote:
      [color=blue]
      > Supra wrote:
      >[color=green]
      >> 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 :[/color]
      >
      >
      > 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.Co mpiled | RegexOptions.Si ngleline);
      >
      > 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.
      >[color=green]
      >>
      >> Picota!lol@96.R ed-213-97-140.pooles.rima-tde.net PRIVMSG #india :any1
      >> seen a-kash?
      >>
      >> eLif^^`!~ltowhd @81.213.252.106 JOIN #india
      >>
      >> Dim str As String = "Picota!lol@96. Red-213-97-140.pooles.rima-tde.net
      >> PRIVMSG #india :any1 seen a-kash?"
      >> Dim intI As Integer = str.IndexOf("!" )[/color]
      >
      >
      > 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
      >[color=green]
      >> str = str.Substring(i ntI - 6)[/color]
      >
      >
      > Here you would need to use the overloaded version of the Substring
      > functionality
      >
      > Dim nick As String = str.Substring(0 , intI)
      >[color=green]
      >> TextBox1.Append Text(str)
      >>
      >> i can't get nick name. i need first nick Picota , etc.
      >>[/color]
      >
      > Yves[/color]

      Comment

      Working...