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.
Initialize OpenSSL locking functions
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>
Modules: Add a module version of CJob

Signed-off-by: Uli Schlachter <psychon@znc.in>
sample: Add an example for CModuleJob

Signed-off-by: Uli Schlachter <psychon@znc.in>
Merge pull request #598 from jpnurmi/query

Full-fledged query buffers
Fix CChan::SendBuffer()

The CChan::SendBuffer(CClient,CBuffer) overload should just playback
the given buffer and obviously not clear the channel's own buffer
=> auto-clear the buffer in CChan::SendBuffer(CClient) as appropriate.
Merge pull request #619 from jpnurmi/cchan-sendbuffer

Fix CChan::SendBuffer()