Commit Graph

231 Commits

Author SHA1 Message Date
Andrew Brampton d7116e2bd0 Also add time to the Connected event. 2014-11-30 16:00:21 -08:00
Andrew Brampton 706c90baa3 Ensure the time field is populated on the pseudo line events, such as connecting and disconnecting. 2014-11-30 15:42:08 -08:00
Andrew Brampton dbcdb4c13d Fixed the building of the server/port string to be IPv6 safe. 2014-11-30 10:09:17 -08:00
Minecrell b533f5b698 Make local bind address configurable. 2014-10-12 19:34:29 +02:00
Bill Thiede 09765bab65 client: track bot mode on who replies. 2014-09-30 15:01:45 -07:00
Alex Bramley 58eaab3f1f New race detector finds more bugs in my crappy code :-) 2014-09-05 15:39:56 +01:00
Alex Bee 7c53f41c56 Merge pull request #46 from 3onyc/master
Make parseLine public by renaming it to ParseLine
2014-07-06 21:38:46 +01:00
3onyc 8f2ab20f4f Make parseLine public by renaming it to ParseLine 2014-07-06 20:26:34 +02:00
StalkR ec98b98fa6 client/mocknetconn_test: minor fix found by go vet
net.IPAddr composite literal uses unkeyed fields
2014-06-19 15:19:37 +02:00
Alex Bee 7711182a72 Use Connected() instead of .connected in String() 2014-06-14 15:50:52 +01:00
Peter SZTANOJEV 3fdd17a2b8 move the disconnection event after we are done disconnecting, there is nothing to be done anyway 2014-05-31 20:34:21 +02:00
Alex Bramley d0606981cb Atomic incrementing of call count for dispatch test (1->0).
This probably could be done better with channels...
2013-09-30 14:49:32 +01:00
Alex Bramley 4eaad0e95e Use call checker instead of writing to shared var in tests (10->1). 2013-09-30 14:43:29 +01:00
Alex Bramley 637cdb573f Put read lock in Connected() (10->9). 2013-09-30 13:55:55 +01:00
Alex Bramley 648864c1d4 Wait for all goroutines before calling initialise (54->10). 2013-09-30 13:26:06 +01:00
Alex Bramley adc6c2917d Use a single control chan to kill mockNetConn goroutines (77->54). 2013-09-30 13:25:24 +01:00
Alex Bramley 144001d109 Split handlers up into three groups. 2013-09-28 00:15:54 +01:00
Alex Bramley 5bb0c8278d Minimally invasive change to put logging behind a user-replaceable interface.
This could probably be done better, and there are probably awful caveats
and hidden gotchas with this approach. I REGRET NOTHING.
2013-09-27 22:19:40 +01:00
Alex Bramley 06a9cb5d0f Give each handler its own copy of *Line.
Thanks to Kevin Ballard for the suggestion.
2013-04-08 18:04:40 +01:00
Alex Bramley 8ae6733942 Use a channel close to kill goroutines.
This tidies things up nicely, especially in some of the tests.
2013-04-08 18:02:34 +01:00
Alex Bramley 8d6b5de994 Don't Error() for EOF, since it's expected. 2013-03-17 21:13:20 +00:00
Alex Bramley 34462b2ad5 Add another Line method to make life easier. 2013-03-17 16:46:39 +00:00
Alex Bramley 5c56572b0d Split long messages at a configurable length. Fixes #29. 2013-03-17 01:21:09 +00:00
Alex Bramley 0b64613fe3 Add VHost() command, because I wants it. 2013-03-15 17:40:28 +00:00
Alex Bramley fd5fddc2cc Returning an error was awkward. Panic when people do things wrong instead. 2013-03-15 17:04:58 +00:00
Alex Bramley e6cf0933b5 Add a version of iopred's Message() and Target() Line methods, and tests. 2013-03-10 15:55:16 +00:00
Alex Bramley 332ff0a27d Fix up parseLine to use these new-fangled constants; fix Copy doc and test. 2013-03-10 15:54:37 +00:00
Alex Bramley 0c25d2d602 Hmm, this is failing occasionally now. Maybe I need a faster computer ;-) 2013-03-10 15:51:43 +00:00
Alex Bramley 31606b7f2f gofmt run. 2013-03-10 13:31:04 +00:00
Alex Bramley ac9d05efa2 Port sp0rkle's panic recovery back into goirc. 2013-03-10 13:30:00 +00:00
Alex Bramley 5f2665dde8 Further comment tidy and code reorg. 2013-03-10 13:16:14 +00:00
Alex Bramley d6cb0bb026 Fix comments and my poor code-reading skills. Damn you StalkR :-) 2013-03-10 12:17:16 +00:00
StalkR 9c832fdbdb merge #34 changes into #32 2013-03-08 23:59:54 +01:00
Chris Rhodes 60b9313a7a Ping/Pong message. 2013-03-07 17:43:33 -08:00
Chris Rhodes d1bf2c3a68 Use constants for named messages. 2013-03-07 17:33:56 -08:00
StalkR 8c5282eda1 client: commands: route commands to Raw and add command injection protection there 2013-03-07 11:54:00 +01:00
StalkR 45ecc205ff client: commands: protection against IRC command injection 2013-03-06 22:46:10 +01:00
StalkR 4fd4d930cf client: 352 who reply: do not warn if nick is me 2013-03-06 22:19:08 +01:00
Alex Bramley 9d069586a7 Don't update Me from WHO/WHOIS reply handlers. Fixes #27. 2013-02-27 23:30:13 +00:00
Alex Bramley 4cd3831e92 Remove Commands from core goirc.
This dictates too much about how people might want to parse and act upon
information from PRIVMSGs, and thus should be an optional thing.
2013-02-27 20:23:24 +00:00
Chris Rhodes f1fe9d99a4 Fix test. 2013-02-18 17:02:58 -08:00
Chris Rhodes 74dea68158 Moved QUIT and VERSION messages into the config. 2013-02-17 22:28:22 -08:00
Alex Bramley fd6fc1269b SimpleClient shouldn't need to return an error. 2013-02-18 01:42:44 +00:00
Alex Bramley 8ed96e4294 Add Me() function for ease of use. 2013-02-18 01:38:04 +00:00
Alex Bramley 12bcc94eeb Add mutex for connect/disconnect locking. 2013-02-18 01:36:52 +00:00
Alex Bramley a323372a0b First steps towards client interface.
- Move all exported vars to Config struct;
- Plumbing for Config.Me etc;
- Constants and INIT/REGISTER handler from github.com/iopred;
2013-02-18 01:36:17 +00:00
Alex Bramley 39882dafd4 Minor rearrangements. 2013-02-17 23:55:39 +00:00
Alex Bramley b1242aa351 Break out tweakable things into a Config struct. 2013-02-16 18:05:56 +00:00
Alex Bramley 45d7b3317f Remove state.StateTracker stutter, hide it in Conn. 2013-02-16 11:29:56 +00:00
Alex Bramley f27e56c8b0 Run gofmt, since it's clearly been a while. 2013-02-16 10:33:15 +00:00
Alex Bramley a674267128 Re-work Handlers for IRC events; add Commands. 2013-02-16 00:17:31 +00:00
Alex Bramley a038856094 Remove embedded logger from client package. 2013-02-16 00:15:23 +00:00
Alex Bramley b39e4717af Allow renicking to be customised. (Closes #14) 2013-01-06 21:01:55 +00:00
Alex Bramley aa021c7cac Fix due to logging api change change. 2012-09-25 23:42:37 +01:00
Alex Bramley 13855ff77b Fix due to logging api change. 2012-09-25 22:39:02 +01:00
Alex Bramley c85f891c6b Bah, dsymonds moved gomock again. 2012-06-26 11:20:57 +01:00
Alex Bramley b98fabe44e Fix go1 time changes up. 2012-06-06 17:12:07 +01:00
Alex Bramley 9c67c42fa1 Merge branch 'release'
Conflicts:
	client/connection.go
	client/connection_test.go
2012-06-06 16:25:07 +01:00
Alex Bramley dbdc470c5c Fix os.EINVAL -> os.ErrInvalid change. 2012-05-14 22:51:01 +01:00
Alex Bramley cb5001bb27 Rate limit testing was not testing properly. Needed abs() and some fixes for time changes. 2012-02-04 23:34:09 +00:00
Alex Bramley a78aed7e7c Functions are not comparable any more, so only compare event names. 2012-02-04 23:32:39 +00:00
Alex Bramley 6fd04236fb "Fix" testing of ratelimiting code. 2012-02-04 01:32:48 +00:00
Alex Bramley eb87e56f96 Mock net.Conn needs updating for interface changes. 2012-02-04 01:16:19 +00:00
Alex Bramley 1c62354cb8 Rewrite flood limiting for new time behaviour. 2012-02-04 01:13:07 +00:00
Alex Bramley dfb6f94b56 Manually managing deadlines is going to *suck*. 2012-02-04 01:12:41 +00:00
Alex Bramley b23215d09b Gofix run. 2012-02-04 00:51:06 +00:00
Alex Bramley be271308c9 Correct import path, again. 2012-02-03 23:48:20 +00:00
Alex Bramley fce8723af0 Basic copy test, to verify expected behaviour. 2011-12-06 00:21:57 +00:00
Alex Bramley f1d0dbe45a If client-side ping can be disabled, we need to ensure something absorbs the shutdown message. 2011-11-15 22:57:29 +00:00
Alex Bramley 3183c9f177 Allow client-side ping to be disabled by setting PingFreq to zero. 2011-11-15 22:22:40 +00:00
Alex Bramley 8fa5e5624e Fix issues/9 by implementing a client-side ping loop. 2011-11-15 22:17:29 +00:00
Alex Bramley e0a5a57fe1 Merge branch 'master' into weekly
Conflicts:
	client/connection.go  # MERGED
	event/registry.go     # DELETED
	logging/mock_test.go  # DELETED
2011-11-13 14:13:55 +00:00
Alex Bramley 907560b599 Migrate to split event pkg. 2011-11-13 14:07:19 +00:00
Alex Bramley 4e4c4b6798 Migrate to split logging pkg. 2011-11-13 14:02:12 +00:00
Alex Bramley 9d5159a220 gofix weekly fixes for client. 2011-11-13 13:34:32 +00:00
Alex Bramley f62470c091 Test rateLimit(). Move call to time.After to write() for ease of testing.
Complete test coverage! Well, for things that matter. I think.
2011-11-11 11:17:18 +00:00
Alex Bramley dbc9c5f09d Misc minor fixen. 2011-11-11 10:49:33 +00:00
Alex Bramley 6a54622df9 Make mockNetConn more likely to expose racy conditions.
Use buffered channels so that Close() returns without waiting.
Use an array of three channels rather than appending to a slice.
2011-11-11 10:48:58 +00:00
Alex Bramley dc524420b0 Test write(). Fix bug where return of Flush() was not checked. 2011-11-11 10:17:17 +00:00
Alex Bramley 19ea7138e5 Test runLoop(). Needed a lot of sleeps... 2011-11-11 09:23:12 +00:00
Alex Bramley 9ccb0a39ab Test recv(). 2011-11-11 08:35:23 +00:00
Alex Bramley 0d4e83ea7f Fix length bug in mockNetChan.
Using the length of the provided buffer is dangerous after the first buffered
read from it, as it'll be the length of the buffer size...
2011-11-11 08:34:55 +00:00
Alex Bramley 38cd23891a Streamline timers in mockNetConn slightly. 2011-11-11 08:00:18 +00:00
Alex Bramley bfdd895ca6 Test send(). 2011-11-11 07:59:16 +00:00
Alex Bramley d4aceddcd7 Test Client creation and ST enable/disable. 2011-11-10 15:06:44 +00:00
Alex Bramley a271cc06f3 Use mock dispatcher for testing event triggering. 2011-11-07 14:53:07 +00:00
Alex Bramley 3feaa7f302 Use a static map of event handlers for internal handlers too. 2011-11-07 13:44:03 +00:00
Alex Bramley aa75e0e0c6 Make enabling/disabling state-tracking easier. Improve constructors. 2011-11-07 13:34:13 +00:00
Alex Bramley 4853024928 Nuke extraneous makefiles, no longer needed. 2011-11-06 06:26:59 +00:00
Alex Bramley caa9429a74 Update README. 2011-11-06 05:22:02 +00:00
Alex Bramley 2bc8238f8e Move state-related handlers to their own file for clarity. 2011-11-06 05:11:49 +00:00
Alex Bramley 85097043cf Epic final commit for nick/chan/logging/testing refactor.
* Brings logging changes to client library.
* Brings state tracker to client library.
* Rewrites all tests to use mock logger and mock state tracker.
* Makes state tracking optional, finally.
* Shaves yaks until they are almost completely bald.
2011-11-06 04:56:46 +00:00
Alex Bramley f128ce84b4 Start of breaking out state tracking into separate package. 2011-10-08 10:42:15 +01:00
Alex Bramley a0020f4e62 Method to initialise tracker memory. 2011-10-08 10:40:58 +01:00
Alex Bramley d072abbb76 Give nicks an awareness of me. 2011-10-07 00:19:31 +01:00
Alex Bramley 7a17ee9eb5 State tracking refactor completer. 2011-10-06 23:54:34 +01:00
Alex Bramley e36caa3a3d Merge branch 'logging' into nickchan-refactor
Conflicts:
	client/nickchan.go

Fix up some inconsistencies in the beginning of the nickchan refactor too.
2011-10-06 22:33:06 +01:00
Alex Bramley 3e1b2c0f81 Turns out gofmt isn't big on spaces sometimes. 2011-09-29 22:58:04 +01:00
Alex Bramley de66051d07 Convert conn.Err into logging.
Also, remove all error-side-effect testing cos it was a bit shit.
First step on the long road to refactoring the nick/chan state tracking
and making everything more testable and mockable with interfaces.
2011-09-29 22:54:54 +01:00
Alex Bramley eb6ac4ce05 Tracking wip. 2011-09-28 20:48:58 +01:00