Stanislav N. aka pztrn
e39cceace6
Added eventsMutex and wrap all events calls with it.
...
Due to some "golangish" code this library have possibility to
run into data race when application is working with callbacks.
This commit adds eventsMutex (which is a sync.Mutex), removed
all "golangish" ifs-map reads, and wrap events map read with
sync.Mutex to avoid data races.
2017-10-03 02:03:43 +05:00
Thomas Jager
9e77c40650
Fix lag printing
2016-11-05 18:53:35 +01:00
Taylor Etheredge
62964f02b0
update comment on handling error events
2016-08-02 20:58:54 -05:00
Thomas Jager
582bf80992
Changed the way Quit/Disconnect works to avoid possible DATA races.
...
Rewrote tests to be less spammy. Created REconnection test.
2016-07-27 22:55:55 +02:00
Thomas Jager
39b48423fd
Wrong format type in printf (%s -> %d)
2016-07-25 01:29:47 +02:00
Thomas Jager
da78ed515c
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.
2016-02-06 21:38:53 +01:00
Thomas Jager
6ce1e34c21
Don't crash on empty ACTION
2015-07-31 13:03:09 +02:00
Andy Walker
b0ed3d4bd5
should return in case of CTCP error
2015-07-30 13:03:55 -04:00
Andy Walker
03b22b08f4
Report on unterminated CTCP messages
...
A bug was discovered where, under certain circumstances that are still
being researched, the library would panic on a message that started with
\0x01, but did not end with it. This would cause the re-slice to panic,
because the library assumes a terminating index >0, effectively
introducing the possibility of msg = msg[1:0]. Since this violates the
CTCP spec, it is an error, and should be logged, along with the
complete, escaped message.
2015-07-30 12:58:23 -04:00
Andy Walker
b49099e075
use rand.Seed() in init() to properly randomize
2015-07-20 16:13:15 -04:00
Thomas Jager
087ae892d0
CTCP Messages must be more then 2 characters long.
...
Avoid panic on malformed CTCP messages.
2015-03-31 15:14:13 +02:00
Juliane Clausen
bdde4f62f9
Set irc.currentnick to irc.nick if irc.currentnick is empty.
...
Handle nicks longer than 8 characters for IRC event 437 too.
Fixes issue 43 (IRC client gets stuck on nick collision)
2014-08-27 20:51:31 +02:00
Dumb Thing
d088b73396
no longer breaks on invalid ctcp requests
2014-08-06 00:27:45 +02:00
Thomas Jager
14db1acfd0
Add default callback for ERROR
2014-06-18 15:58:18 +02:00
Brenton Morris
96de31cab4
Fixed a bug in irc_callback.go on line 163 where a Message is treated as an expression istead of a function
2014-05-12 15:27:02 +12:00
tpltnt
8dfda9ca4f
event code clarification
2014-02-14 16:41:58 +01:00
tpltnt
735d2f0040
more doc on callback management
2014-02-14 16:30:09 +01:00
tpltnt
4a8fffa828
some doc on callback management
2014-02-14 16:12:16 +01:00
tpltnt
eef65b116e
some doc on structs
2014-02-14 15:40:25 +01:00
Thomas Jager
9bdf790e25
Fix formats
2014-02-12 08:41:22 +01:00
Thomas Jager
bbbdd715fa
Merge pull request #24 from darkliquid/callback-tweaks
...
Looks good to me. The id generating code may need some tweaking but should work fine as is :)
2014-02-12 08:17:43 +01:00
Andrew Montgomery-Hurrell
bf01c6c9e2
Added ClearCallback method for clearing all callbacks for an event
2014-02-11 23:57:08 +00:00
Andrew Montgomery-Hurrell
6edb7ec06e
Added unique id to callbacks so they can be referenced. Since Go doens't actually provide unique function pointers, we use the closest we can get by grabbing the pointer for the function and slapping a random int on the end. Does it guarantee there will never be a collision? No, but it makes it's pretty damn unlikely that you'll get one during the lifetime of an app unless you are generating millions and millions of callbacks and never, ever deleting them, in which case you probably have something else to worry about
2014-02-11 23:35:13 +00:00
Kaleb Elwert
ea57336e8f
Replaces the Event.Message field with a function
...
Note that this purposefully breaks backwords compatibility. Because of
how Arguments are now handled, this will force users using this library
to update anything using this.
This is not bad, as it seems, because otherwise (just updating the
Event.Arguments to include the Message) the change could cause silent,
strange breakages.
2014-02-12 00:02:58 +01:00
Andrew Montgomery-Hurrell
33d8019793
Added ability to get the index of a callback in the callback registry. Ability to process events against a 'wildcard' handler
2014-02-11 21:44:29 +00:00
Andrew Montgomery-Hurrell
847ce8faa2
Make IRC logger public. No reason for disallowing overrides.
2014-02-10 19:56:16 +00:00
Andrew Montgomery-Hurrell
c0e6d50e0c
Added configurable timeouts and overridable version string
2014-02-09 10:20:58 +00:00
Thomas Jager
a1d207d5fa
Merge pull request #19 from worr/ctcp_action
...
Added support for CTCP ACTION (/me)
2014-02-02 03:21:25 -08:00
William Orr
391b6d42cf
Added support for CTCP ACTION (/me)
2014-02-01 21:38:45 -08:00
joe
c10849b4c0
Loop: catch reconnection errors; writeLoop: only log.Print if Debug
2013-09-25 23:37:11 -04:00
Thomas Jager
0304912f18
Fix crash on nick change
2013-03-13 12:52:31 +01:00
Thomas Jager
be3afcc796
Merge branch 'master' of git://github.com/lye/cleanirc
...
Conflicts:
irc.go
irc_callback.go
irc_struct.go
Merge Interesting changes from fork
2012-11-06 00:38:20 +01:00
Thomas Jager
a5f3a91fd1
go get not working quite as i thought
2012-11-05 23:46:47 +01:00
Thomas Jager
ddf0508cdb
Cleanup old files
2012-11-05 23:41:04 +01:00
Reynir Reynisson
670fd99fb4
Rename IRC{Connection,Event} -> {Connection,Event}
...
I don't feel it's necessary to tag the types with IRC, as a client would
tag it with the module name anyway. Example:
var conn irc.IRCConnection
// ...
vs.
var conn irc.Connection
// ...
2012-05-11 13:35:25 +02:00
lye
4f82a31c9c
Minor tweaks to play nicely with the new go tool
2012-03-28 01:15:26 -05:00
lye
5fe3fea8c0
Hurrah, starting a real fork.
...
The old codebase is too messy for my taste and doesn't provide a clean
enough API. I don't like the name either, so I'm also rebranding it. I
don't care.
2012-03-21 22:38:22 -05:00
Michael Jard
a0256382be
Fixes against weekly.2012-02-22
...
Convert time/duration variables
Clean up duration math
2012-02-25 00:52:19 -08:00
Michael Jard
0a5d471404
fix minor issue where bot tries to set its nick every 15 minutes,
...
even if it has the wanted nick.
2011-05-21 23:24:35 -07:00
Michael Jard
78a4c71736
Add ability to silence callback handler
2011-05-21 21:06:22 -07:00
tj
ea8495857e
Better nick recapture
2011-02-03 01:16:13 +01:00
tj
cf4e9f829a
Crashfix on empty privmsg
2010-11-21 21:20:18 +01:00
tj
deae8abc23
Use append built-in instead of custom function
2010-11-19 19:36:28 +01:00
tj
fd854c475a
Fix adding more then one callback for same eventcode, grow slice dynamically.
2010-10-09 15:11:28 +02:00
Thomas Jäger
3d0ffc5d06
Merge branch 'master' of git@github.com:thoj/Go-IRC-Client-Library
2010-09-23 18:56:15 +02:00
tj
1165a7fbf2
Fix compile + bit more robust reconnect code
2010-09-23 18:54:34 +02:00
tj
bcec3b6f11
Prefix nick instead of suffix if the nick is in use and over 8 characters long
2010-08-08 23:10:54 +02:00
tj
a557416dcf
Better parameter order for ReplaceCallback
2010-03-12 21:55:56 +01:00
tj
2c7ddd7719
Fix time reply
2010-03-12 21:43:50 +01:00
tj
3cf868b6ef
Fix time reply
2010-03-12 21:39:28 +01:00