diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-06-18 18:52:54 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-06-18 18:52:54 +0200 |
commit | a1c1e00973b8799860db594e64a9dee231e325d1 (patch) | |
tree | 6a0f493a57f04ceaab2c6f3253cc92d77a3819cf /sys/src/cmd/upas/fs/mdir.c | |
parent | c3d372c3dae46dbf4657ded30dc3b2bf6c369f59 (diff) |
upas/fs: work in progress...
get plumbing logic out of mailbox drivers, all handled from
syncmbox() now. avoid reentrancy in syncmbox().
store attachment filename in index, so that we can return it
in mail info without fetching headers. (used to return blank
filename when read out of the index messing up attachments in
nedmail).
maintain Message.size for attachments.
get rid of string "refs" and just have a simple string intern
table (only used for Message.type and Message.charset).
Message.replyto and Message.filename are owned by the index,
so don't free in delmessage().
Diffstat (limited to 'sys/src/cmd/upas/fs/mdir.c')
-rw-r--r-- | sys/src/cmd/upas/fs/mdir.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/sys/src/cmd/upas/fs/mdir.c b/sys/src/cmd/upas/fs/mdir.c index 283f09093..782ea7bae 100644 --- a/sys/src/cmd/upas/fs/mdir.c +++ b/sys/src/cmd/upas/fs/mdir.c @@ -109,9 +109,9 @@ dircmp(Dir *a, Dir *b) } static char* -mdirread(Mdir* mdir, Mailbox* mb, int doplumb, int *new) +mdirread(Mdir* mdir, Mailbox* mb) { - int i, nnew, ndel, fd, n, c; + int i, fd, n, c; uvlong uv; Dir *d; Message *m, **ll; @@ -127,7 +127,6 @@ mdirread(Mdir* mdir, Mailbox* mb, int doplumb, int *new) close(fd); return err; } - *new = nnew = 0; if(mb->d){ if(d->qid.path == mb->d->qid.path) if(d->qid.vers == mb->d->qid.vers){ @@ -149,7 +148,6 @@ mdirread(Mdir* mdir, Mailbox* mb, int doplumb, int *new) } qsort(d, n, sizeof *d, (int(*)(void*, void*))dircmp); - ndel = 0; ll = &mb->root->part; for(i = 0; (m = *ll) != nil || i < n; ){ if(i < n && dirskip(d + i, &uv)){ @@ -170,7 +168,6 @@ mdirread(Mdir* mdir, Mailbox* mb, int doplumb, int *new) i++; continue; } - nnew++; m = newmessage(mb->root); m->fileid = uv; m->size = d[i].length; @@ -178,15 +175,10 @@ mdirread(Mdir* mdir, Mailbox* mb, int doplumb, int *new) m->next = *ll; *ll = m; ll = &m->next; - newcachehash(mb, m, doplumb); - putcache(mb, m); i++; }else if(c > 0){ /* deleted message; */ mdprint(mdir, "deleted: %s (%D)\n", i<n? d[i].name: 0, m? m->fileid: 0); - ndel++; - if(doplumb) - mailplumb(mb, m, 1); m->inmbox = 0; m->deleted = Disappear; ll = &m->next; @@ -196,11 +188,8 @@ mdirread(Mdir* mdir, Mailbox* mb, int doplumb, int *new) i++; } } - free(d); - logmsg(nil, "mbox read: %d new %d deleted", nnew, ndel); finished: - *new = nnew; return nil; } @@ -220,13 +209,13 @@ mdirdelete(Mailbox *mb, Message *m) } static char* -mdirsync(Mailbox* mb, int doplumb, int *new) +mdirsync(Mailbox* mb) { Mdir *mdir; mdir = mb->aux; mdprint(mdir, "mdirsync()\n"); - return mdirread(mdir, mb, doplumb, new); + return mdirread(mdir, mb); } static char* |