Add message processor hooks.

The dump urls is now done as a message processor hook, running in a
separate thread. Since, we have functions doing stuff to files on
threads, we also need a lock, now!
Merge pull request #5 from punchagan/message-processor-hooks

Add message processor hooks.