]> code.citadel.org Git - citadel.git/commitdiff
* mail stuff
authorArt Cancro <ajc@citadel.org>
Mon, 31 Dec 2001 19:51:14 +0000 (19:51 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 31 Dec 2001 19:51:14 +0000 (19:51 +0000)
citadel/msgbase.c
citadel/msgbase.h
citadel/serv_smtp.c

index ba2921be9ccdb3c8d196fbbb323b441252c02098..70d16cf300a5a8d1d7c3501383cb34d5e3af0517 100644 (file)
@@ -1834,6 +1834,16 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,      /* message to save */
                CtdlSaveMsgPointerInRoom(SMTP_SPOOLOUT_ROOM, newmsgid, 0);
        }
 
+       /* If other rooms are specified, drop them there too. */
+       if (recps != NULL)
+        if (recps->num_room > 0)
+         for (i=0; i<num_tokens(recps->recp_room, '|'); ++i) {
+               extract(recipient, recps->recp_room, i);
+               lprintf(9, "Delivering to local room <%s>\n",
+                       recipient);
+               CtdlSaveMsgPointerInRoom(recipient, newmsgid, 0);
+       }
+
        /* Bump this user's messages posted counter. */
        lprintf(9, "Updating user\n");
        lgetuser(&CC->usersupp, CC->curr_user);
@@ -2259,8 +2269,8 @@ struct recptypes *validate_recipients(char *recipients) {
                }
        }
 
-       if ((ret->num_local + ret->num_internet +
-          ret->num_ignet + ret->num_error) == 0) {
+       if ((ret->num_local + ret->num_internet + ret->num_ignet +
+          ret->num_room + ret->num_error) == 0) {
                ++ret->num_error;
                strcpy(ret->errormsg, "No recipients specified.");
        }
@@ -2324,18 +2334,9 @@ void cmd_ent0(char *entargs)
                }
 
                valid = validate_recipients(recp);
-               lprintf(9, "validate_recipients(%s)\n", recp);
-               lprintf(9, " num_local    = %d\n", valid->num_local);
-               lprintf(9, " num_internet = %d\n", valid->num_internet);
-               lprintf(9, " num_ignet    = %d\n", valid->num_ignet);
-               lprintf(9, " num_error    = %d\n", valid->num_error);
-               lprintf(9, " errormsg     = %s\n", valid->errormsg);
-               lprintf(9, " display_recp = %s\n", valid->display_recp);
-
                if (valid->num_error > 0) {
                        cprintf("%d %s\n",
-                               ERROR + NO_SUCH_USER,
-                               valid->errormsg);
+                               ERROR + NO_SUCH_USER, valid->errormsg);
                        phree(valid);
                        return;
                }
index ea521a39212fc0a0b0c3058856cdfee2bd839c59..0251e01090a8797974dfb6d84199a1b8f5761d3f 100644 (file)
@@ -48,11 +48,13 @@ struct recptypes {
         int num_local;
         int num_internet;
         int num_ignet;
+       int num_room;
         int num_error;
        char errormsg[SIZ];
        char recp_local[SIZ];
        char recp_internet[SIZ];
        char recp_ignet[SIZ];
+       char recp_room[SIZ];
        char display_recp[SIZ];
 };
 
index ae891fca4bd56f9388adae963b6e0af1e3e470b3..ff238c58baaacf5ea9e05f69c1af03df43e09193 100644 (file)
@@ -66,6 +66,7 @@ struct citsmtp {              /* Information about the current session */
        int number_of_rooms;
        int delivery_mode;
        int message_originated_locally;
+       struct recptypes *valid;
 };
 
 enum {                         /* Command states for login authentication */
@@ -309,9 +310,9 @@ void smtp_expn(char *argbuf) {
  */
 void smtp_rset(void) {
        memset(SMTP, 0, sizeof(struct citsmtp));
-       if (SMTP_RECPS != NULL) strcpy(SMTP_RECPS, "");
-       if (SMTP_ROOMS != NULL) strcpy(SMTP_ROOMS, "");
-       if (CC->logged_in) logout(CC);
+       if (CC->logged_in) {
+               logout(CC);
+       }
        cprintf("250 Zap!\r\n");
 }
 
@@ -322,11 +323,9 @@ void smtp_rset(void) {
 void smtp_data_clear(void) {
        strcpy(SMTP->from, "");
        SMTP->number_of_recipients = 0;
-       SMTP->number_of_rooms = 0;
        SMTP->delivery_mode = 0;
        SMTP->message_originated_locally = 0;
-       if (SMTP_RECPS != NULL) strcpy(SMTP_RECPS, "");
-       if (SMTP_ROOMS != NULL) strcpy(SMTP_ROOMS, "");
+       memset(SMTP->valid, 0, sizeof(struct recptypes));
 }
 
 
@@ -365,7 +364,8 @@ void smtp_mail(char *argbuf) {
                cvt = convert_internet_address(user, node, SMTP->from);
                lprintf(9, "cvt=%d, citaddr=<%s@%s>\n", cvt, user, node);
                if ( (cvt != 0) || (strcasecmp(user, CC->usersupp.fullname))) {
-                       cprintf("550 <%s> is not your address.\r\n", SMTP->from);
+                       cprintf("550 <%s> is not your address.\r\n",
+                               SMTP->from);
                        strcpy(SMTP->from, "");
                        return;
                }
@@ -422,6 +422,9 @@ void smtp_rcpt(char *argbuf) {
 
        switch(cvt) {
                case rfc822_address_locally_validated:
+                       SMTP->valid.num_local += 1;
+                       strcat
+                       return;
                case rfc822_address_on_citadel_network:
                        cprintf("250 %s is a valid recipient.\r\n", user);
                        CtdlReallocUserData(SYM_SMTP_RECPS,
@@ -487,7 +490,6 @@ int smtp_message_delivery(struct CtdlMessage *msg) {
        struct usersupp userbuf;
        char *instr;                    /* Remote delivery instructions */
        struct CtdlMessage *imsg;
-       struct recptypes *valid;
 
        lprintf(9, "smtp_message_delivery() called\n");