Store CTCP ACTIONs recieved as well as normal PRIVMSGs.

Prepends CTCP ACTION messages recieved with a "* " before storing them.
Additionally change AddMessage to accept const CString&
Merge pull request #599 from NuclearW/awaystore-action

In awaystore, store CTCP ACTIONs
make the log filename lower case always

this fixes an annoying bug where two separate log files will be written
if an irc client sends to channel #Foobar and another irc client sends
to channel #foobar.
Merge pull request #590 from FruitieX/master

Use only lower case characters in log filenames
Add numerics 307 and 379 to route_replies for whois
UnrealIRCd (at least version Unreal3.2.10+) sends numerics 307 and 379 on whois if the client is an IRCop.
These are non-rfc and they can be seen documented here: https://www.alien.net.au/irc/irc2numerics.html
Merge pull request #600 from NuclearW/route-reply

Add numerics 307 and 379 to route_replies for whois
Add timestamp parsing to awaystore away messages
Pass the given reason through CUtils::FormatTime before setting it, allows use of strftime formatting in away messages.
Merge pull request #611 from NuclearW/awaystore-timestamp

Add timestamp parsing to awaystore away messages
Full-fledged query buffers

Store query buffers per query the same way it's done for channels.

This allows clients to implement persistent query buffers. Queries
remain open across clients and sessions until a client explicitly
sends a command to clear a (closed) query buffer.

A new config option AutoClearQueryBuffer that default to false
ensures behavioral backwards compatibility, and another config
MaxQueries protects from OOM eg. due to PM attacks.
controlpanel: add support for AutoClearQueryBuffer & MaxQueries
webadmin: add support for AutoClearQueryBuffer & MaxQueries
clearbufferonmsg: handle query buffers
savebuff: handle query buffers
Threads: Add some undefined constructors etc

This is needed to "get rid" of the C++ default implementation. Yes, I know that
this can be done way nicer with C++11...

Signed-off-by: Uli Schlachter <psychon@znc.in>
StringTest: Make a local function static

Signed-off-by: Uli Schlachter <psychon@znc.in>
Add a ThreadTest to the testsuite

Signed-off-by: Uli Schlachter <psychon@znc.in>
modpython, modperl: Parse all headers

Signed-off-by: Uli Schlachter <psychon@znc.in>
Threads.h: Add some doxygen comments

Signed-off-by: Uli Schlachter <psychon@znc.in>
CThreadPool: Add cancellation support

This adds CThreadPool::cancelJob() and cancelJobs() which can cancel a set of
jobs synchronously. These functions only return when the job was successfully
cancelled.

It tries to cancel the jobs as quickly as possible, skipping any callbacks on
CJob that were not yet called. A job that is already running can use
CJob::wasCancelled() to check if it should quit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
CThreadPool: Fix a race when starting threads

There was a race where threads were themselves responsible for increasing the
counter for the number of running threads. This left an open window where the
thread was already started, but our counter was not yet increased. The effect of
this race would be that we start more threads than we should.

Fix this by increasing the counter before actually starting new worker threads.

Signed-off-by: Uli Schlachter <psychon@znc.in>