____ _ _ ___ / ___|| |__ (_) |_ _| _ __ ___ | | | '_ \ | | | | | '__|/ __| | |___ | | | || | | | | | | (__ \____||_| |_||_| |___||_| \___| An Extension Of Chisock library (By Cha0s - rubentbstk (AT) gmail [DOT] com) By LukeL +================================================================== The API is organized under the namespace "chi" Just Copy chi_irc.bi to FreeBASIC/inc directory And Compile with "FILL THE COMPILE COMMAND HERE!" There is libchi_irc.a which is already compiled. Copy it to \lib\win32 directory, for Windows +================================================================== => function Connect ( Byref Server As String, Byval Port As Integer = IRC) As Integer > Connects to "Server" IRC server on IRC port "Port". > Eg. Dim chi.IRC_Client MyClient If (MyClient.Connect("irc.freenode.net",6667) = FALSE) then Print "Error connecting to Server!" > Returns TRUE if connected Otherwise FALSE is returned. +================================================================== => function Disconnect ( ByRef quit_message As String = "") As Integer > Disconnects from a connected server with optional Quit_message. > Eg. Dim chi.IRC_Client MyClient If (MyClient.Connect("irc.freenode.net",6667) = FALSE) then Print "Error connecting to Server!" If (MyClient.Disconnect("Peace.") = False) then print "Error Disconnecting!" > Returns TRUE if disconnected Otherwise FALSE is returned. +================================================================== => function Is_Closed () As Integer > Checks whether Socket is open or closed. > Eg. Dim chi.IRC_Client MyClient If (MyClient.Connect("irc.freenode.net",6667) = FALSE) then Print "Error connecting to Server!" If(MyClient.Is_Closed() = False) then Print "Socket Open!" > Returns TRUE is Socket is Closed and FALSE if socket is open. +================================================================== => function Queue () as Integer > Eg. Dim chi.IRC_Client MyClient If (MyClient.Connect("irc.freenode.net",6667) = FALSE) then Print "Error connecting to Server!" Print Queue() & " messages queued!" > Returns the number of queued messages. +================================================================== => function Get_Message () As Irc_Message > Gets the message from server and parses it. > Eg. Dim chi.IRC_Client MyClient If (MyClient.Connect("irc.freenode.net",6667) = FALSE) then Print "Error connecting to Server!" Do Dim as Chi.IRC_Message MyMessage = MyClient.Get_Message() ? .From & .Param(.Trailing) Loop until Multikey(&h01) > Returns the Message returned from the server. +================================================================== => function Get_Raw () As String > Gets Raw data from the socket stream. > Eg. Dim chi.IRC_Client MyClient If (MyClient.Connect("irc.freenode.net",6667) = FALSE) then Print "Error connecting to Server!" Do Dim as string MyMessage = MyClient.Get_Raw() ? MyMessage Loop until Multikey(&h01) > Returns Raw message(unparsed) from the server. +================================================================== => Function Send_Message ( ByRef To_Whom As String, ByRef message As String, ByRef ID As String = "PRIVMSG" ) As Integer > Sends "message" to "To_Whom" as ID. > ID can be either PRIVMSG (default),NOTICE etc > Return TRUE if message sending successful. +================================================================== => Function Send_Raw ( ByRef message As String ) As Integer > Send Raw data to the Server. > Eg. Dim chi.IRC_Client MyClient Dim as string MyMessage = "Hi!" If (MyClient.Connect("irc.freenode.net",6667) = FALSE) then Print "Error connecting to Server!" If(MyClient.Send_Raw(MyMessage) = False) then Print "Error Sending Message!" > Returns TRUE if message sending successful. +================================================================== => Function JoinChannel ( ByRef channel As String ) As Integer > Joins a Channel on the connected server. > Eg. Dim As chi.IRC_Client MyClient MyClient.Connect( "irc.freenode.net" ) MyClient.Join_Channel( "##FreeBASIC" ) > Returns TRUE on connection. +================================================================== => Function Leave_Channel ( ByRef channel As String ) As Integer > Leaves a Channel on the connected server. > Eg. Dim As chi.IRC_Client MyClient MyClient.Connect( "irc.freenode.net" ) MyClient.Join_Channel( "##FreeBASIC" ) MyClient.Leave_Channel( "##FreeBASIC" ) > Returns TRUE on disconnection. +==================================================================