Rev 4417 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4417 | Rev 4534 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | GetHeader(#subj, "\nSubject:"); |
41 | GetHeader(#subj, "\nSubject:"); |
42 | debug("Get mdata"); |
42 | debug("Get mdata"); |
43 | mdata = strstr(mailstart, "\x0a\x0d") + 3; |
43 | mdata = strstr(mailstart, "\x0a\x0d") + 3; |
44 | debug("ConvertToDOS"); |
44 | debug("ConvertToDOS"); |
45 | ConvertToDOS(mdata, mailstart); |
45 | ConvertToDOS(mdata, mailstart); |
46 | debug("FromHTMLtoTXT"); |
- | |
47 | FromHTMLtoTXT(); |
- | |
48 | letter_view.first = letter_view.count = 0; |
- | |
49 | - | ||
50 | line_off = mdata; |
- | |
51 | while (line_off>1) |
- | |
52 | { |
- | |
53 | line_off = GetNextLine(line_off); |
- | |
54 | letter_view.count++; |
- | |
55 | } |
- | |
56 | debug("SetAtrFromCurr"); |
46 | debug("SetAtrFromCurr"); |
57 | atr.SetAtrFromCurr(mail_list.current+1); |
47 | atr.SetAtrFromCurr(mail_list.current+1); |
58 | DrawMailBox(); |
48 | DrawMailBox(); |
59 | } |
49 | } |
60 | } |
50 | } |
Line 83... | Line 73... | ||
83 | if (strstri(searchin, "utf-8")!=0) utf8rutodos( inbuf); |
73 | if (strstri(searchin, "utf-8")!=0) utf8rutodos( inbuf); |
84 | } |
74 | } |
85 | } |
75 | } |
Line 86... | Line -... | ||
86 | - | ||
87 | - | ||
88 | void FromHTMLtoTXT() |
- | |
89 | { |
- | |
90 | dword cur_chr, txt_buf_srt, txt_buf_end, is_tag=0; |
- | |
91 | int i; |
- | |
92 | if (strstri(mdata, "")==0) && (strstri(mailstart, "text/html")==0) {debug("no html tags found"); return;} |
- | |
93 | debug ("Mail got code"); |
- | |
94 | cur_chr = mdata; |
- | |
95 | txt_buf_srt = malloc(mailend - mailstart); |
- | |
96 | txt_buf_end = txt_buf_srt; |
- | |
97 | - | ||
98 | while (cur_chr < mailend) |
- | |
99 | { |
- | |
100 | if (DSBYTE[cur_chr]=='<') is_tag = 1; |
- | |
101 | if (!is_tag) |
- | |
102 | { |
- | |
103 | DSBYTE[txt_buf_end] = DSBYTE[cur_chr]; |
- | |
104 | txt_buf_end++; |
- | |
105 | _END: |
- | |
106 | } |
- | |
107 | if (DSBYTE[cur_chr]=='>') is_tag = NULL; |
- | |
108 | cur_chr++; |
- | |
109 | } |
- | |
110 | DSBYTE[txt_buf_end] = '\0'; |
- | |
111 | strcpy(mdata, txt_buf_srt); |
- | |
112 | mailend = strlen(mailstart) + mailstart; |
- | |
113 | free(txt_buf_srt); |
- | |
114 | } |
- | |
115 | - | ||
116 | - | ||
117 | dword GetNextLine(dword start_offset) |
- | |
118 | { |
- | |
119 | dword off_n = strstr(start_offset, "\n") + 1, //разрыв строки |
- | |
120 | off_w = letter_view.w / 6 - 2 + start_offset, //max длинна скроки |
- | |
121 | off_m; |
- | |
122 | off_m = off_w; |
- | |
123 | if (off_n < off_w) return off_n; |
- | |
124 | while (off_m > start_offset) //перенос по словам |
- | |
125 | { |
- | |
126 | if (DSBYTE[off_m]==' ') || (DSBYTE[off_m]=='\9') || (DSBYTE[off_m]=='-') return off_m; |
- | |
127 | off_m--; |
- | |
128 | } |
- | |
129 | return off_w; |
- | |
130 | } |
76 | |
131 | 77 | ||
132 | dword CopyBetweenOffsets(dword start, end) //do not forget to free(line) after use |
78 | dword CopyBetweenOffsets(dword start, end) //do not forget to free(line) after use |
133 | { |
79 | { |
134 | dword line, new_line; |
80 | dword line, new_line; |