Sign in to follow this  
Followers 0
zxzxzx

I can't join a channel at IRC ?

5 posts in this topic

#1 ·  Posted (edited)

#include <String.au3>

$nick = "QuyPhap"
TCPStartup()
$chan = "#Vui"
$sock = _IRCConnect("210.245.124.69","6667", $nick)
_IRCJoinChannel($sock, $chan)
While 1
    $recv = TCPRecv($sock, 8192)
    If @error Then
        Exit
    Else
        ConsoleWrite($recv)
    EndIf
    If $recv Then
        $sData = StringSplit($recv, @CRLF); Splits the messages
        
        For $i = 1 To $sData[0] Step 1
            $sTemp = StringSplit($sData[$i], " ")

            If $sTemp[1] = "" Then ContinueLoop; If its empty, Continue!
            If $sTemp[1] = "PING" Then _IRCPing($sock, $sTemp[2]); Checks for PING replys (There smaller then usual messages so its special! 
            If $sTemp[0] <= 2 Then ContinueLoop; Useless messages for the most part

        
    
    EndIf
    
        
            
WEnd




;===============================================================================
;
; Description:    Connects you to a IRC Server, and gives your chosen Nick
; Parameter(s):  $server - IRC Server you wish to connect to
;                  $port - Port to connect to (Usually 6667)
;                  $nick - Nick you choose to use (You can change later)
; Requirement(s):   TCPStartup () to be run
; Return Value(s):  On Success - Socket identifer
;                  On Failure - It will exit on error
; Author(s):        Chip
; Note(s):        English only
;
;===============================================================================
Func _IRCConnect($server, $port, $nick)
    Local $i = TCPConnect(TCPNameToIP($server), $port)
    If $i = -1 Then Exit MsgBox(1, "IRC.au3 Error", "Server " & $server & " is not responding.")
    TCPSend($i, "NICK " & $nick & @CRLF)
    TCPSend($i, "USER " & $nick & " 0 0 " & $nick & @CRLF)
    Return $i
EndFunc ;==>_IRCConnect

;===============================================================================
;
; Description:    Joins an IRC Channel
; Parameter(s):  $irc - Socket Identifer from _IRCConnect ()
;                  $chan - Channel you wish to join
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                  On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):        English only
;
;===============================================================================
Func _IRCJoinChannel($irc, $chan)
    If $irc = -1 Then Return 0
    TCPSend($irc, "JOIN " & $chan & @CRLF)
    If @error Then
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc ;==>_IRCJoinChannel

;===============================================================================
;
; Description:    Sends a message using IRC
; Parameter(s):  $irc - Socket Identifer from _IRCConnect ()
;              $msg - Message you want to send
;                  $chan - Channel/Nick you wish to send to
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                  On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):        English only
;
;===============================================================================
Func _IRCSendMessage($irc, $msg, $chan = "")
    If $irc = -1 Then Return 0
    If $chan = "" Then
        TCPSend($irc, $msg & @CRLF)
        If @error Then
            MsgBox(1, "IRC.au3", "Server has disconnected.")
            Return -1
        EndIf
        Return 1
    EndIf
    TCPSend($irc, "PRIVMSG " & $chan & " :" & $msg & @CRLF)
    If @error Then
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc ;==>_IRCSendMessage

;===============================================================================
;
; Description:    Changes a MODE on IRC
; Parameter(s):  $irc - Socket Identifer from _IRCConnect ()
;              $mode - Mode you wish to change
;                  $chan - Channel/Nick you wish to send to
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                  On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):        English only
;
;===============================================================================
Func _IRCChangeMode($irc, $mode, $chan = "")
    If $irc = -1 Then Return 0
    If $chan = "" Then
        TCPSend($irc, "MODE " & $mode & @CRLF)
        If @error Then
            MsgBox(1, "IRC.au3", "Server has disconnected.")
            Return -1
        EndIf
        Return 1
    EndIf
    TCPSend($irc, "MODE " & $chan & " " & $mode & @CRLF)
    If @error Then
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc ;==>_IRCChangeMode

;===============================================================================
;
; Description:    Returns a PING to Server
; Parameter(s):  $irc - Socket Identifer from _IRCConnect ()
;              $ret - The end of the PING to return
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                  On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):        English only
;
;===============================================================================
Func _IRCPing($irc, $ret)
    If $ret = "" Then Return -1
    TCPSend($irc, "PONG " & $ret & @CRLF)
    If @error Then
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc ;==>_IRCPing

;===============================================================================
;
; Description:    Leave the IRC Channel
; Parameter(s):  $irc - Socket Identifer from _IRCConnect ()
;              $msg - Message to send with PART, optional
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                  On Failure - -1 = Server disconnected.
;
;===============================================================================
Func _IRCLeaveChannel($irc, $msg = "", $chan = "")
    If $irc = -1 Then Return 0
    TCPSend($irc, "PART " & $chan & " :" & $msg & @CRLF)
    If @error Then
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc ;==>_IRCLeaveChannel

;===============================================================================
;
; Description:    Close the IRC Connection
; Parameter(s):  $irc - Socket Identifer from _IRCConnect ()
;              $msg - Message to send with quit, optional (not able to see with all clients)
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                  On Failure - -1 = Server disconnected.
;
;===============================================================================
Func _IRCQuit($irc, $msg = "")
    If $irc = -1 Then Return 0
    TCPSend($irc, "QUIT :" & $msg & @CRLF)
    Sleep(100); I think the message has to sink in or something tongue.gif
    Return 1
EndFunc ;==>_IRCQuit

That is my script.

And that irc server is running. (210.245.124.69)

I can connect to that server but i can't join channel. I got ":Vietnamese Hackers Comunity - LlyKiL. 451 JOIN :You have not registered"

How must i edit that script ?

Thank you very much.

Edited by zxzxzx

Share this post


Link to post
Share on other sites



Help me please. I very need

Share this post


Link to post
Share on other sites

Help please................................

Share this post


Link to post
Share on other sites

Sad, No one help me

Share this post


Link to post
Share on other sites

Sad. No one help until now :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0