Daniel,
Thinking about it further, I would rather replace this block: `if(ostate==DLG_STATE_CONFIRMED && sval==DLG_STATE_DELETED) {` by this one: `if(sval==DLG_STATE_DELETED) {`
Because if a dialog is changed to deleted state from a state < 4, it stays in the dialog memory for no reason. I think it would be cleaner to reset the timestamps each time the state is set to 5, whatever the old state was.
What is your opinion about this?