+
+
+void render_MIME_ICS_TPL(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
+{
+ icalcomponent *cal;
+ icalcomponent *c;
+ WCTemplputParams SubTP;
+
+
+ if (StrLength(Mime->Data) == 0) {
+ MimeLoadData(Mime);
+ }
+ if (StrLength(Mime->Data) > 0) {
+ cal = icalcomponent_new_from_string(ChrPtr(Mime->Data));
+ }
+ if (cal == NULL) {
+ StrBufAppendPrintf(Mime->Data, _("There was an error parsing this calendar item."));
+ StrBufAppendPrintf(Mime->Data, "<br>\n");
+ return;
+ }
+
+ memset(&SubTP, 0, sizeof(WCTemplputParams));
+ SubTP.Filter.ContextType = CTX_ICAL;
+
+ ical_dezonify(cal);
+
+ /* If the component has subcomponents, recurse through them. */
+ c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
+
+ SubTP.Context = (c != NULL) ? c : cal;
+
+ FlushStrBuf(Mime->Data);
+ DoTemplate(HKEY("ical_attachment_display"), Mime->Data, &SubTP);
+
+ cal_process_object(Mime->Data, cal, 0, Mime->msgnum, ChrPtr(Mime->PartNum));
+
+ /* Free the memory we obtained from libical's constructor */
+ icalcomponent_free(cal);
+}