> Wed Jun 10 2009 4:23:43 pm EDT EDT from samjam @ Uncensored Subject:
>Save to drafts
>
> unexpected end of message (1)
>
>
>
>
>
>
>
>
Something wrong with citadel here I think... IMAP shows the message OK, but
the message did NOT make it into my sent-items folder it seems, further more
the top message that webcit shows in my sent-items folder has my sender name
cut off at the last letter.
The original message said:
>
>
>Here's a draft attempt at a save-to-drafts button:
>
>http://repo.or.cz/w/citadel.git?a=commitdiff;h=6b629c46e4e744d0288acf866fab95
>7d36c0ea87
>
>and attached.
>
>It does save to the Drafts folder, and thunderbird is able to pick-up from
>the Drafts folder and carry on.
>
>I'll post a separate patch on webcit picking up messages from the Drafts
>folder.
>
>One difficulty is that when you post a message, webcit will decide if it is
>for post to a room or email depending on whether or not you specify any
>recipients; however sometimes an email (saved to drafts) doesn't have any
>recipients YET, so if you save-to-drafts an email message and didn't bother
>to enter any recipients, then it becomes indistinguishable from a room post;
>so perhaps we can introduce a hidden form field called post_room or something
>which is filled in for room posts?
Sam
From 6b629c46e4e744d0288acf866fab957d36c0ea87 Mon Sep 17 00:00:00 2001
From: Sam Liddicott <[email protected]>
Date: Wed, 10 Jun 2009 21:08:46 +0100
Subject: [PATCH] Add save to drafts to edit mode
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.5.4.3"
This is a multi-part message in MIME format.
--------------1.5.4.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
Recipients are saved in To, Cc, Bcc headers (if any),
otherwise the post-room is saved in X-Citadel-Room
These will need examining in the next patch to follow
were we resume from Drafts folder.
We probably need a psuedo folder _DRAFTS_
Signed-off-by: Sam Liddicott <[email protected]>
---
webcit/messages.c | 45 ++++++++++++++++++++++++++++++++----
webcit/static/t/edit_message.html | 2 +
2 files changed, 42 insertions(+), 5 deletions(-)
--------------1.5.4.3
Content-Type: text/x-patch; name="6b629c46e4e744d0288acf866fab957d36c0ea87.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="6b629c46e4e744d0288acf866fab957d36c0ea87.diff"
diff --git a/webcit/messages.c b/webcit/messages.c
index da9797e..9c3b7fe 100644
--- a/webcit/messages.c
+++ b/webcit/messages.c
@@ -1356,6 +1356,7 @@ void post_message(void)
const StrBuf *my_email_addr = NULL;
StrBuf *CmdBuf = NULL;
StrBuf *references = NULL;
+ int save_to_drafts = havebstr("save_button");
if (havebstr("references"))
{
@@ -1394,25 +1395,56 @@ void post_message(void)
StrBufPrintf(CmdBuf,
CMD,
- ChrPtr(Recp),
+ save_to_drafts?"":ChrPtr(Recp),
is_anonymous,
ChrPtr(encoded_subject),
ChrPtr(display_name),
- ChrPtr(Cc),
- ChrPtr(Bcc),
+ save_to_drafts?"":ChrPtr(Cc),
+ save_to_drafts?"":ChrPtr(Bcc),
ChrPtr(Wikipage),
ChrPtr(my_email_addr),
ChrPtr(references));
FreeStrBuf(&references);
+ if (save_to_drafts) {
+ /** temp move to the new room */
+ /* I guess we need a _DRAFTS_ */
+ serv_printf("GOTO %s", "Drafts");
+ serv_getln(buf, sizeof buf);
+ if (buf[0] != '2') {
+ /* You probably don't even have a dumb Drafts folder */
+ lprintf(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, buf);
+ sprintf(WC->ImportantMessage, "%s %s", _("Saved to Drafts failed"), &buf[4]);
+ FreeStrBuf(&CmdBuf);
+ display_enter();
+ return;
+ }
+ }
lprintf(9, "%s\n", ChrPtr(CmdBuf));
serv_puts(ChrPtr(CmdBuf));
serv_getln(buf, sizeof buf);
- FreeStrBuf(&CmdBuf);
FreeStrBuf(&encoded_subject);
+ FreeStrBuf(&CmdBuf);
if (buf[0] == '4') {
+ if (save_to_drafts) {
+ if ( (havebstr("recp"))
+ || (havebstr("cc" ))
+ || (havebstr("bcc" )) ) {
+ /* save recipient headers or room to post to */
+ serv_printf("To: %s", ChrPtr(Recp));
+ serv_printf("Cc: %s", ChrPtr(Cc));
+ serv_printf("Bcc: %s", ChrPtr(Bcc));
+ } else {
+ serv_printf("X-Citadel-Room: %s", ChrPtr(WC->wc_roomname));
+ }
+ }
post_mime_to_server();
- if ( (havebstr("recp"))
+ if (save_to_drafts) {
+ sprintf(WCC->ImportantMessage, _("Message has been saved to Drafts.\n"));
+ gotoroom(WC->wc_roomname);
+ display_enter();
+ return;
+ } else if ( (havebstr("recp"))
|| (havebstr("cc" ))
|| (havebstr("bcc" ))
) {
@@ -1425,6 +1457,9 @@ void post_message(void)
} else {
lprintf(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, buf);
sprintf(WC->ImportantMessage, "%s", &buf[4]);
+ if (save_to_drafts) {
+ gotoroom(WC->wc_roomname);
+ }
display_enter();
return;
}
diff --git a/webcit/static/t/edit_message.html b/webcit/static/t/edit_message.html
index 201fc7d..f954263 100644
--- a/webcit/static/t/edit_message.html
+++ b/webcit/static/t/edit_message.html
@@ -10,6 +10,8 @@
<input type="hidden" name="references" value="<?BSTR("references")>">
<p class="send_edit_msg">
+ <input type="submit" name="save_button" value="<?_("Save to Drafts")>">
+
<?!("COND:SUBST", 1, "RCPTREQUIRED")><input type="submit" name="send_button" value="<?_("Send message")>"><?!("X", 1)>
<??("COND:SUBST", 2, "RCPTREQUIRED")><input type="submit" name="send_button" value="<?_("Post message")>"><?!("X", 2)>
--------------1.5.4.3--