", "\r\n"); debug_mfree(s2, "strip_html (23)"); s2 = s1; s1 = strreplace(s2, "
", "/blockquote>\r\n"); debug_mfree(s2, "strip_html (25)"); s2 = s1; s1 = strreplace(s2, "", " "); debug_mfree(s2, "strip_html (26)"); s2 = s1; s1 = strreplace(s2, "", "\r\n"); debug_mfree(s2, "strip_html (27)"); s2 = s1; s1 = strreplace(s2, ""e;", "\""); debug_mfree(s2, "strip_html (28)"); s2 = s1; s1 = strreplace(s2, " ", " "); debug_mfree(s2, "strip_html (29)"); s2 = s1; s1 = strreplace(s2, "<", "<"); debug_mfree(s2, "strip_html (30)"); s2 = s1; s1 = strreplace(s2, ">", ">"); debug_mfree(s2, "strip_html (31)"); s2 = s1; s1 = strreplace(s2, "&", "&"); debug_mfree(s2, "strip_html (32)"); s2 = s1; s1 = strreplace(s2, "©", "(c)"); debug_mfree(s2, "strip_html (33)"); //§ã§ð§Õ§Ñ §Þ§í §Ò§å§Õ§Ö§Þ §Ò§â§à§ã§Ñ§ä§î §Ü§à§ã§ä§Ú char *d = (char*) debug_malloc(strlen(s)+1, "strip_html (1)"); //§à§ä§æ§Ú§Ý§î§ä§â§å§Ö§Þ html - §â§Ö§Ù§å§Ý§î§ä§Ñ§ä §Ù§Ñ§Ó§Ö§Õ§à§Þ§à §Þ§Ö§ß§î§ê§Ö§Û §Õ§Ý§Ú§ß§í char *r = s1; d_ptr = 0; while(*r) { for(;*r && *r != '<'; r++) d[d_ptr++] = *r; for(;*r && *r != '>'; r++); if(*r) r++; } d[d_ptr] = 0; //§Ó§Ö§â§ß§×§Þ §Þ§à§Õ§Ú§æ§Ú§è§Ú§â§à§Ó§Ñ§ß§ß§å§ð §ã§ä§â§à§Ü§å §Ó §Ú§ã§ç§à§Õ§ß§í§Û §Ò§å§æ§Ö§â strcpy(s,d); debug_mfree(d, "strip_html (2)"); debug_mfree(s1, "strip_html (3)"); strip_special(s); } int get_charset(char *charset) { if (!strncmp_nocase(charset,"GB2312",12)) return GB2312; if (!strncmp_nocase(charset,"UTF-8",5)) return UTF_8; return GB2312; } char *unmime_header(const char *encoded_str, int default_charset) { const char *p = encoded_str; const char *eword_begin_p, *encoding_begin_p, *text_begin_p, *eword_end_p; char charset[32]; int encoding; char *conv_str; char *outbuf; char *out_str; size_t out_len; size_t decoded_len; out_len=strlen(encoded_str) * 2; outbuf = (char*) debug_malloc(out_len, "unmime_header (1)"); zeromem(outbuf,out_len); while (*p != '\0') { char *decoded_text = NULL; int len; eword_begin_p = strstr(p, ENCODED_WORD_BEGIN); if (!eword_begin_p) { char * curbuf = (char*) debug_malloc(strlen(p)+1, "unmime_header (2)"); switch(default_charset) { default: case GB2312: strcpy(curbuf,p); break; case UTF_8: utf82gb(curbuf,p); break; } strcat(outbuf, curbuf); debug_mfree(curbuf, "unmime_header (1)"); //strcat(outbuf, p); break; } encoding_begin_p = strchr(eword_begin_p + 2, '?'); if (!encoding_begin_p) { strcat(outbuf, p); break; } text_begin_p = strchr(encoding_begin_p + 1, '?'); if (!text_begin_p) { strcat(outbuf, p); break; } eword_end_p = strstr(text_begin_p + 1, ENCODED_WORD_END); if (!eword_end_p) { strcat(outbuf, p); break; } if (p == encoded_str) { strncat(outbuf, p, eword_begin_p - p); p = eword_begin_p; } else { /* ignore spaces between encoded words */ const char *sp; for (sp = p; sp < eword_begin_p; sp++) { if (!is_space(*sp)) { strncat(outbuf, p, eword_begin_p - p); p = eword_begin_p; break; } } } len = MIN(sizeof(charset) - 1, encoding_begin_p - (eword_begin_p + 2)); strncpy(charset, eword_begin_p + 2, len); charset[len] = '\0'; encoding = toupper(*(encoding_begin_p + 1)); if (encoding == 'B') { decoded_len=eword_end_p - (text_begin_p + 1); decoded_text = base64_decode(text_begin_p + 1,&decoded_len); } else if (encoding == 'Q') { decoded_len=eword_end_p - (text_begin_p + 1); decoded_text = quoted_printable_decode(text_begin_p + 1,&decoded_len); } else { strncat(outbuf, p, eword_end_p + 2 - p); p = eword_end_p + 2; continue; } switch(get_charset(charset)) { case GB2312: conv_str=(char*) debug_malloc(strlen(decoded_text)+1, "unmime_header (6)"); strcpy(conv_str,decoded_text); break; case UTF_8: conv_str=(char*) debug_malloc(strlen(decoded_text)+1, "unmime_header (5)"); utf82gb(conv_str,decoded_text); break; } strcat(outbuf, conv_str); debug_mfree(conv_str, "unmime_header (2)"); debug_mfree(decoded_text, "unmime_header (3)"); p = eword_end_p + 2; } out_str = outbuf; out_len = strlen(outbuf); return debug_realloc(out_str, out_len + 1, "unmime_header (1)"); }