From 0952ab98d73959ad9897b427773fd80a385f151b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 8 Nov 2008 23:17:37 +0000 Subject: [PATCH] * add ical and vcard rendering --- webcit/calendar.c | 115 ++++++------ webcit/messages.c | 171 +++++++++++------- webcit/static/t/view_message.html | 4 + .../static/t/view_message_inline_attach.html | 5 + webcit/webcit.c | 24 +++ webcit/webcit.h | 13 +- 6 files changed, 204 insertions(+), 128 deletions(-) create mode 100644 webcit/static/t/view_message_inline_attach.html diff --git a/webcit/calendar.c b/webcit/calendar.c index 9013ad3b1..8f465c629 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -16,10 +16,11 @@ * msgnum: Message number on the Citadel server * cal_partnum: MIME part number within that message containing the calendar object */ -void cal_process_object(icalcomponent *cal, +void cal_process_object(StrBuf *Target, + icalcomponent *cal, int recursion_level, long msgnum, - char *cal_partnum) + const char *cal_partnum) { icalcomponent *c; icalproperty *method = NULL; @@ -38,7 +39,7 @@ void cal_process_object(icalcomponent *cal, /* Leading HTML for the display of this object */ if (recursion_level == 0) { - wprintf("
\n"); + StrBufAppendPrintf(Target, "
\n"); } /* Look for a method */ @@ -49,9 +50,9 @@ void cal_process_object(icalcomponent *cal, the_method = icalproperty_get_method(method); char *title; - wprintf("
", divname); - wprintf(""); - wprintf(""); + StrBufAppendPrintf(Target, "
", divname); + StrBufAppendPrintf(Target, ""); + StrBufAppendPrintf(Target, ""); switch(the_method) { case ICAL_METHOD_REQUEST: title = _("Meeting invitation"); @@ -66,29 +67,29 @@ void cal_process_object(icalcomponent *cal, title = _("This is an unknown type of calendar item."); break; } - wprintf(""); + StrBufAppendPrintf(Target, ""); - wprintf("  %s",title); - wprintf("
"); + StrBufAppendPrintf(Target, "  %s",title); + StrBufAppendPrintf(Target, "
"); } - wprintf("
"); + StrBufAppendPrintf(Target, "
"); p = icalcomponent_get_first_property(cal, ICAL_SUMMARY_PROPERTY); if (p != NULL) { - wprintf("
"); - wprintf(_("Summary:")); - wprintf("
"); - escputs((char *)icalproperty_get_comment(p)); - wprintf("
\n"); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Summary:")); + StrBufAppendPrintf(Target, "
"); + StrEscAppend(Target, NULL, (char *)icalproperty_get_comment(p), 0, 0); + StrBufAppendPrintf(Target, "
\n"); } p = icalcomponent_get_first_property(cal, ICAL_LOCATION_PROPERTY); if (p != NULL) { - wprintf("
"); - wprintf(_("Location:")); - wprintf("
"); - escputs((char *)icalproperty_get_comment(p)); - wprintf("
\n"); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Location:")); + StrBufAppendPrintf(Target, "
"); + StrEscAppend(Target, NULL, (char *)icalproperty_get_comment(p), 0, 0); + StrBufAppendPrintf(Target, "
\n"); } /* @@ -109,16 +110,16 @@ void cal_process_object(icalcomponent *cal, d_tm.tm_mon = t.month - 1; d_tm.tm_mday = t.day; wc_strftime(d_str, sizeof d_str, "%x", &d_tm); - wprintf("
"); - wprintf(_("Date:")); - wprintf("
%s
", d_str); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Date:")); + StrBufAppendPrintf(Target, "
%s
", d_str); } else { tt = icaltime_as_timet(t); webcit_fmt_date(buf, tt, 0); - wprintf("
"); - wprintf(_("Starting date/time:")); - wprintf("
%s
", buf); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Starting date/time:")); + StrBufAppendPrintf(Target, "
%s
", buf); } } @@ -127,43 +128,43 @@ void cal_process_object(icalcomponent *cal, t = icalproperty_get_dtend(p); tt = icaltime_as_timet(t); webcit_fmt_date(buf, tt, 0); - wprintf("
"); - wprintf(_("Ending date/time:")); - wprintf("
%s
", buf); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Ending date/time:")); + StrBufAppendPrintf(Target, "
%s
", buf); } } p = icalcomponent_get_first_property(cal, ICAL_DESCRIPTION_PROPERTY); if (p != NULL) { - wprintf("
"); - wprintf(_("Description:")); - wprintf("
"); - escputs((char *)icalproperty_get_comment(p)); - wprintf("
\n"); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Description:")); + StrBufAppendPrintf(Target, "
"); + StrEscAppend(Target, NULL, (char *)icalproperty_get_comment(p), 0, 0); + StrBufAppendPrintf(Target, "
\n"); } /* If the component has attendees, iterate through them. */ for (p = icalcomponent_get_first_property(cal, ICAL_ATTENDEE_PROPERTY); (p != NULL); p = icalcomponent_get_next_property(cal, ICAL_ATTENDEE_PROPERTY)) { - wprintf("
"); - wprintf(_("Attendee:")); - wprintf("
"); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Attendee:")); + StrBufAppendPrintf(Target, "
"); safestrncpy(buf, icalproperty_get_attendee(p), sizeof buf); if (!strncasecmp(buf, "MAILTO:", 7)) { /** screen name or email address */ strcpy(buf, &buf[7]); striplt(buf); - escputs(buf); - wprintf(" "); + StrEscAppend(Target, NULL, buf, 0, 0); + StrBufAppendPrintf(Target, " "); /** participant status */ partstat_as_string(buf, p); - escputs(buf); + StrEscAppend(Target, NULL, buf, 0, 0); } - wprintf("
\n"); + StrBufAppendPrintf(Target, "\n"); } /* If the component has subcomponents, recurse through them. */ @@ -171,7 +172,7 @@ void cal_process_object(icalcomponent *cal, (c != 0); c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) { /* Recursively process subcomponent */ - cal_process_object(c, recursion_level+1, msgnum, cal_partnum); + cal_process_object(Target, c, recursion_level+1, msgnum, cal_partnum); } /* If this is a REQUEST, display conflicts and buttons */ @@ -195,23 +196,23 @@ void cal_process_object(icalcomponent *cal, _("This event would conflict with '%s' which is already in your calendar."), conflict_name); } - wprintf("
%s", + StrBufAppendPrintf(Target, "
%s", (is_update ? _("Update:") : _("CONFLICT:") ) ); - wprintf("
"); - escputs(conflict_message); - wprintf("
\n"); + StrBufAppendPrintf(Target, "
"); + StrEscAppend(Target, NULL, conflict_message, 0, 0); + StrBufAppendPrintf(Target, "
\n"); } } lprintf(9, "...done.\n"); - wprintf("
"); + StrBufAppendPrintf(Target, "
"); /* Display the Accept/Decline buttons */ - wprintf("

" + StrBufAppendPrintf(Target, "

" "%s " "    " "%s" @@ -240,7 +241,7 @@ void cal_process_object(icalcomponent *cal, ***********/ /* Display the update buttons */ - wprintf("

" + StrBufAppendPrintf(Target, "

" "%s " "    " "%s" @@ -257,7 +258,7 @@ void cal_process_object(icalcomponent *cal, /* Trailing HTML for the display of this object */ if (recursion_level == 0) { - wprintf("

 

\n"); + StrBufAppendPrintf(Target, "

 

\n"); } } @@ -270,20 +271,20 @@ void cal_process_object(icalcomponent *cal, * \param msgnum number of the mesage in our db * \param cal_partnum the number of the calendar item */ -void cal_process_attachment(char *part_source, long msgnum, char *cal_partnum) +void cal_process_attachment(wc_mime_attachment *Mime) { icalcomponent *cal; - - cal = icalcomponent_new_from_string(part_source); - + + cal = icalcomponent_new_from_string(ChrPtr(Mime->Data)); + FlushStrBuf(Mime->Data); if (cal == NULL) { - wprintf(_("There was an error parsing this calendar item.")); - wprintf("
\n"); + StrBufAppendPrintf(Mime->Data, _("There was an error parsing this calendar item.")); + StrBufAppendPrintf(Mime->Data, "
\n"); return; } ical_dezonify(cal); - cal_process_object(cal, 0, msgnum, cal_partnum); + cal_process_object(Mime->Data, cal, 0, Mime->msgnum, ChrPtr(Mime->PartNum)); /* Free the memory we obtained from libical's constructor */ icalcomponent_free(cal); diff --git a/webcit/messages.c b/webcit/messages.c index 64b0c5189..093a123e1 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -17,6 +17,9 @@ HashList *MimeRenderHandler = NULL; #define SENDER_COL_WIDTH_PCT 30 /**< Mailbox view column width */ #define DATE_PLUS_BUTTONS_WIDTH_PCT 20 /**< Mailbox view column width */ +void display_vcard(StrBuf *Target, const char *vcard_source, char alpha, int full, char *storename, long msgnum); + + void display_enter(void); int longcmp_r(const void *s1, const void *s2); int summcmp_subj(const void *s1, const void *s2); @@ -500,13 +503,52 @@ void tmplput_MAIL_SUMM_DATE_NO(StrBuf *Target, int nArgs, WCTemplateToken *Token +void render_MAIL(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset) +{ +} + +void render_MIME_VCard(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset) +{ + MimeLoadData(Mime); + if (StrLength(Mime->Data) > 0) { + StrBuf *Buf; + Buf = NewStrBuf(); + /** If it's my vCard I can edit it */ + if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM)) + || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM)) + || (WC->wc_view == VIEW_ADDRESSBOOK) + ) { + StrBufAppendPrintf(Buf, "", + Mime->msgnum, ChrPtr(Mime->PartNum)); + StrBufAppendPrintf(Buf, "[%s]", _("edit")); + } + + /* In all cases, display the full card */ + display_vcard(Buf, ChrPtr(Mime->Data), 0, 1, NULL, Mime->msgnum); + FreeStrBuf(&Mime->Data); + Mime->Data = Buf; + } + +} +void render_MIME_ICS(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset) +{ + MimeLoadData(Mime); + if (StrLength(Mime->Data) > 0) { + cal_process_attachment(Mime); + } +} + + + void examine_mime_part(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) { wc_mime_attachment *mime; StrBuf *Buf; + void *vMimeRenderer; mime = (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment)); memset(mime, 0, sizeof(wc_mime_attachment)); + mime->msgnum = Msg->msgnum; Buf = NewStrBuf(); mime->Name = NewStrBuf(); @@ -538,7 +580,11 @@ void examine_mime_part(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundChars Msg->AllAttach = NewHash(1,NULL); Put(Msg->AllAttach, SKEY(mime->PartNum), mime, DestroyMime); - if (!strcasecmp(ChrPtr(mime->ContentType), "message/rfc822")) { + + if (GetHash(MimeRenderHandler, SKEY(mime->ContentType), &vMimeRenderer) && + vMimeRenderer != NULL) + { + mime->Renderer = (RenderMimeFunc) vMimeRenderer; if (Msg->Submessages == NULL) Msg->Submessages = NewHash(1,NULL); Put(Msg->Submessages, SKEY(mime->PartNum), mime, reference_free_handler); @@ -553,8 +599,7 @@ void examine_mime_part(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundChars ( (!strcasecmp(ChrPtr(mime->Disposition), "attachment")) || (!strcasecmp(ChrPtr(mime->Disposition), "inline")) || (!strcasecmp(ChrPtr(mime->Disposition), "")))) - { - + { if (Msg->AttachLinks == NULL) Msg->AttachLinks = NewHash(1,NULL); Put(Msg->AttachLinks, SKEY(mime->PartNum), mime, reference_free_handler); @@ -566,20 +611,9 @@ void examine_mime_part(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundChars } } - /** begin handler prep ** */ - if ( (!strcasecmp(ChrPtr(mime->ContentType), "text/x-vcard")) - || (!strcasecmp(ChrPtr(mime->ContentType), "text/vcard")) ) { - Msg->vcard_partnum_ref = mime; - } - else if ( (!strcasecmp(ChrPtr(mime->ContentType), "text/calendar")) - || (!strcasecmp(ChrPtr(mime->ContentType), "application/ics")) ) { - Msg->cal_partnum_ref = mime; - } - /** end handler prep ***/ - FreeStrBuf(&Buf); - } + void tmplput_MAIL_SUMM_NATTACH(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType) { message_summary *Msg = (message_summary*) Context; @@ -907,6 +941,8 @@ void tmplput_MIME_Charset(StrBuf *Target, int nArgs, WCTemplateToken *Token, voi void tmplput_MIME_Data(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType) { wc_mime_attachment *mime = (wc_mime_attachment*) Context; + if (mime->Renderer != NULL) + mime->Renderer(mime, NULL, NULL); StrBufAppendBuf(Target, mime->Data, 0); /// TODO: check whether we need to load it now? } @@ -1134,7 +1170,7 @@ void fetchname_parsed_vcard(struct vCard *v, char *storename) { * \param full display all items of the vcard? * \param msgnum Citadel message pointer */ -void display_parsed_vcard(struct vCard *v, int full, long msgnum) { +void display_parsed_vcard(StrBuf *Target, struct vCard *v, int full, long msgnum) { int i, j; char buf[SIZ]; char *name; @@ -1157,24 +1193,24 @@ void display_parsed_vcard(struct vCard *v, int full, long msgnum) { strcpy(org, ""); if (!full) { - wprintf(""); + StrBufAppendPrintf(Target, ""); name = vcard_get_prop(v, "fn", 1, 0, 0); if (name != NULL) { - escputs(name); + StrEscAppend(Target, NULL, name, 0, 0); } else if (name = vcard_get_prop(v, "n", 1, 0, 0), name != NULL) { strcpy(fullname, name); vcard_n_prettyize(fullname); - escputs(fullname); + StrEscAppend(Target, NULL, fullname, 0, 0); } else { - wprintf(" "); + StrBufAppendPrintf(Target, " "); } - wprintf(""); + StrBufAppendPrintf(Target, ""); return; } - wprintf("
" + StrBufAppendPrintf(Target, "
" ""); for (pass=1; pass<=2; ++pass) { @@ -1289,27 +1325,27 @@ void display_parsed_vcard(struct vCard *v, int full, long msgnum) { } else if (!strcasecmp(firsttoken, "adr")) { if (pass == 2) { - wprintf("\n"); + StrBufAppendPrintf(Target, "\n"); } } /* else if (!strcasecmp(firsttoken, "photo") && full && pass == 2) { // Only output on second pass - wprintf("\n"); + StrBufAppendPrintf(Target, "\n"); } */ else if (!strcasecmp(firsttoken, "version")) { /* ignore */ @@ -1324,11 +1360,11 @@ void display_parsed_vcard(struct vCard *v, int full, long msgnum) { /*** Don't show extra fields. They're ugly. if (pass == 2) { - wprintf("\n"); + StrBufAppendPrintf(Target, "\n"); } ***/ } @@ -1338,39 +1374,39 @@ void display_parsed_vcard(struct vCard *v, int full, long msgnum) { } if (pass == 1) { - wprintf("" + StrBufAppendPrintf(Target, "" "\n"); + StrBufAppendPrintf(Target, "\n"); if (!IsEmptyStr(phone)) { - wprintf("\n", phone); + StrBufAppendPrintf(Target, "\n", phone); } if (!IsEmptyStr(mailto)) { - wprintf("\n", mailto); + StrBufAppendPrintf(Target, "\n", mailto); } } } - wprintf("
"); - wprintf(_("Address:")); - wprintf(""); + StrBufAppendPrintf(Target, "
"); + StrBufAppendPrintf(Target, _("Address:")); + StrBufAppendPrintf(Target, ""); for (j=0; j"); - else wprintf(" "); + StrEscAppend(Target, NULL, buf, 0, 0); + if (j<3) StrBufAppendPrintf(Target, "
"); + else StrBufAppendPrintf(Target, " "); } } - wprintf("
"); - wprintf(_("Photo:")); - wprintf(""); - wprintf("\"Contact",msgnum); - wprintf("
"); + StrBufAppendPrintf(Target, _("Photo:")); + StrBufAppendPrintf(Target, ""); + StrBufAppendPrintf(Target, "\"Contact",msgnum); + StrBufAppendPrintf(Target, "
"); - escputs(thisname); - wprintf(""); - escputs(thisvalue); - wprintf("
"); + StrEscAppend(Target, NULL, thisname, 0, 0); + StrBufAppendPrintf(Target, ""); + StrEscAppend(Target, NULL, thisvalue, 0, 0); + StrBufAppendPrintf(Target, "
" "" ""); - escputs(fullname); - wprintf(""); + StrEscAppend(Target, NULL, fullname, 0, 0); + StrBufAppendPrintf(Target, ""); if (!IsEmptyStr(title)) { - wprintf("
"); - escputs(title); - wprintf("
"); + StrBufAppendPrintf(Target, "
"); + StrEscAppend(Target, NULL, title, 0, 0); + StrBufAppendPrintf(Target, "
"); } if (!IsEmptyStr(org)) { - wprintf("
"); - escputs(org); - wprintf("
"); + StrBufAppendPrintf(Target, "
"); + StrEscAppend(Target, NULL, org, 0, 0); + StrBufAppendPrintf(Target, "
"); } - wprintf("
"); - wprintf(_("Telephone:")); - wprintf("%s
"); + StrBufAppendPrintf(Target, _("Telephone:")); + StrBufAppendPrintf(Target, "%s
"); - wprintf(_("E-mail:")); - wprintf("%s
"); + StrBufAppendPrintf(Target, _("E-mail:")); + StrBufAppendPrintf(Target, "%s
\n"); + StrBufAppendPrintf(Target, "
\n"); } @@ -1387,14 +1423,15 @@ void display_parsed_vcard(struct vCard *v, int full, long msgnum) { * \param storename where to store??? * \param msgnum Citadel message pointer */ -void display_vcard(char *vcard_source, char alpha, int full, char *storename, +void display_vcard(StrBuf *Target, const char *vcard_source, char alpha, int full, char *storename, long msgnum) { struct vCard *v; char *name; char buf[SIZ]; char this_alpha = 0; - v = vcard_load(vcard_source); + v = vcard_load((char*)vcard_source); ///TODO + if (v == NULL) return; name = vcard_get_prop(v, "n", 1, 0, 0); @@ -1411,7 +1448,7 @@ void display_vcard(char *vcard_source, char alpha, int full, char *storename, || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)) ) || ((!isalpha(alpha)) && (!isalpha(this_alpha))) ) { - display_parsed_vcard(v, full,msgnum); + display_parsed_vcard(Target, v, full,msgnum); } vcard_free(v); @@ -1655,16 +1692,12 @@ void read_message(long msgnum, int printable_view, char *section) { } /* In all cases, display the full card */ - display_vcard(part_source, 0, 1, NULL,msgnum); + display_vcard(WC->WBuf, part_source, 0, 1, NULL,msgnum); } } /* Handler for calendar parts */ if (!IsEmptyStr(cal_partnum)) { - part_source = load_mimepart(msgnum, cal_partnum); - if (part_source != NULL) { - cal_process_attachment(part_source, msgnum, cal_partnum); - } } if (part_source) { @@ -2192,7 +2225,7 @@ void display_addressbook(long msgnum, char alpha) { if (vcard_source != NULL) { /** Display the summary line */ - display_vcard(vcard_source, alpha, 0, NULL,msgnum); + display_vcard(WC->WBuf, vcard_source, alpha, 0, NULL,msgnum); /** If it's my vCard I can edit it */ if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM)) @@ -2283,7 +2316,7 @@ void fetch_ab_name(message_summary *Msg, char *namebuf) { if (vcard_source != NULL) { /* Grab the name off the card */ - display_vcard(vcard_source, 0, 0, namebuf, Msg->msgnum); + display_vcard(WC->WBuf, vcard_source, 0, 0, namebuf, Msg->msgnum); free(vcard_source); } @@ -4011,6 +4044,12 @@ InitModule_MSG + RegisterMimeRenderer(HKEY("message/rfc822"), render_MAIL); + RegisterMimeRenderer(HKEY("text/x-vcard"), render_MIME_VCard); + RegisterMimeRenderer(HKEY("text/vcard"), render_MIME_VCard); + RegisterMimeRenderer(HKEY("text/calendar"), render_MIME_ICS); + RegisterMimeRenderer(HKEY("application/ics"), render_MIME_ICS); + RegisterMimeRenderer(HKEY("text/x-citadel-variformat"), render_MAIL_variformat); RegisterMimeRenderer(HKEY("text/plain"), render_MAIL_text_plain); RegisterMimeRenderer(HKEY("text"), render_MAIL_text_plain); diff --git a/webcit/static/t/view_message.html b/webcit/static/t/view_message.html index 16a2b22bf..c5264eeb9 100644 --- a/webcit/static/t/view_message.html +++ b/webcit/static/t/view_message.html @@ -31,4 +31,8 @@ onMouseOut=document.getElementById("msg").style.visibility="hidden + + + + diff --git a/webcit/static/t/view_message_inline_attach.html b/webcit/static/t/view_message_inline_attach.html new file mode 100644 index 000000000..9c02dcb5b --- /dev/null +++ b/webcit/static/t/view_message_inline_attach.html @@ -0,0 +1,5 @@ + +" border=0 align=middle> + (, bytes) +[ " target="wc.."> | + "> ]
diff --git a/webcit/webcit.c b/webcit/webcit.c index 9c738b1f5..5856fce8a 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1054,6 +1054,30 @@ char *load_mimepart(long msgnum, char *partnum) } } +/* + * Read any MIME part of a message, from the server, into memory. + */ +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? + serv_printf("DLAT %ld|%s", Mime->msgnum, ChrPtr(Mime->PartNum)); + serv_getln(buf, sizeof buf); + if (buf[0] == '6') { + bytes = extract_long(&buf[4], 0); + + if (Mime->Data == NULL) + Mime->Data = NewStrBufPlain(NULL, bytes); + StrBuf_ServGetBLOB(Mime->Data, bytes); + + } + else { + FlushStrBuf(Mime->Data); + /// TODO XImportant message + } +} + /* * Convenience functions to display a page containing only a string diff --git a/webcit/webcit.h b/webcit/webcit.h index bbc026eba..033262460 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -394,7 +394,10 @@ struct wc_attachment { long lvalue; /* if we put a long... */ }; -typedef struct _wc_mime_attachment { + +typedef struct wc_mime_attachment wc_mime_attachment; +typedef void (*RenderMimeFunc)(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset); +struct wc_mime_attachment { StrBuf *Name; StrBuf *FileName; StrBuf *PartNum; @@ -409,10 +412,9 @@ typedef struct _wc_mime_attachment { char *data; /* the data pool; aka this content */ long lvalue; /* if we put a long... */ long msgnum; /**< the message number on the citadel server derived from message_summary */ -}wc_mime_attachment; - + RenderMimeFunc Renderer; +}; -typedef void (*RenderMimeFunc)(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset); /* * \brief message summary structure. ??? @@ -792,6 +794,7 @@ char *memreadlinelen(char *start, char *buf, int maxlen, int *retlen); long extract_token(char *dest, const char *source, int parmnum, char separator, int maxlen); void remove_token(char *source, int parmnum, char separator); char *load_mimepart(long msgnum, char *partnum); +void MimeLoadData(wc_mime_attachment *Mime); int pattern2(char *search, char *patn); void do_edit_vcard(long, char *, char *, char *); void striplt(char *); @@ -835,7 +838,7 @@ void output_html(const char *, int, int, StrBuf *, StrBuf *); void do_listsub(void); void toggle_self_service(void); ssize_t write(int fd, const void *buf, size_t count); -void cal_process_attachment(char *part_source, long msgnum, char *cal_partnum); +void cal_process_attachment(wc_mime_attachment *Mime); void load_calendar_item(message_summary *Msg, int unread, struct calview *c); void display_calendar(message_summary *Msg, int unread); void display_task(message_summary *Msg, int unread); -- 2.30.2