* msgbase.c: began laying the groundwork to support attachments.
authorArt Cancro <ajc@citadel.org>
Tue, 22 Sep 1998 01:20:32 +0000 (01:20 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 22 Sep 1998 01:20:32 +0000 (01:20 +0000)
          Purchased Rogaine(tm) in preparation for expected hair loss.

citadel/ChangeLog
citadel/msgbase.c
citadel/msgbase.h
citadel/techdoc/hack.txt
citadel/techdoc/session.txt

index be7325950ef8087d12bc944f72f80b6c51707f87..efa0fa574c760c38ea82db89f1680e79e6579f20 100644 (file)
@@ -1,3 +1,7 @@
+Mon Sep 21 21:19:17 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * msgbase.c: began laying the groundwork to support attachments.
+         Purchased Rogaine(tm) in preparation for expected hair loss.
+
 1998-09-21 Nathan Bryant <bryant@cs.usm.maine.edu>
        * msgbase.c: include dynloader.h
        * citadelapi.h: removed
index 8274ca1dac2bd08803625661f149ffcf071281a4..cef37b9e35b0b3bc3832190b53ba9748e4af3d98 100644 (file)
@@ -315,7 +315,7 @@ FMTEND:     cprintf("\n");
 void output_message(char *msgid, int mode, int headers_only)
 {
        long msg_num;
-       int a,och,len;
+       int a;
        CIT_UBYTE ch, rch;
        CIT_UBYTE format_type,anon_flag;
        char buf[1024];
@@ -498,7 +498,7 @@ void output_message(char *msgid, int mode, int headers_only)
        if (headers_only) {
                /* give 'em a length */
                msg_len = 0L;
-               while(och=ch, ch = *mptr++, ch>0) {
+               while(ch = *mptr++, ch>0) {
                        ++msg_len;
                        }
                cprintf("mlen=%ld\n", msg_len);
@@ -516,22 +516,19 @@ void output_message(char *msgid, int mode, int headers_only)
         * what message transfer format is in use.
         */
        if (format_type == 1) {
-               och = 0;
-               len = 0;
-               while(och=ch, ch = *mptr++, ch>0) {
+               strcpy(buf, "");
+               while(ch = *mptr++, ch>0) {
                        if (ch == 13) ch = 10;
-                       ++len;
-                       /* if ((ch!=10)||(och!=10)) { */
-                               cprintf("%c", ch);
-                               if (ch==10) len = 0;
-                               /* } */
-                       if (len>=250) {
-                               len = 0;
-                               /* cprintf("%c", ch); */
-                               cprintf("%c", 10);
+                       if ( (ch == 10) || (strlen(buf)>250) ) {
+                               cprintf("%s\n", buf);
+                               strcpy(buf, "");
+                               }
+                       else {
+                               buf[strlen(buf)+1] = 0;
+                               buf[strlen(buf)] = ch;
                                }
                        }
-               if (len!=0) cprintf("%c", 10);
+               if (strlen(buf)>0) cprintf("%s\n", buf);
                }
        /* If the message on disk is format 0 (Citadel vari-format), we
         * output using the formatter at 80 columns.  This is the final output
@@ -866,15 +863,17 @@ void aide_message(char *text)
 /*
  * Build a binary message to be saved on disk.
  */
-void make_message(char *filename, struct usersupp *author, char *recipient, char *room, int type, int net_type, int format_type, char *fake_name)
-                       /* temporary file name */
-                        /* author's usersupp structure */
-                       /* NULL if it's not mail */
-                       /* room where it's going */
-                       /* see MES_ types in header file */
-                       /* local or remote type, see citadel.h */
-                       /* format type (see citadel.h) */
-{ 
+void make_message(
+       char *filename,                 /* temporary file name */
+       struct usersupp *author,        /* author's usersupp structure */
+       char *recipient,                /* NULL if it's not mail */
+       char *room,                     /* room where it's going */
+       int type,                       /* see MES_ types in header file */
+       int net_type,                   /* see MES_ types in header file */
+       int format_type,                /* local or remote (see citadel.h) */
+       char *fake_name,                /* who we're masquerading as */
+       char *separator) {              /* separator (if exist attachments) */
+
        FILE *fp;
        int a;
        long now;
@@ -918,8 +917,9 @@ void make_message(char *filename, struct usersupp *author, char *recipient, char
        fprintf(fp,"N%s%c",NODENAME,0);                 /* nodename */
        fprintf(fp,"H%s%c",HUMANNODE,0);                /* human nodename */
 
-       if (recipient[0]!=0) fprintf(fp,"R%s%c",recipient,0);
-       if (dest_node[0]!=0) fprintf(fp,"D%s%c",dest_node,0);
+       if (recipient[0]!=0) fprintf(fp, "R%s%c", recipient, 0);
+       if (dest_node[0]!=0) fprintf(fp, "D%s%c", dest_node, 0);
+       if (separator[0]!=0) fprintf(fp, "Z%s%c", separator, 0);
 
        putc('M',fp);
 
@@ -946,6 +946,7 @@ void cmd_ent0(char *entargs)
        int anon_flag = 0;
        int format_type = 0;
        char newusername[256];          /* <bc> */
+       char separator[256];
 
        int a,b,e;
        int mtsflag = 0;
@@ -956,6 +957,7 @@ void cmd_ent0(char *entargs)
        extract(recipient,entargs,1);
        anon_flag = extract_int(entargs,2);
        format_type = extract_int(entargs,3);
+       extract(separator, entargs, 4);
 
        /* first check to make sure the request is valid. */
 
@@ -1068,12 +1070,12 @@ SKFALL: b=MES_NORMAL;
        
        cprintf("%d send message\n",SEND_LISTING);
        if (CC->fake_postname[0])
-          make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_postname);
+          make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_postname, separator);
        else
           if (CC->fake_username[0])
-             make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_username);
+             make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_username, separator);
           else
-             make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, "");
+             make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, "", separator);
        save_message(CC->temp,buf,mtsflag,e,1);
         CC->fake_postname[0]='\0';
        return;
index c08446d5eeb79321386d58292ff1dba593841bf3..ce041b50b94cc6b99db5a25277a8e44346cedbdb 100644 (file)
@@ -17,7 +17,7 @@ void save_message (char *mtmp, char *rec, char mtsflag, int mailtype,
 void aide_message (char *text);
 void make_message (char *filename, struct usersupp *author, char *recipient,
                   char *room, int type, int net_type, int format_type,
-                  char *fake_name);
+                  char *fake_name, char *separator);
 void cmd_ent0 (char *entargs);
 void cmd_ent3 (char *entargs);
 void cmd_dele (char *delstr);
index 718797a15db092db32097687710dcec6af541a76..1a46a3ecf9a68b8852b27dc9a0f2d23c8b2fdf2a 100644 (file)
@@ -70,49 +70,51 @@ all software should be written to IGNORE fields not currently defined.
 
 BYTE   Mnemonic        Comments
 
-T      Date/Time       A 32-bit integer containing the date and time of
-                        the message in standard UNIX format (the number
-                        of seconds since January 1, 1970 GMT).
-P      Path            Complete path of message, as in the UseNet news
-                       standard.  A user should be able to send UUCP mail to
-                       this path. (Note that your system name will not be
-                       tacked onto this until you're sending the message to
-                       someone else)
-I      Original ID     A 32-bit integer containing the message ID on the
-                       system the message *originated* on.
 #       Local ID       A 32-bit integer containing the message ID on the
                         system the message is *currently* on (obviously this
                         is meaningless for a message being transmitted over
                         a network).
 A      Author          Name of originator of message.
-R      Recipient       Only present in Mail messages.
-O      Room            Room of origin.
-N      Nodename        Contains node name of system message originated on.
-H      HumanNodeName   Human-readable name of system message originated on.
-D      Destination     Contains name of the system this message should
-                       be sent to, for mail routing (private mail only).
-U       Subject         Optional.  Developers may choose whether they wish to
-                        generate or display subject fields.  Citadel/UX does
-                        not generate them, but it does print them when found.
 B      Phone number    The dialup number of the system this message
                        originated on.  This is optional, and is only
                        defined for helping implement C86Net gateways.
+D      Destination     Contains name of the system this message should
+                       be sent to, for mail routing (private mail only).
 G      Gateway domain  This field is provided solely for the implementation
                         of C86Net gateways, and holds the C86Net domain of
                         the system this message originated on.  Unless you're
                         implementing such a gateway, there's no need to even
                         bother with this field.
+H      HumanNodeName   Human-readable name of system message originated on.
+I      Original ID     A 32-bit integer containing the message ID on the
+                       system the message *originated* on.
+M      Message Text    Normal ASCII, newlines seperated by CR's or LF's,
+                        null terminated as always.
+N      Nodename        Contains node name of system message originated on.
+O      Room            Room of origin.
+P      Path            Complete path of message, as in the UseNet news
+                       standard.  A user should be able to send UUCP mail to
+                       this path. (Note that your system name will not be
+                       tacked onto this until you're sending the message to
+                       someone else)
+R      Recipient       Only present in Mail messages.
 S       Special field   Only meaningful for messages being spooled over a
                         network.  Usually means that the message isn't really
                         a message, but rather some other network function:
                         -> "S" followed by "FILE" (followed by a null, of
                         course) means that the message text is actually an
                         IGnet/Open file transfer.
-M      Message Text    Normal ASCII, newlines seperated by CR's or LF's,
-                        null terminated as always.
+T      Date/Time       A 32-bit integer containing the date and time of
+                        the message in standard UNIX format (the number
+                        of seconds since January 1, 1970 GMT).
+U       Subject         Optional.  Developers may choose whether they wish to
+                        generate or display subject fields.  Citadel/UX does
+                        not generate them, but it does print them when found.
 X      eXtension field Extension fields are used to carry additional RFC822
                        type lines.  X fields contain the X byte followed by
                        the RFC822 field name, a colon, a space, and the value.
+Z      Separator       If there are MIME attachments following the message
+                       text, the Z field specifies the separator string.
   
                        EXAMPLE
 
index 1c5d4f350ae2f6311ad6c8fc8936088dc279a154..4abd9d53f9ec858d897107c0571c0dff0b98e184 100644 (file)
@@ -664,7 +664,7 @@ the error) without reading in a message.  Client software should, in fact,
 perform this operation at the beginning of an "enter message" command
 *before* starting up its editor, so the user does not end up typing a message
 in vain that will not be permitted to be saved.  If it is set to 2, the
-server will accept an "apparant" post name if the user is privileged enough. 
+server will accept an "apparent" post name if the user is privileged enough. 
 This post name is arg 4.
   1  -  Recipient.  This argument is utilized only for private mail messages.
 It is ignored for public messages.  It contains, of course, the name of the
@@ -676,6 +676,8 @@ message as anonymous, otherwise 0 for a normal message.
 typically be 0; see the MSG0 command above).
   4  -  Post name.  When postflag is 2, this is the name you are posting as.
 This is an Aide only command.
+  5  -  Separator string to be used when there are MIME attachments following
+the normal message text.
 
  Possible result codes:
   OK  -  The request is valid.  (Client did not set the "post" flag, so the