diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:13:59 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:13:59 +0000 |
commit | a6d58bb6052ac8cb01805a48c4ad2f129126116f (patch) | |
tree | dd867a099fcbb263a8009a9fb22695b87855dad6 /doc/scriptexamples/socket1.kvs | |
download | kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.tar.gz kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.zip |
Added KDE3 version of kvirc
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1095341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'doc/scriptexamples/socket1.kvs')
-rw-r--r-- | doc/scriptexamples/socket1.kvs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/doc/scriptexamples/socket1.kvs b/doc/scriptexamples/socket1.kvs new file mode 100644 index 00000000..382b48c9 --- /dev/null +++ b/doc/scriptexamples/socket1.kvs @@ -0,0 +1,45 @@ +# This is a simple socket class to play with from the console +# It just echoes the events to the console window + +class(testsocket,socket) +{ + connectEvent() + { + echo "[$$] Connected to $$->$remoteIp() $$->$remotePort()" + } + + disconnectEvent() + { + echo "[$$] Disconnected ($0-)" + } + + connectFailedEvent() + { + echo "[$$] Connect failed ($0-)" + } + + dataAvailableEvent() + { + echo "[$$] Data: $$->$read()" + } +} + +echo "testsocket class installed" +echo "You can play with it by using:" + +echo "/\%X = \$new(testsocket); # To create it" +echo "/\%X->\$connect(<host>,<port>); # To connect to a host" +echo "/\%X->\$write(<data>); # To write ASCII data" +echo "/\%X->\$close(); # To terminate a connection" +echo "/delete \%X; # To destroy it" +echo "...." +echo "Tip: why don't you try to IRC ?" +echo "The sequence might be something like:" +echo "/\%X = \$new(testsocket)" +echo "/\%X->\$connect(<your_irc_server>,6667)" +echo "/\%X->\$write(\"USER <youruser> <somestring> <somestring> :<realname>\$cr\$lf\")" +echo "/\%X->\$write(\"NICK <yournick>\$cr\$lf\")" +echo "/\%X->\$write(\"JOIN #kvirc\$cr\$lf\")" +echo "/\%X->\$write(\"PRIVMSG #kvirc :Hello IRC-World! :D\$cr\$lf\")" +echo "...." +echo "Have fun! :)" |