api: Add a mainloop class

The mainloop class can be used to monitor sockets, files and keep track
of timeouts for multiple objects within a single thread.
It can replace parts of the run function in several plugins and reduce
the number of threads needed. It should also allow SocketManager to be
retired.
licq: Use MainLoop for main thread
rms: Use MainLoop class
jabber: Use MainLoop class
msn: Manage sockets instead of file descriptors
msn: Use MainLoop class

The MainLoop replaces the socket manager and the need for a separate
ping thread allowing mutexes within the MSN plugin to be removed.