In case of bad command usage, throw an IllegalArgumentException.
IllegalArgumentException will be caught and handled specially. Whenever
IAE is thrown, it will be caught and command.help() will be called so
that we can receive additional usage instructions. The error and the
help information will be thrown inside a BadCommandInvocationException
which will be handled by the appropriate OperationSet.
In case of such an event, a system message will be fired with the usage
instructions as to inform the user on how to use the command. Other
exceptions will be logged as an error, as they are not expected and
considered to be an implementation issue.
* Moved from 'init' method to constructor.
* Expected format for the constructor described in the Command
interface comments.
* Distinguish between exceptions that occur during construction of the
command, log these and inform the user of an error; and exception
occurring during the execution of the command.
* Better error handling for commands.
To do:
* Add 'help' method to the Command interface.
* Catch IllegalArgumentException and automatically display help()
information to the user.
stack and connection.
This restructuring extracts all the methods that are related to an
established connection such that there is a better separation of
concerns between IRC stack state and the state for an individual
connection.
This way it is even possible to set null connection even before the
connection, its listeners, and its threads are completely disposed of.
This also fixes the bug with auto-join behaviour that occurs because of
multi-threading and bad (i.e. no) synchronization on the IRCApi
instance.
A more advanced pattern that tries to take quotes into account. In case
this pattern does not work, this commit can be reverted and instead a
simpler pattern is used that relies on html tags being opened and closed
with < and > brackets. It assumes that < and > are always part of HTML
tags so any textual (content) occurrence should be replaced with html
entities (escaping).
Now escapes html entities during the parsing of the message received
from IRC and added a unit test for this requirement.
Renamed format* methods to styleAs*, since this is more appropriate.
The following IRC control codes are now supported:
* Bold
* Italics
* Underline
* Normal (clears all outstanding codes)
* Color (foreground and background)
* 16 colors (00 up to and including 15)