msg.Copy() makes a deep-copy of the msg object

There was a copy function that did shallow copies of the msg
object. Export it and make it support proper deep copying.
Merge pull request #74 from majek/marek/deepcopy

msg.Copy() makes a deep-copy of the msg object