Partial rewrite to use roundcube internal functions

The plugin is now more folder aware and should correctly treat:
- deletion of messages
- moving of messages
- marking of messages