DeleteHash(&Msg->Attachments); /**< list of Accachments */
DeleteHash(&Msg->Submessages);
DeleteHash(&Msg->AttachLinks);
+ DeleteHash(&Msg->AllAttach);
DestroyMimeParts(&Msg->MsgBody);
StrBufExtract_token(mime->Name, HdrLine, 0, '|');
StrBufExtract_token(Buf, HdrLine, 1, '|');
+ mime->FileName = NewStrBuf();
StrBuf_RFC822_to_Utf8(mime->FileName, Buf, WC->DefaultCharset, FoundCharset);
mime->PartNum = NewStrBuf();
StrBufAppendBuf(mime->FileName, mime->Name, 0);
}
+ if (Msg->AllAttach == NULL)
+ Msg->AllAttach = NewHash(1,NULL);
+ Put(Msg->AllAttach, SKEY(mime->PartNum), mime, DestroyMime);
+
if (!strcasecmp(ChrPtr(mime->ContentType), "message/rfc822")) {
if (Msg->Submessages == NULL)
Msg->Submessages = NewHash(1,NULL);
- Put(Msg->Submessages, SKEY(mime->PartNum), mime->PartNum, reference_free_handler);
+ Put(Msg->Submessages, SKEY(mime->PartNum), mime, reference_free_handler);
}
else if ((!strcasecmp(ChrPtr(mime->Disposition), "inline"))
&& (!strncasecmp(ChrPtr(mime->ContentType), "image/", 6)) ){
if (Msg->AttachLinks == NULL)
Msg->AttachLinks = NewHash(1,NULL);
- Put(Msg->AttachLinks, SKEY(mime->PartNum), mime->PartNum, reference_free_handler);
+ Put(Msg->AttachLinks, SKEY(mime->PartNum), mime, reference_free_handler);
}
else if ((StrLength(mime->ContentType) > 0) &&
( (!strcasecmp(ChrPtr(mime->Disposition), "attachment"))
if (Msg->AttachLinks == NULL)
Msg->AttachLinks = NewHash(1,NULL);
- Put(Msg->AttachLinks, SKEY(mime->PartNum), mime->PartNum, reference_free_handler);
+ Put(Msg->AttachLinks, SKEY(mime->PartNum), mime, reference_free_handler);
if (strcasecmp(ChrPtr(mime->ContentType), "application/octet-stream") == 0) {
FlushStrBuf(mime->ContentType);
StrBufAppendBufPlain(mime->ContentType,
+HashList *iterate_get_mime_All(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ message_summary *Msg = (message_summary*) Context;
+ return Msg->AllAttach;
+}
+HashList *iterate_get_mime_Submessages(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ message_summary *Msg = (message_summary*) Context;
+ return Msg->Submessages;
+}
+HashList *iterate_get_mime_AttachLinks(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ message_summary *Msg = (message_summary*) Context;
+ return Msg->AttachLinks;
+}
+HashList *iterate_get_mime_Attachments(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ message_summary *Msg = (message_summary*) Context;
+ return Msg->AllAttach;
+}
+
+
+void tmplput_MIME_ATTACH(StrBuf *TemplBuffer, void *Context, WCTemplateToken *Token)
+{
+}
+
+
+
+
/*
* Look for URL's embedded in a buffer and make them linkable. We use a
RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY, CTX_MAILSUM);
+ RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM);
+ RegisterConditional(HKEY("COND:MAIL:SUMM:H_NODE"), 0, Conditional_MAIL_SUMM_H_NODE, CTX_MAILSUM);
+ RegisterConditional(HKEY("COND:MAIL:SUMM:OTHERNODE"), 0, Conditional_MAIL_SUMM_OTHERNODE, CTX_MAILSUM);
+
+
+ RegisterIterator("MAIL:MIME:ATTACH", 0, NULL, iterate_get_mime_All,
+ tmplput_MIME_ATTACH, NULL, CTX_MIME_ATACH, CTX_MAILSUM);
+ RegisterIterator("MAIL:MIME:ATTACH:SUBMESSAGES", 0, NULL, iterate_get_mime_Submessages,
+ tmplput_MIME_ATTACH, NULL, CTX_MIME_ATACH, CTX_MAILSUM);
+ RegisterIterator("MAIL:MIME:ATTACH:LINKS", 0, NULL, iterate_get_mime_AttachLinks,
+ tmplput_MIME_ATTACH, NULL, CTX_MIME_ATACH, CTX_MAILSUM);
+ RegisterIterator("MAIL:MIME:ATTACH:ATT", 0, NULL, iterate_get_mime_Attachments,
+ tmplput_MIME_ATTACH, NULL, CTX_MIME_ATACH, CTX_MAILSUM);
RegisterMimeRenderer(HKEY("text/x-citadel-variformat"), render_MAIL_variformat);
RegisterMimeRenderer(HKEY("text/plain"), render_MAIL_text_plain);
RegisterMimeRenderer(HKEY("text/html"), render_MAIL_html);
RegisterMimeRenderer(HKEY(""), render_MAIL_UNKNOWN);
-
- RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM);
- RegisterConditional(HKEY("COND:MAIL:SUMM:H_NODE"), 0, Conditional_MAIL_SUMM_H_NODE, CTX_MAILSUM);
- RegisterConditional(HKEY("COND:MAIL:SUMM:OTHERNODE"), 0, Conditional_MAIL_SUMM_OTHERNODE, CTX_MAILSUM);
-
RegisterMsgHdr(HKEY("nhdr"), examine_nhdr, 0);
RegisterMsgHdr(HKEY("type"), examine_type, 0);
RegisterMsgHdr(HKEY("from"), examine_from, 0);