The whole mailbox/append code leaves me a bit lost, but I've tracked down the general area of the problem, Ken maybe you can work out what the right fix is, I don't think it's hard.

sieve_fileinto() does the following:

1. cast void * sc -> script_data_t *sd
2. pass "sd->username" as the "authuser" param to deliver_mailbox()
3. deliver_mailbox() calls append_setup() with "authuser" as the "userid" param 4. append_setup() copys the "userid" parameter into the "appendstate.userid" struct area 5. during append_commit() "appendstate.userid" is used as the username to add the seen flag to

That all works fine.

However, sieve_keep() does the following:

1. cast void *mc -> deliver_data_t *mydata
2. pass "mydata" as the "mydata" param to deliver_local()
3. deliver_local() calls deliver_mailbox(), with "mydata->authuser" as the "userid" param

The value in mydata->authuser is not the username, in fact they're empty:

(gdb) p *mydata
$29 = { ..., authuser = 0x0, authstate = 0x0}

This means the seen flag never gets stored correctly if you're using keep or the implicit keep, you have to use fileinto.

I'm not sure of the best way of fixing this. I can see the obvious solution (in sieve_keep, cast void * sc -> script_data_t *sd, and copy authuser and authstate sd to mydata), but that doesn't feel right to me.

Ken, do you know what the right solution is here?

Rob

Reply via email to