Diffstat (limited to 'noncore/net/mailit/emailhandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index b180051..fbbada7 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -118,36 +118,38 @@ void EmailHandler::getMailHeaders() | |||
118 | popClient->newConnection(mailAccount.popServer, 110); | 118 | popClient->newConnection(mailAccount.popServer, 110); |
119 | } | 119 | } |
120 | 120 | ||
121 | void EmailHandler::getMailByList(MailList *mailList) | 121 | void EmailHandler::getMailByList(MailList *mailList) |
122 | { | 122 | { |
123 | if (mailList->count() == 0) { //should not occur though | 123 | if (mailList->count() == 0) { //should not occur though |
124 | emit mailTransfered(0); | 124 | emit mailTransfered(0); |
125 | return; | 125 | return; |
126 | } | 126 | } |
127 | 127 | ||
128 | headers = FALSE; | 128 | headers = FALSE; |
129 | popClient->headersOnly(FALSE, 0); | 129 | popClient->headersOnly(FALSE, 0); |
130 | popClient->newConnection(mailAccount.popServer, 110); | 130 | |
131 | popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd); | ||
131 | popClient->setSelectedMails(mailList); | 132 | popClient->setSelectedMails(mailList); |
132 | } | 133 | popClient->newConnection(mailAccount.popServer, 110); |
134 | } | ||
133 | 135 | ||
134 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) | 136 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) |
135 | { | 137 | { |
136 | Email mail; | 138 | Email mail; |
137 | 139 | ||
138 | mail.rawMail = message; | 140 | mail.rawMail = message; |
139 | mail.serverId = id; | 141 | mail.serverId = id; |
140 | mail.size = size; | 142 | mail.size = size; |
141 | mail.downloaded = incomplete; | 143 | mail.downloaded = complete; |
142 | 144 | ||
143 | emit mailArrived(mail, FALSE); | 145 | emit mailArrived(mail, FALSE); |
144 | } | 146 | } |
145 | 147 | ||
146 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | 148 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) |
147 | { | 149 | { |
148 | QString temp, boundary; | 150 | QString temp, boundary; |
149 | int pos; | 151 | int pos; |
150 | QString delimiter, header, body, mimeHeader, mimeBody; | 152 | QString delimiter, header, body, mimeHeader, mimeBody; |
151 | QString content, contentType, contentAttribute, id, encoding; | 153 | QString content, contentType, contentAttribute, id, encoding; |
152 | QString fileName, storedName; | 154 | QString fileName, storedName; |
153 | int enclosureId = 0; | 155 | int enclosureId = 0; |
@@ -173,31 +175,29 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
173 | TextParser p(header, lineShift); | 175 | TextParser p(header, lineShift); |
174 | 176 | ||
175 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { | 177 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { |
176 | pos++; | 178 | pos++; |
177 | if (p.separatorAt(pos) == ' ') { | 179 | if (p.separatorAt(pos) == ' ') { |
178 | mail->from = p.getString(&pos, '<', false); | 180 | mail->from = p.getString(&pos, '<', false); |
179 | mail->from = mail->from.stripWhiteSpace(); | 181 | mail->from = mail->from.stripWhiteSpace(); |
180 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 182 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
181 | mail->from = mail->from.left(mail->from.length() - 1); | 183 | mail->from = mail->from.left(mail->from.length() - 1); |
182 | mail->from = mail->from.right(mail->from.length() - 1); | 184 | mail->from = mail->from.right(mail->from.length() - 1); |
183 | } | 185 | } |
184 | pos++; | 186 | pos++; |
185 | |||
186 | mail->fromMail = p.getString(&pos, '>', false); | 187 | mail->fromMail = p.getString(&pos, '>', false); |
187 | } else { | 188 | } else { |
188 | if ((p.separatorAt(pos) == '<') | 189 | if (p.separatorAt(pos) == '<') //No name.. nasty |
189 | || (p.separatorAt(pos) == ' ')) //No name.. nasty | ||
190 | pos++; | ||
191 | pos++; | 190 | pos++; |
191 | //pos++; | ||
192 | mail->fromMail = p.getString(&pos, 'z', TRUE); | 192 | mail->fromMail = p.getString(&pos, 'z', TRUE); |
193 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') | 193 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') |
194 | mail->fromMail.truncate(mail->fromMail.length() - 1); | 194 | mail->fromMail.truncate(mail->fromMail.length() - 1); |
195 | mail->from=mail->fromMail; | 195 | mail->from=mail->fromMail; |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | pos=0; | 199 | pos=0; |
200 | 200 | ||
201 | //Search for To: after the FROM: attribute to prevent hitting the Delivered-To: | 201 | //Search for To: after the FROM: attribute to prevent hitting the Delivered-To: |
202 | while((pos = p.find("TO",':', pos+1, TRUE))!=-1) | 202 | while((pos = p.find("TO",':', pos+1, TRUE))!=-1) |
203 | { | 203 | { |