Commit Graph

36 Commits

Author SHA1 Message Date
Jan Vidar Krey 845aefc941 Decouple hub and user manager more cleanly. 2012-09-27 15:29:00 +02:00
Jan Vidar Krey 74ca5a0a33 Cleaned up command handling code, by splitting into multiple files. 2012-05-01 20:15:49 +02:00
Jan Vidar Krey df7bbc094f Command arguments handling + cleanups
Fix bug #185 - Args of !commands lost/damaged.
All string arguments were incorrectly freed after being added to the argument list for a command.
Instead this fix makes sure it is properly copied into a new string, and by doing so this requires
a new API for dealing with hub command arguments in a type safe manner, and also allows for each
argument to be cleaned up properly when the command is no longer needed.

This also fixes issues with parse errors for certain types, and optional arguments (previously it was impossible
to tell the difference for an integer with value 0 or if no integer was given).

All arguments can now be accessed through the new functions
hub_command_arg_reset() and hub_command_arg_next().

These functions are also exposed to plug-ins.

The argument type notations for 'n' has changed to mean nick (string),
and 'u' is used for a user (struct hub_user - must be online).
2012-04-18 23:03:05 +02:00
Jan Vidar Krey f2cb84180a Refactored command parsing.
Allows for automatically tested command parsing by splitting parsing
and invokation of the commands.
2011-12-19 00:34:45 +01:00
Jan Vidar Krey b993e97bb4 Fix bug in config parser where 'foo=bar' did not work, but 'foo = bar' did work due to extra whitespace between tokens. 2010-11-18 22:43:48 +01:00
Jan Vidar Krey dbf790bb93 Added autotests for credentials handling. 2010-07-29 11:22:04 +02:00
Jan Vidar Krey 1ff0f54a4b Fixup some minor details in tests. 2010-07-23 00:34:49 +02:00
Jan Vidar Krey d41d649353 Encapsulate token API. 2010-07-18 19:43:11 +02:00
Jan Vidar Krey 4b22ccb73c Added a proper config file tokenizer that supports escaping sequences
and comments.

This allows for:

'"foo bar"' can be represented as 'foo\ bar'.

And allows for comments using the hash symbol (#), but not inside
escapes or quotes. "#this is not a comment", \#this\ is\ not\ a comment.

All configuration file parsers should be rewritten using this functionality.
2010-07-09 14:01:03 +02:00
Jan Vidar Krey 198d86a1ee Added some automatic tests for the timeout handling. 2010-02-25 17:57:50 +01:00
Jan Vidar Krey 59ed268f4d Added test cases for sid allocation.
This revealed a few bugs:
* when sid allocator is full, then uhub will loop indefinitely when allocating one more (unlikely to occur).
* looking up a user object based on a sid that is out of range (off by one) returns invalid memory.
2010-02-18 16:02:13 +01:00
Jan Vidar Krey 963416ad73 Cleanup reference adc message reference counting somewhat. 2010-02-16 20:51:10 +01:00
Jan Vidar Krey 56605f7dcb Fix autotest crash. 2010-02-11 01:18:45 +01:00
Jan Vidar Krey 1599f63134 Make sure the autotests work. 2010-01-28 00:07:42 +01:00
Jan Vidar Krey 1bb3bd90c1 Use non-default port to ensure autotests work even though a hub is running on the default port. 2010-01-22 16:05:48 +01:00
Jan Vidar Krey f84073f7cc Various fixes for epoll handling without libevent.
This should take care of most compile issues as well as busy loops caused by unhandled recv() calls returning 0 and general cleanups.
2010-01-19 17:52:58 +01:00
Jan Vidar Krey a3d6646b99 Fix a failing autotest. 2009-08-31 20:37:47 +02:00
Jan Vidar Krey 86ba3ca86f Complete moving all connection related data out of the hub_user object. 2009-08-07 00:22:30 +02:00
Jan Vidar Krey 1f24bd6812 Fix autotests. 2009-08-02 22:29:22 +02:00
Jan Vidar Krey 112fa2f845 Fixes to tests. 2009-07-26 06:27:16 +02:00
Jan Vidar Krey 945c6be14c Added tests for ip_convert_address_to_range 2009-07-26 06:21:22 +02:00
Jan Vidar Krey 099ed6dbe2 Fix autotest 2009-07-26 06:06:27 +02:00
Jan Vidar Krey 041ce7a1fb Generalized the IP range and mask parsing code. 2009-07-26 03:56:55 +02:00
Jan Vidar Krey 367871e476 Renamed all "struct user" to hub_user in order to resolve a naming conflict on OpenWRT.
Basically: sed -i 's/struct user/struct hub_user/g' `find -type f`
2009-07-26 01:47:17 +02:00
Jan Vidar Krey 8b5bfdd922 Compile fix. 2009-05-27 18:05:34 +02:00
Jan Vidar Krey 1dbf2640d2 More API fixes; remove implicit relationship between hub and user
in APIs.
2009-05-18 16:30:17 +02:00
Jan Vidar Krey 326fcc467c Moved the update_user_info code into user_update_info 2009-05-16 12:32:48 +02:00
Jan Vidar Krey 82ac450b4b Fixed further memory leaks in autotests. 2009-05-16 04:03:00 +02:00
Jan Vidar Krey 968266b22f Fix memory leaks. 2009-05-16 03:44:51 +02:00
Jan Vidar Krey 953db2dcbc Fixed some autotest memory leaks. 2009-05-16 03:06:14 +02:00
Jan Vidar Krey 6e4ac1355f Fix autotest crashers. 2009-05-16 02:33:43 +02:00
Jan Vidar Krey 8af965c0ca Fixed utf8 parse issue.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-24 00:21:38 +01:00
Jan Vidar Krey 156c137237 Autotest for bug #12
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 21:55:24 +01:00
Jan Vidar Krey 95b741bb5e More message tests. 2009-03-23 14:58:15 +01:00
Jan Vidar Krey 7a9d40d8dd Fix autotests for event queue.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 17:42:29 +01:00
Jan Vidar Krey ac56e7a5b9 First git commit. 2009-02-19 17:14:09 +01:00