I don't know if there is still interest in this, but I'm sending here the patch rebased to the current master branch.