* [Edbrowse-dev] [PATCH] Restructure the email interface to separate -f and -m
@ 2011-04-08 22:48 Karl Dahlke
2011-04-09 11:05 ` Chris Brannon
0 siblings, 1 reply; 2+ messages in thread
From: Karl Dahlke @ 2011-04-08 22:48 UTC (permalink / raw)
To: edbrowse-dev
-f is now fetchmail, -m reads the mail in mbox/unread.
-fm is shorthand to do both.
Fetch is done first, then the scan through the emails;
so you're not under the gun on what to do with each email,
before the pop3 server times out.
-fm# specify an account number to fetch your mail from.
-fm fetch mail from all accounts,
excluding duplicates, and excluding accounts with "nofetch" in the descriptor.
Filtering takes place in the -m side, so any fetchmail client could be used,
as long as some follow-on shell script places
the mail files in the unread directory,
and follows our numbering convention 1 2 3 4 etc.
---
src/eb.h | 4 +-
src/eb.p | 3 +-
src/fetchmail.c | 363 ++++++++++++++++++++++++++++++++-----------------------
src/main.c | 74 +++++++++--
src/messages.c | 10 ++-
src/messages.h | 2 +
src/sendmail.c | 1 -
7 files changed, 289 insertions(+), 168 deletions(-)
diff --git a/src/eb.h b/src/eb.h
index 2497d02..8345fd0 100644
--- a/src/eb.h
+++ b/src/eb.h
@@ -168,6 +168,7 @@ struct MACCOUNT { /* pop3 account */
char *inurl, *outurl;
int inport, outport;
uchar inssl, outssl;
+ char nofetch;
};
struct MIMETYPE {
@@ -199,7 +200,6 @@ extern bool js_redirects; /* window.location = new_url */
extern uchar browseLocal; /* browsing a local file */
extern bool parsePage; /* parsing the html page, and any java therein */
extern bool htmlAttrVal_nl; /* allow nl in the attribute of an html tag */
-extern bool unformatMail; /* suppress formatting */
extern bool passMail; /* pass mail across the filters */
extern bool errorExit; /* exit on any error, for scripting purposes */
extern bool isInteractive;
@@ -223,7 +223,7 @@ 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 */
+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;
diff --git a/src/eb.p b/src/eb.p
index cc704ab..5fb3e3a 100644
--- a/src/eb.p
+++ b/src/eb.p
@@ -109,7 +109,8 @@ bool sendMailCurrent(int sm_account, bool dosig) ;
/* sourcefile=fetchmail.c */
void loadBlacklist(void) ;
bool onBlacklist1(IP32bit tip) ;
-void fetchMail(int account, bool fetch) ;
+void fetchMail(int account) ;
+void scanMail(void) ;
bool emailTest(void) ;
void unpackUploadedFile(const char *post, const char *boundary, char **postb, int *postb_l) ;
char * emailParse(char *buf) ;
diff --git a/src/fetchmail.c b/src/fetchmail.c
index 25b9eb8..a0fe001 100644
--- a/src/fetchmail.c
+++ b/src/fetchmail.c
@@ -272,45 +272,65 @@ writeAttachments(struct MHINFO *w)
} /* writeAttachments */
/* find the last mail in the unread directory */
-static int unreadNumber;
+static int unreadMax, unreadMin, unreadCount;
+static int unreadBase; /* find min larger than base */
+
static void
-lastUnread(void)
+unreadStats(void)
{
const char *f;
int n;
- unreadNumber = 0;
+ unreadMax = 0;
+ unreadMin = 0;
+ unreadCount = 0;
while(f = nextScanFile(mailUnread)) {
if(!stringIsNum(f))
continue;
n = atoi(f);
- if(n > unreadNumber)
- unreadNumber = n;
+ if(n > unreadMax)
+ unreadMax = n;
+ if(n > unreadBase) {
+ if(!unreadMin || n < unreadMin)
+ unreadMin = n;
+ ++unreadCount;
+ }
}
-} /* lastUnread */
+} /* unreadStats */
+
+static char *umf; /* unread mail file */
+static char *umf_end;
+static int umfd; /* file descriptor for the above */
+/* string to hold the mail message, and then its length */
+static char *mailstring;
+static int mailstring_l;
+/* convert mail message to/from utf8 if need be. */
+/* This isn't really right, cause it should be done per mime component. */
+static char *mailu8;
+static int mailu8_l;
void
-fetchMail(int account, bool fetch)
+fetchMail(int account)
{
const struct MACCOUNT *a = accounts + account - 1;
const char *login = a->login;
const char *pass = a->password;
const char *host = a->inurl;
int nmsgs, m, j, k;
- char *umf; /* unread mail file */
- char *umf_end;
-
- if(!isInteractive)
- i_printfExit(MSG_FetchNotBackgnd);
if(!mailDir)
i_printfExit(MSG_NoMailDir);
if(chdir(mailDir))
i_printfExit(MSG_NoDirChange, mailDir);
- if(!loadAddressBook())
- showErrorAbort();
+ if(!umf) {
+ umf = allocMem(strlen(mailUnread) + 12);
+ sprintf(umf, "%s/", mailUnread);
+ umf_end = umf + strlen(umf);
+ }
+ unreadBase = 0;
+ unreadStats();
if(!mailConnect(host, a->inport, a->inssl))
showErrorAbort();
@@ -318,6 +338,7 @@ fetchMail(int account, bool fetch)
showErrorAbort();
if(memcmp(serverLine, "+OK ", 4)) {
i_printf(MSG_BadPopIntro, serverLine);
+ mailClose();
return;
}
sprintf(serverLine, "user %s%s", login, eol);
@@ -328,6 +349,7 @@ fetchMail(int account, bool fetch)
} /* password */
if(memcmp(serverLine, "+OK", 3)) {
i_printf(MSG_PopNotComplete, serverLine);
+ mailClose();
return;
}
@@ -335,6 +357,7 @@ fetchMail(int account, bool fetch)
mailPutGetError("stat\r\n");
if(memcmp(serverLine, "+OK ", 4)) {
i_printf(MSG_NoStatusMailBox, serverLine);
+ mailClose();
return;
}
nmsgs = atoi(serverLine + 4);
@@ -343,57 +366,18 @@ fetchMail(int account, bool fetch)
mailClose();
return;
}
-
- if(!passMail) {
-/* We look up a lot of hosts; make a tcp connect */
- sethostent(1);
-/* the conect will drop when the program exits */
- }
-
- if(fetch) {
- umf = allocMem(strlen(mailUnread) + 8);
- sprintf(umf, "%s/", mailUnread);
- umf_end = umf + strlen(umf);
- lastUnread();
- }
i_printf(MSG_MessagesX, nmsgs);
for(m = 1; m <= nmsgs; ++m) {
- const char *redirect = 0; /* send mail elsewhere */
- char key;
- const char *atname; /* name of attachment */
- bool delflag = false; /* delete this mail */
- int exact_l;
- char *exact = initString(&exact_l); /* the exact message */
- int exactf_l;
- char *exactf = 0; /* utf8 formatted */
- int displine;
- int stashNumber = -1;
char retrbuf[5000];
bool retr1;
-/* We need to clear out the editor, from the last message,
- * then read in this one, in its entirety.
- * This is probably a waste, since the user might delete a megabyte message
- * after seeing only the first paragraph, or even the subject,
- * but as for programming, it's easier to read the whole thing in right now. */
-
- if(lastMailInfo)
- freeMailInfo(lastMailInfo);
- lastMailInfo = 0;
- nzFree(lastMailText);
- lastMailText = 0;
-
- if(sessionList[1].lw)
- cxQuit(1, 2);
- cs = 0;
- linesReset();
- cxSwitch(1, false);
-
-/* Now grab the entire message */
+/* Grab the message */
sprintf(serverLine, "retr %d%s", m, eol);
if(!mailPutLine(serverLine, false))
showErrorAbort();
+
+ mailstring = initString(&mailstring_l);
retr1 = true;
while(true) {
int nr;
@@ -403,17 +387,23 @@ fetchMail(int account, bool fetch)
nr = tcp_read(mssock, retrbuf, sizeof (retrbuf));
if(nr <= 0) {
i_printf(MSG_ErrorReadMess, errno);
+ mailClose();
+ nzFree(mailstring);
return;
}
+
if(retr1) {
/* add null, to make it easy to print the error message if necessary */
if(nr < sizeof (retrbuf))
retrbuf[nr] = 0;
if(memcmp(retrbuf, "+OK", 3)) {
i_printf(MSG_ErrorFetchMess, m, retrbuf);
+ mailClose();
+ nzFree(mailstring);
return;
}
- j = 3;
+
+ j = 3; /* skip past ok */
while(retrbuf[j] != '\n')
++j;
++j;
@@ -421,92 +411,174 @@ fetchMail(int account, bool fetch)
memmove(retrbuf, retrbuf + j, nr);
retr1 = false;
}
+
if(nr)
- stringAndBytes(&exact, &exact_l, retrbuf, nr);
+ stringAndBytes(&mailstring, &mailstring_l, retrbuf, nr);
+
/* . by itself on a line ends the transmission */
- j = exact_l - 1;
+ j = mailstring_l - 1;
if(j < 0)
continue;
- if(exact[j] != '\n')
+ if(mailstring[j] != '\n')
continue;
--j;
- if(j >= 0 && exact[j] == '\r')
+ if(j >= 0 && mailstring[j] == '\r')
--j;
if(j < 0)
continue;
- if(exact[j] != '.')
+ if(mailstring[j] != '.')
continue;
if(!j)
break;
- if(exact[j - 1] == '\n')
+ if(mailstring[j - 1] == '\n')
break;
}
- exact_l = j;
+ mailstring_l = j;
/* get rid of the dos returns, and dot strip */
- for(j = k = 0; j < exact_l; ++j) {
- if(!j && exact[j] == '.')
+ for(j = k = 0; j < mailstring_l; ++j) {
+ if(!j && mailstring[j] == '.')
continue;
- if(j && exact[j] == '.' && exact[j - 1] == '\n')
+ if(j && mailstring[j] == '.' && mailstring[j - 1] == '\n')
continue;
- if(exact[j] == '\r' && j < exact_l - 1 && exact[j + 1] == '\n')
+ if(mailstring[j] == '\r' && j < mailstring_l - 1 &&
+ mailstring[j + 1] == '\n')
continue;
- exact[k++] = exact[j];
+ mailstring[k++] = mailstring[j];
}
- exact_l = k;
- exact[k] = 0;
+ mailstring_l = k;
+ mailstring[k] = 0;
+
+/* got the file, save it in unread */
+ sprintf(umf_end, "%d", unreadMax + m);
+ umfd = open(umf, O_WRONLY | O_TEXT | O_CREAT, 0666);
+ if(umfd < 0)
+ i_printfExit(MSG_NoCreate, umf);
+ if(write(umfd, mailstring, mailstring_l) < mailstring_l)
+ i_printfExit(MSG_NoWrite, umf);
+ close(umfd);
+ nzFree(mailstring);
+ mailstring = 0;
+
+ sprintf(serverLine, "dele %d%s", m, eol);
+ if(!mailPutLine(serverLine, false))
+ showErrorAbort();
+ if(!mailGetLine())
+ i_printfExit(MSG_MailTimeOver);
+ if(memcmp(serverLine, "+OK", 3))
+ i_printfExit(MSG_UnableDelMail, serverLine);
+ } /* loop over mail messages */
+
+ mailClose();
+} /* fetchMail */
+
+void
+scanMail(void)
+{
+ int nmsgs, m, j, k;
+
+ if(!isInteractive)
+ i_printfExit(MSG_FetchNotBackgnd);
+ if(!mailDir)
+ i_printfExit(MSG_NoMailDir);
+ if(chdir(mailDir))
+ i_printfExit(MSG_NoDirChange, mailDir);
+
+ if(!umf) {
+ umf = allocMem(strlen(mailUnread) + 12);
+ sprintf(umf, "%s/", mailUnread);
+ umf_end = umf + strlen(umf);
+ }
+
+/* How many mail messages? */
+ unreadBase = 0;
+ unreadStats();
+ nmsgs = unreadCount;
+ if(!nmsgs) {
+ i_puts(MSG_NoUnread);
+ exit(0);
+ }
+ i_printf(MSG_UnreadX, nmsgs);
+
+ for(m = 1; m <= nmsgs; ++m) {
+ const char *redirect = 0; /* send mail elsewhere */
+ char key;
+ const char *atname; /* name of attachment */
+ bool delflag = false; /* delete this mail */
+ int displine;
+ int stashNumber = -1;
+
+/* We need to clear out the editor, from the last message,
+ * then read in this one, in its entirety.
+ * This is probably a waste, since the user might delete a megabyte message
+ * after seeing only the first paragraph, or even the subject,
+ * but as for programming, it's easier to read the whole thing in right now. */
+
+ if(lastMailInfo)
+ freeMailInfo(lastMailInfo);
+ lastMailInfo = 0;
+ nzFree(lastMailText);
+ lastMailText = 0;
- iuReformat(exact, exact_l, &exactf, &exactf_l);
+ if(sessionList[1].lw)
+ cxQuit(1, 2);
+ cs = 0;
+ linesReset();
+ cxSwitch(1, false);
+
+/* Now grab the entire message */
+ unreadStats();
+ sprintf(umf_end, "%d", unreadMin);
+ if(!fileIntoMemory(umf, &mailstring, &mailstring_l))
+ showErrorAbort();
+ unreadBase = unreadMin;
- if(exactf) {
- if(!addTextToBuffer((pst) exactf, exactf_l, 0, false))
+ iuReformat(mailstring, mailstring_l, &mailu8, &mailu8_l);
+
+ if(mailu8) {
+ if(!addTextToBuffer((pst) mailu8, mailu8_l, 0, false))
showErrorAbort();
} else {
- if(!addTextToBuffer((pst) exact, exact_l, 0, false))
+ if(!addTextToBuffer((pst) mailstring, mailstring_l, 0, false))
showErrorAbort();
}
- if(!unformatMail) {
- browseCurrentBuffer();
- if(!passMail) {
- mailIsBlack = onBlacklist();
- redirect = mailRedirect(lastMailInfo->to,
- lastMailInfo->from, lastMailInfo->reply,
- lastMailInfo->subject);
- }
- if(redirect) {
- key = 'w';
- if(*redirect == '-')
- ++redirect, key = 'u';
- if(stringEqual(redirect, "x"))
- i_puts(MSG_Junk);
- else
- printf("> %s\n", redirect);
- } else if((mailIsSpam | mailIsBlack) && spamCan) {
- redirect = spamCan;
- key = 'u';
- i_printf(MSG_Spam);
- if(lastMailInfo->from[0]) {
- i_printf(MSG_From);
- printf("%s", lastMailInfo->from);
- } else if(lastMailInfo->reply[0]) {
- i_printf(MSG_From);
- printf("%s", lastMailInfo->reply);
- }
- nl();
- } else if(!nattach && /* drop empty mail message */
- cw->dol -
- (strlen(lastMailInfo->subject) != 0) -
- (strlen(lastMailInfo->from) != 0) -
- (strlen(lastMailInfo->reply) != 0) <= 1) {
- redirect = "x";
- i_puts(MSG_Empty);
- }
+ browseCurrentBuffer();
+
+ if(!passMail) {
+ mailIsBlack = onBlacklist();
+ redirect = mailRedirect(lastMailInfo->to,
+ lastMailInfo->from, lastMailInfo->reply, lastMailInfo->subject);
}
- if(redirect || fetch)
- delflag = true;
- key = 0;
+ if(redirect) {
+ key = 'w';
+ if(*redirect == '-')
+ ++redirect, key = 'u';
+ if(stringEqual(redirect, "x"))
+ i_puts(MSG_Junk);
+ else
+ printf("> %s\n", redirect);
+ } else if((mailIsSpam | mailIsBlack) && spamCan) {
+ redirect = spamCan;
+ key = 'u';
+ i_printf(MSG_Spam);
+ if(lastMailInfo->from[0]) {
+ i_printf(MSG_From);
+ printf("%s", lastMailInfo->from);
+ } else if(lastMailInfo->reply[0]) {
+ i_printf(MSG_From);
+ printf("%s", lastMailInfo->reply);
+ }
+ nl();
+ } else if(!nattach && /* drop empty mail message */
+ cw->dol -
+ (strlen(lastMailInfo->subject) != 0) -
+ (strlen(lastMailInfo->from) != 0) -
+ (strlen(lastMailInfo->reply) != 0) <= 1) {
+ redirect = "x";
+ i_puts(MSG_Empty);
+ }
/* display the next page of mail and get a command from the keyboard */
displine = 1;
@@ -530,23 +602,24 @@ fetchMail(int account, bool fetch)
/* interactive prompt depends on whether there is more text or not */
printf("%c ", displine > cw->dol ? '?' : '*');
fflush(stdout);
- key = getLetter("qx? nwkudijJ");
+ key = getLetter("q? nwudijJ");
printf("\b\b\b");
fflush(stdout);
switch (key) {
case 'q':
i_puts(MSG_Quit);
- mailClose();
- case 'x':
exit(0);
+
case 'n':
i_puts(MSG_Next);
goto afterinput;
+
case 'd':
i_puts(MSG_Delete);
delflag = true;
goto afterinput;
+
case 'i':
i_puts(MSG_IPDelete);
if(!cw->iplist || cw->iplist[0] == -1) {
@@ -568,6 +641,7 @@ fetchMail(int account, bool fetch)
}
delflag = true;
goto afterinput;
+
case 'j':
case 'J':
i_puts(MSG_Junk);
@@ -575,17 +649,20 @@ fetchMail(int account, bool fetch)
continue;
delflag = true;
goto afterinput;
+
case ' ':
if(displine > cw->dol)
i_puts(MSG_EndMessage);
goto nextpage;
+
case '?':
i_puts(MSG_MailHelp);
continue;
- case 'k':
+
case 'w':
case 'u':
break;
+
default:
i_puts(MSG_NYI);
continue;
@@ -593,14 +670,8 @@ fetchMail(int account, bool fetch)
}
/* At this point we're saving the mail somewhere. */
- if(key != 'k')
- delflag = true;
+ delflag = true;
atname = redirect;
- if(!atname && fetch) {
- sprintf(umf_end, "%d", unreadNumber + m);
- atname = umf;
- key = 'u'; /* save unformatted */
- }
savemail:
if(!atname)
@@ -619,15 +690,15 @@ fetchMail(int account, bool fetch)
write(fh,
"======================================================================\n",
71);
- if(key == 'u' || unformatMail) {
- if(write(fh, exact, exact_l) < exact_l) {
+ if(key == 'u') {
+ if(write(fh, mailstring, mailstring_l) < mailstring_l) {
badsave:
i_printf(MSG_NoWrite, atname);
close(fh);
goto savemail;
}
close(fh);
- fsize = exact_l;
+ fsize = mailstring_l;
} else {
if(mailStash) {
@@ -657,7 +728,8 @@ fetchMail(int account, bool fetch)
0666);
if(rmfh < 0)
break;
- if(write(rmfh, exact, exact_l) < exact_l) {
+ if(write(rmfh, mailstring,
+ mailstring_l) < mailstring_l) {
close(rmfh);
unlink(rmf);
break;
@@ -668,7 +740,7 @@ fetchMail(int account, bool fetch)
break;
}
}
- /* stashing the original */
+
fsize = 0;
for(j = 1; j <= cw->dol; ++j) {
char *showline = (char *)fetchLine(j, 1);
@@ -681,7 +753,8 @@ fetchMail(int account, bool fetch)
if(stashNumber >= 0) {
char addstash[60];
- sprintf(addstash, "\nUnformatted %05d\n", stashNumber);
+ sprintf(addstash, "\nUnformatted %05d\n",
+ stashNumber);
k = strlen(addstash);
if(write(fh, addstash, k) < k)
goto badsave;
@@ -689,12 +762,13 @@ fetchMail(int account, bool fetch)
}
close(fh);
+
if(nattach)
writeAttachments(lastMailInfo);
} /* unformat or format */
/* print "mail saved" message */
- if(atname != spamCan && atname != umf) {
+ if(atname != spamCan) {
i_printf(MSG_MailSaved, fsize);
if(exists)
i_printf(MSG_Appended);
@@ -705,28 +779,19 @@ fetchMail(int account, bool fetch)
} /* key commands */
} /* paging through the message */
+
afterinput:
+ if(delflag)
+ unlink(umf);
- if(delflag) {
-/* Remember, it isn't really gone until you quit the session.
- * So if you didn't mean to delete, type x to exit abruptly,
- * then fetch your mail again. */
- sprintf(serverLine, "dele %d%s", m, eol);
- if(!mailPutLine(serverLine, false))
- showErrorAbort();
- if(!mailGetLine())
- i_printfExit(MSG_MailTimeOver);
- if(memcmp(serverLine, "+OK", 3))
- i_printfExit(MSG_UnableDelMail, serverLine);
- }
- /* deleted */
- nzFree(exact);
- nzFree(exactf);
+ nzFree(mailstring);
+ mailstring = 0;
+ nzFree(mailu8);
+ mailu8 = 0;
} /* loop over mail messages */
- mailClose();
exit(0);
-} /* fetchMail */
+} /* scanMail */
/* Here are the common keywords for mail header lines.
* These are in alphabetical order, so you can stick more in as you find them.
diff --git a/src/main.c b/src/main.c
index 5ebacfe..491c3b4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -19,7 +19,7 @@ const char eol[] = "\r\n";
char EMPTYSTRING[] = "";
int debugLevel = 1;
int webTimeout = 20, mailTimeout = 0;
-bool ismc, browseLocal, unformatMail, passMail, errorExit;
+bool ismc, browseLocal, passMail, errorExit;
bool isInteractive, inInput, listNA;
volatile bool intFlag;
int fileSize, maxFileSize = 50000000;
@@ -640,6 +640,11 @@ readConfigFile(void)
continue;
}
+ if(stringEqual(s, "nofetch") && mailblock == 1) {
+ act->nofetch = 1;
+ continue;
+ }
+
if(*s == '\x82' && s[1] == 0) {
if(mailblock == 1) {
++maxAccount;
@@ -991,7 +996,7 @@ main(int argc, char **argv)
{
int cx, account;
bool rc, doConfig = true;
- bool fetchOnly = false;
+ bool dofetch = false, domail = false;
/* In case this is being piped over to a synthesizer, or whatever. */
if(fileTypeByHandle(fileno(stdout)) != 'f')
@@ -1080,41 +1085,57 @@ main(int argc, char **argv)
for(; argc && argv[0][0] == '-'; ++argv, --argc) {
char *s = *argv;
++s;
+
if(stringEqual(s, "v")) {
puts(version);
exit(0);
}
+
if(stringEqual(s, "d")) {
debugLevel = 4;
continue;
}
+
if(*s == 'd' && isdigitByte(s[1]) && !s[2]) {
debugLevel = s[1] - '0';
continue;
}
+
if(stringEqual(s, "e")) {
errorExit = true;
continue;
}
- if(*s == 'u')
- ++s, unformatMail = true;
+
if(*s == 'p')
++s, passMail = true;
- if((*s == 'm' || *s == 'f') && isdigitByte(s[1])) {
- if(*s == 'f')
- fetchOnly = true;
+
+ if(*s == 'm' || *s == 'f') {
if(!maxAccount)
i_printfExit(MSG_NoMailAcc);
- account = strtol(s + 1, &s, 10);
- if(account == 0 || account > maxAccount)
- i_printfExit(MSG_BadAccNb, maxAccount);
+ if(*s == 'f') {
+ account = 0;
+ dofetch = true;
+ ++s;
+ if(*s == 'm')
+ domail = true, ++s;
+ } else {
+ domail = true;
+ ++s;
+ }
+ if(isdigitByte(*s)) {
+ account = strtol(s, &s, 10);
+ if(account == 0 || account > maxAccount)
+ i_printfExit(MSG_BadAccNb, maxAccount);
+ }
if(!*s) {
ismc = true; /* running as a mail client */
allowJS = false; /* no javascript in mail client */
- ++argv, --argc; /* we're going to break out */
- break;
+ ++argv, --argc;
+ if(!argc || !dofetch)
+ break;
}
}
+
i_printfExit(MSG_Usage);
} /* options */
@@ -1142,10 +1163,37 @@ main(int argc, char **argv)
int nat, nalt, nrec;
if(!argc) {
- fetchMail(account, fetchOnly);
+/* This is fetch / read mode */
+ if(dofetch) {
+ if(account) {
+ fetchMail(account);
+ } else {
+ int i, j;
+ for(i = 1; i <= maxAccount; ++i) {
+/* did we set this to nofetch in the config file? */
+ if(accounts[i - 1].nofetch)
+ continue;
+/* don't fetch from a different account that has the same host an dlogin */
+ for(j = 1; j < i; ++j)
+ if(stringEqual(accounts[i - 1].inurl,
+ accounts[j - 1].inurl) &&
+ stringEqual(accounts[i - 1].login,
+ accounts[j - 1].login))
+ break;
+ if(j == i)
+ fetchMail(i);
+ }
+ }
+ }
+
+ if(domail) {
+ scanMail();
+ }
+
exit(0);
}
+/* now in sendmail mode */
if(argc == 1)
i_printfExit(MSG_MinOneRec);
/* I don't know that argv[argc] is 0, or that I can set it to 0,
diff --git a/src/messages.c b/src/messages.c
index 20b4089..6378f0c 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -122,7 +122,7 @@ static const char *englishMessages[] = {
"%d messages\n",
"spam",
" from ",
- "?\tprint this help message.\nq\tquit this program.\nx\texit without changing anything on the mail server.\nspace\tread more of this mail message.\nn\tmove on to the next mail message.\nd\tdelete this message.\nj\tjunk this subject for ten days.\nJ\tjunk this subject for a year.\nw\twrite this message to a file and delete it.\nk\tkeep this message in a file, but don't delete it.\nu\twrite this message unformatted to a file, and delete it.",
+ "?\tprint this help message.\nq\tquit this program.\nspace\tread more of this mail message.\nn\tmove on to the next mail message.\nd\tdelete this message.\nj\tjunk this subject for ten days.\nJ\tjunk this subject for a year.\nw\twrite this message to a file and delete it.\nu\twrite this message unformatted to a file, and delete it.",
"cannot create file %s\n",
"cannot write to file %s\n",
"mail saved, %d bytes",
@@ -571,7 +571,7 @@ static const char *englishMessages[] = {
"%s is not a directory",
"no mail accounts specified, please check your .ebrc config file",
"invalid account number, please use 1 through %d",
- "edbrowse -v (show version)\nedbrowse -h (this message)\nedbrowse -c (edit config file)\nedbrowse [-e] [-d#] -[u|p]m# (read your mail)\nedbrowse [-e] [-d#] -f# (fetch mail) \nedbrowse [-e] [-d#] -m# address1 address2 ... file [+attachments]\nedbrowse [-e] [-d#] file1 file2 ...",
+ "edbrowse -v (show version)\nedbrowse -h (this message)\nedbrowse -c (edit config file)\nedbrowse [-e] [-d#] -f[#] (fetch mail) \nedbrowse [-e] [-d#] -[p]m (read pending mail)\nedbrowse [-e] [-d#] -[p]fm[#] (fetch mail and read pending mail)\nedbrowse [-e] [-d#] -m[#] address1 address2 ... file [+attachments]\nedbrowse [-e] [-d#] file1 file2 ...",
"please specify at least one recipient and the file to send",
"please specify at least one recipient and the file to send, before your attachments",
"too many files open simultaneously, limit %d",
@@ -678,6 +678,8 @@ static const char *englishMessages[] = {
"SSL connect error in libcurl: %s",
"input tty",
"input readline()",
+ "nothing pending",
+ "%d pending\n",
};
/* Translation by Erwin Bliesenick: erwinb@no-log.org */
@@ -1337,6 +1339,8 @@ static const char *frenchMessages[] = {
0,
0,
0,
+ 0,
+ 0,
};
/* Translation by Cleverson: clever92000@yahoo.com.br */
@@ -1996,6 +2000,8 @@ static const char *brazilianPortugueseMessages[] = {
0,
0,
0,
+ 0,
+ 0,
};
/* Translation by Jan Mura: jan.mura@volny.cz */
diff --git a/src/messages.h b/src/messages.h
index bec55d7..82aaeeb 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -678,4 +678,6 @@ enum {
MSG_SSLConnectError,
MSG_InputTTY,
MSG_InputReadLine,
+ MSG_NoUnread,
+ MSG_UnreadX,
};
diff --git a/src/sendmail.c b/src/sendmail.c
index 901e89f..3275e55 100644
--- a/src/sendmail.c
+++ b/src/sendmail.c
@@ -303,7 +303,6 @@ void
mailClose(void)
{
mailPutLine("quit\r\n", false);
- endhostent();
/* the other side has to have time to process the quit command, before we simply hang up. */
usleep(400000);
if(ssl_on)
--
1.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Edbrowse-dev] [PATCH] Restructure the email interface to separate -f and -m
2011-04-08 22:48 [Edbrowse-dev] [PATCH] Restructure the email interface to separate -f and -m Karl Dahlke
@ 2011-04-09 11:05 ` Chris Brannon
0 siblings, 0 replies; 2+ messages in thread
From: Chris Brannon @ 2011-04-09 11:05 UTC (permalink / raw)
To: edbrowse-dev
This is applied to the master branch, and it is working for me.
I don't think it will make the cut for the 3.4.7 release, which will be
uploaded early next week, at the latest.
Thanks for the submission!
-- Chris
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-09 11:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-08 22:48 [Edbrowse-dev] [PATCH] Restructure the email interface to separate -f and -m Karl Dahlke
2011-04-09 11:05 ` Chris Brannon
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).