From: Art Cancro Date: Sun, 11 Jan 2009 03:56:02 +0000 (+0000) Subject: * Updated render_MIME_ICS() to do the right thing if the calendar attachment happens... X-Git-Tag: v7.86~1627 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=22e1937630febcc5c01d38ab9227cc95230da824 * Updated render_MIME_ICS() to do the right thing if the calendar attachment happens to be at the MSG4 top level and is already resident. The previous behavior was to attempt to load it using DLAT with msgnum=0, which erased the copy in memory so it didn't render. Invitations sent by Exchange now render properly. Invitations sent by Google Calendar are displaying twice now, which is probably because they do a multipart/alternative *and* send it as an attachment. I don't know why. --- diff --git a/webcit/messages.c b/webcit/messages.c index 96510d188..3fce730f3 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -1574,10 +1574,8 @@ void MimeLoadData(wc_mime_attachment *Mime) char buf[SIZ]; off_t bytes; /* TODO: is there a chance the contenttype is different to the one we know? */ - lprintf(9, "< DLAT %ld|%s\n", Mime->msgnum, ChrPtr(Mime->PartNum)); // FIXME temporary, remove serv_printf("DLAT %ld|%s", Mime->msgnum, ChrPtr(Mime->PartNum)); serv_getln(buf, sizeof buf); - lprintf(9, "> %s\n", buf); // FIXME temporary, remove if (buf[0] == '6') { bytes = extract_long(&buf[4], 0); diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 450e66889..c8f367627 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -475,9 +475,12 @@ void render_MIME_VCard(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundC } } + void render_MIME_ICS(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset) { - MimeLoadData(Mime); + if (StrLength(Mime->Data) == 0) { + MimeLoadData(Mime); + } if (StrLength(Mime->Data) > 0) { cal_process_attachment(Mime); } @@ -855,12 +858,13 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F void render_MAIL_html(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset) { StrBuf *Buf; - /* HTML is fun, but we've got to strip it first */ + if (StrLength(Mime->Data) == 0) return; Buf = NewStrBufPlain(NULL, StrLength(Mime->Data)); + /* HTML is fun, but we've got to strip it first */ output_html(ChrPtr(Mime->Charset), (WC->wc_view == VIEW_WIKI ? 1 : 0), StrToi(Mime->PartNum),