changeset 50:f818073d0926

changed bounce_from_adr() to match the bounce handling
author mortenp
date Tue, 27 Apr 2004 22:51:56 +1000
parents afd7356e8f2e
children 98952eec991d
files src/mlmmj-send.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/mlmmj-send.c	Tue Apr 27 22:37:58 2004 +1000
+++ b/src/mlmmj-send.c	Tue Apr 27 22:51:56 2004 +1000
@@ -41,7 +41,11 @@
 	size_t len;
 
 	indexstr = strrchr(mailfilename, '/');
-	if (!indexstr) indexstr = mailfilename;
+	if (indexstr) {
+		indexstr++;  /* skip the slash */
+	} else {
+		indexstr = mailfilename;
+	}
 
 	recipient = strdup(recipient);
 	if (!recipient) {
@@ -63,16 +67,17 @@
 	}
 	*listdomain++ = '\0';
 
-	/* 11 = "-bounces" + RECIPDELIM + "@" + NUL */
-	len = strlen(listadr) + strlen(recipient) + strlen(listdomain) + 11;
+	/* 12 = RECIPDELIM + "bounces-" + "-" + "@" + NUL */
+	len = strlen(listadr) + strlen(recipient) + strlen(indexstr)
+		 + strlen(listdomain) + 12;
 	bounce_adr = malloc(len);
 	if (!bounce_adr) {
 		free(recipient);
 		free(listadr);
 		return NULL;
 	}
-	snprintf(bounce_adr, len, "%s-bounces%c%s@%s", listadr, RECIPDELIM,
-		 recipient, listdomain);
+	snprintf(bounce_adr, len, "%s%cbounces-%s-%s@%s", listadr, RECIPDELIM,
+		 recipient, indexstr, listdomain);
 
 	free(recipient);
 	free(listadr);