]> code.citadel.org Git - citadel.git/blobdiff - webcit/messages.c
Submitting a message and getting back a 550 from the server now results in an error...
[citadel.git] / webcit / messages.c
index feaf5db329371b53bafbd3c06bcc0b3c70de94e8..93107db0c5b074410bf2660f2e4a8afcadab3a51 100644 (file)
@@ -1007,13 +1007,13 @@ void post_message(void)
                const StrBuf *my_email_addr = NULL;
                StrBuf *CmdBuf = NULL;
                StrBuf *references = NULL;
-               int save_to_drafts;
-               long HeaderLen;
+               int saving_to_drafts = 0;
+               long HeaderLen = 0;
 
-               save_to_drafts = !strcasecmp(bstr("submit_action"), "drafts");
+               saving_to_drafts = !strcasecmp(bstr("submit_action"), "drafts");
                Buf = NewStrBuf();
 
-               if (save_to_drafts) {
+               if (saving_to_drafts) {
                        /* temporarily change to the drafts room */
                        serv_puts("GOTO _DRAFTS_");
                        StrBuf_ServGetln(Buf);
@@ -1071,12 +1071,12 @@ void post_message(void)
                CmdBuf = NewStrBufPlain(NULL, sizeof (CMD) + HeaderLen);
                StrBufPrintf(CmdBuf, 
                             CMD,
-                            save_to_drafts?"":ChrPtr(Recp),
+                            saving_to_drafts?"":ChrPtr(Recp),
                             is_anonymous,
                             ChrPtr(encoded_subject),
                             ChrPtr(display_name),
-                            save_to_drafts?"":ChrPtr(Cc),
-                            save_to_drafts?"":ChrPtr(Bcc),
+                            saving_to_drafts?"":ChrPtr(Cc),
+                            saving_to_drafts?"":ChrPtr(Bcc),
                             ChrPtr(Wikipage),
                             ChrPtr(my_email_addr),
                             ChrPtr(references));
@@ -1097,7 +1097,7 @@ void post_message(void)
 
                        StrBuf_ServGetln(Buf);
                        if (GetServerStatus(Buf, NULL) == 4) {
-                               if (save_to_drafts) {
+                               if (saving_to_drafts) {
                                        if (  (havebstr("recp"))
                                              || (havebstr("cc"  ))
                                              || (havebstr("bcc" )) ) {
@@ -1110,7 +1110,7 @@ void post_message(void)
                                        }
                                }
                                post_mime_to_server();
-                               if (save_to_drafts) {
+                               if (saving_to_drafts) {
                                        AppendImportantMessage(_("Message has been saved to Drafts.\n"), -1);
                                        gotoroom(WCC->CurRoom.name);
                                        display_enter();
@@ -1127,11 +1127,11 @@ void post_message(void)
                                }
                                dont_post = lbstr("postseq");
                        } else {
-                               /* FIXME this does not work!  It just displays an empty screen */
-                               syslog(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf) + 4);
+                               syslog(9, "%s:%d: server post error: %s", __FILE__, __LINE__, ChrPtr(Buf) + 4);
                                AppendImportantMessage(ChrPtr(Buf) + 4, StrLength(Buf) - 4);
-                               if (save_to_drafts) gotoroom(WCC->CurRoom.name);
                                display_enter();
+                               if (saving_to_drafts) gotoroom(WCC->CurRoom.name);
+                               FreeStrBuf(&Recp);
                                FreeStrBuf(&Buf);
                                FreeStrBuf(&Cc);
                                FreeStrBuf(&Bcc);
@@ -1594,15 +1594,20 @@ void display_enter(void)
 
                rc = GetServerStatusMsg(CmdBuf, &Result, 0, 0);
 
-               if (Result == 570) {    /* 570 means we have an invalid recipient listed */
-                       if (havebstr("recp") && 
-                           havebstr("cc"  ) && 
-                           havebstr("bcc" )) {
-                               recipient_bad = 1; /* TODO: and now????? */
+               if (    (Result == 570)         /* invalid or missing recipient(s) */
+                       || (Result == 550)      /* access control problem */
+               ) {
+                       if (    havebstr("recp")
+                               && havebstr("cc")
+                               && havebstr("bcc")
+                       ) {
+                               recipient_bad = 1;      /* FIXME ... do something with this? */
                        }
                }
                else if (rc != 2) {     /* Any other error means that we cannot continue */
-                       wc_printf("<em>%s</em><br>\n", ChrPtr(CmdBuf) +4);      /* TODO -> important message */
+
+                       /* FIXME IMMEDIATELY this code results in a blank screen!!! */
+                       wc_printf("<em>%s</em><br>\n", ChrPtr(CmdBuf) +4);
                        FreeStrBuf(&CmdBuf);
                        return;
                }