Skip to contentSkip to conversation

Text part in digests

PATCH Morten K. Poulsen 1 participant 1 message Jul 21, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Morten K. Poulsen

The patch does not handle any kind of encoding of Subject: and From: headers. I will add that soon, but I think that some people (hi Andrea :) would like to have this patch now.

So, here it is - the patch with support for any kind of encoding anybody would ever want :-)

Please test it.

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/

Index: include/send_digest.h
===================================================================
RCS file: /home/mmj/MMJCVS/mlmmj/include/send_digest.h,v retrieving revision 1.1

send_digest.h +1 -1
diff -u -r1.1 send_digest.h
@@ -25,6 +25,6 @@
 #define SEND_DIGEST_H
 
 int send_digest(const char *listdir, int lastindex, int index,
-		const char *addr, const char *mlmmjsend);
+		int issue, const char *addr, const char *mlmmjsend);
 
 #endif /* SEND_DIGEST_H */

Index: include/unistr.h
===================================================================
RCS file: include/unistr.h

unistr.h new file +47 -0

47 lines not on this page · raw message

Index: src/Makefile.am
===================================================================
RCS file: /home/mmj/MMJCVS/mlmmj/src/Makefile.am,v retrieving revision 1.39

Makefile.am +2 -1
diff -u -r1.39 Makefile.am
@@ -50,7 +50,8 @@
 mlmmj_maintd_SOURCES = mlmmj-maintd.c print-version.c log_error.c mygetline.c \
 		       strgen.c random-int.c chomp.c writen.c memory.c \
 		       ctrlvalue.c send_digest.c getlistaddr.c dumpfd2fd.c \
-		       mylocking.c log_oper.c readn.c
+		       mylocking.c log_oper.c prepstdreply.c statctrl.c \
+		       gethdrline.c readn.c unistr.c
 
 mlmmj_list_SOURCES = mlmmj-list.c strgen.c writen.c print-version.c memory.c \
 		     log_error.c random-int.c readn.c

Index: src/mlmmj-maintd.c
===================================================================
RCS file: /home/mmj/MMJCVS/mlmmj/src/mlmmj-maintd.c,v retrieving revision 1.55

mlmmj-maintd.c +17 -7
diff -u -r1.55 mlmmj-maintd.c
@@ -743,12 +743,12 @@
 
 int run_digests(const char *listdir, const char *mlmmjsend)
 {
-	char *lasttimestr, *lastindexstr;
+	char *lasttimestr, *lastindexstr, *lastissuestr;
 	char *digestname, *indexname;
 	char *digestintervalstr, *digestmaxmailsstr;
 	char *s1, *s2, *s3;
 	time_t digestinterval, t, lasttime;
-	long digestmaxmails, lastindex, index;
+	long digestmaxmails, lastindex, index, lastissue;
 	int fd, indexfd, lock;
 	size_t lenbuf, lenstr;
 	
@@ -786,9 +786,15 @@
 
 	s1 = mygetline(fd);
 
-	/* Syntax is lastindex:lasttime */
+	/* Syntax is lastindex:lasttime or lastindex:lasttime:lastissue */
 	if (s1 && (lasttimestr = strchr(s1, ':'))) {
 		*(lasttimestr++) = '\0';
+		if ((lastissuestr = strchr(lasttimestr, ':'))) {
+			*(lastissuestr++) = '\0';
+			lastissue = atol(lastissuestr);
+		} else {
+			lastissue = 0;
+		}
 		lasttime = atol(lasttimestr);
 		lastindexstr = s1;
 		lastindex = atol(lastindexstr);
@@ -804,6 +810,7 @@
 		/* If lastdigest is empty, we start from scratch */
 		lasttime = 0;
 		lastindex = 0;
+		lastissue = 0;
 	}
 	
 	indexname = concatstr(2, listdir, "/index");
@@ -837,15 +844,18 @@
 		if (index > lastindex+digestmaxmails)
 			index = lastindex+digestmaxmails;
 
-		send_digest(listdir, lastindex+1, index, NULL, mlmmjsend);
+		if (index > lastindex) {
+			lastissue++;
+			send_digest(listdir, lastindex+1, index, lastissue, NULL, mlmmjsend);
+		}
 
 		if (lseek(fd, 0, SEEK_SET) < 0) {
 			log_error(LOG_ARGS, "Could not seek '%s'", digestname);
 		} else {
-			/* index + ':' + time + '\n' + '\0' */
-			lenbuf = 20 + 1 + 20 + 2;
+			/* index + ':' + time + ':' + issue + '\n' + '\0' */
+			lenbuf = 20 + 1 + 20 + 1 + 20 + 2;
 			s3 = mymalloc(lenbuf);
-			lenstr = snprintf(s3, lenbuf, "%ld:%ld\n", index, (long)t);
+			lenstr = snprintf(s3, lenbuf, "%ld:%ld:%ld\n", index, (long)t, lastissue);
 			if (lenstr >= lenbuf)
 				lenstr = lenbuf - 1;
 			if (writen(fd, s3, lenstr) == -1) {

Index: src/send_digest.c
===================================================================
RCS file: /home/mmj/MMJCVS/mlmmj/src/send_digest.c,v retrieving revision 1.8

send_digest.c +249 -9

304 lines not on this page · raw message

Index: src/unistr.c
===================================================================
RCS file: src/unistr.c

unistr.c new file +455 -0

455 lines not on this page · raw message