Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 1c22c26..098dbdc 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -136,79 +136,79 @@ void IMAPwrapper::logout() | |||
136 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | 136 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) |
137 | { | 137 | { |
138 | int err = MAILIMAP_NO_ERROR; | 138 | int err = MAILIMAP_NO_ERROR; |
139 | clist *result = 0; | 139 | clist *result = 0; |
140 | clistcell *current; | 140 | clistcell *current; |
141 | mailimap_fetch_type *fetchType = 0; | 141 | mailimap_fetch_type *fetchType = 0; |
142 | mailimap_set *set = 0; | 142 | mailimap_set *set = 0; |
143 | 143 | ||
144 | login(); | 144 | login(); |
145 | if (!m_imap) { | 145 | if (!m_imap) { |
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | /* select mailbox READONLY for operations */ | 148 | /* select mailbox READONLY for operations */ |
149 | err = selectMbox(mailbox); | 149 | err = selectMbox(mailbox); |
150 | if ( err != MAILIMAP_NO_ERROR ) { | 150 | if ( err != MAILIMAP_NO_ERROR ) { |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | 153 | ||
154 | int last = m_imap->imap_selection_info->sel_exists; | 154 | int last = m_imap->imap_selection_info->sel_exists; |
155 | 155 | ||
156 | if (last == 0) { | 156 | if (last == 0) { |
157 | Global::statusMessage(tr("Mailbox has no mails")); | 157 | Global::statusMessage(tr("Mailbox has no mails")); |
158 | return; | 158 | return; |
159 | } else { | 159 | } else { |
160 | Global::statusMessage(tr("Mailbox has %1 mails").arg(last)); | ||
161 | } | 160 | } |
162 | 161 | ||
163 | /* the range has to start at 1!!! not with 0!!!! */ | 162 | /* the range has to start at 1!!! not with 0!!!! */ |
164 | set = mailimap_set_new_interval( 1, last ); | 163 | set = mailimap_set_new_interval( 1, last ); |
165 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 164 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
166 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); | 165 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
167 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); | 166 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); |
168 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); | 167 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
169 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); | 168 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); |
170 | 169 | ||
171 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 170 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
172 | mailimap_set_free( set ); | 171 | mailimap_set_free( set ); |
173 | mailimap_fetch_type_free( fetchType ); | 172 | mailimap_fetch_type_free( fetchType ); |
174 | 173 | ||
175 | QString date,subject,from; | 174 | QString date,subject,from; |
176 | 175 | ||
177 | if ( err == MAILIMAP_NO_ERROR ) { | 176 | if ( err == MAILIMAP_NO_ERROR ) { |
178 | mailimap_msg_att * msg_att; | 177 | mailimap_msg_att * msg_att; |
179 | int i = 0; | 178 | int i = 0; |
180 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 179 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
181 | ++i; | 180 | ++i; |
182 | msg_att = (mailimap_msg_att*)current->data; | 181 | msg_att = (mailimap_msg_att*)current->data; |
183 | RecMail*m = parse_list_result(msg_att); | 182 | RecMail*m = parse_list_result(msg_att); |
184 | if (m) { | 183 | if (m) { |
185 | m->setNumber(i); | 184 | m->setNumber(i); |
186 | m->setMbox(mailbox); | 185 | m->setMbox(mailbox); |
187 | m->setWrapper(this); | 186 | m->setWrapper(this); |
188 | target.append(m); | 187 | target.append(m); |
189 | } | 188 | } |
190 | } | 189 | } |
190 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); | ||
191 | } else { | 191 | } else { |
192 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); | 192 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); |
193 | } | 193 | } |
194 | if (result) mailimap_fetch_list_free(result); | 194 | if (result) mailimap_fetch_list_free(result); |
195 | } | 195 | } |
196 | 196 | ||
197 | QList<Folder>* IMAPwrapper::listFolders() | 197 | QList<Folder>* IMAPwrapper::listFolders() |
198 | { | 198 | { |
199 | const char *path, *mask; | 199 | const char *path, *mask; |
200 | int err = MAILIMAP_NO_ERROR; | 200 | int err = MAILIMAP_NO_ERROR; |
201 | clist *result = 0; | 201 | clist *result = 0; |
202 | clistcell *current = 0; | 202 | clistcell *current = 0; |
203 | clistcell*cur_flag = 0; | 203 | clistcell*cur_flag = 0; |
204 | mailimap_mbx_list_flags*bflags = 0; | 204 | mailimap_mbx_list_flags*bflags = 0; |
205 | 205 | ||
206 | QList<Folder> * folders = new QList<Folder>(); | 206 | QList<Folder> * folders = new QList<Folder>(); |
207 | folders->setAutoDelete( false ); | 207 | folders->setAutoDelete( false ); |
208 | login(); | 208 | login(); |
209 | if (!m_imap) { | 209 | if (!m_imap) { |
210 | return folders; | 210 | return folders; |
211 | } | 211 | } |
212 | 212 | ||
213 | /* | 213 | /* |
214 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. | 214 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. |