Adblock breaks this site

IRC like chat - parsing data?

Discussion in 'Programming General' started by gigabyt3r, Mar 2, 2008.

  1. gigabyt3r

    gigabyt3r Member
    Banned

    Joined:
    Jul 31, 2007
    Posts:
    64
    Referrals:
    0
    Sythe Gold:
    0
    IRC like chat - parsing data?

    Im trying to get my server to recognize '/nick newnick' but i cant figure it out. I tried Left, right and mid functions but i still cant do it, hes part of the code

    Code:
    Winsock1.GetData Data
    If InStr(Data, "/nick") Then
    Nick = Mid(Data, 6, 9)
    txtChat.Text = txtChat.Text & "Nickname changed to " & Nick & vbCrLf
    But it doesnt work. does anyone know why? i can post more of the code if u need
     
  2. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    IRC like chat - parsing data?

    How about some details.

    "Does not work" usually doesn't cut it if you're asking for help.
     
  3. gigabyt3r

    gigabyt3r Member
    Banned

    Joined:
    Jul 31, 2007
    Posts:
    64
    Referrals:
    0
    Sythe Gold:
    0
    IRC like chat - parsing data?

    When someone types '/nick newnick' without the quotes i want it to get the text after the /nick part. So if someone typed '/nick Peter' i want it to set their nickname to Peter but i cant figure out how to parse the text after the /nick part
     
  4. Jazz00006

    Jazz00006 Apprentice
    Visual Basic Programmers

    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0
    IRC like chat - parsing data?

    Code:
    nick = Trim(Mid(Data, 6))
    or
    Code:
    nick = Trim(Replace(Data, "/nick", vbNullString))
    And I could go on. There are many ways of grabbing the text, those two are just simple ones
     
  5. Covey

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816
    IRC like chat - parsing data?

    Well to start with, do you want it to change the user's nickname when THEY type "/nick Covey" or do you want it to DISPLAY that someone has changed their nick (a person not using your client).

    If you want it to DISPLAY the nickname change when someone else changes their nick i think (using my dodgy memory) the RAW data you are looking for is something like:
    Code:
    :<CURRENT_NICK> <HOSTMASK> NICK: <NEW_NICK>:
    But if you want to change someone's nickname who IS using your client you will have to search the textbox that they type in, for example:
    Code:
    public sub CheckNickChange(strData as string)
        strdata = ltrim(strdata)
        if mid(ucase(strdata),a,6) = "/NICK " then
            'do stuff here
        end if
    end sub
     
< Temporary File Cleaner program (C++) | Make your own component! >


 
 
Adblock breaks this site