On Thu, 2008-03-20 at 15:16 +0100, Johannes Berg wrote:
The thing is that I don't know what context the update_keywords function runs in and whether it has a transaction at all, so I don't know how to roll back. I suppose it would be possible to grab the original keyword list before invoking super.update_keywords() and then resetting to that if the backend fails...
I haven't looked at your code, but struct mail always has a transaction (mail->transaction). You could fail the transaction by hooking into transaction_commit and calling rollback if your internal failure-flag was set.
But that sounds a bit extreme. Aren't you just adding/removing a single keyword? If so, you can use mail_update_keywords() to just add/remove that without reading/touching other keywords.