add Get, Refresh commands; refresh at startup

This commit is contained in:
rsc 2007-06-23 06:14:23 +00:00
parent bb70a84b1f
commit 7cc0e47fa8

View file

@ -233,6 +233,7 @@ threadmain(int argc, char *argv[])
proccreate(plumbproc, nil, STACK); proccreate(plumbproc, nil, STACK);
proccreate(plumbshowproc, nil, STACK); proccreate(plumbshowproc, nil, STACK);
threadcreate(plumbshowthread, nil, STACK); threadcreate(plumbshowthread, nil, STACK);
fswrite(mbox.ctlfd, "refresh", 7);
/* ... and use this thread to read the messages */ /* ... and use this thread to read the messages */
plumbthread(); plumbthread();
} }
@ -441,6 +442,25 @@ mboxcommand(Window *w, char *s)
rewritembox(wbox, &mbox); rewritembox(wbox, &mbox);
return 1; return 1;
} }
if(strcmp(s, "Get") == 0){
if(mbox.dirty){
mbox.dirty = 0;
fprint(2, "mail: mailbox not written\n");
return 1;
}
winsetaddr(w, ",", 1);
if(w->data == nil)
w->data = winopenfile(w, "data");
fswrite(w->data, "", 0);
mesgmenu(wbox, &mbox);
winclean(wbox);
fswrite(mbox.ctlfd, "refresh", 7);
return 1;
}
if(strcmp(s, "Refresh") == 0){
fswrite(mbox.ctlfd, "refresh", 7);
return 1;
}
if(strcmp(s, "Delmesg") == 0){ if(strcmp(s, "Delmesg") == 0){
save = nil; save = nil;
if(nargs > 1) if(nargs > 1)