Jump to content

IRC UDF problems


Recommended Posts

Hey, can some one help me with this IRC UDF Example

It's can't connect 2 the IRC server, but if i use this program TrayIRC then it's connect perfect

What i done wrong?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IRC.au3>

Global $server = "irc.quakenet.org"
Global $port = 6667
Global $nick = "Au3Bot"
Global $channel = "#esc-rage"

TCPStartup ()
Global $sock = _IRCConnect($server, $port, $nick); Connects to IRC and Identifies its Nickname

While 1
    $recv = TCPRecv($sock, 8192); Recieve things from server
    If @error Then Exit MsgBox(1, "IRC Example", "Server has errored or disconnected"); If you can't recieve then the server must have died.
    Local $sData = StringSplit($recv, @CRLF); Splits the messages, sometimes the server groups them
    For $i = 1 To $sData[0] Step 1; Does each message seperately
        Local $sTemp = StringSplit($sData[$i], " "); Splits the message by spaces
        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
        Switch $sTemp[2]; Splits the command msg
            Case "266"; It's what I use as an indictator to show when its done sending you info.
                _IRCJoinChannel ($sock, $channel)
                _IRCSendMessage($sock, "Hello!", $channel)
                _IRCChangeMode ($sock, "+i", $nick)
        EndSwitch
    Next
WEnd

http://www.autoitscript.com/forum/index.php?showtopic=59794

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...