IRC like chat - parsing data?

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

IRC like chat - parsing data?
  1. Unread #1 - Mar 2, 2008 at 7:27 AM
  2. gigabyt3r
    Joined:
    Jul 31, 2007
    Posts:
    64
    Referrals:
    0
    Sythe Gold:
    0

    gigabyt3r Member
    Banned

    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
     
  3. Unread #2 - Mar 2, 2008 at 4:33 PM
  4. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    IRC like chat - parsing data?

    How about some details.

    "Does not work" usually doesn't cut it if you're asking for help.
     
  5. Unread #3 - Mar 2, 2008 at 4:53 PM
  6. gigabyt3r
    Joined:
    Jul 31, 2007
    Posts:
    64
    Referrals:
    0
    Sythe Gold:
    0

    gigabyt3r Member
    Banned

    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
     
  7. Unread #4 - Mar 2, 2008 at 5:10 PM
  8. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    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
     
  9. Unread #5 - Mar 3, 2008 at 1:23 AM
  10. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    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! >

Users viewing this thread
1 guest


 
 
Adblock breaks this site