summaryrefslogtreecommitdiff
path: root/sys/src/cmd/upas/fs
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2019-12-09 12:46:27 -0800
committerOri Bernstein <ori@eigenstate.org>2019-12-09 12:46:27 -0800
commitf7431283d906b1cd7e53eed47af055a5132bbfae (patch)
tree0cf610c006a09a3d9e9fd30a89286265ca25a38b /sys/src/cmd/upas/fs
parent55af35eeeb3026ee9aba3658b7ba12d6ea3a5015 (diff)
upas/fs plumb flag changes.
This patch makes 3 changes: - It makes upas/fs send plumb messages when a message changes in the background (eg, someone on another imap connection opens a message and sets the read flag) - It makes faces not complain when it gets one of these new modify messages. - It makes acme/Mail update the flags in the display when it gets one of these messages.
Diffstat (limited to 'sys/src/cmd/upas/fs')
-rw-r--r--sys/src/cmd/upas/fs/dat.h1
-rw-r--r--sys/src/cmd/upas/fs/imap.c4
-rw-r--r--sys/src/cmd/upas/fs/mbox.c25
3 files changed, 16 insertions, 14 deletions
diff --git a/sys/src/cmd/upas/fs/dat.h b/sys/src/cmd/upas/fs/dat.h
index 58128644e..3e3fb48bb 100644
--- a/sys/src/cmd/upas/fs/dat.h
+++ b/sys/src/cmd/upas/fs/dat.h
@@ -7,6 +7,7 @@ enum {
Cheader = 1<<2,
Cbody = 1<<3,
Cnew = 1<<4,
+ Cmod = 1<<5,
/* encodings */
Enone= 0,
diff --git a/sys/src/cmd/upas/fs/imap.c b/sys/src/cmd/upas/fs/imap.c
index 6f9a2a4d9..4b1226f12 100644
--- a/sys/src/cmd/upas/fs/imap.c
+++ b/sys/src/cmd/upas/fs/imap.c
@@ -35,7 +35,7 @@ typedef struct {
uvlong uid;
ulong sizes;
ulong dates;
- ulong flags;
+ uint flags;
} Fetchi;
typedef struct Imap Imap;
@@ -1006,6 +1006,8 @@ again:
m->deleted = Disappear;
ll = &m->next;
}else{
+ if((m->flags & ~Frecent) != (f[i].flags & ~Frecent))
+ m->cstate |= Cmod;
m->flags = f[i].flags;
ll = &m->next;
i++;
diff --git a/sys/src/cmd/upas/fs/mbox.c b/sys/src/cmd/upas/fs/mbox.c
index c97bb8d9c..f7b56643e 100644
--- a/sys/src/cmd/upas/fs/mbox.c
+++ b/sys/src/cmd/upas/fs/mbox.c
@@ -58,9 +58,6 @@ static Mailboxinit *boxinit[] = {
static void delmessage(Mailbox*, Message*);
static void mailplumb(Mailbox*, Message*);
-/*
- * do we want to plumb flag changes?
- */
char*
syncmbox(Mailbox *mb, int doplumb)
{
@@ -90,16 +87,13 @@ syncmbox(Mailbox *mb, int doplumb)
cachehash(mb, m);
m->cstate |= Cnew;
n++;
- } else if(!doplumb)
- m->cstate &= ~Cnew;
- if(m->cstate & Cnew){
- if(ensurecache(mb, m) == 0){
- if(doplumb)
- mailplumb(mb, m);
- msgdecref(mb, m);
- }
- m->cstate &= ~Cnew;
}
+ if((m->cstate & (Cnew|Cmod)) && ensurecache(mb, m) == 0){
+ if(doplumb)
+ mailplumb(mb, m);
+ msgdecref(mb, m);
+ }
+ m->cstate &= ~(Cnew|Cmod);
}
if(m->cstate & Cidxstale)
y++;
@@ -1555,7 +1549,12 @@ mailplumb(Mailbox *mb, Message *m)
a[ai-1].next = &a[ai];
a[++ai].name = "mailtype";
- a[ai].value = !m->inmbox ? "delete": "new";
+ if(m->cstate & Cmod)
+ a[ai].value = "modify";
+ else if (!m->inmbox)
+ a[ai].value = "delete";
+ else
+ a[ai].value = "new";
a[ai-1].next = &a[ai];
snprint(date, sizeof date, "%Δ", m->fileid);