BREAKING CHANGES: Run callbacks in main thread and int callback id.

Execute callbacks in main thread. This will break callbacks that
use a long time to execute. Create your own thread in AddCallback
using gorutines on long running callbacks.

Use deterministic IDs for AddCallback. Changes the id from SHA-hash
to int.
This commit is contained in:
Thomas Jager
2016-02-06 21:33:04 +01:00
parent ab737c68eb
commit da78ed515c
4 changed files with 64 additions and 52 deletions

View File

@@ -46,6 +46,20 @@ AddCallback Example
//event.Arguments[0] Contains the channel
});
Please note: Callbacks are run in the main thread. If a callback needs a long
time to execute please run it in a new thread.
Example:
ircobj.AddCallback("PRIVMSG", func(event *irc.Event) {
go func(event *irc.Event) {
//event.Message() contains the message
//event.Nick Contains the sender
//event.Arguments[0] Contains the channel
}(e)
});
Commands
--------
ircobj := irc.IRC("<nick>", "<user>") //Create new ircobj