From: Karl Dahlke <eklhad@comcast.net>
To: edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] [PATCH] A couple new directories for future mail features.
Date: Sun, 3 Apr 2011 18:01:58 -0400 [thread overview]
Message-ID: <1301868118-29404-1-git-send-email-eklhad@comcast.net> (raw)
I'd rather do this in small steps.
Not one big patch that changes everything about how mail works.
This one just sets up a couple directories for unread mail and for
unformatted mail that you probably won't need, but if you do it's there.
---
src/eb.h | 4 ++++
src/main.c | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/src/eb.h b/src/eb.h
index 3dd14d3..5b28cd5 100644
--- a/src/eb.h
+++ b/src/eb.h
@@ -224,6 +224,10 @@ extern void *jdloc; /* javascript document.location */
extern int maxAccount; /* how many email accounts specified */
extern int localAccount; /* this is the smtp server for outgoing mail */
extern char *mailDir; /* move to this directory when fetching mail */
+extern char *mailUnread; /* place to hold fetched but unread mail */
+/* Keep a copy of unformatted mail that you probably won't need again,
+ * but you never know. Should probably live somewhere under .Trash */
+extern char *mailStash;
extern struct MACCOUNT accounts[]; /* all the email accounts */
extern int maxMime; /* how many mime types specified */
extern struct MIMETYPE mimetypes[];
diff --git a/src/main.c b/src/main.c
index e14c7f7..40215ee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -42,6 +42,7 @@ uchar dirWrite, endMarks;
int context = 1;
uchar linePending[MAXTTYLINE];
char *changeFileName, *mailDir;
+char *mailUnread, *mailStash;
char *addressFile, *ipbFile;
char *home, *recycleBin, *configFile, *sigFile, *sigFileEnd;
char *cookieFile, *spamCan;
@@ -543,6 +544,14 @@ readConfigFile(void)
mailDir = v;
if(fileTypeByName(v, false) != 'd')
i_printfExit(MSG_ERBC_NotDir, v);
+ mailUnread = allocMem(strlen(v) + 12);
+ sprintf(mailUnread, "%s/unread", v);
+/* We need the unread directory, else we can't fetch mail. */
+/* Create it if it isn't there. */
+ if(fileTypeByName(mailUnread, false) != 'd') {
+ if(mkdir(mailUnread, 0700))
+ i_printfExit(MSG_ERBC_NotDir, mailUnread);
+ }
continue;
case 20:
@@ -1012,6 +1021,7 @@ main(int argc, char **argv)
recycleBin = allocMem(strlen(home) + 8);
sprintf(recycleBin, "%s/.Trash", home);
+
edbrowseTempFile = allocMem(strlen(recycleBin) + 8 + 6);
/* The extra 6 is for the suffix */
sprintf(edbrowseTempFile, "%s/eb_tmp", recycleBin);
@@ -1019,13 +1029,27 @@ main(int argc, char **argv)
sprintf(edbrowseTempPDF, "%s/eb_pdf", recycleBin);
edbrowseTempHTML = allocMem(strlen(recycleBin) + 13);
sprintf(edbrowseTempHTML, "%s/eb_pdf.html", recycleBin);
+
if(fileTypeByName(recycleBin, false) != 'd') {
if(mkdir(recycleBin, 0700)) {
+/* Don't want to abort here; we might be on a readonly filesystem.
+ * Don't have a Trash directory and can't creat one; yet we should move on. */
free(recycleBin);
recycleBin = 0;
}
}
+ if(recycleBin) {
+ mailStash = allocMem(strlen(recycleBin) + 12);
+ sprintf(mailStash, "%s/rawmail", recycleBin);
+ if(fileTypeByName(mailStash, false) != 'd') {
+ if(mkdir(mailStash, 0700)) {
+ free(mailStash);
+ mailStash = 0;
+ }
+ }
+ }
+
sigFile = allocMem(strlen(home) + 20);
sprintf(sigFile, "%s/.signature", home);
sigFileEnd = sigFile + strlen(sigFile);
--
1.7.4
reply other threads:[~2011-04-03 22:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301868118-29404-1-git-send-email-eklhad@comcast.net \
--to=eklhad@comcast.net \
--cc=edbrowse-dev@lists.the-brannons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).