* When "Add" is clicked without specifying an upload filename, resume
authorArt Cancro <ajc@citadel.org>
Fri, 11 Jun 2004 03:15:08 +0000 (03:15 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 11 Jun 2004 03:15:08 +0000 (03:15 +0000)
  composition instead of aborting the post.
* Add attachments to messages in forward order, not reverse order

webcit/ChangeLog
webcit/messages.c

index be44627f5861c9ab2220b2f893aefe5211167635..eda5193d7be9af31bf9662823b631d5ac787d1cf 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 521.3  2004/06/11 03:15:08  ajc
+* When "Add" is clicked without specifying an upload filename, resume
+  composition instead of aborting the post.
+* Add attachments to messages in forward order, not reverse order
+
 Revision 521.2  2004/06/10 03:08:48  ajc
 * Improved the appearance of tabs in the room config screen
 
@@ -1879,4 +1884,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index 9dfa0bb969116f7d99d4a0cffec21b2823d3ded9..265b7657300e2b2965ba8e0d55f8e676e2489420 100644 (file)
@@ -1364,17 +1364,27 @@ void post_message(void)
 {
        char buf[SIZ];
        static long dont_post = (-1L);
-       struct wc_attachment *att;
+       struct wc_attachment *att, *aptr;
 
        if (WC->upload_length > 0) {
 
+               /* There's an attachment.  Save it to this struct... */
                att = malloc(sizeof(struct wc_attachment));
                memset(att, 0, sizeof(struct wc_attachment));
-               att->next = WC->first_attachment;
-               WC->first_attachment = att;
                att->length = WC->upload_length;
                strcpy(att->content_type, WC->upload_content_type);
                strcpy(att->filename, WC->upload_filename);
+               att->next = NULL;
+
+               /* And add it to the list. */
+               if (WC->first_attachment == NULL) {
+                       WC->first_attachment = att;
+               }
+               else {
+                       aptr = WC->first_attachment;
+                       while (aptr->next != NULL) aptr = aptr->next;
+                       aptr->next = att;
+               }
 
                /* Netscape sends a simple filename, which is what we want,
                 * but Satan's browser sends an entire pathname.  Reduce
@@ -1397,9 +1407,12 @@ void post_message(void)
                return;
        }
 
-       if (strcasecmp(bstr("sc"), "Save message")) {
+       if (!strcasecmp(bstr("sc"), "Cancel")) {
                sprintf(WC->ImportantMessage, 
                        "Cancelled.  Message was not posted.");
+       } else if (!strcasecmp(bstr("attach"), "Add")) {
+               display_enter();
+               return;
        } else if (atol(bstr("postseq")) == dont_post) {
                sprintf(WC->ImportantMessage, 
                        "Automatically cancelled because you have already "