[Pkg-wmaker-commits] [wmbiff] 05/17: Paolo Gianrossi's patch to provide msglst support for pop3 mailboxes

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:04:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_18
in repository wmbiff.

commit 60ea0980b069c8a24ad97bf0a9e469a7c827f57b
Author: bluehal <bluehal>
Date:   Sun Oct 26 08:31:57 2003 +0000

    Paolo Gianrossi's patch to provide msglst support for pop3 mailboxes
---
 AUTHORS              |  1 +
 wmbiff/Pop3Client.c  | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 wmbiff/wmbiffrc.5.in | 11 +++++---
 3 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 453b628..35905fd 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -37,4 +37,5 @@
    Andelko Horvat (comel at srk.fer.hr)
    Jun-ichiro itojun Hagino (itojun at iijlab.net)
    Peter McAlpine (pmcalpin at uoguelph.ca)
+   Paolo Gianrossi (paolino at yersinia.org)
 
diff --git a/wmbiff/Pop3Client.c b/wmbiff/Pop3Client.c
index 490dbcf..9e1db53 100644
--- a/wmbiff/Pop3Client.c
+++ b/wmbiff/Pop3Client.c
@@ -1,4 +1,4 @@
-/* $Id: Pop3Client.c,v 1.17 2003/03/02 02:17:14 bluehal Exp $ */
+/* $Id: Pop3Client.c,v 1.18 2003/10/26 08:31:59 bluehal Exp $ */
 /* Author : Scott Holden ( scotth at thezone.net )
    Modified : Yong-iL Joh ( tolkien at mizi.com )
    Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
@@ -17,6 +17,7 @@
 #include "Client.h"
 #include "charutil.h"
 #include "regulo.h"
+#include "MessageList.h"
 
 #ifdef USE_DMALLOC
 #include <dmalloc.h>
@@ -36,6 +37,14 @@ static FILE *authenticate_apop( /*@notnull@ */ Pop3 pc, FILE * fp,
 static FILE *authenticate_plaintext( /*@notnull@ */ Pop3 pc, FILE * fp,
 									char *unused);
 
+void pop3_cacheHeaders( /*@notnull@ */ Pop3 pc);
+
+extern void imap_releaseHeaders(Pop3 pc
+								__attribute__ ((unused)),
+								struct msglst *h);
+
+extern struct connection_state *state_for_pcu(Pop3 pc);
+
 static struct authentication_method {
 	const char *name;
 	/* callback returns the filehandle if successful, 
@@ -155,6 +164,18 @@ int pop3CheckMail( /*@notnull@ */ Pop3 pc)
 	return 0;
 }
 
+
+struct msglst *pop_getHeaders( /*@notnull@ */ Pop3 pc)
+{
+	if (pc->headerCache == NULL)
+		pop3_cacheHeaders(pc);
+	if (pc->headerCache != NULL)
+		pc->headerCache->in_use = 1;
+	return pc->headerCache;
+}
+
+
+
 int pop3Create(Pop3 pc, const char *str)
 {
 	/* POP3 format: pop3:user:password at server[:port] */
@@ -221,10 +242,12 @@ int pop3Create(Pop3 pc, const char *str)
 	POP_DM(pc, DEBUG_INFO, "authList= '%s'\n", PCU.authList);
 
 	pc->checkMail = pop3CheckMail;
+	pc->getHeaders = pop_getHeaders;
 	pc->TotalMsgs = 0;
 	pc->UnreadMsgs = 0;
 	pc->OldMsgs = -1;
 	pc->OldUnreadMsgs = -1;
+
 	return 0;
 }
 
@@ -368,4 +391,59 @@ static FILE *authenticate_plaintext( /*@notnull@ */ Pop3 pc,
 	return fp;
 }
 
