summaryrefslogtreecommitdiff
authoralwin <alwin>2004-01-10 03:19:09 (UTC)
committer alwin <alwin>2004-01-10 03:19:09 (UTC)
commitdcfd6e5e2e2021bc5ed0bcf42b1b0a7002c59a17 (patch) (unidiff)
tree26f1eb9a79dfadd985e83618c70a116c91a8f810
parent76cf4990cb4171a747ac31e9832f4ee694ced2cc (diff)
downloadopie-dcfd6e5e2e2021bc5ed0bcf42b1b0a7002c59a17.zip
opie-dcfd6e5e2e2021bc5ed0bcf42b1b0a7002c59a17.tar.gz
opie-dcfd6e5e2e2021bc5ed0bcf42b1b0a7002c59a17.tar.bz2
when header displayed print just the count of messages not having
the \deleted flag set.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp2
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
@@ -1,382 +1,382 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <libetpan/libetpan.h> 2#include <libetpan/libetpan.h>
3#include <qpe/global.h> 3#include <qpe/global.h>
4 4
5#include "imapwrapper.h" 5#include "imapwrapper.h"
6#include "mailtypes.h" 6#include "mailtypes.h"
7#include "logindialog.h" 7#include "logindialog.h"
8 8
9IMAPwrapper::IMAPwrapper( IMAPaccount *a ) 9IMAPwrapper::IMAPwrapper( IMAPaccount *a )
10 : AbstractMail() 10 : AbstractMail()
11{ 11{
12 account = a; 12 account = a;
13 m_imap = 0; 13 m_imap = 0;
14 m_Lastmbox = ""; 14 m_Lastmbox = "";
15} 15}
16 16
17IMAPwrapper::~IMAPwrapper() 17IMAPwrapper::~IMAPwrapper()
18{ 18{
19 logout(); 19 logout();
20} 20}
21 21
22/* to avoid to often select statements in loops etc. 22/* to avoid to often select statements in loops etc.
23 we trust that we are logged in and connection is established!*/ 23 we trust that we are logged in and connection is established!*/
24int IMAPwrapper::selectMbox(const QString&mbox) 24int IMAPwrapper::selectMbox(const QString&mbox)
25{ 25{
26 if (mbox == m_Lastmbox) { 26 if (mbox == m_Lastmbox) {
27 return MAILIMAP_NO_ERROR; 27 return MAILIMAP_NO_ERROR;
28 } 28 }
29 int err = mailimap_select( m_imap, (char*)mbox.latin1()); 29 int err = mailimap_select( m_imap, (char*)mbox.latin1());
30 if ( err != MAILIMAP_NO_ERROR ) { 30 if ( err != MAILIMAP_NO_ERROR ) {
31 qDebug("error selecting mailbox: %s",m_imap->imap_response); 31 qDebug("error selecting mailbox: %s",m_imap->imap_response);
32 m_Lastmbox = ""; 32 m_Lastmbox = "";
33 return err; 33 return err;
34 } 34 }
35 m_Lastmbox = mbox; 35 m_Lastmbox = mbox;
36 return err; 36 return err;
37} 37}
38 38
39void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 39void IMAPwrapper::imap_progress( size_t current, size_t maximum )
40{ 40{
41 qDebug( "IMAP: %i of %i", current, maximum ); 41 qDebug( "IMAP: %i of %i", current, maximum );
42} 42}
43 43
44void IMAPwrapper::login() 44void IMAPwrapper::login()
45{ 45{
46 const char *server, *user, *pass; 46 const char *server, *user, *pass;
47 uint16_t port; 47 uint16_t port;
48 int err = MAILIMAP_NO_ERROR; 48 int err = MAILIMAP_NO_ERROR;
49 49
50 if (account->getOffline()) return; 50 if (account->getOffline()) return;
51 /* we are connected this moment */ 51 /* we are connected this moment */
52 /* TODO: setup a timer holding the line or if connection closed - delete the value */ 52 /* TODO: setup a timer holding the line or if connection closed - delete the value */
53 if (m_imap) { 53 if (m_imap) {
54 err = mailimap_noop(m_imap); 54 err = mailimap_noop(m_imap);
55 if (err!=MAILIMAP_NO_ERROR) { 55 if (err!=MAILIMAP_NO_ERROR) {
56 logout(); 56 logout();
57 } else { 57 } else {
58 mailstream_flush(m_imap->imap_stream); 58 mailstream_flush(m_imap->imap_stream);
59 return; 59 return;
60 } 60 }
61 } 61 }
62 server = account->getServer().latin1(); 62 server = account->getServer().latin1();
63 port = account->getPort().toUInt(); 63 port = account->getPort().toUInt();
64 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 64 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
65 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 65 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
66 login.show(); 66 login.show();
67 if ( QDialog::Accepted == login.exec() ) { 67 if ( QDialog::Accepted == login.exec() ) {
68 // ok 68 // ok
69 user = login.getUser().latin1(); 69 user = login.getUser().latin1();
70 pass = login.getPassword().latin1(); 70 pass = login.getPassword().latin1();
71 } else { 71 } else {
72 // cancel 72 // cancel
73 qDebug( "IMAP: Login canceled" ); 73 qDebug( "IMAP: Login canceled" );
74 return; 74 return;
75 } 75 }
76 } else { 76 } else {
77 user = account->getUser().latin1(); 77 user = account->getUser().latin1();
78 pass = account->getPassword().latin1(); 78 pass = account->getPassword().latin1();
79 } 79 }
80 80
81 m_imap = mailimap_new( 20, &imap_progress ); 81 m_imap = mailimap_new( 20, &imap_progress );
82 82
83 83
84 84
85 /* connect */ 85 /* connect */
86 86
87 bool ssl = false; 87 bool ssl = false;
88 88
89 if ( account->ConnectionType() == 2 ) { 89 if ( account->ConnectionType() == 2 ) {
90 ssl = true; 90 ssl = true;
91 } 91 }
92 92
93 if ( ssl ) { 93 if ( ssl ) {
94 qDebug( "using ssl" ); 94 qDebug( "using ssl" );
95 err = mailimap_ssl_connect( m_imap, (char*)server, port ); 95 err = mailimap_ssl_connect( m_imap, (char*)server, port );
96 } else { 96 } else {
97 err = mailimap_socket_connect( m_imap, (char*)server, port ); 97 err = mailimap_socket_connect( m_imap, (char*)server, port );
98 } 98 }
99 99
100 if ( err != MAILIMAP_NO_ERROR && 100 if ( err != MAILIMAP_NO_ERROR &&
101 err != MAILIMAP_NO_ERROR_AUTHENTICATED && 101 err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
102 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { 102 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
103 QString failure = ""; 103 QString failure = "";
104 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { 104 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
105 failure="Connection refused"; 105 failure="Connection refused";
106 } else { 106 } else {
107 failure="Unknown failure"; 107 failure="Unknown failure";
108 } 108 }
109 Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); 109 Global::statusMessage(tr("error connecting imap server: %1").arg(failure));
110 mailimap_free( m_imap ); 110 mailimap_free( m_imap );
111 m_imap = 0; 111 m_imap = 0;
112 return; 112 return;
113 } 113 }
114 114
115 /* login */ 115 /* login */
116 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); 116 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
117 if ( err != MAILIMAP_NO_ERROR ) { 117 if ( err != MAILIMAP_NO_ERROR ) {
118 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); 118 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
119 err = mailimap_close( m_imap ); 119 err = mailimap_close( m_imap );
120 mailimap_free( m_imap ); 120 mailimap_free( m_imap );
121 m_imap = 0; 121 m_imap = 0;
122 } 122 }
123} 123}
124 124
125void IMAPwrapper::logout() 125void IMAPwrapper::logout()
126{ 126{
127 int err = MAILIMAP_NO_ERROR; 127 int err = MAILIMAP_NO_ERROR;
128 if (!m_imap) return; 128 if (!m_imap) return;
129 err = mailimap_logout( m_imap ); 129 err = mailimap_logout( m_imap );
130 err = mailimap_close( m_imap ); 130 err = mailimap_close( m_imap );
131 mailimap_free( m_imap ); 131 mailimap_free( m_imap );
132 m_imap = 0; 132 m_imap = 0;
133 m_Lastmbox = ""; 133 m_Lastmbox = "";
134} 134}
135 135
136void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) 136void 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
197QList<Folder>* IMAPwrapper::listFolders() 197QList<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.
215 * We must not forget to filter them out in next loop! 215 * We must not forget to filter them out in next loop!
216 * it seems like ugly code. and yes - it is ugly code. but the best way. 216 * it seems like ugly code. and yes - it is ugly code. but the best way.
217 */ 217 */
218 QString temp; 218 QString temp;
219 mask = "INBOX" ; 219 mask = "INBOX" ;
220 mailimap_mailbox_list *list; 220 mailimap_mailbox_list *list;
221 err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); 221 err = mailimap_list( m_imap, (char*)"", (char*)mask, &result );
222 QString del; 222 QString del;
223 bool selectable = true; 223 bool selectable = true;
224 bool no_inferiors = false; 224 bool no_inferiors = false;
225 if ( err == MAILIMAP_NO_ERROR ) { 225 if ( err == MAILIMAP_NO_ERROR ) {
226 current = result->first; 226 current = result->first;
227 for ( int i = result->count; i > 0; i-- ) { 227 for ( int i = result->count; i > 0; i-- ) {
228 list = (mailimap_mailbox_list *) current->data; 228 list = (mailimap_mailbox_list *) current->data;
229 // it is better use the deep copy mechanism of qt itself 229 // it is better use the deep copy mechanism of qt itself
230 // instead of using strdup! 230 // instead of using strdup!
231 temp = list->mb_name; 231 temp = list->mb_name;
232 del = list->mb_delimiter; 232 del = list->mb_delimiter;
233 current = current->next; 233 current = current->next;
234 if ( (bflags = list->mb_flag) ) { 234 if ( (bflags = list->mb_flag) ) {
235 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& 235 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
236 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); 236 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
237 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { 237 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
238 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { 238 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
239 no_inferiors = true; 239 no_inferiors = true;
240 } 240 }
241 } 241 }
242 } 242 }
243 folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); 243 folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
244 } 244 }
245 } else { 245 } else {
246 qDebug("error fetching folders: %s",m_imap->imap_response); 246 qDebug("error fetching folders: %s",m_imap->imap_response);
247 } 247 }
248 mailimap_list_result_free( result ); 248 mailimap_list_result_free( result );
249 249
250/* 250/*
251 * second stage - get the other then inbox folders 251 * second stage - get the other then inbox folders
252 */ 252 */
253 mask = "*" ; 253 mask = "*" ;
254 path = account->getPrefix().latin1(); 254 path = account->getPrefix().latin1();
255 if (!path) path = ""; 255 if (!path) path = "";
256 qDebug(path); 256 qDebug(path);
257 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); 257 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
258 if ( err == MAILIMAP_NO_ERROR ) { 258 if ( err == MAILIMAP_NO_ERROR ) {
259 current = result->first; 259 current = result->first;
260 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { 260 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
261 no_inferiors = false; 261 no_inferiors = false;
262 list = (mailimap_mailbox_list *) current->data; 262 list = (mailimap_mailbox_list *) current->data;
263 // it is better use the deep copy mechanism of qt itself 263 // it is better use the deep copy mechanism of qt itself
264 // instead of using strdup! 264 // instead of using strdup!
265 temp = list->mb_name; 265 temp = list->mb_name;
266 if (temp.lower()=="inbox") 266 if (temp.lower()=="inbox")
267 continue; 267 continue;
268 if (temp.lower()==account->getPrefix().lower()) 268 if (temp.lower()==account->getPrefix().lower())
269 continue; 269 continue;
270 if ( (bflags = list->mb_flag) ) { 270 if ( (bflags = list->mb_flag) ) {
271 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& 271 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
272 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); 272 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
273 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { 273 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
274 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { 274 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
275 no_inferiors = true; 275 no_inferiors = true;
276 } 276 }
277 } 277 }
278 } 278 }
279 del = list->mb_delimiter; 279 del = list->mb_delimiter;
280 folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); 280 folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
281 } 281 }
282 } else { 282 } else {
283 qDebug("error fetching folders %s",m_imap->imap_response); 283 qDebug("error fetching folders %s",m_imap->imap_response);
284 } 284 }
285 if (result) mailimap_list_result_free( result ); 285 if (result) mailimap_list_result_free( result );
286 return folders; 286 return folders;
287} 287}
288 288
289RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) 289RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
290{ 290{
291 RecMail * m = 0; 291 RecMail * m = 0;
292 mailimap_msg_att_item *item=0; 292 mailimap_msg_att_item *item=0;
293 clistcell *current,*c,*cf; 293 clistcell *current,*c,*cf;
294 mailimap_msg_att_dynamic*flist; 294 mailimap_msg_att_dynamic*flist;
295 mailimap_flag_fetch*cflag; 295 mailimap_flag_fetch*cflag;
296 int size; 296 int size;
297 QBitArray mFlags(7); 297 QBitArray mFlags(7);
298 QStringList addresslist; 298 QStringList addresslist;
299 299
300 if (!m_att) { 300 if (!m_att) {
301 return m; 301 return m;
302 } 302 }
303 m = new RecMail(); 303 m = new RecMail();
304 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { 304 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
305 current = c; 305 current = c;
306 size = 0; 306 size = 0;
307 item = (mailimap_msg_att_item*)current->data; 307 item = (mailimap_msg_att_item*)current->data;
308 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { 308 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
309 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; 309 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
310 if (!flist->att_list) { 310 if (!flist->att_list) {
311 continue; 311 continue;
312 } 312 }
313 cf = flist->att_list->first; 313 cf = flist->att_list->first;
314 for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { 314 for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) {
315 cflag = (mailimap_flag_fetch*)cf->data; 315 cflag = (mailimap_flag_fetch*)cf->data;
316 if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { 316 if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
317 switch (cflag->fl_flag->fl_type) { 317 switch (cflag->fl_flag->fl_type) {
318 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ 318 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
319 mFlags.setBit(FLAG_ANSWERED); 319 mFlags.setBit(FLAG_ANSWERED);
320 break; 320 break;
321 case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ 321 case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */
322 mFlags.setBit(FLAG_FLAGGED); 322 mFlags.setBit(FLAG_FLAGGED);
323 break; 323 break;
324 case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ 324 case MAILIMAP_FLAG_DELETED: /* \Deleted flag */
325 mFlags.setBit(FLAG_DELETED); 325 mFlags.setBit(FLAG_DELETED);
326 break; 326 break;
327 case MAILIMAP_FLAG_SEEN: /* \Seen flag */ 327 case MAILIMAP_FLAG_SEEN: /* \Seen flag */
328 mFlags.setBit(FLAG_SEEN); 328 mFlags.setBit(FLAG_SEEN);
329 break; 329 break;
330 case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ 330 case MAILIMAP_FLAG_DRAFT: /* \Draft flag */
331 mFlags.setBit(FLAG_DRAFT); 331 mFlags.setBit(FLAG_DRAFT);
332 break; 332 break;
333 case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ 333 case MAILIMAP_FLAG_KEYWORD: /* keyword flag */
334 break; 334 break;
335 case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ 335 case MAILIMAP_FLAG_EXTENSION: /* \extension flag */
336 break; 336 break;
337 default: 337 default:
338 break; 338 break;
339 } 339 }
340 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { 340 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) {
341 mFlags.setBit(FLAG_RECENT); 341 mFlags.setBit(FLAG_RECENT);
342 } 342 }
343 } 343 }
344 continue; 344 continue;
345 } 345 }
346 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { 346 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
347 mailimap_envelope * head = item->att_data.att_static->att_data.att_env; 347 mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
348 m->setDate(head->env_date); 348 m->setDate(head->env_date);
349 m->setSubject(convert_String((const char*)head->env_subject)); 349 m->setSubject(convert_String((const char*)head->env_subject));
350 //m->setSubject(head->env_subject); 350 //m->setSubject(head->env_subject);
351 if (head->env_from!=NULL) { 351 if (head->env_from!=NULL) {
352 addresslist = address_list_to_stringlist(head->env_from->frm_list); 352 addresslist = address_list_to_stringlist(head->env_from->frm_list);
353 if (addresslist.count()) { 353 if (addresslist.count()) {
354 m->setFrom(addresslist.first()); 354 m->setFrom(addresslist.first());
355 } 355 }
356 } 356 }
357 if (head->env_to!=NULL) { 357 if (head->env_to!=NULL) {
358 addresslist = address_list_to_stringlist(head->env_to->to_list); 358 addresslist = address_list_to_stringlist(head->env_to->to_list);
359 m->setTo(addresslist); 359 m->setTo(addresslist);
360 } 360 }
361 if (head->env_cc!=NULL) { 361 if (head->env_cc!=NULL) {
362 addresslist = address_list_to_stringlist(head->env_cc->cc_list); 362 addresslist = address_list_to_stringlist(head->env_cc->cc_list);
363 m->setCC(addresslist); 363 m->setCC(addresslist);
364 } 364 }
365 if (head->env_bcc!=NULL) { 365 if (head->env_bcc!=NULL) {
366 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); 366 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
367 m->setBcc(addresslist); 367 m->setBcc(addresslist);
368 } 368 }
369 if (head->env_reply_to!=NULL) { 369 if (head->env_reply_to!=NULL) {
370 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); 370 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
371 if (addresslist.count()) { 371 if (addresslist.count()) {
372 m->setReplyto(addresslist.first()); 372 m->setReplyto(addresslist.first());
373 } 373 }
374 } 374 }
375 m->setMsgid(QString(head->env_message_id)); 375 m->setMsgid(QString(head->env_message_id));
376 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { 376 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
377#if 0 377#if 0
378 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; 378 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
379 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); 379 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
380 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); 380 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec);
381 qDebug(da.toString()); 381 qDebug(da.toString());
382#endif 382#endif