author | zautrix <zautrix> | 2005-02-12 22:58:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-12 22:58:10 (UTC) |
commit | 00ec9899a4727a4c9100d320935dde7da4803801 (patch) (unidiff) | |
tree | 22c5100623497bc135d13e65a1da993ed5999d4b | |
parent | d45d293d045a8d0f68e09ff9414e2dd6d18dd651 (diff) | |
download | kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.zip kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.tar.gz kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.tar.bz2 |
imap login fix
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.h | 2 |
3 files changed, 17 insertions, 6 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 77f5829..1a3f827 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,71 +1,75 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.7 ************ | 3 | ********** VERSION 2.0.7 ************ |
4 | 4 | ||
5 | Added global application font settings | 5 | Added global application font settings |
6 | (for all KDE-Pim/Pi apps) to the general settings. | 6 | (for all KDE-Pim/Pi apps) to the general settings. |
7 | 7 | ||
8 | Fixed a problem in OM/Pi when trying to login to some IMAP servers | ||
9 | (like the IMAP server of Apple: mail.mac.com ) | ||
10 | |||
11 | |||
8 | ********** VERSION 2.0.6 ************ | 12 | ********** VERSION 2.0.6 ************ |
9 | 13 | ||
10 | Some bugfixes in the pi-sync mode. | 14 | Some bugfixes in the pi-sync mode. |
11 | Added German translation for pi-sync mode. | 15 | Added German translation for pi-sync mode. |
12 | 16 | ||
13 | KO/Pi: | 17 | KO/Pi: |
14 | Made the todolist using alternate background. | 18 | Made the todolist using alternate background. |
15 | 19 | ||
16 | Other minor fixes in KO/Pi. | 20 | Other minor fixes in KO/Pi. |
17 | 21 | ||
18 | 22 | ||
19 | ********** VERSION 2.0.5 ************ | 23 | ********** VERSION 2.0.5 ************ |
20 | 24 | ||
21 | Bugfixes in KO/Pi. | 25 | Bugfixes in KO/Pi. |
22 | 26 | ||
23 | ********** VERSION 2.0.4 ************ | 27 | ********** VERSION 2.0.4 ************ |
24 | 28 | ||
25 | KO/Pi: | 29 | KO/Pi: |
26 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 30 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
27 | 31 | ||
28 | Added a general "select week number" to the toolbar. | 32 | Added a general "select week number" to the toolbar. |
29 | 33 | ||
30 | Fixed some small problem of the new features introduced in version 2.0.3. | 34 | Fixed some small problem of the new features introduced in version 2.0.3. |
31 | 35 | ||
32 | Made it possible to specify one specific category as category color, | 36 | Made it possible to specify one specific category as category color, |
33 | if more than one categories are selected. | 37 | if more than one categories are selected. |
34 | 38 | ||
35 | Fixed a bug in saving colors for categories with non-ascii characters. | 39 | Fixed a bug in saving colors for categories with non-ascii characters. |
36 | (Like, e.g. German Umlauts). | 40 | (Like, e.g. German Umlauts). |
37 | Propably you have to set your colors again for those categories. | 41 | Propably you have to set your colors again for those categories. |
38 | 42 | ||
39 | 43 | ||
40 | ********** VERSION 2.0.3 ************ | 44 | ********** VERSION 2.0.3 ************ |
41 | 45 | ||
42 | KO/Pi: | 46 | KO/Pi: |
43 | Added feature for changing alarm settings for many items at once: | 47 | Added feature for changing alarm settings for many items at once: |
44 | Open list view (or search dialog), select the desired items and choose in | 48 | Open list view (or search dialog), select the desired items and choose in |
45 | the popup menu: Set alarm for selected... | 49 | the popup menu: Set alarm for selected... |
46 | 50 | ||
47 | Added to the event/todo viewer the option to send an email to | 51 | Added to the event/todo viewer the option to send an email to |
48 | all attendees or all selected (with RSVP) attendees. | 52 | all attendees or all selected (with RSVP) attendees. |
49 | 53 | ||
50 | Made the week-month mode changing in month view faster. | 54 | Made the week-month mode changing in month view faster. |
51 | 55 | ||
52 | Made month view better useable with keyboard. | 56 | Made month view better useable with keyboard. |
53 | Now TAB key jumps to next cell with an event/todo. | 57 | Now TAB key jumps to next cell with an event/todo. |
54 | Scroll in cell with coursor keys, scroll in time (next week) with | 58 | Scroll in cell with coursor keys, scroll in time (next week) with |
55 | Shift/Control + coursorkeys. | 59 | Shift/Control + coursorkeys. |
56 | 60 | ||
57 | Fixed bug that the todo view flat mode was reset after first view update. | 61 | Fixed bug that the todo view flat mode was reset after first view update. |
58 | 62 | ||
59 | If a todo is displayed closed in the todo view, | 63 | If a todo is displayed closed in the todo view, |
60 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | 64 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. |
61 | 65 | ||
62 | Added info about the numbers of years to the caption (title) information about a birthday event. | 66 | Added info about the numbers of years to the caption (title) information about a birthday event. |
63 | 67 | ||
64 | Made completion date in todo editor editable. | 68 | Made completion date in todo editor editable. |
65 | 69 | ||
66 | Added possibility to save/load templates for journals. | 70 | Added possibility to save/load templates for journals. |
67 | (Which is just a simple "save text to file" or "insert text from file". | 71 | (Which is just a simple "save text to file" or "insert text from file". |
68 | 72 | ||
69 | ********** VERSION 2.0.2 ************ | 73 | ********** VERSION 2.0.2 ************ |
70 | 74 | ||
71 | KO/Pi: | 75 | KO/Pi: |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 93fb7de..09e52b8 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -62,217 +62,224 @@ void IMAPwrapper::progress( QString m ) | |||
62 | static QString mProgrMess; | 62 | static QString mProgrMess; |
63 | if ( m != QString::null ) { | 63 | if ( m != QString::null ) { |
64 | mProgrMess = m; | 64 | mProgrMess = m; |
65 | mCurrent = 1; | 65 | mCurrent = 1; |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | QString mess; | 68 | QString mess; |
69 | //qDebug("progress "); | 69 | //qDebug("progress "); |
70 | if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); | 70 | if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); |
71 | else mess = mProgrMess +i18n(" message %1").arg( mCurrent++); | 71 | else mess = mProgrMess +i18n(" message %1").arg( mCurrent++); |
72 | Global::statusMessage(mess); | 72 | Global::statusMessage(mess); |
73 | //qDebug("Progress %s %s", mess.latin1(), m.latin1()); | 73 | //qDebug("Progress %s %s", mess.latin1(), m.latin1()); |
74 | qApp->processEvents(); | 74 | qApp->processEvents(); |
75 | } | 75 | } |
76 | bool IMAPwrapper::start_tls(bool force_tls) | 76 | bool IMAPwrapper::start_tls(bool force_tls) |
77 | { | 77 | { |
78 | int err; | 78 | int err; |
79 | bool try_tls = force_tls; | 79 | bool try_tls = force_tls; |
80 | mailimap_capability_data * cap_data = 0; | 80 | mailimap_capability_data * cap_data = 0; |
81 | 81 | ||
82 | err = mailimap_capability(m_imap,&cap_data); | 82 | err = mailimap_capability(m_imap,&cap_data); |
83 | if (err != MAILIMAP_NO_ERROR) { | 83 | if (err != MAILIMAP_NO_ERROR) { |
84 | Global::statusMessage("error getting capabilities!"); | 84 | Global::statusMessage("error getting capabilities!"); |
85 | return false; | 85 | return false; |
86 | } | 86 | } |
87 | clistiter * cur; | 87 | clistiter * cur; |
88 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { | 88 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { |
89 | struct mailimap_capability * cap; | 89 | struct mailimap_capability * cap; |
90 | cap = (struct mailimap_capability *)clist_content(cur); | 90 | cap = (struct mailimap_capability *)clist_content(cur); |
91 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { | 91 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { |
92 | if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { | 92 | if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { |
93 | try_tls = true; | 93 | try_tls = true; |
94 | break; | 94 | break; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | } | 97 | } |
98 | if (cap_data) { | 98 | if (cap_data) { |
99 | mailimap_capability_data_free(cap_data); | 99 | mailimap_capability_data_free(cap_data); |
100 | } | 100 | } |
101 | if (try_tls) { | 101 | if (try_tls) { |
102 | err = mailimap_starttls(m_imap); | 102 | err = mailimap_starttls(m_imap); |
103 | if (err != MAILIMAP_NO_ERROR && force_tls) { | 103 | if (err != MAILIMAP_NO_ERROR && force_tls) { |
104 | Global::statusMessage(i18n("Server has no TLS support!")); | 104 | Global::statusMessage(i18n("Server has no TLS support!")); |
105 | try_tls = false; | 105 | try_tls = false; |
106 | } else { | 106 | } else { |
107 | mailstream_low * low; | 107 | mailstream_low * low; |
108 | mailstream_low * new_low; | 108 | mailstream_low * new_low; |
109 | low = mailstream_get_low(m_imap->imap_stream); | 109 | low = mailstream_get_low(m_imap->imap_stream); |
110 | if (!low) { | 110 | if (!low) { |
111 | try_tls = false; | 111 | try_tls = false; |
112 | } else { | 112 | } else { |
113 | int fd = mailstream_low_get_fd(low); | 113 | int fd = mailstream_low_get_fd(low); |
114 | if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { | 114 | if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { |
115 | mailstream_low_free(low); | 115 | mailstream_low_free(low); |
116 | mailstream_set_low(m_imap->imap_stream, new_low); | 116 | mailstream_set_low(m_imap->imap_stream, new_low); |
117 | } else { | 117 | } else { |
118 | try_tls = false; | 118 | try_tls = false; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | return try_tls; | 123 | return try_tls; |
124 | } | 124 | } |
125 | 125 | ||
126 | void IMAPwrapper::login() | 126 | void IMAPwrapper::login(bool tryTLS) // = true) |
127 | { | 127 | { |
128 | QString server, user, pass; | 128 | QString server, user, pass; |
129 | uint16_t port; | 129 | uint16_t port; |
130 | int err = MAILIMAP_NO_ERROR; | 130 | int err = MAILIMAP_NO_ERROR; |
131 | 131 | ||
132 | if (account->getOffline()) return; | 132 | if (account->getOffline()) return; |
133 | /* we are connected this moment */ | 133 | /* we are connected this moment */ |
134 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | 134 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ |
135 | if (m_imap) { | 135 | if (m_imap) { |
136 | err = mailimap_noop(m_imap); | 136 | err = mailimap_noop(m_imap); |
137 | if (err!=MAILIMAP_NO_ERROR) { | 137 | if (err!=MAILIMAP_NO_ERROR) { |
138 | logout(); | 138 | logout(); |
139 | } else { | 139 | } else { |
140 | mailstream_flush(m_imap->imap_stream); | 140 | mailstream_flush(m_imap->imap_stream); |
141 | return; | 141 | return; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | server = account->getServer(); | 144 | server = account->getServer(); |
145 | port = account->getPort().toUInt(); | 145 | port = account->getPort().toUInt(); |
146 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 146 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
147 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 147 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
148 | login.show(); | 148 | login.show(); |
149 | if ( QDialog::Accepted == login.exec() ) { | 149 | if ( QDialog::Accepted == login.exec() ) { |
150 | // ok | 150 | // ok |
151 | user = login.getUser(); | 151 | user = login.getUser(); |
152 | pass = login.getPassword(); | 152 | pass = login.getPassword(); |
153 | } else { | 153 | } else { |
154 | // cancel | 154 | // cancel |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | } else { | 157 | } else { |
158 | user = account->getUser(); | 158 | user = account->getUser(); |
159 | pass = account->getPassword(); | 159 | pass = account->getPassword(); |
160 | } | 160 | } |
161 | 161 | ||
162 | m_imap = mailimap_new( 20, &imap_progress ); | 162 | m_imap = mailimap_new( 20, &imap_progress ); |
163 | 163 | ||
164 | /* connect */ | 164 | /* connect */ |
165 | bool ssl = false; | 165 | bool ssl = false; |
166 | bool try_tls = false; | 166 | bool try_tls = false; |
167 | bool force_tls = false; | 167 | bool force_tls = false; |
168 | 168 | ||
169 | if ( account->ConnectionType() == 2 ) { | 169 | if ( account->ConnectionType() == 2 ) { |
170 | ssl = true; | 170 | ssl = true; |
171 | } | 171 | } |
172 | if (account->ConnectionType()==1) { | 172 | if (account->ConnectionType()==1) { |
173 | force_tls = true; | 173 | force_tls = true; |
174 | } | 174 | } |
175 | 175 | ||
176 | if ( ssl ) { | 176 | if ( ssl ) { |
177 | qDebug("using ssl "); | 177 | qDebug("using ssl "); |
178 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); | 178 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); |
179 | qDebug("back "); | 179 | qDebug("back "); |
180 | } else { | 180 | } else { |
181 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); | 181 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); |
182 | } | 182 | } |
183 | 183 | ||
184 | if ( err != MAILIMAP_NO_ERROR && | 184 | if ( err != MAILIMAP_NO_ERROR && |
185 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && | 185 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && |
186 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { | 186 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { |
187 | QString failure = ""; | 187 | QString failure = ""; |
188 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { | 188 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { |
189 | failure="Connection refused"; | 189 | failure="Connection refused"; |
190 | } else { | 190 | } else { |
191 | failure="Unknown failure"; | 191 | failure="Unknown failure"; |
192 | } | 192 | } |
193 | Global::statusMessage(i18n("error connecting imap server: %1").arg(failure)); | 193 | Global::statusMessage(i18n("error connecting imap server: %1").arg(failure)); |
194 | mailimap_free( m_imap ); | 194 | mailimap_free( m_imap ); |
195 | m_imap = 0; | 195 | m_imap = 0; |
196 | return; | 196 | return; |
197 | } | 197 | } |
198 | 198 | if ( tryTLS ) { | |
199 | if (!ssl) { | 199 | if (!ssl) { |
200 | try_tls = start_tls(force_tls); | 200 | try_tls = start_tls(force_tls); |
201 | } | ||
201 | } | 202 | } |
202 | |||
203 | bool ok = true; | 203 | bool ok = true; |
204 | if (force_tls && !try_tls) { | 204 | if (force_tls && !try_tls) { |
205 | Global::statusMessage(i18n("Server has no TLS support!")); | 205 | Global::statusMessage(i18n("Server has no TLS support!")); |
206 | ok = false; | 206 | ok = false; |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | ||
210 | /* login */ | 210 | /* login */ |
211 | 211 | ||
212 | if (ok) { | 212 | if (ok) { |
213 | err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); | 213 | err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); |
214 | if ( err != MAILIMAP_NO_ERROR ) { | 214 | if ( err != MAILIMAP_NO_ERROR ) { |
215 | if ( tryTLS && !force_tls && !try_tls ) { | ||
216 | err = mailimap_close( m_imap ); | ||
217 | mailimap_free( m_imap ); | ||
218 | m_imap = 0; | ||
219 | login( false ); | ||
220 | return; | ||
221 | } | ||
215 | Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response)); | 222 | Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response)); |
216 | ok = false; | 223 | ok = false; |
217 | } | 224 | } |
218 | } | 225 | } |
219 | if (!ok) { | 226 | if (!ok) { |
220 | err = mailimap_close( m_imap ); | 227 | err = mailimap_close( m_imap ); |
221 | mailimap_free( m_imap ); | 228 | mailimap_free( m_imap ); |
222 | m_imap = 0; | 229 | m_imap = 0; |
223 | } | 230 | } |
224 | } | 231 | } |
225 | 232 | ||
226 | void IMAPwrapper::logout() | 233 | void IMAPwrapper::logout() |
227 | { | 234 | { |
228 | int err = MAILIMAP_NO_ERROR; | 235 | int err = MAILIMAP_NO_ERROR; |
229 | if (!m_imap) return; | 236 | if (!m_imap) return; |
230 | err = mailimap_logout( m_imap ); | 237 | err = mailimap_logout( m_imap ); |
231 | err = mailimap_close( m_imap ); | 238 | err = mailimap_close( m_imap ); |
232 | mailimap_free( m_imap ); | 239 | mailimap_free( m_imap ); |
233 | m_imap = 0; | 240 | m_imap = 0; |
234 | m_Lastmbox = ""; | 241 | m_Lastmbox = ""; |
235 | } | 242 | } |
236 | 243 | ||
237 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) | 244 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) |
238 | { | 245 | { |
239 | 246 | ||
240 | int tryAgain = 1; | 247 | int tryAgain = 1; |
241 | while ( tryAgain >= 0 ) { | 248 | while ( tryAgain >= 0 ) { |
242 | int err = MAILIMAP_NO_ERROR; | 249 | int err = MAILIMAP_NO_ERROR; |
243 | clist *result = 0; | 250 | clist *result = 0; |
244 | clistcell *current; | 251 | clistcell *current; |
245 | mailimap_fetch_type *fetchType = 0; | 252 | mailimap_fetch_type *fetchType = 0; |
246 | mailimap_set *set = 0; | 253 | mailimap_set *set = 0; |
247 | 254 | ||
248 | login(); | 255 | login(); |
249 | if (!m_imap) { | 256 | if (!m_imap) { |
250 | return; | 257 | return; |
251 | } | 258 | } |
252 | /* select mailbox READONLY for operations */ | 259 | /* select mailbox READONLY for operations */ |
253 | err = selectMbox(mailbox); | 260 | err = selectMbox(mailbox); |
254 | if ( err != MAILIMAP_NO_ERROR ) { | 261 | if ( err != MAILIMAP_NO_ERROR ) { |
255 | return; | 262 | return; |
256 | } | 263 | } |
257 | 264 | ||
258 | int last = m_imap->imap_selection_info->sel_exists; | 265 | int last = m_imap->imap_selection_info->sel_exists; |
259 | 266 | ||
260 | if (last == 0) { | 267 | if (last == 0) { |
261 | Global::statusMessage(i18n("Mailbox has no mails")); | 268 | Global::statusMessage(i18n("Mailbox has no mails")); |
262 | return; | 269 | return; |
263 | } else { | 270 | } else { |
264 | } | 271 | } |
265 | progress( i18n("Fetch ")); | 272 | progress( i18n("Fetch ")); |
266 | mMax = last; | 273 | mMax = last; |
267 | //qDebug("last %d ", last); | 274 | //qDebug("last %d ", last); |
268 | Global::statusMessage(i18n("Fetching header list")); | 275 | Global::statusMessage(i18n("Fetching header list")); |
269 | qApp->processEvents(); | 276 | qApp->processEvents(); |
270 | /* the range has to start at 1!!! not with 0!!!! */ | 277 | /* the range has to start at 1!!! not with 0!!!! */ |
271 | //LR the access to web.de imap server is no working with value 1 | 278 | //LR the access to web.de imap server is no working with value 1 |
272 | //qDebug("interval %d - %d ", tryAgain, last-1+tryAgain ); | 279 | //qDebug("interval %d - %d ", tryAgain, last-1+tryAgain ); |
273 | set = mailimap_set_new_interval( tryAgain, last ); | 280 | set = mailimap_set_new_interval( tryAgain, last ); |
274 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 281 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
275 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); | 282 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
276 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); | 283 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); |
277 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); | 284 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
278 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); | 285 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); |
diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h index 5535d8d..31c60a8 100644 --- a/kmicromail/libmailwrapper/imapwrapper.h +++ b/kmicromail/libmailwrapper/imapwrapper.h | |||
@@ -1,85 +1,85 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __IMAPWRAPPER | 2 | #ifndef __IMAPWRAPPER |
3 | #define __IMAPWRAPPER | 3 | #define __IMAPWRAPPER |
4 | 4 | ||
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include "mailwrapper.h" | 6 | #include "mailwrapper.h" |
7 | #include "abstractmail.h" | 7 | #include "abstractmail.h" |
8 | #include <libetpan/clist.h> | 8 | #include <libetpan/clist.h> |
9 | 9 | ||
10 | struct mailimap; | 10 | struct mailimap; |
11 | struct mailimap_body; | 11 | struct mailimap_body; |
12 | struct mailimap_body_type_1part; | 12 | struct mailimap_body_type_1part; |
13 | struct mailimap_body_type_text; | 13 | struct mailimap_body_type_text; |
14 | struct mailimap_body_type_basic; | 14 | struct mailimap_body_type_basic; |
15 | struct mailimap_body_type_msg; | 15 | struct mailimap_body_type_msg; |
16 | struct mailimap_body_type_mpart; | 16 | struct mailimap_body_type_mpart; |
17 | struct mailimap_body_fields; | 17 | struct mailimap_body_fields; |
18 | struct mailimap_msg_att; | 18 | struct mailimap_msg_att; |
19 | class encodedString; | 19 | class encodedString; |
20 | 20 | ||
21 | class IMAPwrapper : public AbstractMail | 21 | class IMAPwrapper : public AbstractMail |
22 | { | 22 | { |
23 | Q_OBJECT | 23 | Q_OBJECT |
24 | public: | 24 | public: |
25 | IMAPwrapper( IMAPaccount *a ); | 25 | IMAPwrapper( IMAPaccount *a ); |
26 | virtual ~IMAPwrapper(); | 26 | virtual ~IMAPwrapper(); |
27 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 27 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
28 | virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0); | 28 | virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0); |
29 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 29 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
30 | 30 | ||
31 | virtual void deleteMail(const RecMailP&mail); | 31 | virtual void deleteMail(const RecMailP&mail); |
32 | void deleteMailList(const QValueList<RecMailP>&target); | 32 | void deleteMailList(const QValueList<RecMailP>&target); |
33 | virtual void answeredMail(const RecMailP&mail); | 33 | virtual void answeredMail(const RecMailP&mail); |
34 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder); | 34 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder); |
35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
36 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 36 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
37 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0); | 37 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0); |
38 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 38 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
39 | 39 | ||
40 | virtual RecBodyP fetchBody(const RecMailP&mail); | 40 | virtual RecBodyP fetchBody(const RecMailP&mail); |
41 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); | 41 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); |
42 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); | 42 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); |
43 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); | 43 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
44 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 44 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
45 | 45 | ||
46 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, | 46 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
47 | const QString& delemiter="/",bool getsubfolder=false); | 47 | const QString& delemiter="/",bool getsubfolder=false); |
48 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); | 48 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); |
49 | 49 | ||
50 | static void imap_progress( size_t current, size_t maximum ); | 50 | static void imap_progress( size_t current, size_t maximum ); |
51 | 51 | ||
52 | virtual void logout(); | 52 | virtual void logout(); |
53 | virtual MAILLIB::ATYPE getType()const; | 53 | virtual MAILLIB::ATYPE getType()const; |
54 | virtual const QString&getName()const; | 54 | virtual const QString&getName()const; |
55 | virtual Account* getAccount() { return account; }; | 55 | virtual Account* getAccount() { return account; }; |
56 | 56 | ||
57 | protected: | 57 | protected: |
58 | RecMail*parse_list_result(mailimap_msg_att*); | 58 | RecMail*parse_list_result(mailimap_msg_att*); |
59 | void login(); | 59 | void login(bool tryTLS = true); |
60 | bool start_tls(bool force=true); | 60 | bool start_tls(bool force=true); |
61 | 61 | ||
62 | virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 62 | virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
63 | virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); | 63 | virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); |
64 | int selectMbox(const QString&mbox); | 64 | int selectMbox(const QString&mbox); |
65 | 65 | ||
66 | void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); | 66 | void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); |
67 | void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); | 67 | void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); |
68 | void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which); | 68 | void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which); |
69 | void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which); | 69 | void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which); |
70 | void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which); | 70 | void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which); |
71 | void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1); | 71 | void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1); |
72 | 72 | ||
73 | /* just helpers */ | 73 | /* just helpers */ |
74 | static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which); | 74 | static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which); |
75 | static QStringList address_list_to_stringlist(clist*list); | 75 | static QStringList address_list_to_stringlist(clist*list); |
76 | 76 | ||
77 | static void progress(QString mess = QString::null); | 77 | static void progress(QString mess = QString::null); |
78 | static int mCurrent; | 78 | static int mCurrent; |
79 | static int mMax; | 79 | static int mMax; |
80 | IMAPaccount *account; | 80 | IMAPaccount *account; |
81 | mailimap *m_imap; | 81 | mailimap *m_imap; |
82 | QString m_Lastmbox; | 82 | QString m_Lastmbox; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #endif | 85 | #endif |