--- lmtpd.c.orig	Sat Mar 30 20:39:23 2002
+++ lmtpd.c	Sat Mar 30 16:48:16 2002
@@ -1138,13 +1138,32 @@
     for (n = 0; n < nrcpts; n++) {
 	char *rcpt = xstrdup(msg_getrcpt(msgdata, n));
 	char *plus;
+	char *at_on;
 	int quotaoverride = msg_getrcpt_ignorequota(msgdata, n);
 	int r = 0;
 
 	mydata.cur_rcpt = n;
-	plus = strchr(rcpt, '+');
 	/* +++++ Simon change code here */
-	if (plus) *plus++ = '\0';
+	if ( (plus = strchr(rcpt, '+')) != NULL ) {
+		/* ok so we are going to put plus in its own space
+		** and make rcpt = user@domain.com 
+		*/
+		if ( (at_on = strchr(plus,'@')) != NULL ) {
+			char *temp;
+			/* need to alloc some memory for plus */
+			temp = (char *) xmalloc(at_on - plus + 1);
+			memcpy(temp,plus+1,at_on-plus);
+			temp[at_on-plus-1] = '\0';
+			memmove(plus,at_on,strlen(at_on)+1); /* must get the null */
+			plus = temp;
+			
+		syslog(LOG_ERR, "what we like got is : %s %s", plus,rcpt);
+		} else {
+		/* just do what would normally happen */
+	    		*plus = '\0';
+		}
+	}
+	
 	/* case 1: shared mailbox request */
 	if (plus && !strcmp(rcpt, BB)) {
 	    strcpy(namebuf, lmtpd_namespace.prefix[NAMESPACE_SHARED]);
@@ -1251,6 +1270,7 @@
 	}
 
     donercpt:
+	if (plus) free(plus);
 	free(rcpt);
 	msg_setrcpt_status(msgdata, n, r);
     }
@@ -1313,6 +1333,7 @@
 {
     char buf[MAX_MAILBOX_NAME];
     char *plus;
+    char *at_on;
     int r;
     int sl = strlen(BB);
 
@@ -1322,7 +1343,6 @@
     if (!strncmp(user, BB, sl) && user[sl] == '+') {
 	/* special shared folder address */
 	strcpy(buf, user + sl + 1);
-	/* Translate any separators in user */
 	mboxname_hiersep_tointernal(&lmtpd_namespace, buf);
 	/* - must have posting privileges on shared folders
 	   - don't care about message size (1 msg over quota allowed) */
@@ -1335,8 +1355,15 @@
 	} else {
 	    strcpy(buf, "user.");
 	    strcat(buf, user);
-	    plus = strchr(buf, '+');
-	    if (plus) *plus = '\0';
+	    if ( (plus = strchr(buf, '+')) != NULL ) {
+	    	/*if (plus) *plus = '\0';*/
+		/* turn simon+what@surf.org.uk */
+		/* into simon@surf.org.uk */
+		/* find @ */
+		if ( (at_on = strchr(plus,'@')) != NULL ) {
+			memmove(plus,at_on,strlen(at_on)+1); /* must get the null */
+		}
+	    }
 	    /* Translate any separators in user */
 	    mboxname_hiersep_tointernal(&lmtpd_namespace, buf+5);
 	    /* - don't care about ACL on INBOX (always allow post)
--- lmtpengine.c.orig	Wed Jan  9 20:11:08 2002
+++ lmtpengine.c	Thu Jan 31 15:54:12 2002
@@ -1034,7 +1034,7 @@
 	}
     }
     else {
-	while (*addr != '@' && *addr != '>') {
+	while ( *addr != '>') {
 	    if (*addr == '\\') addr++;
 	    *dest++ = *addr++;
 	}
