parsing and several events; -- noch

This commit is contained in:
norayr 2017-05-18 03:55:31 +04:00
parent 1cac25c181
commit 3d496ea58d
2 changed files with 79 additions and 24 deletions

View file

@ -3,13 +3,46 @@ MODULE test;
IMPORT IRC, Out, Strings := ooc2Strings;
PROCEDURE clbk(VAR msg : ARRAY OF CHAR);
PROCEDURE onMessage(VAR msg : ARRAY OF CHAR);
BEGIN
Out.String("callback procedure is running, youhoo!"); Out.Ln;
Out.String("input:"); Out.Ln;
Out.String(msg); Out.String("|"); Out.Ln;
Out.Ln;
END clbk;
Out.String("callback procedure is running, youhoo!"); Out.Ln;
Out.String("input:"); Out.Ln;
Out.String(msg); Out.String("|"); Out.Ln;
Out.Ln;
END onMessage;
PROCEDURE onPrivateMessage(VAR msg, user, ident, host: ARRAY OF CHAR);
BEGIN
Out.String("*** private message ***"); Out.Ln;
Out.String("message: '"); Out.String(msg); Out.Char("'"); Out.Ln;
Out.String("user: '"); Out.String(user); Out.Char("'"); Out.Ln;
Out.String("ident: '"); Out.String(ident); Out.Char("'"); Out.Ln;
Out.String("host: '"); Out.String(host); Out.Char("'"); Out.Ln;
Out.String("*** that's it ***"); Out.Ln;
END onPrivateMessage;
PROCEDURE onPublicMessage(VAR msg, user, ident, rcpt, host: ARRAY OF CHAR);
BEGIN
Out.String("*** public message ***"); Out.Ln;
Out.String("message: '"); Out.String(msg); Out.Char("'"); Out.Ln;
Out.String("user: '"); Out.String(user); Out.Char("'"); Out.Ln;
Out.String("ident: '"); Out.String(ident); Out.Char("'"); Out.Ln;
Out.String("recipient: '"); Out.String(rcpt); Out.Char("'"); Out.Ln;
Out.String("host: '"); Out.String(host); Out.Char("'"); Out.Ln;
Out.String("*** that's it ***"); Out.Ln;
END onPublicMessage;
PROCEDURE onPublicMessageWithMention(VAR msg, user, ident, rcpt, host: ARRAY OF CHAR);
BEGIN
Out.String("*** public message, bot name mentioned ***"); Out.Ln;
Out.String("message: '"); Out.String(msg); Out.Char("'"); Out.Ln;
Out.String("user: '"); Out.String(user); Out.Char("'"); Out.Ln;
Out.String("ident: '"); Out.String(ident); Out.Char("'"); Out.Ln;
Out.String("recipient: '"); Out.String(rcpt); Out.Char("'"); Out.Ln;
Out.String("host: '"); Out.String(host); Out.Char("'"); Out.Ln;
Out.String("*** that's it ***"); Out.Ln;
END onPublicMessageWithMention;
PROCEDURE testBot;
VAR
@ -22,7 +55,10 @@ BEGIN
inst.nick := "vocbot";
inst.host := "irc.freenode.net";
inst.port := "6667";
inst.callbackSimple := clbk;
inst.callbackSimple := onMessage;
inst.callbackPrivate := onPrivateMessage;
inst.callbackPublic := onPublicMessage;
inst.callbackPublicMention := onPublicMessageWithMention;