-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index a086dfc..2144899 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -152,72 +152,72 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
152 | QString temp, boundary; | 152 | QString temp, boundary; |
153 | int pos; | 153 | int pos; |
154 | QString delimiter, header, body, mimeHeader, mimeBody; | 154 | QString delimiter, header, body, mimeHeader, mimeBody; |
155 | QString content, contentType, contentAttribute, id, encoding; | 155 | QString content, contentType, contentAttribute, id, encoding; |
156 | QString fileName, storedName; | 156 | QString fileName, storedName; |
157 | int enclosureId = 0; | 157 | int enclosureId = 0; |
158 | 158 | ||
159 | mail->rawMail = in; | 159 | mail->rawMail = in; |
160 | mail->received = TRUE; | 160 | mail->received = TRUE; |
161 | mail->files.setAutoDelete(TRUE); | 161 | mail->files.setAutoDelete(TRUE); |
162 | 162 | ||
163 | temp = lineShift + "." + lineShift; | 163 | temp = lineShift + "." + lineShift; |
164 | 164 | ||
165 | if (in.right(temp.length()) != temp) { | 165 | if (in.right(temp.length()) != temp) { |
166 | qWarning(in.right(temp.length())); | 166 | qWarning(in.right(temp.length())); |
167 | qWarning(" . added at end of email as separator"); | 167 | qWarning(" . added at end of email as separator"); |
168 | mail->rawMail += temp; | 168 | mail->rawMail += temp; |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" | 172 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" |
173 | pos = in.find(delimiter, 0, FALSE); | 173 | pos = in.find(delimiter, 0, FALSE); |
174 | header = in.left(pos); | 174 | header = in.left(pos); |
175 | body = in.right(in.length() - pos - delimiter.length()); | 175 | body = in.right(in.length() - pos - delimiter.length()); |
176 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) | 176 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) |
177 | body.truncate(body.length()-2); | 177 | body.truncate(body.length()-2); |
178 | 178 | ||
179 | TextParser p(header, lineShift); | 179 | TextParser p(header, lineShift); |
180 | 180 | ||
181 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { | 181 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { |
182 | pos++; | 182 | pos++; |
183 | if (p.separatorAt(pos) == ' ') { | 183 | if (p.separatorAt(pos) == ' ') { |
184 | mail->from = p.getString(&pos, '<'); | 184 | mail->from = p.getString(&pos, '<', false); |
185 | mail->from = mail->from.stripWhiteSpace(); | 185 | mail->from = mail->from.stripWhiteSpace(); |
186 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 186 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
187 | mail->from = mail->from.left(mail->from.length() - 1); | 187 | mail->from = mail->from.left(mail->from.length() - 1); |
188 | mail->from = mail->from.right(mail->from.length() - 1); | 188 | mail->from = mail->from.right(mail->from.length() - 1); |
189 | } | 189 | } |
190 | pos++; | 190 | pos++; |
191 | mail->fromMail = p.getString(&pos, '>'); | 191 | mail->fromMail = p.getString(&pos, '>', false); |
192 | } else { | 192 | } else { |
193 | if ((p.separatorAt(pos) == '<') | 193 | if ((p.separatorAt(pos) == '<') |
194 | || (p.separatorAt(pos) == ' ')) //No name.. nasty | 194 | || (p.separatorAt(pos) == ' ')) //No name.. nasty |
195 | pos++; | 195 | pos++; |
196 | pos++; | 196 | pos++; |
197 | mail->fromMail = p.getString(&pos, 'z', TRUE); | 197 | mail->fromMail = p.getString(&pos, 'z', TRUE); |
198 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') | 198 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') |
199 | mail->fromMail.truncate(mail->fromMail.length() - 1); | 199 | mail->fromMail.truncate(mail->fromMail.length() - 1); |
200 | mail->from=mail->fromMail; | 200 | mail->from=mail->fromMail; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { | 203 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { |
204 | pos++; | 204 | pos++; |
205 | mail->subject = p.getString(&pos, 'z', TRUE); | 205 | mail->subject = p.getString(&pos, 'z', TRUE); |
206 | } | 206 | } |
207 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { | 207 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { |
208 | pos++; | 208 | pos++; |
209 | mail->date = p.getString(&pos, 'z', true); | 209 | mail->date = p.getString(&pos, 'z', true); |
210 | } | 210 | } |
211 | if ((pos = p.find("TO",':', 0, TRUE)) != -1) { | 211 | if ((pos = p.find("TO",':', 0, TRUE)) != -1) { |
212 | pos++; | 212 | pos++; |
213 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); | 213 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); |
214 | } | 214 | } |
215 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { | 215 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { |
216 | pos++; | 216 | pos++; |
217 | if ( (p.wordAt(pos).upper() == "ID") && | 217 | if ( (p.wordAt(pos).upper() == "ID") && |
218 | (p.separatorAt(pos) == ':') ) { | 218 | (p.separatorAt(pos) == ':') ) { |
219 | 219 | ||
220 | id = p.getString(&pos, 'z', TRUE); | 220 | id = p.getString(&pos, 'z', TRUE); |
221 | mail->id = id; | 221 | mail->id = id; |
222 | } | 222 | } |
223 | } | 223 | } |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index a086dfc..2144899 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -152,72 +152,72 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
152 | QString temp, boundary; | 152 | QString temp, boundary; |
153 | int pos; | 153 | int pos; |
154 | QString delimiter, header, body, mimeHeader, mimeBody; | 154 | QString delimiter, header, body, mimeHeader, mimeBody; |
155 | QString content, contentType, contentAttribute, id, encoding; | 155 | QString content, contentType, contentAttribute, id, encoding; |
156 | QString fileName, storedName; | 156 | QString fileName, storedName; |
157 | int enclosureId = 0; | 157 | int enclosureId = 0; |
158 | 158 | ||
159 | mail->rawMail = in; | 159 | mail->rawMail = in; |
160 | mail->received = TRUE; | 160 | mail->received = TRUE; |
161 | mail->files.setAutoDelete(TRUE); | 161 | mail->files.setAutoDelete(TRUE); |
162 | 162 | ||
163 | temp = lineShift + "." + lineShift; | 163 | temp = lineShift + "." + lineShift; |
164 | 164 | ||
165 | if (in.right(temp.length()) != temp) { | 165 | if (in.right(temp.length()) != temp) { |
166 | qWarning(in.right(temp.length())); | 166 | qWarning(in.right(temp.length())); |
167 | qWarning(" . added at end of email as separator"); | 167 | qWarning(" . added at end of email as separator"); |
168 | mail->rawMail += temp; | 168 | mail->rawMail += temp; |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" | 172 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" |
173 | pos = in.find(delimiter, 0, FALSE); | 173 | pos = in.find(delimiter, 0, FALSE); |
174 | header = in.left(pos); | 174 | header = in.left(pos); |
175 | body = in.right(in.length() - pos - delimiter.length()); | 175 | body = in.right(in.length() - pos - delimiter.length()); |
176 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) | 176 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) |
177 | body.truncate(body.length()-2); | 177 | body.truncate(body.length()-2); |
178 | 178 | ||
179 | TextParser p(header, lineShift); | 179 | TextParser p(header, lineShift); |
180 | 180 | ||
181 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { | 181 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { |
182 | pos++; | 182 | pos++; |
183 | if (p.separatorAt(pos) == ' ') { | 183 | if (p.separatorAt(pos) == ' ') { |
184 | mail->from = p.getString(&pos, '<'); | 184 | mail->from = p.getString(&pos, '<', false); |
185 | mail->from = mail->from.stripWhiteSpace(); | 185 | mail->from = mail->from.stripWhiteSpace(); |
186 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 186 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
187 | mail->from = mail->from.left(mail->from.length() - 1); | 187 | mail->from = mail->from.left(mail->from.length() - 1); |
188 | mail->from = mail->from.right(mail->from.length() - 1); | 188 | mail->from = mail->from.right(mail->from.length() - 1); |
189 | } | 189 | } |
190 | pos++; | 190 | pos++; |
191 | mail->fromMail = p.getString(&pos, '>'); | 191 | mail->fromMail = p.getString(&pos, '>', false); |
192 | } else { | 192 | } else { |
193 | if ((p.separatorAt(pos) == '<') | 193 | if ((p.separatorAt(pos) == '<') |
194 | || (p.separatorAt(pos) == ' ')) //No name.. nasty | 194 | || (p.separatorAt(pos) == ' ')) //No name.. nasty |
195 | pos++; | 195 | pos++; |
196 | pos++; | 196 | pos++; |
197 | mail->fromMail = p.getString(&pos, 'z', TRUE); | 197 | mail->fromMail = p.getString(&pos, 'z', TRUE); |
198 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') | 198 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') |
199 | mail->fromMail.truncate(mail->fromMail.length() - 1); | 199 | mail->fromMail.truncate(mail->fromMail.length() - 1); |
200 | mail->from=mail->fromMail; | 200 | mail->from=mail->fromMail; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { | 203 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { |
204 | pos++; | 204 | pos++; |
205 | mail->subject = p.getString(&pos, 'z', TRUE); | 205 | mail->subject = p.getString(&pos, 'z', TRUE); |
206 | } | 206 | } |
207 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { | 207 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { |
208 | pos++; | 208 | pos++; |
209 | mail->date = p.getString(&pos, 'z', true); | 209 | mail->date = p.getString(&pos, 'z', true); |
210 | } | 210 | } |
211 | if ((pos = p.find("TO",':', 0, TRUE)) != -1) { | 211 | if ((pos = p.find("TO",':', 0, TRUE)) != -1) { |
212 | pos++; | 212 | pos++; |
213 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); | 213 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); |
214 | } | 214 | } |
215 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { | 215 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { |
216 | pos++; | 216 | pos++; |
217 | if ( (p.wordAt(pos).upper() == "ID") && | 217 | if ( (p.wordAt(pos).upper() == "ID") && |
218 | (p.separatorAt(pos) == ':') ) { | 218 | (p.separatorAt(pos) == ':') ) { |
219 | 219 | ||
220 | id = p.getString(&pos, 'z', TRUE); | 220 | id = p.getString(&pos, 'z', TRUE); |
221 | mail->id = id; | 221 | mail->id = id; |
222 | } | 222 | } |
223 | } | 223 | } |