fb:porticula NoPaste
PNE :: examples/irc_client.bas
Uploader: | PMedia |
Datum/Zeit: | 05.12.2007 15:05:11 |
''==============================================================================
''
'' PMedia's Network Engine
'' for FreeBASIC
''
''==============================================================================
'
' irc_client.bas =--------------------------------------------------------------
'
' this should show you the bindevent-option of PNE
#include "pne/pne.bi"
declare sub show(incoming as string)
declare sub errh()
declare sub reconn()
declare sub login()
dim shared as pne.Client serverCall
serverCall.connectDNS("irc.freenode.net", 6667)
serverCall.bindEvent(pne.e_onReceive, @show)
serverCall.bindEvent(pne.e_onError, @errh)
serverCall.bindEvent(pne.e_onDisConnect, @reconn)
serverCall.bindEvent(pne.e_onConnect, @login)
do
sleep 5
loop until multikey(1)
serverCall.disconnect
end
sub show(incoming as string)
print incoming
end sub
sub errh()
Print "Error happened"
Print serverCall.GetLastError("EN")
end sub
sub reconn()
cls
Print "Server-connection lost... trying to reconnect"
serverCall.connectDNS("irc.freenode.net", 6667)
end sub
Sub login()
serverCall.lock_writebuffer()
serverCall.writeLN("NICK PNE_Tester")
serverCall.writeLN("USER PNE_Tester 0 0 *:PNE_TESTER")
serverCall.unlock_writebuffer()
end sub