2 * This is the MIME parser for Citadel.
4 * Copyright (c) 1998-2010 by the citadel.org development team.
5 * This code is distributed under the GNU General Public License v3.
13 #include <sys/types.h>
17 #include <sys/types.h>
21 #include "xdgmime/xdgmime.h"
22 #include "libcitadel.h"
23 #include "libcitadellocal.h"
25 const unsigned char FromHexTable [256] = {
26 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0
27 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 10
28 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 20
29 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 30
30 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01, // 40
31 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF, // 50
32 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, // 60
33 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 70
34 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 80
35 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, // 90
36 0x0D, 0x0E, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //100
37 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //110
38 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //120
39 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //130
40 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //140
41 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //150
42 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //160
43 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //170
44 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //180
45 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //190
46 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //200
47 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //210
48 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //220
49 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //230
50 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //240
51 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF //250
55 void extract_key(char *target, char *source, long sourcelen, char *key, long keylen, char KeyEnd)
57 char *sptr, *ptr = NULL;
58 int double_quotes = 0;
59 long RealKeyLen = keylen;
65 ptr = bmstrcasestr_len(sptr, sourcelen - (sptr - source),
69 while (isspace(*(ptr + RealKeyLen)))
71 if (*(ptr + RealKeyLen) == KeyEnd)
78 sptr = ptr + RealKeyLen + 1;
88 strcpy(target, (ptr + RealKeyLen));
90 for (ptr=target; (*ptr != 0); ptr++) {
92 /* A semicolon means we've hit the end of the key, unless we're inside double quotes */
93 if ( (double_quotes != 1) && (*ptr == ';')) {
97 /* if we find double quotes, we've got a great set of string boundaries */
100 if (double_quotes == 1) {
113 * For non-multipart messages, we need to generate a quickie partnum of "1"
114 * to return to callback functions. Some callbacks demand it.
116 char *fixed_partnum(char *supplied_partnum) {
117 if (supplied_partnum == NULL) return "1";
118 if (strlen(supplied_partnum)==0) return "1";
119 return supplied_partnum;
123 static inline unsigned int _decode_hex(const char *Source)
126 unsigned char LO_NIBBLE;
127 unsigned char HI_NIBBLE;
129 HI_NIBBLE = FromHexTable[(unsigned char) *Source];
130 LO_NIBBLE = FromHexTable[(unsigned char) *(Source+1)];
132 if ((LO_NIBBLE == 0xFF) || (LO_NIBBLE == 0xFF))
136 ret = ret | LO_NIBBLE;
140 unsigned int decode_hex(char *Source) {return _decode_hex(Source);}
143 * Convert "quoted-printable" to binary. Returns number of bytes decoded.
144 * according to RFC2045 section 6.7
146 int CtdlDecodeQuotedPrintable(char *decoded, char *encoded, int sourcelen) {
148 int decoded_length = 0;
151 while (pos < sourcelen)
153 if (*(encoded + pos) == '=')
156 if (*(encoded + pos) == '\n')
160 else if (*(encoded + pos) == '\r')
163 if (*(encoded + pos) == '\n')
169 ch = _decode_hex(&encoded[pos]);
171 decoded[decoded_length++] = ch;
176 decoded[decoded_length++] = encoded[pos];
180 decoded[decoded_length] = 0;
181 return(decoded_length);
186 * Given a message or message-part body and a length, handle any necessary
187 * decoding and pass the request up the stack.
189 void mime_decode(char *partnum,
190 char *part_start, size_t length,
191 char *content_type, char *charset, char *encoding,
194 char *name, char *filename,
195 MimeParserCallBackType CallBack,
196 MimeParserCallBackType PreMultiPartCallBack,
197 MimeParserCallBackType PostMultiPartCallBack,
203 size_t bytes_decoded = 0;
205 /* Some encodings aren't really encodings */
206 if (!strcasecmp(encoding, "7bit"))
207 strcpy(encoding, "");
208 if (!strcasecmp(encoding, "8bit"))
209 strcpy(encoding, "");
210 if (!strcasecmp(encoding, "binary"))
211 strcpy(encoding, "");
213 /* If this part is not encoded, send as-is */
214 if ( (strlen(encoding) == 0) || (dont_decode)) {
215 if (CallBack != NULL) {
218 fixed_partnum(partnum),
231 /* Fail silently if we hit an unknown encoding. */
232 if ((strcasecmp(encoding, "base64"))
233 && (strcasecmp(encoding, "quoted-printable"))) {
238 * Allocate a buffer for the decoded data. The output buffer is slightly
239 * larger than the input buffer; this assumes that the decoded data
240 * will never be significantly larger than the encoded data. This is a
241 * safe assumption with base64, uuencode, and quoted-printable.
243 decoded = malloc(length + 32768);
244 if (decoded == NULL) {
248 if (!strcasecmp(encoding, "base64")) {
249 bytes_decoded = CtdlDecodeBase64(decoded, part_start, length);
251 else if (!strcasecmp(encoding, "quoted-printable")) {
252 bytes_decoded = CtdlDecodeQuotedPrintable(decoded, part_start, length);
255 if (bytes_decoded > 0) if (CallBack != NULL) {
256 CallBack(name, filename, fixed_partnum(partnum),
257 disposition, decoded,
258 content_type, charset, bytes_decoded, "binary", id, userdata);
265 * this is the extract of mime_decode which can be called if 'dont_decode' was set;
266 * to save the cpu intense process of decoding to the time when it realy wants the content.
268 * - > 0 we decoded something, its on *decoded, you need to free it.
269 * - = 0 no need to decode stuff. *decoded will be NULL.
270 * - < 0 an error occured, either an unknown encoding, or alloc failed. no need to free.
272 int mime_decode_now (char *part_start,
276 size_t *bytes_decoded)
280 /* Some encodings aren't really encodings */
281 if (!strcasecmp(encoding, "7bit"))
282 strcpy(encoding, "");
283 if (!strcasecmp(encoding, "8bit"))
284 strcpy(encoding, "");
285 if (!strcasecmp(encoding, "binary"))
286 strcpy(encoding, "");
288 /* If this part is not encoded, send as-is */
289 if (strlen(encoding) == 0) {
294 /* Fail if we hit an unknown encoding. */
295 if ((strcasecmp(encoding, "base64"))
296 && (strcasecmp(encoding, "quoted-printable"))) {
301 * Allocate a buffer for the decoded data. The output buffer is slightly
302 * larger than the input buffer; this assumes that the decoded data
303 * will never be significantly larger than the encoded data. This is a
304 * safe assumption with base64, uuencode, and quoted-printable.
306 *decoded = malloc(length + 32768);
307 if (decoded == NULL) {
311 if (!strcasecmp(encoding, "base64")) {
312 *bytes_decoded = CtdlDecodeBase64(*decoded, part_start, length);
315 else if (!strcasecmp(encoding, "quoted-printable")) {
316 *bytes_decoded = CtdlDecodeQuotedPrintable(*decoded, part_start, length);
324 * Break out the components of a multipart message
325 * (This function expects to be fed HEADERS + CONTENT)
326 * Note: NULL can be supplied as content_end; in this case, the message is
327 * considered to have ended when the parser encounters a 0x00 byte.
329 void the_mime_parser(char *partnum,
330 char *content_start, char *content_end,
331 MimeParserCallBackType CallBack,
332 MimeParserCallBackType PreMultiPartCallBack,
333 MimeParserCallBackType PostMultiPartCallBack,
339 char *part_start, *part_end = NULL;
344 size_t startary_len = 0;
349 size_t content_type_len;
350 size_t content_length;
353 size_t disposition_len;
356 char *content_type_name;
357 char *content_disposition_name;
363 char nested_partnum[256];
365 char *evaluate_crlf_ptr = NULL;
372 boundary = malloc(SIZ * 12);
375 startary = boundary + SIZ * 1;
378 endary = boundary + SIZ * 2;
381 header = boundary + SIZ * 3;
384 content_type = boundary + SIZ * 4;
385 *content_type = '\0';
387 charset = boundary + SIZ * 5;
390 encoding = boundary + SIZ * 6;
393 content_type_name = boundary + SIZ * 7;
394 *content_type_name = '\0';
396 content_disposition_name = boundary + SIZ * 8;
397 *content_disposition_name = '\0';
399 filename = boundary + SIZ * 9;
402 disposition = boundary + SIZ * 10;
405 id = boundary + SIZ * 11;
408 /* If the caller didn't supply an endpointer, generate one by measure */
409 if (content_end == NULL) {
410 content_end = &content_start[strlen(content_start)];
413 /* Learn interesting things from the headers */
417 ptr = memreadlinelen(ptr, buf, SIZ, &buflen);
418 if (ptr >= content_end) {
422 for (i = 0; i < buflen; ++i) {
423 if (isspace(buf[i])) {
428 if (!isspace(buf[0])) {
429 if (!strncasecmp(header, "Content-type:", 13)) {
430 memcpy (content_type, &header[13], headerlen - 12);
431 content_type_len = striplt (content_type);
433 extract_key(content_type_name, content_type, content_type_len, HKEY("name"), '=');
434 extract_key(charset, content_type, content_type_len, HKEY("charset"), '=');
435 extract_key(boundary, header, headerlen, HKEY("boundary"), '=');
437 /* Deal with weird headers */
438 if (strchr(content_type, ' '))
439 *(strchr(content_type, ' ')) = '\0';
440 if (strchr(content_type, ';'))
441 *(strchr(content_type, ';')) = '\0';
443 else if (!strncasecmp(header, "Content-Disposition:", 20)) {
444 memcpy (disposition, &header[20], headerlen - 19);
445 disposition_len = striplt(disposition);
446 extract_key(content_disposition_name, disposition, disposition_len, HKEY("name"), '=');
447 extract_key(filename, disposition, disposition_len, HKEY("filename"), '=');
449 else if (!strncasecmp(header, "Content-ID:", 11)) {
450 strcpy(id, &header[11]);
452 stripallbut(id, '<', '>');
454 else if (!strncasecmp(header, "Content-length: ", 15)) {
456 safestrncpy(clbuf, &header[15], sizeof clbuf);
458 content_length = (size_t) atol(clbuf);
460 else if (!strncasecmp(header, "Content-transfer-encoding: ", 26)) {
461 strcpy(encoding, &header[26]);
467 if ((headerlen + buflen + 2) < SIZ) {
468 memcpy(&header[headerlen], buf, buflen);
470 header[headerlen] = '\0';
472 } while ((!IsEmptyStr(buf)) && (*ptr != 0));
474 if (strchr(disposition, ';'))
475 *(strchr(disposition, ';')) = '\0';
476 striplt(disposition);
477 if (strchr(content_type, ';'))
478 *(strchr(content_type, ';')) = '\0';
479 striplt(content_type);
481 if (!IsEmptyStr(boundary)) {
487 /* If this is a multipart message, then recursively process it */
491 /* Tell the client about this message's multipartedness */
492 if (PreMultiPartCallBack != NULL) {
493 PreMultiPartCallBack("", "", partnum, "",
494 NULL, content_type, charset,
495 0, encoding, id, userdata);
498 /* Figure out where the boundaries are */
499 startary_len = snprintf(startary, SIZ, "--%s", boundary);
500 snprintf(endary, SIZ, "--%s--", boundary);
509 next_boundary = strstr(ptr, startary);
512 if ( (part_start != NULL) && (next_boundary != NULL) ) {
513 part_end = next_boundary;
514 --part_end; /* omit the trailing LF */
516 --part_end; /* omit the trailing CR */
519 if (!IsEmptyStr(partnum)) {
520 snprintf(nested_partnum,
521 sizeof nested_partnum,
526 snprintf(nested_partnum,
527 sizeof nested_partnum,
530 the_mime_parser(nested_partnum,
531 part_start, part_end,
533 PreMultiPartCallBack,
534 PostMultiPartCallBack,
539 if (next_boundary != NULL) {
540 /* If we pass out of scope, don't attempt to
541 * read past the end boundary. */
542 if (!strcmp(next_boundary, endary)) {
546 /* Set up for the next part. */
547 part_start = strstr(next_boundary, "\n");
549 /* Determine whether newlines are LF or CRLF */
550 evaluate_crlf_ptr = part_start;
552 if ((*evaluate_crlf_ptr == '\r') &&
553 (*(evaluate_crlf_ptr + 1) == '\n'))
561 /* Advance past the LF ... now we're in the next part */
567 /* Invalid end of multipart. Bail out! */
570 } while ( (ptr < content_end) && (next_boundary != NULL) );
572 if (PostMultiPartCallBack != NULL) {
573 PostMultiPartCallBack("", "", partnum, "", NULL,
574 content_type, charset, 0, encoding, id, userdata);
579 /* If it's not a multipart message, then do something with it */
583 while (ptr < content_end) {
587 part_end = content_end;
590 /* The following code will truncate the MIME part to the size
591 * specified by the Content-length: header. We have commented it
592 * out because these headers have a tendency to be wrong.
594 * if ( (content_length > 0) && (length > content_length) ) {
595 * length = content_length;
599 /* Sometimes the "name" field is tacked on to Content-type,
600 * and sometimes it's tacked on to Content-disposition. Use
601 * whichever one we have.
603 if (strlen(content_disposition_name) > strlen(content_type_name)) {
604 name = content_disposition_name;
607 name = content_type_name;
610 /* Ok, we've got a non-multipart part here, so do something with it.
614 content_type, charset, encoding, disposition, id,
616 CallBack, NULL, NULL,
617 userdata, dont_decode
621 * Now if it's an encapsulated message/rfc822 then we have to recurse into it
623 if (!strcasecmp(content_type, "message/rfc822")) {
625 if (PreMultiPartCallBack != NULL) {
626 PreMultiPartCallBack("", "", partnum, "",
627 NULL, content_type, charset,
628 0, encoding, id, userdata);
630 if (CallBack != NULL) {
631 if (strlen(partnum) > 0) {
632 snprintf(nested_partnum,
633 sizeof nested_partnum,
638 snprintf(nested_partnum,
639 sizeof nested_partnum,
642 the_mime_parser(nested_partnum,
643 part_start, part_end,
645 PreMultiPartCallBack,
646 PostMultiPartCallBack,
651 if (PostMultiPartCallBack != NULL) {
652 PostMultiPartCallBack("", "", partnum, "", NULL,
653 content_type, charset, 0, encoding, id, userdata);
661 end_parser: /* free the buffers! end the oppression!! */
668 * Entry point for the MIME parser.
669 * (This function expects to be fed HEADERS + CONTENT)
670 * Note: NULL can be supplied as content_end; in this case, the message is
671 * considered to have ended when the parser encounters a 0x00 byte.
673 void mime_parser(char *content_start,
675 MimeParserCallBackType CallBack,
676 MimeParserCallBackType PreMultiPartCallBack,
677 MimeParserCallBackType PostMultiPartCallBack,
682 the_mime_parser("", content_start, content_end,
684 PreMultiPartCallBack,
685 PostMultiPartCallBack,
686 userdata, dont_decode);
694 typedef struct _MimeGuess {
698 const char *MimeString;
701 MimeGuess MyMimes [] = {
729 const char *GuessMimeType(const char *data, size_t dlen)
733 while (MyMimes[MimeIndex].PatternLen != 0)
735 if ((MyMimes[MimeIndex].PatternLen +
736 MyMimes[MimeIndex].PatternOffset < dlen) &&
737 strncmp(MyMimes[MimeIndex].Pattern,
738 &data[MyMimes[MimeIndex].PatternOffset],
739 MyMimes[MimeIndex].PatternLen) == 0)
741 return MyMimes[MimeIndex].MimeString;
746 * ok, our simple minded algorythm didn't find anything,
747 * let the big chegger try it, he wil default to application/octet-stream
749 return (xdg_mime_get_mime_type_for_data(data, dlen));
753 const char* GuessMimeByFilename(const char *what, size_t len)
755 /* we know some hardcoded on our own, try them... */
756 if ((len > 3) && !strncasecmp(&what[len - 4], ".gif", 4))
758 else if ((len > 2) && !strncasecmp(&what[len - 3], ".js", 3))
759 return "text/javascript";
760 else if ((len > 3) && !strncasecmp(&what[len - 4], ".txt", 4))
762 else if ((len > 3) && !strncasecmp(&what[len - 4], ".css", 4))
764 else if ((len > 3) && !strncasecmp(&what[len - 4], ".htc", 4))
765 return "text/x-component";
766 else if ((len > 3) && !strncasecmp(&what[len - 4], ".jpg", 4))
768 else if ((len > 3) && !strncasecmp(&what[len - 4], ".png", 4))
770 else if ((len > 3) && !strncasecmp(&what[len - 4], ".ico", 4))
771 return "image/x-icon";
772 else if ((len > 3) && !strncasecmp(&what[len - 4], ".vcf", 4))
773 return "text/x-vcard";
774 else if ((len > 4) && !strncasecmp(&what[len - 5], ".html", 5))
776 else if ((len > 3) && !strncasecmp(&what[len - 4], ".htm", 4))
778 else if ((len > 3) && !strncasecmp(&what[len - 4], ".wml", 4))
779 return "text/vnd.wap.wml";
780 else if ((len > 4) && !strncasecmp(&what[len - 5], ".wmls", 5))
781 return "text/vnd.wap.wmlscript";
782 else if ((len > 4) && !strncasecmp(&what[len - 5], ".wmlc", 5))
783 return "application/vnd.wap.wmlc";
784 else if ((len > 5) && !strncasecmp(&what[len - 6], ".wmlsc", 6))
785 return "application/vnd.wap.wmlscriptc";
786 else if ((len > 4) && !strncasecmp(&what[len - 5], ".wbmp", 5))
787 return "image/vnd.wap.wbmp";
789 /* and let xdgmime do the fallback. */
790 return xdg_mime_get_mime_type_from_file_name(what);
793 static HashList *IconHash = NULL;
795 typedef struct IconName IconName;
802 static void DeleteIcon(void *IconNamePtr)
804 IconName *Icon = (IconName*) IconNamePtr;
805 free(Icon->FlatName);
806 free(Icon->FileName);
811 static const char *PrintFlat(void *IconNamePtr)
813 IconName *Icon = (IconName*) IconNamePtr;
814 return Icon->FlatName;
816 static const char *PrintFile(void *IconNamePtr)
818 IconName *Icon = (IconName*) IconNamePtr;
819 return Icon->FileName;
823 #define GENSTR "x-generic"
824 #define IGNORE_PREFIX_1 "gnome-mime"
825 int LoadIconDir(const char *DirName)
828 struct dirent *filedir_entry;
833 filedir = opendir (DirName);
834 IconHash = NewHash(1, NULL);
835 if (filedir == NULL) {
839 while ((filedir_entry = readdir(filedir)))
843 #ifdef _DIRENT_HAVE_D_NAMELEN
844 d_namelen = filedir_entry->d_namelen;
846 d_namelen = strlen(filedir_entry->d_name);
848 d_without_ext = d_namelen;
849 while ((d_without_ext > 0) && (filedir_entry->d_name[d_without_ext] != '.'))
851 if ((d_without_ext == 0) || (d_namelen < 3))
854 if ((sizeof(IGNORE_PREFIX_1) < d_namelen) &&
855 (strncmp(IGNORE_PREFIX_1,
856 filedir_entry->d_name,
857 sizeof(IGNORE_PREFIX_1) - 1) == 0)) {
858 PStart = filedir_entry->d_name + sizeof(IGNORE_PREFIX_1);
859 d_without_ext -= sizeof(IGNORE_PREFIX_1);
862 PStart = filedir_entry->d_name;
864 Icon = malloc(sizeof(IconName));
866 Icon->FileName = malloc(d_namelen + 1);
867 memcpy(Icon->FileName, filedir_entry->d_name, d_namelen + 1);
869 Icon->FlatName = malloc(d_without_ext + 1);
870 memcpy(Icon->FlatName, PStart, d_without_ext);
871 Icon->FlatName[d_without_ext] = '\0';
872 /* Try to find Minor type in image-jpeg */
873 MinorPtr = strchr(Icon->FlatName, '-');
874 if (MinorPtr != NULL) {
876 MinorLen = 1 + d_without_ext - (MinorPtr - Icon->FlatName + 1);
877 if ((MinorLen == sizeof(GENSTR)) &&
878 (strncmp(MinorPtr + 1, GENSTR, sizeof(GENSTR)) == 0)) {
879 /* ok, we found a generic filename. cut the generic. */
881 d_without_ext = d_without_ext - (MinorPtr - Icon->FlatName);
883 else { /* Map the major / minor separator to / */
888 // PrintHash(IconHash, PrintFlat, PrintFile);
889 // printf("%s - %s\n", Icon->FlatName, Icon->FileName);
890 Put(IconHash, Icon->FlatName, d_without_ext, Icon, DeleteIcon);
891 // PrintHash(IconHash, PrintFlat, PrintFile);
897 const char *GetIconFilename(char *MimeType, size_t len)
905 GetHash(IconHash, MimeType, len, &vIcon), Icon = (IconName*) vIcon;
906 /* didn't find the exact mimetype? try major only. */
909 pMinor = strchr(MimeType, '/');
910 if (pMinor != NULL) {
912 GetHash(IconHash, MimeType, pMinor - MimeType, &vIcon),
913 Icon = (IconName*) vIcon;
920 /*printf("Getting: [%s] == [%s] -> [%s]\n", MimeType, Icon->FlatName, Icon->FileName);*/
921 return Icon->FileName;
924 void ShutDownLibCitadelMime(void)
926 DeleteHash(&IconHash);