add a thread-safe message queue (fifo)
use re-entrant versions of rand & strtok on functions that are being called by multiple threads
remove most typedefs. Only use them to keep structs private. Prepend all bot commands with bot_ to make them stand better and to remind that they must be thread-safe
launch commands in a new thread instead of process
use compiler builtins to atomically access & change state of mpd struct members
make curl functions thread-safe by disabling signals and registering openssl crypto callbacks for use with https sites
use threads instead of forking in bot_url, make twitter functions re-entrant and make sure we don't leave zombies in the only case we use fork()
remove all references to mmap
refactor some code into seperate functions and add TIME & PING ctcp replies
use loop initial declarations where it's cleaner to do so
BSD compatibility improvements by being POSIX compliant.
Can't make assumptions of the pthread_t type, so don't use arithmetic on
it. On platforms where pthread_t is not a scalar type, we can't use
CRYPTO_THREADID_set_numeric. We have to use CRYPTO_THREADID_set_pointer.
So instead of clobbering the file with #ifdef's, remove the
CRYPTO_THREADID_set_callback() alltogether and let openssl use the
default implementation.
Only seed once on program initialization instead of each new thread.
We don't care much if threads interrupt the random sequence meant for
other threads. Use the posix version of random() instead of rand() and
getcwd() instead of the GNU specific get_current_dir_name().