* Began implementing some code to handle multiple recipients (but #define'd
authorArt Cancro <ajc@citadel.org>
Mon, 3 Dec 2001 02:45:47 +0000 (02:45 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 3 Dec 2001 02:45:47 +0000 (02:45 +0000)
  it all out because we're approaching a release)

citadel/ChangeLog
citadel/msgbase.c
citadel/msgbase.h

index 8774438fa0f987790e49ac968138a1a1dce62c77..56fb591f92a63c1011b013b38bdc5d5b8d3e753e 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 580.88  2001/12/03 02:45:46  ajc
+ * Began implementing some code to handle multiple recipients (but #define'd
+   it all out because we're approaching a release)
+
  Revision 580.87  2001/12/03 01:50:17  ajc
  * When sending mail, copy to the sender's "Sent Items>" room instead of to
    the sender's "Mail>" room.
@@ -2908,3 +2912,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 42491c8cc1f7646da801ae2fcb128c60a4f363a8..2f90bb9ee6a0dbb95c1c75ff925fea74cea30151 100644 (file)
@@ -2145,6 +2145,71 @@ int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf) {
 }
 
 
+#define NYI_FIXME
+/*
+ * Validate recipients, count delivery types and errors, and handle aliasing
+ */
+struct recptypes *validate_recipients(char *recipients) {
+       struct recptypes *ret;
+       char this_recp[SIZ];
+       int num_recps;
+       int i;
+       int mailtype;
+       struct usersupp tempUS;
+
+       /* Initialize */
+       ret = (struct recptypes *) malloc(sizeof(struct recptypes));
+       if (ret == NULL) return(NULL);
+       memset(ret, 0, sizeof(struct recptypes));
+
+       ret->num_local = 0;
+       ret->num_internet = 0;
+       ret->num_ignet = 0;
+       ret->num_error = 0;
+
+       if (recipients == NULL) return(ret);
+       if (strlen(recipients) == NULL) return(ret);
+
+       /* Allow either , or ; separators by changing ; to , */
+       for (i=0; i<strlen(recipients); ++i) {
+               if (recipients[i] == ';') {
+                       recipients[i] = ',';
+               }
+       }
+
+       /* Count 'em up */
+       num_recps = num_tokens(recipients, ',');
+       
+       for (i=0; i<num_recps; ++i) {
+               extract_token(this_recp, recipients, i, ',');
+               lprintf(9, "Evaluating recipient #%d <%s>\n", i, this_recp);
+               mailtype = alias(this_recp);
+               switch(mailtype) {
+                       case MES_LOCAL:
+                               if (getuser(&tempUS, buf) == 0) {
+                                       ++ret->num_local;
+                               }
+                               else {
+                                       ++ret->num_error;
+                               }
+                               break;
+                       case MES_INTERNET:
+                               ++ret->num_internet;
+                               break;
+                       case MES_IGNET:
+                               ++ret->num_ignet;
+                               break;
+                       case MES_ERROR:
+                               ++ret->num_error;
+                               break;
+               }
+
+       }
+
+       return(ret);
+}
+#endif NYI_FIXME
+
 
 
 /*
@@ -2198,8 +2263,10 @@ void cmd_ent0(char *entargs)
        if (CC->quickroom.QRflags & QR_MAILBOX) {
                if (CC->usersupp.axlevel >= 2) {
                        strcpy(buf, recipient);
-               } else
+               }
+               else {
                        strcpy(buf, "sysop");
+               }
                e = alias(buf); /* alias and mail type */
                if ((buf[0] == 0) || (e == MES_ERROR)) {
                        cprintf("%d Unknown address - cannot send message.\n",
@@ -2260,21 +2327,25 @@ void cmd_ent0(char *entargs)
        cprintf("%d send message\n", SEND_LISTING);
 
        /* Read in the message from the client. */
-       if (CC->fake_postname[0])
+       if (CC->fake_postname[0]) {
                msg = make_message(&CC->usersupp, buf,
                        CC->quickroom.QRname, b, e, format_type,
                        CC->fake_postname);
-       else if (CC->fake_username[0])
+       }
+       else if (CC->fake_username[0]) {
                msg = make_message(&CC->usersupp, buf,
                        CC->quickroom.QRname, b, e, format_type,
                        CC->fake_username);
-       else
+       }
+       else {
                msg = make_message(&CC->usersupp, buf,
                        CC->quickroom.QRname, b, e, format_type, "");
+       }
 
-       if (msg != NULL)
+       if (msg != NULL) {
                CtdlSaveMsg(msg, buf, (mtsflag ? AIDEROOM : ""), e);
                CtdlFreeMessage(msg);
+       }
        CC->fake_postname[0] = '\0';
        return;
 }
index 01bbb97919e74c5a4ab4431a4d87010d77221cd7..90dae425615f17d38188b3238af0531113179c3a 100644 (file)
@@ -43,6 +43,17 @@ struct repl {                        /* Info for replication checking */
 };
 
 
+/* Data structure returned by validate_recipients() */
+struct recptypes {
+        int num_local;
+        int num_internet;
+        int num_ignet;
+        int num_error;
+       char errormsg[SIZ];
+};
+
+
+
 int alias (char *name);
 void get_mm (void);
 void cmd_msgs (char *cmdbuf);