+ if ((pBody != NULL) && (ptr - pBody > 4)) {
+ char* src;
+ char *cid_start, *cid_end;
+
+ *ptr = '\0';
+ pBody += 4;
+ while ((isspace(*pBody)) && (pBody < ptr))
+ pBody ++;
+ BodyArea = NewStrBufPlain(NULL, ptr - pBody);
+
+ if (pBody < ptr) {
+ src = strstr(pBody, "cid:");
+ if (src) {
+ cid_start = src + 4;
+ cid_end = cid_start;
+ while ((*cid_end != '"') &&
+ !isspace(*cid_end) &&
+ (cid_end < ptr))
+ cid_end ++;
+
+ /* copy tag and attributes up to src="cid: */
+ StrBufAppendBufPlain(BodyArea, pBody, src - pBody, 0);
+
+ /* add in /webcit/mimepart/<msgno>/CID/
+ trailing / stops dumb URL filters getting excited */
+ StrBufAppendPrintf(BodyArea,
+ "/webcit/mimepart/%d/",msgnum);
+ StrBufAppendBufPlain(BodyArea, cid_start, cid_end - cid_start, 0);
+
+ if (ptr - cid_end > 0)
+ StrBufAppendBufPlain(BodyArea,
+ cid_end + 1,
+ ptr - cid_end, 0);
+ }
+ else
+ StrBufAppendBufPlain(BodyArea, pBody, ptr - pBody, 0);
+ }
+ *ptr = '>';
+ }