implementation of openchangedb_message functions

This need A LOT more unit test, I'm sure there are more bugs than lines of code here