+void pop3_cacheHeaders( /*@notnull@ */ Pop3 pc)
+{
+	char buf[BUF_SIZE];
+	FILE *f;
+	int i;
+
+	if (pc->headerCache != NULL) {
+		/* decrement the reference count, and free our version */
+		imap_releaseHeaders(pc, pc->headerCache);
+		pc->headerCache = NULL;
+	}
+
+	POP_DM(pc, DEBUG_INFO, "working headers\n");
+	/* login the server */
+	f = pop3Login(pc);
+	if (!f)
+		return;
+	/* pc->UnreadMsgs = pc->TotalMsgs - read; */
+	pc->headerCache = NULL;
+	for (i = pc->TotalMsgs - pc->UnreadMsgs + 1; i <= pc->TotalMsgs; ++i) {
+		struct msglst *m;
+		m = malloc(sizeof(struct msglst));
+
+		m->subj[0] = '\0';
+		m->from[0] = '\0';
+		POP_DM(pc, DEBUG_INFO, "search: %s", buf);
+
+		fprintf(f, "TOP %i 0\r\n", i);
+		fflush(f);
+		while (fgets(buf, 256, f) && buf[0] != '.') {
+			if (!strncmp(buf, "From: ", 6)) {
+				/* manage the from in heads */
+				strncpy(m->from, buf + 6, FROM_LEN - 1);
+				m->from[FROM_LEN - 1] = '\0';
+			} else if (!strncmp(buf, "Subject: ", 9)) {
+				/* manage subject */
+				strncpy(m->subj, buf + 9, SUBJ_LEN - 1);
+				m->subj[SUBJ_LEN - 1] = '\0';
+			}
+			if (!m->subj[0]) {
+				strncpy(m->subj, "[NO SUBJECT]", 14);
+			}
+			if (!m->from[0]) {
+				strncpy(m->from, "[ANONYMOUS]", 14);
+			}
+		}
+		m->next = pc->headerCache;
+		pc->headerCache = m;
+		pc->headerCache->in_use = 0;
+	}
+	fprintf(f, "QUIT\r\n");
+	fflush(f);
+	fclose(f);
+}
+
 /* vim:set ts=4: */
diff --git a/wmbiff/wmbiffrc.5.in b/wmbiff/wmbiffrc.5.in
index 0bd1a4f..9f87e8b 100644
--- a/wmbiff/wmbiffrc.5.in
+++ b/wmbiff/wmbiffrc.5.in
@@ -1,5 +1,5 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" $Id: wmbiffrc.5.in,v 1.15 2003/06/08 06:59:56 bluehal Exp $
+.\" $Id: wmbiffrc.5.in,v 1.16 2003/10/26 08:31:59 bluehal Exp $
 .\"
 .\" @configure_input@
 .\"
@@ -202,12 +202,14 @@ the special keyword "beep" to use the pc speaker.
 \fBaction.n\fP
 Command to be executed on left mouse click on a mailbox label.  
 Accepts
-the special keyword "msglst" to pop up a window of recent message headers.
+the special keyword "msglst" to pop up a window of recent message headers 
+from IMAP or POP3 mailboxes when the left mouse button is held.
 .TP
 \fBbuttontwo.n\fP
 Command to be executed on middle mouse click on a mailbox level.
 Accepts
-the special keyword "msglst" to pop up a window of recent message headers.
+the special keyword "msglst" to pop up a window of 
+recent message headers from IMAP or POP3 mailboxes when the middle mouse button is held.
 .TP
 \fBinterval.n\fP
 Per mailbox check interval. Value is the amount of seconds between
@@ -222,7 +224,8 @@ in seconds.
 Command to be executed to fetch mail. If not specified, fetching through
 wmbiff is disabled completely.
 Accepts
-the special keyword "msglst" to pop up a window of recent message headers,
+the special keyword "msglst" to pop up a window of recent message headers 
+from IMAP and POP3 mailboxes when the right mouse button is held down,
 though not when fetchinterval is nonzero.
 .TP
 \fBdebug.n\fP 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list