author | zautrix <zautrix> | 2005-01-24 12:16:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-24 12:16:16 (UTC) |
commit | d4f5ce1bedd03191da5ecef2dc68381c10ef1fba (patch) (unidiff) | |
tree | 2d6860078083e588f8f365b308ee4ffb2c34f1c1 | |
parent | 485a6b28e3be6437742852970fdd122ba071b726 (diff) | |
download | kdepimpi-d4f5ce1bedd03191da5ecef2dc68381c10ef1fba.zip kdepimpi-d4f5ce1bedd03191da5ecef2dc68381c10ef1fba.tar.gz kdepimpi-d4f5ce1bedd03191da5ecef2dc68381c10ef1fba.tar.bz2 |
more imap fixes
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 7 | ||||
-rw-r--r-- | kmicromail/libetpan/imap/mailimap_parser.c | 22 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 67 | ||||
-rw-r--r-- | kmicromail/viewmailbase.cpp | 2 |
4 files changed, 64 insertions, 34 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 5bfe1c8..cbed872 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,401 +1,408 @@ | |||
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 1.9.20 ************ | 3 | ********** VERSION 1.9.20 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Added for the "dislplay one day" agenda mode | 6 | Added for the "dislplay one day" agenda mode |
7 | info in the caption and in the day lables: | 7 | info in the caption and in the day lables: |
8 | Now it is displayed, if the selected day is from "day before yesterday" | 8 | Now it is displayed, if the selected day is from "day before yesterday" |
9 | to "day after tomorrow". | 9 | to "day after tomorrow". |
10 | Made it possible to delete a Todo, which has sub-todos. | 10 | Made it possible to delete a Todo, which has sub-todos. |
11 | Fixed two small problems in the todo view. | 11 | Fixed two small problems in the todo view. |
12 | Added missing German translation for filter edit and print dialog. | 12 | Added missing German translation for filter edit and print dialog. |
13 | Made search dialog closeable by cancel key. | 13 | Made search dialog closeable by cancel key. |
14 | 14 | ||
15 | Made it possible to select in the date picker the (ligt grey ) | 15 | Made it possible to select in the date picker the (ligt grey ) |
16 | dates of the prev./next month with the mouse. | 16 | dates of the prev./next month with the mouse. |
17 | 17 | ||
18 | OM/Pi: | ||
19 | "Delete mail" icon in main window now deletes all selected mails. | ||
20 | Fixed the problem, that the state flag of imap mails was ignored. | ||
21 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | ||
22 | to idecate that they are already seen. | ||
23 | Fixed the problem that the body of some mails was not displayed in the | ||
24 | mail viewer when fetching them from the imap server directly to read them. | ||
18 | 25 | ||
19 | 26 | ||
20 | 27 | ||
21 | ********** VERSION 1.9.19 ************ | 28 | ********** VERSION 1.9.19 ************ |
22 | 29 | ||
23 | Added a lot of missing translations to KA/Pi, | 30 | Added a lot of missing translations to KA/Pi, |
24 | Added some missing translations to KO/Pi and OM/Pi. | 31 | Added some missing translations to KO/Pi and OM/Pi. |
25 | 32 | ||
26 | Fixed some minor problems in KA/Pi + KO/Pi. | 33 | Fixed some minor problems in KA/Pi + KO/Pi. |
27 | 34 | ||
28 | Fixed a crash when closing PwM/Pi. | 35 | Fixed a crash when closing PwM/Pi. |
29 | Added German translation for PwM/Pi. | 36 | Added German translation for PwM/Pi. |
30 | 37 | ||
31 | Made view change and Month View update faster in KO/Pi. | 38 | Made view change and Month View update faster in KO/Pi. |
32 | 39 | ||
33 | 40 | ||
34 | ********** VERSION 1.9.18 ************ | 41 | ********** VERSION 1.9.18 ************ |
35 | 42 | ||
36 | FYI: The VERSION 1.9.17 was a testing release only. | 43 | FYI: The VERSION 1.9.17 was a testing release only. |
37 | Please read the changelog of VERSION 1.9.17 as well. | 44 | Please read the changelog of VERSION 1.9.17 as well. |
38 | 45 | ||
39 | Cleaned up the syncing config dialog. | 46 | Cleaned up the syncing config dialog. |
40 | Added sync config options for date range for events. | 47 | Added sync config options for date range for events. |
41 | Added sync config options for filters on incoming data. | 48 | Added sync config options for filters on incoming data. |
42 | Added sync config options for filters on outgoing data. | 49 | Added sync config options for filters on outgoing data. |
43 | Please read the updated SyncHowTo about the new filter settings. | 50 | Please read the updated SyncHowTo about the new filter settings. |
44 | These filter settings make it now possible to sync with shared | 51 | These filter settings make it now possible to sync with shared |
45 | calendars without writing back private or confidential data | 52 | calendars without writing back private or confidential data |
46 | (via the outgoing filters). | 53 | (via the outgoing filters). |
47 | To sync only with particular parts of a shared calendar, | 54 | To sync only with particular parts of a shared calendar, |
48 | the incoming filter settings can be used. | 55 | the incoming filter settings can be used. |
49 | An example can be found in the SyncHowTo. | 56 | An example can be found in the SyncHowTo. |
50 | Same for shared addressbooks. | 57 | Same for shared addressbooks. |
51 | 58 | ||
52 | Added a setting for the global kdepim data storage. | 59 | Added a setting for the global kdepim data storage. |
53 | Usually the data is stored in (yourhomedir/kdepim). | 60 | Usually the data is stored in (yourhomedir/kdepim). |
54 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 61 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
55 | a directory where all the kdepim data is stored. | 62 | a directory where all the kdepim data is stored. |
56 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 63 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
57 | 64 | ||
58 | KO/Pi: | 65 | KO/Pi: |
59 | The timeedit input has a pulldown list for times. | 66 | The timeedit input has a pulldown list for times. |
60 | If opened, this pulldown list should now has the right time highlighted. | 67 | If opened, this pulldown list should now has the right time highlighted. |
61 | Added the possibility to exclude events/todos/journals in a filter. | 68 | Added the possibility to exclude events/todos/journals in a filter. |
62 | You should exclude journals, if you do not want them to sync with a public calendar. | 69 | You should exclude journals, if you do not want them to sync with a public calendar. |
63 | 70 | ||
64 | KA/Pi: | 71 | KA/Pi: |
65 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 72 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
66 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... | 73 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... |
67 | Added printing of card view and details view on desktop. | 74 | Added printing of card view and details view on desktop. |
68 | Printing of list view is not working... | 75 | Printing of list view is not working... |
69 | Added button for removing pictures in contact editor. | 76 | Added button for removing pictures in contact editor. |
70 | Parsing data fix of KA/Pi version 1.9.17. | 77 | Parsing data fix of KA/Pi version 1.9.17. |
71 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 78 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
72 | Fixed some syncing merging problems. | 79 | Fixed some syncing merging problems. |
73 | 80 | ||
74 | 81 | ||
75 | ********** VERSION 1.9.17 ************ | 82 | ********** VERSION 1.9.17 ************ |
76 | 83 | ||
77 | KO/Pi: | 84 | KO/Pi: |
78 | Fixed that tooltips were not updated after moving an item in agenda view. | 85 | Fixed that tooltips were not updated after moving an item in agenda view. |
79 | Fixed a bug in sorting start date for recurring events in list view. | 86 | Fixed a bug in sorting start date for recurring events in list view. |
80 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 87 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
81 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. | 88 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. |
82 | Added more info in the todo viewer: Startdate, parent/sub todos. | 89 | Added more info in the todo viewer: Startdate, parent/sub todos. |
83 | 90 | ||
84 | 91 | ||
85 | KA/Pi: | 92 | KA/Pi: |
86 | All fields search does now actually search all the (possible) fields, | 93 | All fields search does now actually search all the (possible) fields, |
87 | not only those listed in the contact list. | 94 | not only those listed in the contact list. |
88 | Made is possible to inline a picture in a vcard on the Z. | 95 | Made is possible to inline a picture in a vcard on the Z. |
89 | This was only possible on the desktop, now is it possible on the Z as well. | 96 | This was only possible on the desktop, now is it possible on the Z as well. |
90 | Fixed of missing save settings after filter configuration. | 97 | Fixed of missing save settings after filter configuration. |
91 | Made saving of addressbook much faster. | 98 | Made saving of addressbook much faster. |
92 | Fixed extension widget layout problem. | 99 | Fixed extension widget layout problem. |
93 | Fixed saving of default formatted name settings. | 100 | Fixed saving of default formatted name settings. |
94 | Fixed formatted name handling in edit dialog. | 101 | Fixed formatted name handling in edit dialog. |
95 | Added an option for changing formatted names of many contacts | 102 | Added an option for changing formatted names of many contacts |
96 | (menu: File - Change - Set formatted name). | 103 | (menu: File - Change - Set formatted name). |
97 | 104 | ||
98 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 105 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
99 | This is Fixed. | 106 | This is Fixed. |
100 | 107 | ||
101 | KDE-Sync: | 108 | KDE-Sync: |
102 | Now readonly KDE resources are synced as well. | 109 | Now readonly KDE resources are synced as well. |
103 | (They are not changed in KDE itself, of course). | 110 | (They are not changed in KDE itself, of course). |
104 | 111 | ||
105 | 112 | ||
106 | 113 | ||
107 | ********** VERSION 1.9.16 ************ | 114 | ********** VERSION 1.9.16 ************ |
108 | 115 | ||
109 | KO/Pi: | 116 | KO/Pi: |
110 | Fixed search dialog size on Z 6000 (480x640 display). | 117 | Fixed search dialog size on Z 6000 (480x640 display). |
111 | Added setting to hide/show time in agenda items. | 118 | Added setting to hide/show time in agenda items. |
112 | Added setting to hide not running todos in todo view. | 119 | Added setting to hide not running todos in todo view. |
113 | Added columns for start date/time in todo view. | 120 | Added columns for start date/time in todo view. |
114 | Replaced the solid half-hour lines in agenda view by dot lines. | 121 | Replaced the solid half-hour lines in agenda view by dot lines. |
115 | Added possibility of printing the What's Next View on the desktop | 122 | Added possibility of printing the What's Next View on the desktop |
116 | (i.e. Windows and Linux). | 123 | (i.e. Windows and Linux). |
117 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 124 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
118 | Added tooltips in month view.(Tooltips only available on desktop) | 125 | Added tooltips in month view.(Tooltips only available on desktop) |
119 | 126 | ||
120 | Fixed a strange problem in KO/Pi alarm applet. | 127 | Fixed a strange problem in KO/Pi alarm applet. |
121 | Did not find the actual problem, | 128 | Did not find the actual problem, |
122 | such that now Qtopia reboots again if deinstalling the alarm applet. | 129 | such that now Qtopia reboots again if deinstalling the alarm applet. |
123 | But the alarm applet should work again. | 130 | But the alarm applet should work again. |
124 | 131 | ||
125 | KA/Pi: | 132 | KA/Pi: |
126 | Fixed the problem, that internal pictures were not saved. | 133 | Fixed the problem, that internal pictures were not saved. |
127 | 134 | ||
128 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 135 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
129 | 136 | ||
130 | Fixed some minor problems. (Like word wrap in help text windows). | 137 | Fixed some minor problems. (Like word wrap in help text windows). |
131 | 138 | ||
132 | Fixed a compiling problem in microkde/kresources. | 139 | Fixed a compiling problem in microkde/kresources. |
133 | 140 | ||
134 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 141 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
135 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 142 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
136 | such that now syncing KO/Pi with Sharp DTM should work on the | 143 | such that now syncing KO/Pi with Sharp DTM should work on the |
137 | Zaurus C 3000 model. | 144 | Zaurus C 3000 model. |
138 | 145 | ||
139 | ********** VERSION 1.9.15 ************ | 146 | ********** VERSION 1.9.15 ************ |
140 | 147 | ||
141 | Usebilty enhancements in KO/Pi: | 148 | Usebilty enhancements in KO/Pi: |
142 | When clicking on the date in a month view cell, the day view is shown. | 149 | When clicking on the date in a month view cell, the day view is shown. |
143 | Old behaviour was, that the "new event" dialog popped up. | 150 | Old behaviour was, that the "new event" dialog popped up. |
144 | 151 | ||
145 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 152 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
146 | That means, you can restore the latest | 153 | That means, you can restore the latest |
147 | event/todo/journal you have deleted. | 154 | event/todo/journal you have deleted. |
148 | A journal is deleted, if you clear all the text of the journal. | 155 | A journal is deleted, if you clear all the text of the journal. |
149 | 156 | ||
150 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 157 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
151 | 158 | ||
152 | KA/Pi starting in 480x640 resolution: | 159 | KA/Pi starting in 480x640 resolution: |
153 | Hide the filter action in toolbar | 160 | Hide the filter action in toolbar |
154 | and added icons for undo/delete/redo in toolbar. | 161 | and added icons for undo/delete/redo in toolbar. |
155 | 162 | ||
156 | Change in OM/Pi ViewMail dialog: | 163 | Change in OM/Pi ViewMail dialog: |
157 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 164 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
158 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 165 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
159 | 166 | ||
160 | Fixed a crash when deleting mail-accounts in OM/Pi. | 167 | Fixed a crash when deleting mail-accounts in OM/Pi. |
161 | 168 | ||
162 | 169 | ||
163 | ********** VERSION 1.9.14 ************ | 170 | ********** VERSION 1.9.14 ************ |
164 | 171 | ||
165 | Fixed some problems with the dialog sizes when switching | 172 | Fixed some problems with the dialog sizes when switching |
166 | portrait/landscape mode on 640x480 PDA display. | 173 | portrait/landscape mode on 640x480 PDA display. |
167 | 174 | ||
168 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 175 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
169 | 176 | ||
170 | Fixed an ugly bug in KOpieMail: | 177 | Fixed an ugly bug in KOpieMail: |
171 | KOpieMail was not able to write files (mails) to MSDOS file system, | 178 | KOpieMail was not able to write files (mails) to MSDOS file system, |
172 | like on an usual preformatted SD card. That should work now. | 179 | like on an usual preformatted SD card. That should work now. |
173 | To save your mail data on the Sd card do the following: | 180 | To save your mail data on the Sd card do the following: |
174 | Create a dir on the SD card: | 181 | Create a dir on the SD card: |
175 | mkdir /mnt/card/localmail | 182 | mkdir /mnt/card/localmail |
176 | Go to your home dir: | 183 | Go to your home dir: |
177 | cd | 184 | cd |
178 | Go to kopiemail data storage dir: | 185 | Go to kopiemail data storage dir: |
179 | cd kdepim/apps/kopiemail | 186 | cd kdepim/apps/kopiemail |
180 | Create a symlink to the SD card: | 187 | Create a symlink to the SD card: |
181 | ls -s /mnt/card/localmail | 188 | ls -s /mnt/card/localmail |
182 | Now KOpieMail will store all mails on the SD card. | 189 | Now KOpieMail will store all mails on the SD card. |
183 | 190 | ||
184 | KO/Pi Monthview: | 191 | KO/Pi Monthview: |
185 | Now "Go to Today" selects the current month from day 1-end, | 192 | Now "Go to Today" selects the current month from day 1-end, |
186 | not the current date + some days. | 193 | not the current date + some days. |
187 | I.e. "Go to Today" shows now always | 194 | I.e. "Go to Today" shows now always |
188 | the current month with first day of month in the first row. | 195 | the current month with first day of month in the first row. |
189 | 196 | ||
190 | Added missing German translation. | 197 | Added missing German translation. |
191 | 198 | ||
192 | Fixed icons of executeable on Wintendo. | 199 | Fixed icons of executeable on Wintendo. |
193 | 200 | ||
194 | Added a "Show next Mail" button to the OM/Pi | 201 | Added a "Show next Mail" button to the OM/Pi |
195 | mail viewer such that the mail below the current mail | 202 | mail viewer such that the mail below the current mail |
196 | in the mail list view of the current folder | 203 | in the mail list view of the current folder |
197 | can be read with a single click. | 204 | can be read with a single click. |
198 | 205 | ||
199 | 206 | ||
200 | ********** VERSION 1.9.13 ************ | 207 | ********** VERSION 1.9.13 ************ |
201 | 208 | ||
202 | Fixed nasty PwM/Pi file reading bug, when | 209 | Fixed nasty PwM/Pi file reading bug, when |
203 | the used hash algo of file is different then the global | 210 | the used hash algo of file is different then the global |
204 | hash algo. | 211 | hash algo. |
205 | 212 | ||
206 | Added KA/Pi support for opie mailit mailapplication. | 213 | Added KA/Pi support for opie mailit mailapplication. |
207 | 214 | ||
208 | Fixed some bugs in OM/Pi. | 215 | Fixed some bugs in OM/Pi. |
209 | Now character conversion tables are available for the Zaurus | 216 | Now character conversion tables are available for the Zaurus |
210 | to make OM/Pi working properly. | 217 | to make OM/Pi working properly. |
211 | To get the character conversion in OM/Pi working, please download | 218 | To get the character conversion in OM/Pi working, please download |
212 | at the sourceforge project site the package | 219 | at the sourceforge project site the package |
213 | sr-character-conversion_SharpROM_arm.ipk.zip | 220 | sr-character-conversion_SharpROM_arm.ipk.zip |
214 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 221 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
215 | from the section "general files for KDE/Pim" | 222 | from the section "general files for KDE/Pim" |
216 | Instructions how to install this package are in a ReadMe in this file. | 223 | Instructions how to install this package are in a ReadMe in this file. |
217 | 224 | ||
218 | 225 | ||
219 | Fixed the orientation change problem in KA/Pi when switching | 226 | Fixed the orientation change problem in KA/Pi when switching |
220 | portrait/landscape mode. | 227 | portrait/landscape mode. |
221 | 228 | ||
222 | French translation available for KA/Pi and OM/Pi. | 229 | French translation available for KA/Pi and OM/Pi. |
223 | 230 | ||
224 | Fixed some problems with categories in KO/Pi in DTM sync. | 231 | Fixed some problems with categories in KO/Pi in DTM sync. |
225 | 232 | ||
226 | Added selection dialog for export to phone in KA/Pi. | 233 | Added selection dialog for export to phone in KA/Pi. |
227 | 234 | ||
228 | If in KO/Pi is an attendee selected to add to a meeting and this | 235 | If in KO/Pi is an attendee selected to add to a meeting and this |
229 | attendee is already in the list of attendees, this person is not added | 236 | attendee is already in the list of attendees, this person is not added |
230 | again. | 237 | again. |
231 | 238 | ||
232 | Some menu cleanup in KA/Pi. | 239 | Some menu cleanup in KA/Pi. |
233 | 240 | ||
234 | ********** VERSION 1.9.12 ************ | 241 | ********** VERSION 1.9.12 ************ |
235 | 242 | ||
236 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 243 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
237 | 244 | ||
238 | Bugfix: Licence file is now shown again. | 245 | Bugfix: Licence file is now shown again. |
239 | 246 | ||
240 | OM/Pi now supports Unicode (utf8 charset). | 247 | OM/Pi now supports Unicode (utf8 charset). |
241 | Fixed some bugs in OM/Pi. | 248 | Fixed some bugs in OM/Pi. |
242 | 249 | ||
243 | KA/Pi has more German translation. | 250 | KA/Pi has more German translation. |
244 | 251 | ||
245 | 252 | ||
246 | ********** VERSION 1.9.11 ************ | 253 | ********** VERSION 1.9.11 ************ |
247 | 254 | ||
248 | Fixed several problems in PWM/Pi, like | 255 | Fixed several problems in PWM/Pi, like |
249 | asking the user, if unsaved changed are pending | 256 | asking the user, if unsaved changed are pending |
250 | when closing the app. | 257 | when closing the app. |
251 | And PwM/Pi handles now different texts for the | 258 | And PwM/Pi handles now different texts for the |
252 | fields Description, Username, Password, configurable per category. | 259 | fields Description, Username, Password, configurable per category. |
253 | 260 | ||
254 | Fixed a crash in KO/Pi , when importing/loading vcs files | 261 | Fixed a crash in KO/Pi , when importing/loading vcs files |
255 | which have an entry with an attendee with state: | 262 | which have an entry with an attendee with state: |
256 | NEEDS ACTION | 263 | NEEDS ACTION |
257 | 264 | ||
258 | Fixed some problems in the German translation of OM/Pi, | 265 | Fixed some problems in the German translation of OM/Pi, |
259 | which makes some dialogs not fitting on the screen | 266 | which makes some dialogs not fitting on the screen |
260 | of the Z 5500. | 267 | of the Z 5500. |
261 | 268 | ||
262 | Fixed Qtopia crash, when disabling/deinstalling | 269 | Fixed Qtopia crash, when disabling/deinstalling |
263 | KO/Pi alarm applet. | 270 | KO/Pi alarm applet. |
264 | 271 | ||
265 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 272 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
266 | on Linux desktop. | 273 | on Linux desktop. |
267 | 274 | ||
268 | Added feature "remove sync info" to sync menu. | 275 | Added feature "remove sync info" to sync menu. |
269 | 276 | ||
270 | Tweaked the KO/Pi What's next view a bit, added | 277 | Tweaked the KO/Pi What's next view a bit, added |
271 | setting to hide events that are done. | 278 | setting to hide events that are done. |
272 | 279 | ||
273 | Disabled "beam receive enabled" on startup to | 280 | Disabled "beam receive enabled" on startup to |
274 | avoid problems if Fastload is enabled. | 281 | avoid problems if Fastload is enabled. |
275 | Please set "beam receive enabled", | 282 | Please set "beam receive enabled", |
276 | if you want to receive data via IR. | 283 | if you want to receive data via IR. |
277 | 284 | ||
278 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 285 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
279 | on Linux desktop. | 286 | on Linux desktop. |
280 | 287 | ||
281 | Made in KA/Pi scrolling possible, if details view is selected. | 288 | Made in KA/Pi scrolling possible, if details view is selected. |
282 | (The keyboard focus is set automatically to the search line) | 289 | (The keyboard focus is set automatically to the search line) |
283 | 290 | ||
284 | Fixed a bug in DMT sync, that a new entry in DTM was added | 291 | Fixed a bug in DMT sync, that a new entry in DTM was added |
285 | on every sync to Kx/Pi. | 292 | on every sync to Kx/Pi. |
286 | 293 | ||
287 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 294 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
288 | 295 | ||
289 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 296 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
290 | non-latin1 characters. | 297 | non-latin1 characters. |
291 | 298 | ||
292 | Rearranged package contents of Sharp-ipks and made all | 299 | Rearranged package contents of Sharp-ipks and made all |
293 | packages installable on SD again. | 300 | packages installable on SD again. |
294 | 301 | ||
295 | Fixed the writing of addressbook data in DTM sync. | 302 | Fixed the writing of addressbook data in DTM sync. |
296 | Empty fields in KA/Pi were not removed. | 303 | Empty fields in KA/Pi were not removed. |
297 | 304 | ||
298 | Added better category handling in KA/Pi: | 305 | Added better category handling in KA/Pi: |
299 | Added item | 306 | Added item |
300 | Edit Categories and | 307 | Edit Categories and |
301 | Manage new categories | 308 | Manage new categories |
302 | to the settings menu. | 309 | to the settings menu. |
303 | Possible to configure a view to display categories. | 310 | Possible to configure a view to display categories. |
304 | 311 | ||
305 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 312 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
306 | 313 | ||
307 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 314 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
308 | 315 | ||
309 | ... and many other bugfixes. | 316 | ... and many other bugfixes. |
310 | 317 | ||
311 | ********** VERSION 1.9.10 ************ | 318 | ********** VERSION 1.9.10 ************ |
312 | 319 | ||
313 | Many internal small bugfixes. | 320 | Many internal small bugfixes. |
314 | And fix of the "big" bug in KO/Pi, | 321 | And fix of the "big" bug in KO/Pi, |
315 | that after Syncing the appointments had an offset by several hours. | 322 | that after Syncing the appointments had an offset by several hours. |
316 | That was a problem with the internal timezone setting, | 323 | That was a problem with the internal timezone setting, |
317 | introduced by the changed timezone configuration settings. | 324 | introduced by the changed timezone configuration settings. |
318 | 325 | ||
319 | German translation for OM/Pi is now available. | 326 | German translation for OM/Pi is now available. |
320 | 327 | ||
321 | 328 | ||
322 | ********** VERSION 1.9.9 ************ | 329 | ********** VERSION 1.9.9 ************ |
323 | 330 | ||
324 | KDE-Pim/Pi has a new Member! | 331 | KDE-Pim/Pi has a new Member! |
325 | It is called PWM/Pi (Passwordmanager/platform-independent) | 332 | It is called PWM/Pi (Passwordmanager/platform-independent) |
326 | and it is available for the Zaurus. | 333 | and it is available for the Zaurus. |
327 | It is planned, that it will be available later for Windows. | 334 | It is planned, that it will be available later for Windows. |
328 | (And for Linux, of course). | 335 | (And for Linux, of course). |
329 | It is a port of the Passwordmanager of KDE. | 336 | It is a port of the Passwordmanager of KDE. |
330 | It will need the MicroKDElibs to run. | 337 | It will need the MicroKDElibs to run. |
331 | 338 | ||
332 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 339 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
333 | The bigger your addressbook file, the more starting speed | 340 | The bigger your addressbook file, the more starting speed |
334 | will you gain. (relatively) | 341 | will you gain. (relatively) |
335 | 342 | ||
336 | The Qtopia addressbook connector is now platform independend | 343 | The Qtopia addressbook connector is now platform independend |
337 | as well and should work on any platform for importing/exporting | 344 | as well and should work on any platform for importing/exporting |
338 | Qtopia and Opie XML files. | 345 | Qtopia and Opie XML files. |
339 | 346 | ||
340 | Added a +30min feature to the timezone settings to make | 347 | Added a +30min feature to the timezone settings to make |
341 | KDE-Pim/Pi useable in Australia and other parts on the | 348 | KDE-Pim/Pi useable in Australia and other parts on the |
342 | world with strange timezones ;-) | 349 | world with strange timezones ;-) |
343 | 350 | ||
344 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 351 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
345 | 352 | ||
346 | It is now possible to disable the | 353 | It is now possible to disable the |
347 | "receive data via infrared" feature, such that syncing with | 354 | "receive data via infrared" feature, such that syncing with |
348 | Outlook is now possible again with Kx/Pi runing. | 355 | Outlook is now possible again with Kx/Pi runing. |
349 | Please disable it, before syncing Sharp DTM with Outlook. | 356 | Please disable it, before syncing Sharp DTM with Outlook. |
350 | For your convenience, the "receive data via infrared" feature | 357 | For your convenience, the "receive data via infrared" feature |
351 | is disabled automatically, if you sync Kx/Pi with DTM. | 358 | is disabled automatically, if you sync Kx/Pi with DTM. |
352 | You have to enable it again manually after syncing. | 359 | You have to enable it again manually after syncing. |
353 | Enabling this feature makes it impossible to start the | 360 | Enabling this feature makes it impossible to start the |
354 | Sharp DTM apps. If this feature is enabled, you will only get the | 361 | Sharp DTM apps. If this feature is enabled, you will only get the |
355 | alarm notification from KO/Pi and not from the Sharp calendar. | 362 | alarm notification from KO/Pi and not from the Sharp calendar. |
356 | This is very useful if you sync KO/Pi with Sharp DTM, | 363 | This is very useful if you sync KO/Pi with Sharp DTM, |
357 | because after syncing you usually would get notified about | 364 | because after syncing you usually would get notified about |
358 | an alarm by KO/Pi and the Sharp Calendar. | 365 | an alarm by KO/Pi and the Sharp Calendar. |
359 | 366 | ||
360 | Together with the Linux desktop version of KO/Pi | 367 | Together with the Linux desktop version of KO/Pi |
361 | it is now possible to sync KO/Pi on the Zaurus | 368 | it is now possible to sync KO/Pi on the Zaurus |
362 | with the complete KDE-desktop (3.3 or later) | 369 | with the complete KDE-desktop (3.3 or later) |
363 | calendar data easily. | 370 | calendar data easily. |
364 | That makes it possible to sync the Z with one | 371 | That makes it possible to sync the Z with one |
365 | click of a mouse with the KDE-Desktop. | 372 | click of a mouse with the KDE-Desktop. |
366 | This feature it available for all Zaurus platforms KO/Pi | 373 | This feature it available for all Zaurus platforms KO/Pi |
367 | is running on. | 374 | is running on. |
368 | The only thing needed is a running KO/Pi on Linux and | 375 | The only thing needed is a running KO/Pi on Linux and |
369 | a compiled version of the small | 376 | a compiled version of the small |
370 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 377 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
371 | which is in the KDE-Pim/Pi sources available. | 378 | which is in the KDE-Pim/Pi sources available. |
372 | 379 | ||
373 | The "KDE-desktop" syncing feature for KA/Pi will follow | 380 | The "KDE-desktop" syncing feature for KA/Pi will follow |
374 | in the next releases. | 381 | in the next releases. |
375 | 382 | ||
376 | Fixed the vcard export bug, which had the version 1.9.8. | 383 | Fixed the vcard export bug, which had the version 1.9.8. |
377 | 384 | ||
378 | Added missing GERMAN translation to KO/Pi. | 385 | Added missing GERMAN translation to KO/Pi. |
379 | Hi PsionX, could you add the missing french translation?Thx! | 386 | Hi PsionX, could you add the missing french translation?Thx! |
380 | 387 | ||
381 | Translation files for KA/Pi are available as well. | 388 | Translation files for KA/Pi are available as well. |
382 | GERMAN translation will be available in the next release. | 389 | GERMAN translation will be available in the next release. |
383 | PsionX ( yres, you again ;-) ), could you start translating | 390 | PsionX ( yres, you again ;-) ), could you start translating |
384 | KA/Pi? Thx! | 391 | KA/Pi? Thx! |
385 | 392 | ||
386 | You can download the version 1.9.9 at | 393 | You can download the version 1.9.9 at |
387 | 394 | ||
388 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 395 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
389 | 396 | ||
390 | Note: | 397 | Note: |
391 | To run the mail program OM/Pi you need libopenssl. | 398 | To run the mail program OM/Pi you need libopenssl. |
392 | A link to a download loaction is available at | 399 | A link to a download loaction is available at |
393 | ZSI at www.killefiz.de | 400 | ZSI at www.killefiz.de |
394 | 401 | ||
395 | 402 | ||
396 | ********** VERSION 1.9.8 ************ | 403 | ********** VERSION 1.9.8 ************ |
397 | 404 | ||
398 | Fixed character decoding in OM/Pi. | 405 | Fixed character decoding in OM/Pi. |
399 | (e.g. German "Umlaute" were not displayed properly.) | 406 | (e.g. German "Umlaute" were not displayed properly.) |
400 | 407 | ||
401 | Made is possible to reparent todos in KO/Pi. | 408 | Made is possible to reparent todos in KO/Pi. |
diff --git a/kmicromail/libetpan/imap/mailimap_parser.c b/kmicromail/libetpan/imap/mailimap_parser.c index 1c2ecde..560e58a 100644 --- a/kmicromail/libetpan/imap/mailimap_parser.c +++ b/kmicromail/libetpan/imap/mailimap_parser.c | |||
@@ -2018,770 +2018,788 @@ mailimap_body_ext_1part_parse(mailstream * fd, MMAPString * buffer, | |||
2018 | free: | 2018 | free: |
2019 | if (body_ext_list) { | 2019 | if (body_ext_list) { |
2020 | clist_foreach(body_ext_list, (clist_func) mailimap_body_extension_free, | 2020 | clist_foreach(body_ext_list, (clist_func) mailimap_body_extension_free, |
2021 | NULL); | 2021 | NULL); |
2022 | clist_free(body_ext_list); | 2022 | clist_free(body_ext_list); |
2023 | } | 2023 | } |
2024 | if (fld_lang) | 2024 | if (fld_lang) |
2025 | mailimap_body_fld_lang_free(fld_lang); | 2025 | mailimap_body_fld_lang_free(fld_lang); |
2026 | if (fld_dsp) | 2026 | if (fld_dsp) |
2027 | mailimap_body_fld_dsp_free(fld_dsp); | 2027 | mailimap_body_fld_dsp_free(fld_dsp); |
2028 | mailimap_body_fld_md5_free(fld_md5); | 2028 | mailimap_body_fld_md5_free(fld_md5); |
2029 | err: | 2029 | err: |
2030 | return res; | 2030 | return res; |
2031 | } | 2031 | } |
2032 | 2032 | ||
2033 | 2033 | ||
2034 | /* | 2034 | /* |
2035 | body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang | 2035 | body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang |
2036 | *(SP body-extension)]] | 2036 | *(SP body-extension)]] |
2037 | ; MUST NOT be returned on non-extensible | 2037 | ; MUST NOT be returned on non-extensible |
2038 | ; "BODY" fetch | 2038 | ; "BODY" fetch |
2039 | */ | 2039 | */ |
2040 | 2040 | ||
2041 | static int | 2041 | static int |
2042 | mailimap_body_ext_mpart_parse(mailstream * fd, MMAPString * buffer, | 2042 | mailimap_body_ext_mpart_parse(mailstream * fd, MMAPString * buffer, |
2043 | size_t * index, | 2043 | size_t * index, |
2044 | struct mailimap_body_ext_mpart ** result, | 2044 | struct mailimap_body_ext_mpart ** result, |
2045 | size_t progr_rate, | 2045 | size_t progr_rate, |
2046 | progress_function * progr_fun) | 2046 | progress_function * progr_fun) |
2047 | { | 2047 | { |
2048 | size_t cur_token; | 2048 | size_t cur_token; |
2049 | 2049 | ||
2050 | struct mailimap_body_fld_dsp * fld_dsp; | 2050 | struct mailimap_body_fld_dsp * fld_dsp; |
2051 | struct mailimap_body_fld_lang * fld_lang; | 2051 | struct mailimap_body_fld_lang * fld_lang; |
2052 | struct mailimap_body_fld_param * fld_param; | 2052 | struct mailimap_body_fld_param * fld_param; |
2053 | clist * body_ext_list; | 2053 | clist * body_ext_list; |
2054 | 2054 | ||
2055 | struct mailimap_body_ext_mpart * ext_mpart; | 2055 | struct mailimap_body_ext_mpart * ext_mpart; |
2056 | int r; | 2056 | int r; |
2057 | int res; | 2057 | int res; |
2058 | 2058 | ||
2059 | cur_token = * index; | 2059 | cur_token = * index; |
2060 | 2060 | ||
2061 | fld_param = NULL; | 2061 | fld_param = NULL; |
2062 | fld_dsp = NULL; | 2062 | fld_dsp = NULL; |
2063 | fld_lang = NULL; | 2063 | fld_lang = NULL; |
2064 | body_ext_list = NULL; | 2064 | body_ext_list = NULL; |
2065 | 2065 | ||
2066 | r = mailimap_body_fld_param_parse(fd, buffer, &cur_token, &fld_param, | 2066 | r = mailimap_body_fld_param_parse(fd, buffer, &cur_token, &fld_param, |
2067 | progr_rate, progr_fun); | 2067 | progr_rate, progr_fun); |
2068 | if (r != MAILIMAP_NO_ERROR) { | 2068 | if (r != MAILIMAP_NO_ERROR) { |
2069 | res = r; | 2069 | res = r; |
2070 | goto err; | 2070 | goto err; |
2071 | } | 2071 | } |
2072 | 2072 | ||
2073 | r = mailimap_body_ext_1part_1_parse(fd, buffer, &cur_token, | 2073 | r = mailimap_body_ext_1part_1_parse(fd, buffer, &cur_token, |
2074 | &fld_dsp, | 2074 | &fld_dsp, |
2075 | &fld_lang, | 2075 | &fld_lang, |
2076 | &body_ext_list, | 2076 | &body_ext_list, |
2077 | progr_rate, progr_fun); | 2077 | progr_rate, progr_fun); |
2078 | if ((r != MAILIMAP_NO_ERROR) && (r != MAILIMAP_ERROR_PARSE)) { | 2078 | if ((r != MAILIMAP_NO_ERROR) && (r != MAILIMAP_ERROR_PARSE)) { |
2079 | res = r; | 2079 | res = r; |
2080 | goto free; | 2080 | goto free; |
2081 | } | 2081 | } |
2082 | 2082 | ||
2083 | ext_mpart = mailimap_body_ext_mpart_new(fld_param, fld_dsp, fld_lang, | 2083 | ext_mpart = mailimap_body_ext_mpart_new(fld_param, fld_dsp, fld_lang, |
2084 | body_ext_list); | 2084 | body_ext_list); |
2085 | if (ext_mpart == NULL) { | 2085 | if (ext_mpart == NULL) { |
2086 | res = MAILIMAP_ERROR_MEMORY; | 2086 | res = MAILIMAP_ERROR_MEMORY; |
2087 | goto free; | 2087 | goto free; |
2088 | } | 2088 | } |
2089 | 2089 | ||
2090 | * result = ext_mpart; | 2090 | * result = ext_mpart; |
2091 | * index = cur_token; | 2091 | * index = cur_token; |
2092 | 2092 | ||
2093 | return MAILIMAP_NO_ERROR; | 2093 | return MAILIMAP_NO_ERROR; |
2094 | 2094 | ||
2095 | free: | 2095 | free: |
2096 | if (body_ext_list) { | 2096 | if (body_ext_list) { |
2097 | clist_foreach(body_ext_list, (clist_func) mailimap_body_extension_free, | 2097 | clist_foreach(body_ext_list, (clist_func) mailimap_body_extension_free, |
2098 | NULL); | 2098 | NULL); |
2099 | clist_free(body_ext_list); | 2099 | clist_free(body_ext_list); |
2100 | } | 2100 | } |
2101 | if (fld_lang) | 2101 | if (fld_lang) |
2102 | mailimap_body_fld_lang_free(fld_lang); | 2102 | mailimap_body_fld_lang_free(fld_lang); |
2103 | if (fld_dsp) | 2103 | if (fld_dsp) |
2104 | mailimap_body_fld_dsp_free(fld_dsp); | 2104 | mailimap_body_fld_dsp_free(fld_dsp); |
2105 | if (fld_param != NULL) | 2105 | if (fld_param != NULL) |
2106 | mailimap_body_fld_param_free(fld_param); | 2106 | mailimap_body_fld_param_free(fld_param); |
2107 | err: | 2107 | err: |
2108 | return res; | 2108 | return res; |
2109 | } | 2109 | } |
2110 | 2110 | ||
2111 | /* | 2111 | /* |
2112 | body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP | 2112 | body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP |
2113 | body-fld-enc SP body-fld-octets | 2113 | body-fld-enc SP body-fld-octets |
2114 | */ | 2114 | */ |
2115 | 2115 | ||
2116 | static int | 2116 | static int |
2117 | mailimap_body_fields_parse(mailstream * fd, MMAPString * buffer, | 2117 | mailimap_body_fields_parse(mailstream * fd, MMAPString * buffer, |
2118 | size_t * index, | 2118 | size_t * index, |
2119 | struct mailimap_body_fields ** result, | 2119 | struct mailimap_body_fields ** result, |
2120 | size_t progr_rate, | 2120 | size_t progr_rate, |
2121 | progress_function * progr_fun) | 2121 | progress_function * progr_fun) |
2122 | { | 2122 | { |
2123 | struct mailimap_body_fields * body_fields; | 2123 | struct mailimap_body_fields * body_fields; |
2124 | size_t cur_token; | 2124 | size_t cur_token; |
2125 | struct mailimap_body_fld_param * body_fld_param; | 2125 | struct mailimap_body_fld_param * body_fld_param; |
2126 | char * body_fld_id; | 2126 | char * body_fld_id; |
2127 | char * body_fld_desc; | 2127 | char * body_fld_desc; |
2128 | struct mailimap_body_fld_enc * body_fld_enc; | 2128 | struct mailimap_body_fld_enc * body_fld_enc; |
2129 | size_t body_fld_octets; | 2129 | size_t body_fld_octets; |
2130 | int r; | 2130 | int r; |
2131 | int res; | 2131 | int res; |
2132 | 2132 | ||
2133 | body_fld_param = NULL; | 2133 | body_fld_param = NULL; |
2134 | body_fld_id = NULL; | 2134 | body_fld_id = NULL; |
2135 | body_fld_desc = NULL; | 2135 | body_fld_desc = NULL; |
2136 | body_fld_enc = NULL; | 2136 | body_fld_enc = NULL; |
2137 | body_fld_octets = 0; | 2137 | body_fld_octets = 0; |
2138 | 2138 | ||
2139 | cur_token = * index; | 2139 | cur_token = * index; |
2140 | 2140 | ||
2141 | r = mailimap_body_fld_param_parse(fd, buffer, &cur_token, &body_fld_param, | 2141 | r = mailimap_body_fld_param_parse(fd, buffer, &cur_token, &body_fld_param, |
2142 | progr_rate, progr_fun); | 2142 | progr_rate, progr_fun); |
2143 | if (r != MAILIMAP_NO_ERROR) { | 2143 | if (r != MAILIMAP_NO_ERROR) { |
2144 | res = r; | 2144 | res = r; |
2145 | goto err; | 2145 | goto err; |
2146 | } | 2146 | } |
2147 | 2147 | ||
2148 | r = mailimap_space_parse(fd, buffer, &cur_token); | 2148 | r = mailimap_space_parse(fd, buffer, &cur_token); |
2149 | if (r != MAILIMAP_NO_ERROR) { | 2149 | if (r != MAILIMAP_NO_ERROR) { |
2150 | res = r; | 2150 | res = r; |
2151 | goto fld_param_free; | 2151 | goto fld_param_free; |
2152 | } | 2152 | } |
2153 | 2153 | ||
2154 | r = mailimap_body_fld_id_parse(fd, buffer, &cur_token, &body_fld_id, | 2154 | r = mailimap_body_fld_id_parse(fd, buffer, &cur_token, &body_fld_id, |
2155 | progr_rate, progr_fun); | 2155 | progr_rate, progr_fun); |
2156 | if (r != MAILIMAP_NO_ERROR) { | 2156 | if (r != MAILIMAP_NO_ERROR) { |
2157 | res = r; | 2157 | res = r; |
2158 | goto fld_param_free; | 2158 | goto fld_param_free; |
2159 | } | 2159 | } |
2160 | 2160 | ||
2161 | r = mailimap_space_parse(fd, buffer, &cur_token); | 2161 | r = mailimap_space_parse(fd, buffer, &cur_token); |
2162 | if (r != MAILIMAP_NO_ERROR) { | 2162 | if (r != MAILIMAP_NO_ERROR) { |
2163 | res = r; | 2163 | res = r; |
2164 | goto fld_id_free; | 2164 | goto fld_id_free; |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | r = mailimap_body_fld_desc_parse(fd, buffer, &cur_token, &body_fld_desc, | 2167 | r = mailimap_body_fld_desc_parse(fd, buffer, &cur_token, &body_fld_desc, |
2168 | progr_rate, progr_fun); | 2168 | progr_rate, progr_fun); |
2169 | if (r != MAILIMAP_NO_ERROR) { | 2169 | if (r != MAILIMAP_NO_ERROR) { |
2170 | res = r; | 2170 | res = r; |
2171 | goto fld_id_free; | 2171 | goto fld_id_free; |
2172 | } | 2172 | } |
2173 | 2173 | ||
2174 | r = mailimap_space_parse(fd, buffer, &cur_token); | 2174 | r = mailimap_space_parse(fd, buffer, &cur_token); |
2175 | if (r != MAILIMAP_NO_ERROR) { | 2175 | if (r != MAILIMAP_NO_ERROR) { |
2176 | res = r; | 2176 | res = r; |
2177 | goto fld_desc_free; | 2177 | goto fld_desc_free; |
2178 | } | 2178 | } |
2179 | 2179 | ||
2180 | r = mailimap_body_fld_enc_parse(fd, buffer, &cur_token, &body_fld_enc, | 2180 | r = mailimap_body_fld_enc_parse(fd, buffer, &cur_token, &body_fld_enc, |
2181 | progr_rate, progr_fun); | 2181 | progr_rate, progr_fun); |
2182 | if (r != MAILIMAP_NO_ERROR) { | 2182 | if (r != MAILIMAP_NO_ERROR) { |
2183 | res = r; | 2183 | res = r; |
2184 | goto fld_desc_free; | 2184 | goto fld_desc_free; |
2185 | } | 2185 | } |
2186 | 2186 | ||
2187 | r = mailimap_space_parse(fd, buffer, &cur_token); | 2187 | r = mailimap_space_parse(fd, buffer, &cur_token); |
2188 | if (r != MAILIMAP_NO_ERROR) { | 2188 | if (r != MAILIMAP_NO_ERROR) { |
2189 | res = r; | 2189 | res = r; |
2190 | goto fld_enc_free; | 2190 | goto fld_enc_free; |
2191 | } | 2191 | } |
2192 | 2192 | ||
2193 | r = mailimap_body_fld_octets_parse(fd, buffer, &cur_token, | 2193 | r = mailimap_body_fld_octets_parse(fd, buffer, &cur_token, |
2194 | &body_fld_octets); | 2194 | &body_fld_octets); |
2195 | if (r != MAILIMAP_NO_ERROR) { | 2195 | if (r != MAILIMAP_NO_ERROR) { |
2196 | res = r; | 2196 | res = r; |
2197 | goto fld_enc_free; | 2197 | goto fld_enc_free; |
2198 | } | 2198 | } |
2199 | 2199 | ||
2200 | body_fields = mailimap_body_fields_new(body_fld_param, | 2200 | body_fields = mailimap_body_fields_new(body_fld_param, |
2201 | body_fld_id, | 2201 | body_fld_id, |
2202 | body_fld_desc, | 2202 | body_fld_desc, |
2203 | body_fld_enc, | 2203 | body_fld_enc, |
2204 | body_fld_octets); | 2204 | body_fld_octets); |
2205 | if (body_fields == NULL) { | 2205 | if (body_fields == NULL) { |
2206 | res = MAILIMAP_ERROR_MEMORY; | 2206 | res = MAILIMAP_ERROR_MEMORY; |
2207 | goto fld_enc_free; | 2207 | goto fld_enc_free; |
2208 | } | 2208 | } |
2209 | 2209 | ||
2210 | * result = body_fields; | 2210 | * result = body_fields; |
2211 | * index = cur_token; | 2211 | * index = cur_token; |
2212 | 2212 | ||
2213 | return MAILIMAP_NO_ERROR; | 2213 | return MAILIMAP_NO_ERROR; |
2214 | 2214 | ||
2215 | fld_enc_free: | 2215 | fld_enc_free: |
2216 | mailimap_body_fld_enc_free(body_fld_enc); | 2216 | mailimap_body_fld_enc_free(body_fld_enc); |
2217 | fld_desc_free: | 2217 | fld_desc_free: |
2218 | mailimap_body_fld_desc_free(body_fld_desc); | 2218 | mailimap_body_fld_desc_free(body_fld_desc); |
2219 | fld_id_free: | 2219 | fld_id_free: |
2220 | mailimap_body_fld_id_free(body_fld_id); | 2220 | mailimap_body_fld_id_free(body_fld_id); |
2221 | fld_param_free: | 2221 | fld_param_free: |
2222 | if (body_fld_param != NULL) | 2222 | if (body_fld_param != NULL) |
2223 | mailimap_body_fld_param_free(body_fld_param); | 2223 | mailimap_body_fld_param_free(body_fld_param); |
2224 | err: | 2224 | err: |
2225 | return res; | 2225 | return res; |
2226 | } | 2226 | } |
2227 | 2227 | ||
2228 | /* | 2228 | /* |
2229 | body-fld-desc = nstring | 2229 | body-fld-desc = nstring |
2230 | */ | 2230 | */ |
2231 | 2231 | ||
2232 | static int mailimap_body_fld_desc_parse(mailstream * fd, MMAPString * buffer, | 2232 | static int mailimap_body_fld_desc_parse(mailstream * fd, MMAPString * buffer, |
2233 | size_t * index, char ** result, | 2233 | size_t * index, char ** result, |
2234 | size_t progr_rate, | 2234 | size_t progr_rate, |
2235 | progress_function * progr_fun) | 2235 | progress_function * progr_fun) |
2236 | { | 2236 | { |
2237 | return mailimap_nstring_parse(fd, buffer, index, result, NULL, | 2237 | return mailimap_nstring_parse(fd, buffer, index, result, NULL, |
2238 | progr_rate, progr_fun); | 2238 | progr_rate, progr_fun); |
2239 | } | 2239 | } |
2240 | 2240 | ||
2241 | /* | 2241 | /* |
2242 | body-fld-dsp = "(" string SP body-fld-param ")" / nil | 2242 | body-fld-dsp = "(" string SP body-fld-param ")" / nil |
2243 | */ | 2243 | */ |
2244 | 2244 | ||
2245 | static int | 2245 | static int |
2246 | mailimap_body_fld_dsp_parse(mailstream * fd, MMAPString * buffer, | 2246 | mailimap_body_fld_dsp_parse(mailstream * fd, MMAPString * buffer, |
2247 | size_t * index, | 2247 | size_t * index, |
2248 | struct mailimap_body_fld_dsp ** result, | 2248 | struct mailimap_body_fld_dsp ** result, |
2249 | size_t progr_rate, | 2249 | size_t progr_rate, |
2250 | progress_function * progr_fun) | 2250 | progress_function * progr_fun) |
2251 | { | 2251 | { |
2252 | size_t cur_token; | 2252 | size_t cur_token; |
2253 | char * name; | 2253 | char * name; |
2254 | struct mailimap_body_fld_param * body_fld_param; | 2254 | struct mailimap_body_fld_param * body_fld_param; |
2255 | struct mailimap_body_fld_dsp * body_fld_dsp; | 2255 | struct mailimap_body_fld_dsp * body_fld_dsp; |
2256 | int res; | 2256 | int res; |
2257 | int r; | 2257 | int r; |
2258 | 2258 | ||
2259 | cur_token = * index; | 2259 | cur_token = * index; |
2260 | name = NULL; | 2260 | name = NULL; |
2261 | body_fld_param = NULL; | 2261 | body_fld_param = NULL; |
2262 | 2262 | ||
2263 | r = mailimap_nil_parse(fd, buffer, &cur_token); | 2263 | r = mailimap_nil_parse(fd, buffer, &cur_token); |
2264 | if (r == MAILIMAP_NO_ERROR) { | 2264 | if (r == MAILIMAP_NO_ERROR) { |
2265 | * result = NULL; | 2265 | * result = NULL; |
2266 | * index = cur_token; | 2266 | * index = cur_token; |
2267 | return MAILIMAP_NO_ERROR; | 2267 | return MAILIMAP_NO_ERROR; |
2268 | } | 2268 | } |
2269 | 2269 | ||
2270 | if (r != MAILIMAP_ERROR_PARSE) { | 2270 | if (r != MAILIMAP_ERROR_PARSE) { |
2271 | res = r; | 2271 | res = r; |
2272 | goto err; | 2272 | goto err; |
2273 | } | 2273 | } |
2274 | 2274 | ||
2275 | r = mailimap_oparenth_parse(fd, buffer, &cur_token); | 2275 | r = mailimap_oparenth_parse(fd, buffer, &cur_token); |
2276 | if (r != MAILIMAP_NO_ERROR) { | 2276 | if (r != MAILIMAP_NO_ERROR) { |
2277 | res = r; | 2277 | res = r; |
2278 | goto err; | 2278 | goto err; |
2279 | } | 2279 | } |
2280 | 2280 | ||
2281 | r = mailimap_string_parse(fd, buffer, &cur_token, &name, NULL, | 2281 | r = mailimap_string_parse(fd, buffer, &cur_token, &name, NULL, |
2282 | progr_rate, progr_fun); | 2282 | progr_rate, progr_fun); |
2283 | if (r != MAILIMAP_NO_ERROR) { | 2283 | if (r != MAILIMAP_NO_ERROR) { |
2284 | res = r; | 2284 | res = r; |
2285 | goto err; | 2285 | goto err; |
2286 | } | 2286 | } |
2287 | 2287 | ||
2288 | r = mailimap_space_parse(fd, buffer, &cur_token); | 2288 | r = mailimap_space_parse(fd, buffer, &cur_token); |
2289 | if (r != MAILIMAP_NO_ERROR) { | 2289 | if (r != MAILIMAP_NO_ERROR) { |
2290 | res = r; | 2290 | res = r; |
2291 | goto string_free; | 2291 | goto string_free; |
2292 | } | 2292 | } |
2293 | 2293 | ||
2294 | r = mailimap_body_fld_param_parse(fd, buffer, &cur_token, | 2294 | r = mailimap_body_fld_param_parse(fd, buffer, &cur_token, |
2295 | &body_fld_param, | 2295 | &body_fld_param, |
2296 | progr_rate, progr_fun); | 2296 | progr_rate, progr_fun); |
2297 | if (r != MAILIMAP_NO_ERROR) { | 2297 | if (r != MAILIMAP_NO_ERROR) { |
2298 | res = r; | 2298 | res = r; |
2299 | goto string_free; | 2299 | goto string_free; |
2300 | } | 2300 | } |
2301 | 2301 | ||
2302 | r = mailimap_cparenth_parse(fd, buffer, &cur_token); | 2302 | r = mailimap_cparenth_parse(fd, buffer, &cur_token); |
2303 | if (r != MAILIMAP_NO_ERROR) { | 2303 | if (r != MAILIMAP_NO_ERROR) { |
2304 | res = r; | 2304 | res = r; |
2305 | goto string_free; | 2305 | goto string_free; |
2306 | } | 2306 | } |
2307 | 2307 | ||
2308 | body_fld_dsp = mailimap_body_fld_dsp_new(name, body_fld_param); | 2308 | body_fld_dsp = mailimap_body_fld_dsp_new(name, body_fld_param); |
2309 | if (body_fld_dsp == NULL) { | 2309 | if (body_fld_dsp == NULL) { |
2310 | res = MAILIMAP_ERROR_MEMORY; | 2310 | res = MAILIMAP_ERROR_MEMORY; |
2311 | goto fld_param_free; | 2311 | goto fld_param_free; |
2312 | } | 2312 | } |
2313 | 2313 | ||
2314 | * index = cur_token; | 2314 | * index = cur_token; |
2315 | * result = body_fld_dsp; | 2315 | * result = body_fld_dsp; |
2316 | 2316 | ||
2317 | return MAILIMAP_NO_ERROR; | 2317 | return MAILIMAP_NO_ERROR; |
2318 | 2318 | ||
2319 | fld_param_free: | 2319 | fld_param_free: |
2320 | if (body_fld_param != NULL) | 2320 | if (body_fld_param != NULL) |
2321 | mailimap_body_fld_param_free(body_fld_param); | 2321 | mailimap_body_fld_param_free(body_fld_param); |
2322 | string_free: | 2322 | string_free: |
2323 | mailimap_string_free(name); | 2323 | mailimap_string_free(name); |
2324 | err: | 2324 | err: |
2325 | return res; | 2325 | return res; |
2326 | } | 2326 | } |
2327 | 2327 | ||
2328 | /* | 2328 | /* |
2329 | body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ | 2329 | body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ |
2330 | "QUOTED-PRINTABLE") DQUOTE) / string | 2330 | "QUOTED-PRINTABLE") DQUOTE) / string |
2331 | */ | 2331 | */ |
2332 | 2332 | ||
2333 | static inline int | 2333 | static inline int |
2334 | mailimap_body_fld_known_enc_parse(mailstream * fd, MMAPString * buffer, | 2334 | mailimap_body_fld_known_enc_parse(mailstream * fd, MMAPString * buffer, |
2335 | size_t * index, | 2335 | size_t * index, |
2336 | int * result, | 2336 | int * result, |
2337 | size_t progr_rate, | 2337 | size_t progr_rate, |
2338 | progress_function * progr_fun) | 2338 | progress_function * progr_fun) |
2339 | { | 2339 | { |
2340 | size_t cur_token; | 2340 | size_t cur_token; |
2341 | int type; | 2341 | int type; |
2342 | int r; | 2342 | int r; |
2343 | int res; | 2343 | int res; |
2344 | 2344 | ||
2345 | cur_token = * index; | 2345 | cur_token = * index; |
2346 | 2346 | ||
2347 | r = mailimap_dquote_parse(fd, buffer, &cur_token); | 2347 | r = mailimap_dquote_parse(fd, buffer, &cur_token); |
2348 | if (r != MAILIMAP_NO_ERROR) { | 2348 | if (r != MAILIMAP_NO_ERROR) { |
2349 | res = r; | 2349 | res = r; |
2350 | goto err; | 2350 | goto err; |
2351 | } | 2351 | } |
2352 | 2352 | ||
2353 | type = mailimap_encoding_get_token_value(fd, buffer, &cur_token); | 2353 | type = mailimap_encoding_get_token_value(fd, buffer, &cur_token); |
2354 | 2354 | ||
2355 | if (type == -1) { | 2355 | if (type == -1) { |
2356 | res = MAILIMAP_ERROR_PARSE; | 2356 | res = MAILIMAP_ERROR_PARSE; |
2357 | goto err; | 2357 | goto err; |
2358 | } | 2358 | } |
2359 | 2359 | ||
2360 | r = mailimap_dquote_parse(fd, buffer, &cur_token); | 2360 | r = mailimap_dquote_parse(fd, buffer, &cur_token); |
2361 | if (r != MAILIMAP_NO_ERROR) { | 2361 | if (r != MAILIMAP_NO_ERROR) { |
2362 | res = r; | 2362 | res = r; |
2363 | goto err; | 2363 | goto err; |
2364 | } | 2364 | } |
2365 | 2365 | ||
2366 | * result = type; | 2366 | * result = type; |
2367 | * index = cur_token; | 2367 | * index = cur_token; |
2368 | 2368 | ||
2369 | return MAILIMAP_NO_ERROR; | 2369 | return MAILIMAP_NO_ERROR; |
2370 | 2370 | ||
2371 | err: | 2371 | err: |
2372 | return res; | 2372 | return res; |
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | static int | 2375 | static int |
2376 | mailimap_body_fld_enc_parse(mailstream * fd, MMAPString * buffer, | 2376 | mailimap_body_fld_enc_parse(mailstream * fd, MMAPString * buffer, |
2377 | size_t * index, | 2377 | size_t * index, |
2378 | struct mailimap_body_fld_enc ** result, | 2378 | struct mailimap_body_fld_enc ** result, |
2379 | size_t progr_rate, | 2379 | size_t progr_rate, |
2380 | progress_function * progr_fun) | 2380 | progress_function * progr_fun) |
2381 | { | 2381 | { |
2382 | size_t cur_token; | 2382 | size_t cur_token; |
2383 | int type; | 2383 | int type; |
2384 | char * value; | 2384 | char * value; |
2385 | struct mailimap_body_fld_enc * body_fld_enc; | 2385 | struct mailimap_body_fld_enc * body_fld_enc; |
2386 | int r; | 2386 | int r; |
2387 | int res; | 2387 | int res; |
2388 | 2388 | ||
2389 | cur_token = * index; | 2389 | cur_token = * index; |
2390 | 2390 | ||
2391 | r = mailimap_body_fld_known_enc_parse(fd, buffer, &cur_token, | 2391 | r = mailimap_body_fld_known_enc_parse(fd, buffer, &cur_token, |
2392 | &type, progr_rate, progr_fun); | 2392 | &type, progr_rate, progr_fun); |
2393 | if (r == MAILIMAP_NO_ERROR) { | 2393 | if (r == MAILIMAP_NO_ERROR) { |
2394 | value = NULL; | 2394 | value = NULL; |
2395 | } | 2395 | } |
2396 | else if (r == MAILIMAP_ERROR_PARSE) { | 2396 | else if (r == MAILIMAP_ERROR_PARSE) { |
2397 | type = MAILIMAP_BODY_FLD_ENC_OTHER; | 2397 | type = MAILIMAP_BODY_FLD_ENC_OTHER; |
2398 | 2398 | ||
2399 | r = mailimap_string_parse(fd, buffer, &cur_token, &value, NULL, | 2399 | r = mailimap_string_parse(fd, buffer, &cur_token, &value, NULL, |
2400 | progr_rate, progr_fun); | 2400 | progr_rate, progr_fun); |
2401 | if (r != MAILIMAP_NO_ERROR) { | 2401 | if (r != MAILIMAP_NO_ERROR) { |
2402 | res = r; | 2402 | // LR start |
2403 | goto err; | 2403 | // accept NIL and set type to utf8 |
2404 | int ret = r; | ||
2405 | r = mailimap_char_parse(fd, buffer, &cur_token, 'N'); | ||
2406 | if (r == MAILIMAP_NO_ERROR) { | ||
2407 | r = mailimap_char_parse(fd, buffer, &cur_token, 'I'); | ||
2408 | if (r == MAILIMAP_NO_ERROR) { | ||
2409 | r = mailimap_char_parse(fd, buffer, &cur_token, 'L'); | ||
2410 | if (r == MAILIMAP_NO_ERROR) { | ||
2411 | type = 4; | ||
2412 | ret = MAILIMAP_NO_ERROR; | ||
2413 | value = NULL; | ||
2414 | } | ||
2415 | } | ||
2416 | } | ||
2417 | if ( ret != MAILIMAP_NO_ERROR ) { | ||
2418 | res = ret; | ||
2419 | goto err; | ||
2420 | } | ||
2421 | // LR end | ||
2404 | } | 2422 | } |
2405 | } | 2423 | } |
2406 | else { | 2424 | else { |
2407 | res = r; | 2425 | res = r; |
2408 | goto err; | 2426 | goto err; |
2409 | } | 2427 | } |
2410 | 2428 | ||
2411 | body_fld_enc = mailimap_body_fld_enc_new(type, value); | 2429 | body_fld_enc = mailimap_body_fld_enc_new(type, value); |
2412 | if (body_fld_enc == NULL) { | 2430 | if (body_fld_enc == NULL) { |
2413 | res = MAILIMAP_ERROR_MEMORY; | 2431 | res = MAILIMAP_ERROR_MEMORY; |
2414 | goto value_free; | 2432 | goto value_free; |
2415 | } | 2433 | } |
2416 | 2434 | ||
2417 | * result = body_fld_enc; | 2435 | * result = body_fld_enc; |
2418 | * index = cur_token; | 2436 | * index = cur_token; |
2419 | 2437 | ||
2420 | return MAILIMAP_NO_ERROR; | 2438 | return MAILIMAP_NO_ERROR; |
2421 | 2439 | ||
2422 | value_free: | 2440 | value_free: |
2423 | if (value) | 2441 | if (value) |
2424 | mailimap_string_free(value); | 2442 | mailimap_string_free(value); |
2425 | err: | 2443 | err: |
2426 | return res; | 2444 | return res; |
2427 | } | 2445 | } |
2428 | 2446 | ||
2429 | /* | 2447 | /* |
2430 | body-fld-id = nstring | 2448 | body-fld-id = nstring |
2431 | */ | 2449 | */ |
2432 | 2450 | ||
2433 | static int mailimap_body_fld_id_parse(mailstream * fd, MMAPString * buffer, | 2451 | static int mailimap_body_fld_id_parse(mailstream * fd, MMAPString * buffer, |
2434 | size_t * index, char ** result, | 2452 | size_t * index, char ** result, |
2435 | size_t progr_rate, | 2453 | size_t progr_rate, |
2436 | progress_function * progr_fun) | 2454 | progress_function * progr_fun) |
2437 | { | 2455 | { |
2438 | return mailimap_nstring_parse(fd, buffer, index, result, NULL, | 2456 | return mailimap_nstring_parse(fd, buffer, index, result, NULL, |
2439 | progr_rate, progr_fun); | 2457 | progr_rate, progr_fun); |
2440 | } | 2458 | } |
2441 | 2459 | ||
2442 | 2460 | ||
2443 | /* | 2461 | /* |
2444 | body-fld-lang = nstring / "(" string *(SP string) ")" | 2462 | body-fld-lang = nstring / "(" string *(SP string) ")" |
2445 | */ | 2463 | */ |
2446 | 2464 | ||
2447 | /* | 2465 | /* |
2448 | "(" string *(SP string) ")" | 2466 | "(" string *(SP string) ")" |
2449 | */ | 2467 | */ |
2450 | 2468 | ||
2451 | static int | 2469 | static int |
2452 | mailimap_body_fld_lang_list_parse(mailstream * fd, MMAPString * buffer, | 2470 | mailimap_body_fld_lang_list_parse(mailstream * fd, MMAPString * buffer, |
2453 | size_t * index, clist ** result, | 2471 | size_t * index, clist ** result, |
2454 | size_t progr_rate, | 2472 | size_t progr_rate, |
2455 | progress_function * progr_fun) | 2473 | progress_function * progr_fun) |
2456 | { | 2474 | { |
2457 | size_t cur_token; | 2475 | size_t cur_token; |
2458 | clist * list; | 2476 | clist * list; |
2459 | int r; | 2477 | int r; |
2460 | int res; | 2478 | int res; |
2461 | 2479 | ||
2462 | cur_token = * index; | 2480 | cur_token = * index; |
2463 | 2481 | ||
2464 | r = mailimap_oparenth_parse(fd, buffer, &cur_token); | 2482 | r = mailimap_oparenth_parse(fd, buffer, &cur_token); |
2465 | if (r != MAILIMAP_NO_ERROR) { | 2483 | if (r != MAILIMAP_NO_ERROR) { |
2466 | res = r; | 2484 | res = r; |
2467 | goto err; | 2485 | goto err; |
2468 | } | 2486 | } |
2469 | 2487 | ||
2470 | list = clist_new(); | 2488 | list = clist_new(); |
2471 | if (list == NULL) { | 2489 | if (list == NULL) { |
2472 | res = MAILIMAP_ERROR_MEMORY; | 2490 | res = MAILIMAP_ERROR_MEMORY; |
2473 | goto err; | 2491 | goto err; |
2474 | } | 2492 | } |
2475 | 2493 | ||
2476 | while (1) { | 2494 | while (1) { |
2477 | char * elt; | 2495 | char * elt; |
2478 | 2496 | ||
2479 | r = mailimap_string_parse(fd, buffer, &cur_token, &elt, NULL, | 2497 | r = mailimap_string_parse(fd, buffer, &cur_token, &elt, NULL, |
2480 | progr_rate, progr_fun); | 2498 | progr_rate, progr_fun); |
2481 | if (r != MAILIMAP_ERROR_PARSE) | 2499 | if (r != MAILIMAP_ERROR_PARSE) |
2482 | break; | 2500 | break; |
2483 | else if (r == MAILIMAP_NO_ERROR) { | 2501 | else if (r == MAILIMAP_NO_ERROR) { |
2484 | r = clist_append(list, elt); | 2502 | r = clist_append(list, elt); |
2485 | if (r < 0) { | 2503 | if (r < 0) { |
2486 | mailimap_string_free(elt); | 2504 | mailimap_string_free(elt); |
2487 | res = r; | 2505 | res = r; |
2488 | goto list_free; | 2506 | goto list_free; |
2489 | } | 2507 | } |
2490 | } | 2508 | } |
2491 | else { | 2509 | else { |
2492 | res = r; | 2510 | res = r; |
2493 | goto list_free; | 2511 | goto list_free; |
2494 | } | 2512 | } |
2495 | } | 2513 | } |
2496 | 2514 | ||
2497 | r = mailimap_cparenth_parse(fd, buffer, &cur_token); | 2515 | r = mailimap_cparenth_parse(fd, buffer, &cur_token); |
2498 | if (r != MAILIMAP_NO_ERROR) { | 2516 | if (r != MAILIMAP_NO_ERROR) { |
2499 | res = r; | 2517 | res = r; |
2500 | goto list_free; | 2518 | goto list_free; |
2501 | } | 2519 | } |
2502 | 2520 | ||
2503 | * index = cur_token; | 2521 | * index = cur_token; |
2504 | * result = list; | 2522 | * result = list; |
2505 | 2523 | ||
2506 | return MAILIMAP_NO_ERROR; | 2524 | return MAILIMAP_NO_ERROR; |
2507 | 2525 | ||
2508 | list_free: | 2526 | list_free: |
2509 | clist_foreach(list, (clist_func) mailimap_string_free, NULL); | 2527 | clist_foreach(list, (clist_func) mailimap_string_free, NULL); |
2510 | clist_free(list); | 2528 | clist_free(list); |
2511 | err: | 2529 | err: |
2512 | return res; | 2530 | return res; |
2513 | } | 2531 | } |
2514 | 2532 | ||
2515 | /* | 2533 | /* |
2516 | body-fld-lang = nstring / "(" string *(SP string) ")" | 2534 | body-fld-lang = nstring / "(" string *(SP string) ")" |
2517 | */ | 2535 | */ |
2518 | 2536 | ||
2519 | static int | 2537 | static int |
2520 | mailimap_body_fld_lang_parse(mailstream * fd, MMAPString * buffer, | 2538 | mailimap_body_fld_lang_parse(mailstream * fd, MMAPString * buffer, |
2521 | size_t * index, | 2539 | size_t * index, |
2522 | struct mailimap_body_fld_lang ** result, | 2540 | struct mailimap_body_fld_lang ** result, |
2523 | size_t progr_rate, | 2541 | size_t progr_rate, |
2524 | progress_function * progr_fun) | 2542 | progress_function * progr_fun) |
2525 | { | 2543 | { |
2526 | char * value; | 2544 | char * value; |
2527 | clist * list; | 2545 | clist * list; |
2528 | struct mailimap_body_fld_lang * fld_lang; | 2546 | struct mailimap_body_fld_lang * fld_lang; |
2529 | int type; | 2547 | int type; |
2530 | int r; | 2548 | int r; |
2531 | int res; | 2549 | int res; |
2532 | 2550 | ||
2533 | size_t cur_token; | 2551 | size_t cur_token; |
2534 | 2552 | ||
2535 | cur_token = * index; | 2553 | cur_token = * index; |
2536 | 2554 | ||
2537 | value = NULL; | 2555 | value = NULL; |
2538 | list = NULL; | 2556 | list = NULL; |
2539 | type = MAILIMAP_BODY_FLD_LANG_ERROR; /* XXX - removes a gcc warning */ | 2557 | type = MAILIMAP_BODY_FLD_LANG_ERROR; /* XXX - removes a gcc warning */ |
2540 | 2558 | ||
2541 | r = mailimap_nstring_parse(fd, buffer, &cur_token, &value, NULL, | 2559 | r = mailimap_nstring_parse(fd, buffer, &cur_token, &value, NULL, |
2542 | progr_rate, progr_fun); | 2560 | progr_rate, progr_fun); |
2543 | if (r == MAILIMAP_NO_ERROR) | 2561 | if (r == MAILIMAP_NO_ERROR) |
2544 | type = MAILIMAP_BODY_FLD_LANG_SINGLE; | 2562 | type = MAILIMAP_BODY_FLD_LANG_SINGLE; |
2545 | 2563 | ||
2546 | if (r == MAILIMAP_ERROR_PARSE) { | 2564 | if (r == MAILIMAP_ERROR_PARSE) { |
2547 | r = mailimap_body_fld_lang_list_parse(fd, buffer, &cur_token, &list, | 2565 | r = mailimap_body_fld_lang_list_parse(fd, buffer, &cur_token, &list, |
2548 | progr_rate, progr_fun); | 2566 | progr_rate, progr_fun); |
2549 | if (r == MAILIMAP_NO_ERROR) | 2567 | if (r == MAILIMAP_NO_ERROR) |
2550 | type = MAILIMAP_BODY_FLD_LANG_LIST; | 2568 | type = MAILIMAP_BODY_FLD_LANG_LIST; |
2551 | } | 2569 | } |
2552 | 2570 | ||
2553 | if (r != MAILIMAP_NO_ERROR) { | 2571 | if (r != MAILIMAP_NO_ERROR) { |
2554 | res = r; | 2572 | res = r; |
2555 | goto err; | 2573 | goto err; |
2556 | } | 2574 | } |
2557 | 2575 | ||
2558 | fld_lang = mailimap_body_fld_lang_new(type, value, list); | 2576 | fld_lang = mailimap_body_fld_lang_new(type, value, list); |
2559 | if (fld_lang == NULL) { | 2577 | if (fld_lang == NULL) { |
2560 | res = MAILIMAP_ERROR_MEMORY; | 2578 | res = MAILIMAP_ERROR_MEMORY; |
2561 | goto free; | 2579 | goto free; |
2562 | } | 2580 | } |
2563 | 2581 | ||
2564 | * index = cur_token; | 2582 | * index = cur_token; |
2565 | * result = fld_lang; | 2583 | * result = fld_lang; |
2566 | 2584 | ||
2567 | return MAILIMAP_NO_ERROR; | 2585 | return MAILIMAP_NO_ERROR; |
2568 | 2586 | ||
2569 | free: | 2587 | free: |
2570 | if (value) | 2588 | if (value) |
2571 | mailimap_nstring_free(value); | 2589 | mailimap_nstring_free(value); |
2572 | if (list) { | 2590 | if (list) { |
2573 | clist_foreach(list, (clist_func) mailimap_string_free, NULL); | 2591 | clist_foreach(list, (clist_func) mailimap_string_free, NULL); |
2574 | clist_free(list); | 2592 | clist_free(list); |
2575 | } | 2593 | } |
2576 | err: | 2594 | err: |
2577 | return res; | 2595 | return res; |
2578 | } | 2596 | } |
2579 | 2597 | ||
2580 | /* | 2598 | /* |
2581 | body-fld-lines = number | 2599 | body-fld-lines = number |
2582 | */ | 2600 | */ |
2583 | 2601 | ||
2584 | static int mailimap_body_fld_lines_parse(mailstream * fd, | 2602 | static int mailimap_body_fld_lines_parse(mailstream * fd, |
2585 | MMAPString * buffer, size_t * index, | 2603 | MMAPString * buffer, size_t * index, |
2586 | uint32_t * result) | 2604 | uint32_t * result) |
2587 | { | 2605 | { |
2588 | return mailimap_number_parse(fd, buffer, index, result); | 2606 | return mailimap_number_parse(fd, buffer, index, result); |
2589 | } | 2607 | } |
2590 | 2608 | ||
2591 | /* | 2609 | /* |
2592 | body-fld-md5 = nstring | 2610 | body-fld-md5 = nstring |
2593 | */ | 2611 | */ |
2594 | 2612 | ||
2595 | static int mailimap_body_fld_md5_parse(mailstream * fd, MMAPString * buffer, | 2613 | static int mailimap_body_fld_md5_parse(mailstream * fd, MMAPString * buffer, |
2596 | size_t * index, char ** result, | 2614 | size_t * index, char ** result, |
2597 | size_t progr_rate, | 2615 | size_t progr_rate, |
2598 | progress_function * progr_fun) | 2616 | progress_function * progr_fun) |
2599 | { | 2617 | { |
2600 | return mailimap_nstring_parse(fd, buffer, index, result, NULL, | 2618 | return mailimap_nstring_parse(fd, buffer, index, result, NULL, |
2601 | progr_rate, progr_fun); | 2619 | progr_rate, progr_fun); |
2602 | } | 2620 | } |
2603 | 2621 | ||
2604 | /* | 2622 | /* |
2605 | body-fld-octets = number | 2623 | body-fld-octets = number |
2606 | */ | 2624 | */ |
2607 | 2625 | ||
2608 | static int mailimap_body_fld_octets_parse(mailstream * fd, | 2626 | static int mailimap_body_fld_octets_parse(mailstream * fd, |
2609 | MMAPString * buffer, size_t * index, | 2627 | MMAPString * buffer, size_t * index, |
2610 | uint32_t * result) | 2628 | uint32_t * result) |
2611 | { | 2629 | { |
2612 | return mailimap_number_parse(fd, buffer, index, result); | 2630 | return mailimap_number_parse(fd, buffer, index, result); |
2613 | } | 2631 | } |
2614 | 2632 | ||
2615 | /* | 2633 | /* |
2616 | body-fld-param = "(" string SP string *(SP string SP string) ")" / nil | 2634 | body-fld-param = "(" string SP string *(SP string SP string) ")" / nil |
2617 | */ | 2635 | */ |
2618 | 2636 | ||
2619 | /* | 2637 | /* |
2620 | string SP string | 2638 | string SP string |
2621 | */ | 2639 | */ |
2622 | 2640 | ||
2623 | static int | 2641 | static int |
2624 | mailimap_single_body_fld_param_parse(mailstream * fd, MMAPString * buffer, | 2642 | mailimap_single_body_fld_param_parse(mailstream * fd, MMAPString * buffer, |
2625 | size_t * index, | 2643 | size_t * index, |
2626 | struct mailimap_single_body_fld_param ** | 2644 | struct mailimap_single_body_fld_param ** |
2627 | result, | 2645 | result, |
2628 | size_t progr_rate, | 2646 | size_t progr_rate, |
2629 | progress_function * progr_fun) | 2647 | progress_function * progr_fun) |
2630 | { | 2648 | { |
2631 | struct mailimap_single_body_fld_param * param; | 2649 | struct mailimap_single_body_fld_param * param; |
2632 | char * name; | 2650 | char * name; |
2633 | char * value; | 2651 | char * value; |
2634 | size_t cur_token; | 2652 | size_t cur_token; |
2635 | int r; | 2653 | int r; |
2636 | int res; | 2654 | int res; |
2637 | 2655 | ||
2638 | cur_token = * index; | 2656 | cur_token = * index; |
2639 | 2657 | ||
2640 | name = NULL; | 2658 | name = NULL; |
2641 | value = NULL; | 2659 | value = NULL; |
2642 | 2660 | ||
2643 | r = mailimap_string_parse(fd, buffer, &cur_token, &name, NULL, | 2661 | r = mailimap_string_parse(fd, buffer, &cur_token, &name, NULL, |
2644 | progr_rate, progr_fun); | 2662 | progr_rate, progr_fun); |
2645 | if (r != MAILIMAP_NO_ERROR) { | 2663 | if (r != MAILIMAP_NO_ERROR) { |
2646 | res = r; | 2664 | res = r; |
2647 | goto err; | 2665 | goto err; |
2648 | } | 2666 | } |
2649 | 2667 | ||
2650 | r = mailimap_space_parse(fd, buffer, &cur_token); | 2668 | r = mailimap_space_parse(fd, buffer, &cur_token); |
2651 | if (r != MAILIMAP_NO_ERROR) { | 2669 | if (r != MAILIMAP_NO_ERROR) { |
2652 | res = r; | 2670 | res = r; |
2653 | goto free_name; | 2671 | goto free_name; |
2654 | } | 2672 | } |
2655 | 2673 | ||
2656 | r = mailimap_string_parse(fd, buffer, &cur_token, &value, NULL, | 2674 | r = mailimap_string_parse(fd, buffer, &cur_token, &value, NULL, |
2657 | progr_rate, progr_fun); | 2675 | progr_rate, progr_fun); |
2658 | if (r != MAILIMAP_NO_ERROR) { | 2676 | if (r != MAILIMAP_NO_ERROR) { |
2659 | res = r; | 2677 | res = r; |
2660 | goto free_name; | 2678 | goto free_name; |
2661 | } | 2679 | } |
2662 | 2680 | ||
2663 | param = mailimap_single_body_fld_param_new(name, value); | 2681 | param = mailimap_single_body_fld_param_new(name, value); |
2664 | if (param == NULL) { | 2682 | if (param == NULL) { |
2665 | res = MAILIMAP_ERROR_MEMORY; | 2683 | res = MAILIMAP_ERROR_MEMORY; |
2666 | goto free_value; | 2684 | goto free_value; |
2667 | } | 2685 | } |
2668 | 2686 | ||
2669 | * result = param; | 2687 | * result = param; |
2670 | * index = cur_token; | 2688 | * index = cur_token; |
2671 | 2689 | ||
2672 | return MAILIMAP_NO_ERROR; | 2690 | return MAILIMAP_NO_ERROR; |
2673 | 2691 | ||
2674 | free_value: | 2692 | free_value: |
2675 | mailimap_string_free(name); | 2693 | mailimap_string_free(name); |
2676 | free_name: | 2694 | free_name: |
2677 | mailimap_string_free(value); | 2695 | mailimap_string_free(value); |
2678 | err: | 2696 | err: |
2679 | return res; | 2697 | return res; |
2680 | } | 2698 | } |
2681 | 2699 | ||
2682 | /* | 2700 | /* |
2683 | body-fld-param = "(" string SP string *(SP string SP string) ")" / nil | 2701 | body-fld-param = "(" string SP string *(SP string SP string) ")" / nil |
2684 | */ | 2702 | */ |
2685 | 2703 | ||
2686 | static int | 2704 | static int |
2687 | mailimap_body_fld_param_parse(mailstream * fd, | 2705 | mailimap_body_fld_param_parse(mailstream * fd, |
2688 | MMAPString * buffer, size_t * index, | 2706 | MMAPString * buffer, size_t * index, |
2689 | struct mailimap_body_fld_param ** result, | 2707 | struct mailimap_body_fld_param ** result, |
2690 | size_t progr_rate, | 2708 | size_t progr_rate, |
2691 | progress_function * progr_fun) | 2709 | progress_function * progr_fun) |
2692 | { | 2710 | { |
2693 | size_t cur_token; | 2711 | size_t cur_token; |
2694 | clist * param_list; | 2712 | clist * param_list; |
2695 | struct mailimap_body_fld_param * fld_param; | 2713 | struct mailimap_body_fld_param * fld_param; |
2696 | int r; | 2714 | int r; |
2697 | int res; | 2715 | int res; |
2698 | 2716 | ||
2699 | param_list = NULL; | 2717 | param_list = NULL; |
2700 | cur_token = * index; | 2718 | cur_token = * index; |
2701 | 2719 | ||
2702 | r = mailimap_nil_parse(fd, buffer, &cur_token); | 2720 | r = mailimap_nil_parse(fd, buffer, &cur_token); |
2703 | if (r == MAILIMAP_NO_ERROR) { | 2721 | if (r == MAILIMAP_NO_ERROR) { |
2704 | * result = NULL; | 2722 | * result = NULL; |
2705 | * index = cur_token; | 2723 | * index = cur_token; |
2706 | return MAILIMAP_NO_ERROR; | 2724 | return MAILIMAP_NO_ERROR; |
2707 | } | 2725 | } |
2708 | 2726 | ||
2709 | if (r != MAILIMAP_ERROR_PARSE) { | 2727 | if (r != MAILIMAP_ERROR_PARSE) { |
2710 | res = r; | 2728 | res = r; |
2711 | goto err; | 2729 | goto err; |
2712 | } | 2730 | } |
2713 | 2731 | ||
2714 | r = mailimap_oparenth_parse(fd, buffer, &cur_token); | 2732 | r = mailimap_oparenth_parse(fd, buffer, &cur_token); |
2715 | if (r != MAILIMAP_NO_ERROR) { | 2733 | if (r != MAILIMAP_NO_ERROR) { |
2716 | res = r; | 2734 | res = r; |
2717 | goto err; | 2735 | goto err; |
2718 | } | 2736 | } |
2719 | 2737 | ||
2720 | r = mailimap_struct_spaced_list_parse(fd, buffer, &cur_token, ¶m_list, | 2738 | r = mailimap_struct_spaced_list_parse(fd, buffer, &cur_token, ¶m_list, |
2721 | (mailimap_struct_parser *) | 2739 | (mailimap_struct_parser *) |
2722 | mailimap_single_body_fld_param_parse, | 2740 | mailimap_single_body_fld_param_parse, |
2723 | (mailimap_struct_destructor *) | 2741 | (mailimap_struct_destructor *) |
2724 | mailimap_single_body_fld_param_free, | 2742 | mailimap_single_body_fld_param_free, |
2725 | progr_rate, progr_fun); | 2743 | progr_rate, progr_fun); |
2726 | if (r != MAILIMAP_NO_ERROR) { | 2744 | if (r != MAILIMAP_NO_ERROR) { |
2727 | res = r; | 2745 | res = r; |
2728 | goto err; | 2746 | goto err; |
2729 | } | 2747 | } |
2730 | 2748 | ||
2731 | r = mailimap_cparenth_parse(fd, buffer, &cur_token); | 2749 | r = mailimap_cparenth_parse(fd, buffer, &cur_token); |
2732 | if (r != MAILIMAP_NO_ERROR) { | 2750 | if (r != MAILIMAP_NO_ERROR) { |
2733 | res = r; | 2751 | res = r; |
2734 | goto free; | 2752 | goto free; |
2735 | } | 2753 | } |
2736 | 2754 | ||
2737 | fld_param = mailimap_body_fld_param_new(param_list); | 2755 | fld_param = mailimap_body_fld_param_new(param_list); |
2738 | if (fld_param == NULL) { | 2756 | if (fld_param == NULL) { |
2739 | res = MAILIMAP_ERROR_MEMORY; | 2757 | res = MAILIMAP_ERROR_MEMORY; |
2740 | goto free; | 2758 | goto free; |
2741 | } | 2759 | } |
2742 | 2760 | ||
2743 | * index = cur_token; | 2761 | * index = cur_token; |
2744 | * result = fld_param; | 2762 | * result = fld_param; |
2745 | 2763 | ||
2746 | return MAILIMAP_NO_ERROR; | 2764 | return MAILIMAP_NO_ERROR; |
2747 | 2765 | ||
2748 | free: | 2766 | free: |
2749 | clist_foreach(param_list, | 2767 | clist_foreach(param_list, |
2750 | (clist_func) mailimap_single_body_fld_param_free, | 2768 | (clist_func) mailimap_single_body_fld_param_free, |
2751 | NULL); | 2769 | NULL); |
2752 | clist_free(param_list); | 2770 | clist_free(param_list); |
2753 | err: | 2771 | err: |
2754 | return res; | 2772 | return res; |
2755 | } | 2773 | } |
2756 | 2774 | ||
2757 | /* | 2775 | /* |
2758 | body-type-1part = (body-type-basic / body-type-msg / body-type-text) | 2776 | body-type-1part = (body-type-basic / body-type-msg / body-type-text) |
2759 | [SP body-ext-1part] | 2777 | [SP body-ext-1part] |
2760 | */ | 2778 | */ |
2761 | 2779 | ||
2762 | static int | 2780 | static int |
2763 | mailimap_body_type_1part_parse(mailstream * fd, MMAPString * buffer, | 2781 | mailimap_body_type_1part_parse(mailstream * fd, MMAPString * buffer, |
2764 | size_t * index, | 2782 | size_t * index, |
2765 | struct mailimap_body_type_1part ** result, | 2783 | struct mailimap_body_type_1part ** result, |
2766 | size_t progr_rate, | 2784 | size_t progr_rate, |
2767 | progress_function * progr_fun) | 2785 | progress_function * progr_fun) |
2768 | { | 2786 | { |
2769 | size_t cur_token; | 2787 | size_t cur_token; |
2770 | struct mailimap_body_type_1part * body_type_1part; | 2788 | struct mailimap_body_type_1part * body_type_1part; |
2771 | struct mailimap_body_type_basic * body_type_basic; | 2789 | struct mailimap_body_type_basic * body_type_basic; |
2772 | struct mailimap_body_type_msg * body_type_msg; | 2790 | struct mailimap_body_type_msg * body_type_msg; |
2773 | struct mailimap_body_type_text * body_type_text; | 2791 | struct mailimap_body_type_text * body_type_text; |
2774 | struct mailimap_body_ext_1part * body_ext_1part; | 2792 | struct mailimap_body_ext_1part * body_ext_1part; |
2775 | int type; | 2793 | int type; |
2776 | size_t final_token; | 2794 | size_t final_token; |
2777 | int r; | 2795 | int r; |
2778 | int res; | 2796 | int res; |
2779 | 2797 | ||
2780 | cur_token = * index; | 2798 | cur_token = * index; |
2781 | 2799 | ||
2782 | body_type_basic = NULL; | 2800 | body_type_basic = NULL; |
2783 | body_type_msg = NULL; | 2801 | body_type_msg = NULL; |
2784 | body_type_text = NULL; | 2802 | body_type_text = NULL; |
2785 | body_ext_1part = NULL; | 2803 | body_ext_1part = NULL; |
2786 | 2804 | ||
2787 | type = MAILIMAP_BODY_TYPE_1PART_ERROR; /* XXX - removes a gcc warning */ | 2805 | type = MAILIMAP_BODY_TYPE_1PART_ERROR; /* XXX - removes a gcc warning */ |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index d9496af..93fb7de 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -55,940 +55,945 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | |||
55 | static unsigned int last = 0; | 55 | static unsigned int last = 0; |
56 | if ( last != current ) | 56 | if ( last != current ) |
57 | IMAPwrapper::progress(); | 57 | IMAPwrapper::progress(); |
58 | last = current; | 58 | last = current; |
59 | } | 59 | } |
60 | void IMAPwrapper::progress( QString m ) | 60 | void IMAPwrapper::progress( QString m ) |
61 | { | 61 | { |
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() |
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 | ||
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 | Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response)); | 215 | Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response)); |
216 | ok = false; | 216 | ok = false; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | if (!ok) { | 219 | if (!ok) { |
220 | err = mailimap_close( m_imap ); | 220 | err = mailimap_close( m_imap ); |
221 | mailimap_free( m_imap ); | 221 | mailimap_free( m_imap ); |
222 | m_imap = 0; | 222 | m_imap = 0; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | void IMAPwrapper::logout() | 226 | void IMAPwrapper::logout() |
227 | { | 227 | { |
228 | int err = MAILIMAP_NO_ERROR; | 228 | int err = MAILIMAP_NO_ERROR; |
229 | if (!m_imap) return; | 229 | if (!m_imap) return; |
230 | err = mailimap_logout( m_imap ); | 230 | err = mailimap_logout( m_imap ); |
231 | err = mailimap_close( m_imap ); | 231 | err = mailimap_close( m_imap ); |
232 | mailimap_free( m_imap ); | 232 | mailimap_free( m_imap ); |
233 | m_imap = 0; | 233 | m_imap = 0; |
234 | m_Lastmbox = ""; | 234 | m_Lastmbox = ""; |
235 | } | 235 | } |
236 | 236 | ||
237 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) | 237 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) |
238 | { | 238 | { |
239 | 239 | ||
240 | int tryAgain = 1; | 240 | int tryAgain = 1; |
241 | while ( tryAgain >= 0 ) { | 241 | while ( tryAgain >= 0 ) { |
242 | int err = MAILIMAP_NO_ERROR; | 242 | int err = MAILIMAP_NO_ERROR; |
243 | clist *result = 0; | 243 | clist *result = 0; |
244 | clistcell *current; | 244 | clistcell *current; |
245 | mailimap_fetch_type *fetchType = 0; | 245 | mailimap_fetch_type *fetchType = 0; |
246 | mailimap_set *set = 0; | 246 | mailimap_set *set = 0; |
247 | 247 | ||
248 | login(); | 248 | login(); |
249 | if (!m_imap) { | 249 | if (!m_imap) { |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | /* select mailbox READONLY for operations */ | 252 | /* select mailbox READONLY for operations */ |
253 | err = selectMbox(mailbox); | 253 | err = selectMbox(mailbox); |
254 | if ( err != MAILIMAP_NO_ERROR ) { | 254 | if ( err != MAILIMAP_NO_ERROR ) { |
255 | return; | 255 | return; |
256 | } | 256 | } |
257 | 257 | ||
258 | int last = m_imap->imap_selection_info->sel_exists; | 258 | int last = m_imap->imap_selection_info->sel_exists; |
259 | 259 | ||
260 | if (last == 0) { | 260 | if (last == 0) { |
261 | Global::statusMessage(i18n("Mailbox has no mails")); | 261 | Global::statusMessage(i18n("Mailbox has no mails")); |
262 | return; | 262 | return; |
263 | } else { | 263 | } else { |
264 | } | 264 | } |
265 | progress( i18n("Fetch ")); | 265 | progress( i18n("Fetch ")); |
266 | mMax = last; | 266 | mMax = last; |
267 | //qDebug("last %d ", last); | 267 | //qDebug("last %d ", last); |
268 | Global::statusMessage(i18n("Fetching header list")); | 268 | Global::statusMessage(i18n("Fetching header list")); |
269 | qApp->processEvents(); | 269 | qApp->processEvents(); |
270 | /* the range has to start at 1!!! not with 0!!!! */ | 270 | /* 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 | 271 | //LR the access to web.de imap server is no working with value 1 |
272 | //qDebug("interval %d - %d ", tryAgain, last-1+tryAgain ); | 272 | //qDebug("interval %d - %d ", tryAgain, last-1+tryAgain ); |
273 | set = mailimap_set_new_interval( tryAgain, last ); | 273 | set = mailimap_set_new_interval( tryAgain, last ); |
274 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 274 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
275 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); | 275 | 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()); | 276 | 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()); | 277 | 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()); | 278 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); |
279 | 279 | ||
280 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 280 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
281 | mailimap_set_free( set ); | 281 | mailimap_set_free( set ); |
282 | mailimap_fetch_type_free( fetchType ); | 282 | mailimap_fetch_type_free( fetchType ); |
283 | 283 | ||
284 | QString date,subject,from; | 284 | QString date,subject,from; |
285 | 285 | ||
286 | if ( err == MAILIMAP_NO_ERROR ) { | 286 | if ( err == MAILIMAP_NO_ERROR ) { |
287 | tryAgain = -1; | 287 | tryAgain = -1; |
288 | mailimap_msg_att * msg_att; | 288 | mailimap_msg_att * msg_att; |
289 | int i = 0; | 289 | int i = 0; |
290 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 290 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
291 | ++i; | 291 | ++i; |
292 | //qDebug("iii %d ",i); | 292 | //qDebug("iii %d ",i); |
293 | msg_att = (mailimap_msg_att*)current->data; | 293 | msg_att = (mailimap_msg_att*)current->data; |
294 | RecMail*m = parse_list_result(msg_att); | 294 | RecMail*m = parse_list_result(msg_att); |
295 | if (m) { | 295 | if (m) { |
296 | if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) { | 296 | if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) { |
297 | m->setNumber(i); | 297 | m->setNumber(i); |
298 | m->setMbox(mailbox); | 298 | m->setMbox(mailbox); |
299 | m->setWrapper(this); | 299 | m->setWrapper(this); |
300 | target.append(m); | 300 | target.append(m); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | } | 303 | } |
304 | Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count())); | 304 | Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count())); |
305 | } else { | 305 | } else { |
306 | --tryAgain; | 306 | --tryAgain; |
307 | --tryAgain;//disabled tryagain by adding this line | 307 | --tryAgain;//disabled tryagain by adding this line |
308 | if ( tryAgain < 0 ) | 308 | if ( tryAgain < 0 ) |
309 | Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response)); | 309 | Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response)); |
310 | else | 310 | else |
311 | qDebug("try again... "); | 311 | qDebug("try again... "); |
312 | } | 312 | } |
313 | 313 | ||
314 | if (result) mailimap_fetch_list_free(result); | 314 | if (result) mailimap_fetch_list_free(result); |
315 | } | 315 | } |
316 | } | 316 | } |
317 | 317 | ||
318 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | 318 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() |
319 | { | 319 | { |
320 | const char *path, *mask; | 320 | const char *path, *mask; |
321 | int err = MAILIMAP_NO_ERROR; | 321 | int err = MAILIMAP_NO_ERROR; |
322 | clist *result = 0; | 322 | clist *result = 0; |
323 | clistcell *current = 0; | 323 | clistcell *current = 0; |
324 | clistcell*cur_flag = 0; | 324 | clistcell*cur_flag = 0; |
325 | mailimap_mbx_list_flags*bflags = 0; | 325 | mailimap_mbx_list_flags*bflags = 0; |
326 | 326 | ||
327 | QValueList<FolderP>* folders = new QValueList<FolderP>(); | 327 | QValueList<FolderP>* folders = new QValueList<FolderP>(); |
328 | login(); | 328 | login(); |
329 | if (!m_imap) { | 329 | if (!m_imap) { |
330 | return folders; | 330 | return folders; |
331 | } | 331 | } |
332 | 332 | ||
333 | /* | 333 | /* |
334 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. | 334 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. |
335 | * We must not forget to filter them out in next loop! | 335 | * We must not forget to filter them out in next loop! |
336 | * it seems like ugly code. and yes - it is ugly code. but the best way. | 336 | * it seems like ugly code. and yes - it is ugly code. but the best way. |
337 | */ | 337 | */ |
338 | Global::statusMessage(i18n("Fetching folder list")); | 338 | Global::statusMessage(i18n("Fetching folder list")); |
339 | qApp->processEvents(); | 339 | qApp->processEvents(); |
340 | QString temp; | 340 | QString temp; |
341 | mask = "INBOX" ; | 341 | mask = "INBOX" ; |
342 | mailimap_mailbox_list *list; | 342 | mailimap_mailbox_list *list; |
343 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); | 343 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); |
344 | QString del; | 344 | QString del; |
345 | bool selectable = true; | 345 | bool selectable = true; |
346 | bool no_inferiors = false; | 346 | bool no_inferiors = false; |
347 | if ( err == MAILIMAP_NO_ERROR ) { | 347 | if ( err == MAILIMAP_NO_ERROR ) { |
348 | current = result->first; | 348 | current = result->first; |
349 | for ( int i = result->count; i > 0; i-- ) { | 349 | for ( int i = result->count; i > 0; i-- ) { |
350 | list = (mailimap_mailbox_list *) current->data; | 350 | list = (mailimap_mailbox_list *) current->data; |
351 | // it is better use the deep copy mechanism of qt itself | 351 | // it is better use the deep copy mechanism of qt itself |
352 | // instead of using strdup! | 352 | // instead of using strdup! |
353 | temp = list->mb_name; | 353 | temp = list->mb_name; |
354 | del = list->mb_delimiter; | 354 | del = list->mb_delimiter; |
355 | current = current->next; | 355 | current = current->next; |
356 | if ( (bflags = list->mb_flag) ) { | 356 | if ( (bflags = list->mb_flag) ) { |
357 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 357 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
358 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 358 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
359 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 359 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
360 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { | 360 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { |
361 | no_inferiors = true; | 361 | no_inferiors = true; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | } | 364 | } |
365 | folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); | 365 | folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); |
366 | } | 366 | } |
367 | } else { | 367 | } else { |
368 | qDebug("error fetching folders: "); | 368 | qDebug("error fetching folders: "); |
369 | 369 | ||
370 | } | 370 | } |
371 | mailimap_list_result_free( result ); | 371 | mailimap_list_result_free( result ); |
372 | 372 | ||
373 | /* | 373 | /* |
374 | * second stage - get the other then inbox folders | 374 | * second stage - get the other then inbox folders |
375 | */ | 375 | */ |
376 | mask = "*" ; | 376 | mask = "*" ; |
377 | path = account->getPrefix().latin1(); | 377 | path = account->getPrefix().latin1(); |
378 | if (!path) path = ""; | 378 | if (!path) path = ""; |
379 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); | 379 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); |
380 | if ( err == MAILIMAP_NO_ERROR ) { | 380 | if ( err == MAILIMAP_NO_ERROR ) { |
381 | current = result->first; | 381 | current = result->first; |
382 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { | 382 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { |
383 | no_inferiors = false; | 383 | no_inferiors = false; |
384 | list = (mailimap_mailbox_list *) current->data; | 384 | list = (mailimap_mailbox_list *) current->data; |
385 | // it is better use the deep copy mechanism of qt itself | 385 | // it is better use the deep copy mechanism of qt itself |
386 | // instead of using strdup! | 386 | // instead of using strdup! |
387 | temp = list->mb_name; | 387 | temp = list->mb_name; |
388 | if (temp.lower()=="inbox") | 388 | if (temp.lower()=="inbox") |
389 | continue; | 389 | continue; |
390 | if (temp.lower()==account->getPrefix().lower()) | 390 | if (temp.lower()==account->getPrefix().lower()) |
391 | continue; | 391 | continue; |
392 | if ( (bflags = list->mb_flag) ) { | 392 | if ( (bflags = list->mb_flag) ) { |
393 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 393 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
394 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 394 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
395 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 395 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
396 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { | 396 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { |
397 | no_inferiors = true; | 397 | no_inferiors = true; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | } | 400 | } |
401 | del = list->mb_delimiter; | 401 | del = list->mb_delimiter; |
402 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); | 402 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); |
403 | } | 403 | } |
404 | } else { | 404 | } else { |
405 | qDebug("error fetching folders "); | 405 | qDebug("error fetching folders "); |
406 | 406 | ||
407 | } | 407 | } |
408 | if (result) mailimap_list_result_free( result ); | 408 | if (result) mailimap_list_result_free( result ); |
409 | return folders; | 409 | return folders; |
410 | } | 410 | } |
411 | 411 | ||
412 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 412 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
413 | { | 413 | { |
414 | RecMail * m = 0; | 414 | RecMail * m = 0; |
415 | mailimap_msg_att_item *item=0; | 415 | mailimap_msg_att_item *item=0; |
416 | clistcell *current,*c,*cf; | 416 | clistcell *current,*c,*cf; |
417 | mailimap_msg_att_dynamic*flist; | 417 | mailimap_msg_att_dynamic*flist; |
418 | mailimap_flag_fetch*cflag; | 418 | mailimap_flag_fetch*cflag; |
419 | int size = 0; | 419 | int size = 0; |
420 | QBitArray mFlags(7); | 420 | QBitArray mFlags(7); |
421 | QStringList addresslist; | 421 | QStringList addresslist; |
422 | 422 | ||
423 | if (!m_att) { | 423 | if (!m_att) { |
424 | return m; | 424 | return m; |
425 | } | 425 | } |
426 | m = new RecMail(); | 426 | m = new RecMail(); |
427 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { | 427 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
428 | current = c; | 428 | current = c; |
429 | size = 0; | 429 | size = 0; |
430 | item = (mailimap_msg_att_item*)current->data; | 430 | item = (mailimap_msg_att_item*)current->data; |
431 | if ( !item ) | 431 | if ( !item ) |
432 | continue; | 432 | continue; |
433 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 433 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
434 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; | 434 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; |
435 | if (!flist || !flist->att_list) { | 435 | if (!flist || !flist->att_list) { |
436 | continue; | 436 | continue; |
437 | } | 437 | } |
438 | cf = flist->att_list->first; | 438 | cf = flist->att_list->first; |
439 | if( ! cf ) | 439 | if( cf ) { |
440 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { | 440 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { |
441 | cflag = (mailimap_flag_fetch*)cf->data; | 441 | cflag = (mailimap_flag_fetch*)cf->data; |
442 | if( ! cflag ) | 442 | if( ! cflag ) |
443 | qDebug("imap:not cflag "); | 443 | qDebug("imap:NO cflag "); |
444 | if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { | 444 | else { |
445 | switch (cflag->fl_flag->fl_type) { | 445 | if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { |
446 | case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ | 446 | switch (cflag->fl_flag->fl_type) { |
447 | mFlags.setBit(FLAG_ANSWERED); | 447 | case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ |
448 | break; | 448 | mFlags.setBit(FLAG_ANSWERED); |
449 | case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ | 449 | break; |
450 | mFlags.setBit(FLAG_FLAGGED); | 450 | case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ |
451 | break; | 451 | mFlags.setBit(FLAG_FLAGGED); |
452 | case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ | 452 | break; |
453 | mFlags.setBit(FLAG_DELETED); | 453 | case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ |
454 | break; | 454 | mFlags.setBit(FLAG_DELETED); |
455 | case MAILIMAP_FLAG_SEEN: /* \Seen flag */ | 455 | break; |
456 | mFlags.setBit(FLAG_SEEN); | 456 | case MAILIMAP_FLAG_SEEN: /* \Seen flag */ |
457 | break; | 457 | mFlags.setBit(FLAG_SEEN); |
458 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ | 458 | break; |
459 | mFlags.setBit(FLAG_DRAFT); | 459 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ |
460 | break; | 460 | mFlags.setBit(FLAG_DRAFT); |
461 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ | 461 | break; |
462 | break; | 462 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ |
463 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ | 463 | break; |
464 | break; | 464 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ |
465 | default: | 465 | break; |
466 | break; | 466 | default: |
467 | break; | ||
468 | } | ||
469 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | ||
470 | mFlags.setBit(FLAG_RECENT); | ||
471 | } | ||
467 | } | 472 | } |
468 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | ||
469 | mFlags.setBit(FLAG_RECENT); | ||
470 | } | 473 | } |
471 | } | 474 | } |
475 | //qDebug(" continue"); | ||
472 | continue; | 476 | continue; |
473 | } | 477 | } |
474 | if ( item->att_data.att_static == NULL ) | 478 | if ( item->att_data.att_static == NULL ) |
475 | continue; | 479 | continue; |
476 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 480 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
477 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 481 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
478 | if ( head == NULL ) | 482 | if ( head == NULL ) |
479 | continue; | 483 | continue; |
480 | if ( head->env_date != NULL ) { | 484 | if ( head->env_date != NULL ) { |
481 | m->setDate(head->env_date); | 485 | m->setDate(head->env_date); |
482 | //struct mailimf_date_time result; | 486 | //struct mailimf_date_time result; |
483 | struct mailimf_date_time* date;// = &result; | 487 | struct mailimf_date_time* date;// = &result; |
484 | struct mailimf_date_time **re = &date; | 488 | struct mailimf_date_time **re = &date; |
485 | size_t length = m->getDate().length(); | 489 | size_t length = m->getDate().length(); |
486 | size_t index = 0; | 490 | size_t index = 0; |
487 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { | 491 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { |
492 | //qDebug("parseDateTime "); | ||
488 | QDateTime dt = Genericwrapper::parseDateTime( date ); | 493 | QDateTime dt = Genericwrapper::parseDateTime( date ); |
489 | QString ret; | 494 | QString ret; |
490 | if ( dt.date() == QDate::currentDate () ) | 495 | if ( dt.date() == QDate::currentDate () ) |
491 | ret = KGlobal::locale()->formatTime( dt.time(),true); | 496 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
492 | else { | 497 | else { |
493 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | 498 | ret = KGlobal::locale()->formatDateTime( dt,true,true); |
494 | } | 499 | } |
495 | m->setDate( ret ); | 500 | m->setDate( ret ); |
496 | char tmp[20]; | 501 | char tmp[20]; |
497 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", | 502 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", |
498 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); | 503 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); |
499 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); | 504 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); |
500 | m->setIsoDate( QString( tmp ) ); | 505 | m->setIsoDate( QString( tmp ) ); |
501 | mailimf_date_time_free ( date ); | 506 | mailimf_date_time_free ( date ); |
502 | } else { | 507 | } else { |
503 | m->setIsoDate(head->env_date); | 508 | m->setIsoDate(head->env_date); |
504 | } | 509 | } |
505 | } | 510 | } |
506 | if ( head->env_subject != NULL ) | 511 | if ( head->env_subject != NULL ) |
507 | m->setSubject(convert_String((const char*)head->env_subject)); | 512 | m->setSubject(convert_String((const char*)head->env_subject)); |
508 | //m->setSubject(head->env_subject); | 513 | //m->setSubject(head->env_subject); |
509 | if (head->env_from!=NULL) { | 514 | if (head->env_from!=NULL) { |
510 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 515 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
511 | if (addresslist.count()) { | 516 | if (addresslist.count()) { |
512 | m->setFrom(addresslist.first()); | 517 | m->setFrom(addresslist.first()); |
513 | } | 518 | } |
514 | } | 519 | } |
515 | if (head->env_to!=NULL) { | 520 | if (head->env_to!=NULL) { |
516 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 521 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
517 | m->setTo(addresslist); | 522 | m->setTo(addresslist); |
518 | } | 523 | } |
519 | if (head->env_cc!=NULL) { | 524 | if (head->env_cc!=NULL) { |
520 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); | 525 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); |
521 | m->setCC(addresslist); | 526 | m->setCC(addresslist); |
522 | } | 527 | } |
523 | if (head->env_bcc!=NULL) { | 528 | if (head->env_bcc!=NULL) { |
524 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); | 529 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); |
525 | m->setBcc(addresslist); | 530 | m->setBcc(addresslist); |
526 | } | 531 | } |
527 | /* reply to address, eg. email. */ | 532 | /* reply to address, eg. email. */ |
528 | if (head->env_reply_to!=NULL) { | 533 | if (head->env_reply_to!=NULL) { |
529 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); | 534 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); |
530 | if (addresslist.count()) { | 535 | if (addresslist.count()) { |
531 | m->setReplyto(addresslist.first()); | 536 | m->setReplyto(addresslist.first()); |
532 | } | 537 | } |
533 | } | 538 | } |
534 | if (head->env_in_reply_to!=NULL) { | 539 | if (head->env_in_reply_to!=NULL) { |
535 | QString h(head->env_in_reply_to); | 540 | QString h(head->env_in_reply_to); |
536 | while (h.length()>0 && h[0]=='<') { | 541 | while (h.length()>0 && h[0]=='<') { |
537 | h.remove(0,1); | 542 | h.remove(0,1); |
538 | } | 543 | } |
539 | while (h.length()>0 && h[h.length()-1]=='>') { | 544 | while (h.length()>0 && h[h.length()-1]=='>') { |
540 | h.remove(h.length()-1,1); | 545 | h.remove(h.length()-1,1); |
541 | } | 546 | } |
542 | if (h.length()>0) { | 547 | if (h.length()>0) { |
543 | m->setInreply(QStringList(h)); | 548 | m->setInreply(QStringList(h)); |
544 | } | 549 | } |
545 | } | 550 | } |
546 | if (head->env_message_id != NULL) { | 551 | if (head->env_message_id != NULL) { |
547 | m->setMsgid(QString(head->env_message_id)); | 552 | m->setMsgid(QString(head->env_message_id)); |
548 | } | 553 | } |
549 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 554 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
550 | #if 0 | 555 | #if 0 |
551 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 556 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
552 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 557 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
553 | qDebug("time %s ",da.toString().latin1() ); | 558 | qDebug("time %s ",da.toString().latin1() ); |
554 | #endif | 559 | #endif |
555 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 560 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
556 | size = item->att_data.att_static->att_data.att_rfc822_size; | 561 | size = item->att_data.att_static->att_data.att_rfc822_size; |
557 | } | 562 | } |
558 | } | 563 | } |
559 | /* msg is already deleted */ | 564 | /* msg is already deleted */ |
560 | if (mFlags.testBit(FLAG_DELETED) && m) { | 565 | if (mFlags.testBit(FLAG_DELETED) && m) { |
561 | delete m; | 566 | delete m; |
562 | m = 0; | 567 | m = 0; |
563 | } | 568 | } |
564 | if (m) { | 569 | if (m) { |
565 | m->setFlags(mFlags); | 570 | m->setFlags(mFlags); |
566 | m->setMsgsize(size); | 571 | m->setMsgsize(size); |
567 | } | 572 | } |
568 | return m; | 573 | return m; |
569 | } | 574 | } |
570 | 575 | ||
571 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) | 576 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) |
572 | { | 577 | { |
573 | RecBodyP body = new RecBody(); | 578 | RecBodyP body = new RecBody(); |
574 | const char *mb; | 579 | const char *mb; |
575 | int err = MAILIMAP_NO_ERROR; | 580 | int err = MAILIMAP_NO_ERROR; |
576 | clist *result = 0; | 581 | clist *result = 0; |
577 | clistcell *current; | 582 | clistcell *current; |
578 | mailimap_fetch_att *fetchAtt = 0; | 583 | mailimap_fetch_att *fetchAtt = 0; |
579 | mailimap_fetch_type *fetchType = 0; | 584 | mailimap_fetch_type *fetchType = 0; |
580 | mailimap_set *set = 0; | 585 | mailimap_set *set = 0; |
581 | mailimap_body*body_desc = 0; | 586 | mailimap_body*body_desc = 0; |
582 | 587 | ||
583 | mb = mail->getMbox().latin1(); | 588 | mb = mail->getMbox().latin1(); |
584 | 589 | ||
585 | login(); | 590 | login(); |
586 | if (!m_imap) { | 591 | if (!m_imap) { |
587 | return body; | 592 | return body; |
588 | } | 593 | } |
589 | err = selectMbox(mail->getMbox()); | 594 | err = selectMbox(mail->getMbox()); |
590 | if ( err != MAILIMAP_NO_ERROR ) { | 595 | if ( err != MAILIMAP_NO_ERROR ) { |
591 | return body; | 596 | return body; |
592 | } | 597 | } |
593 | 598 | ||
594 | /* the range has to start at 1!!! not with 0!!!! */ | 599 | /* the range has to start at 1!!! not with 0!!!! */ |
595 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); | 600 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); |
596 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 601 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
597 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 602 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
598 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 603 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
599 | mailimap_set_free( set ); | 604 | mailimap_set_free( set ); |
600 | mailimap_fetch_type_free( fetchType ); | 605 | mailimap_fetch_type_free( fetchType ); |
601 | 606 | ||
602 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 607 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
603 | mailimap_msg_att * msg_att; | 608 | mailimap_msg_att * msg_att; |
604 | msg_att = (mailimap_msg_att*)current->data; | 609 | msg_att = (mailimap_msg_att*)current->data; |
605 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 610 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
606 | QValueList<int> path; | 611 | QValueList<int> path; |
607 | body_desc = item->att_data.att_static->att_data.att_body; | 612 | body_desc = item->att_data.att_static->att_data.att_body; |
608 | traverseBody(mail,body_desc,body,0,path); | 613 | traverseBody(mail,body_desc,body,0,path); |
609 | } else { | 614 | } else { |
610 | //odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; | 615 | qDebug("error fetching body %d (%d): %s", err, MAILIMAP_NO_ERROR, m_imap->imap_response ); |
611 | } | 616 | } |
612 | if (result) mailimap_fetch_list_free(result); | 617 | if (result) mailimap_fetch_list_free(result); |
613 | return body; | 618 | return body; |
614 | } | 619 | } |
615 | 620 | ||
616 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 621 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
617 | { | 622 | { |
618 | QStringList l; | 623 | QStringList l; |
619 | QString from; | 624 | QString from; |
620 | bool named_from; | 625 | bool named_from; |
621 | clistcell *current = NULL; | 626 | clistcell *current = NULL; |
622 | mailimap_address * current_address=NULL; | 627 | mailimap_address * current_address=NULL; |
623 | if (!list) { | 628 | if (!list) { |
624 | return l; | 629 | return l; |
625 | } | 630 | } |
626 | unsigned int count = 0; | 631 | unsigned int count = 0; |
627 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { | 632 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
628 | from = ""; | 633 | from = ""; |
629 | named_from = false; | 634 | named_from = false; |
630 | current_address=(mailimap_address*)current->data; | 635 | current_address=(mailimap_address*)current->data; |
631 | if (current_address->ad_personal_name){ | 636 | if (current_address->ad_personal_name){ |
632 | from+=convert_String((const char*)current_address->ad_personal_name); | 637 | from+=convert_String((const char*)current_address->ad_personal_name); |
633 | from+=" "; | 638 | from+=" "; |
634 | named_from = true; | 639 | named_from = true; |
635 | } | 640 | } |
636 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 641 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
637 | from+="<"; | 642 | from+="<"; |
638 | } | 643 | } |
639 | if (current_address->ad_mailbox_name) { | 644 | if (current_address->ad_mailbox_name) { |
640 | from+=QString(current_address->ad_mailbox_name); | 645 | from+=QString(current_address->ad_mailbox_name); |
641 | from+="@"; | 646 | from+="@"; |
642 | } | 647 | } |
643 | if (current_address->ad_host_name) { | 648 | if (current_address->ad_host_name) { |
644 | from+=QString(current_address->ad_host_name); | 649 | from+=QString(current_address->ad_host_name); |
645 | } | 650 | } |
646 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 651 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
647 | from+=">"; | 652 | from+=">"; |
648 | } | 653 | } |
649 | l.append(QString(from)); | 654 | l.append(QString(from)); |
650 | if (++count > 99) { | 655 | if (++count > 99) { |
651 | break; | 656 | break; |
652 | } | 657 | } |
653 | } | 658 | } |
654 | return l; | 659 | return l; |
655 | } | 660 | } |
656 | 661 | ||
657 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) | 662 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) |
658 | { | 663 | { |
659 | encodedString*res=new encodedString; | 664 | encodedString*res=new encodedString; |
660 | int err; | 665 | int err; |
661 | mailimap_fetch_type *fetchType; | 666 | mailimap_fetch_type *fetchType; |
662 | mailimap_set *set; | 667 | mailimap_set *set; |
663 | clistcell*current,*cur; | 668 | clistcell*current,*cur; |
664 | mailimap_section_part * section_part = 0; | 669 | mailimap_section_part * section_part = 0; |
665 | mailimap_section_spec * section_spec = 0; | 670 | mailimap_section_spec * section_spec = 0; |
666 | mailimap_section * section = 0; | 671 | mailimap_section * section = 0; |
667 | mailimap_fetch_att * fetch_att = 0; | 672 | mailimap_fetch_att * fetch_att = 0; |
668 | 673 | ||
669 | login(); | 674 | login(); |
670 | if (!m_imap) { | 675 | if (!m_imap) { |
671 | return res; | 676 | return res; |
672 | } | 677 | } |
673 | if (!internal_call) { | 678 | if (!internal_call) { |
674 | err = selectMbox(mail->getMbox()); | 679 | err = selectMbox(mail->getMbox()); |
675 | if ( err != MAILIMAP_NO_ERROR ) { | 680 | if ( err != MAILIMAP_NO_ERROR ) { |
676 | return res; | 681 | return res; |
677 | } | 682 | } |
678 | } | 683 | } |
679 | set = mailimap_set_new_single(mail->getNumber()); | 684 | set = mailimap_set_new_single(mail->getNumber()); |
680 | 685 | ||
681 | clist*id_list = 0; | 686 | clist*id_list = 0; |
682 | 687 | ||
683 | /* if path == empty then its a request for the whole rfc822 mail and generates | 688 | /* if path == empty then its a request for the whole rfc822 mail and generates |
684 | a "fetch <id> (body[])" statement on imap server */ | 689 | a "fetch <id> (body[])" statement on imap server */ |
685 | if (path.count()>0 ) { | 690 | if (path.count()>0 ) { |
686 | id_list = clist_new(); | 691 | id_list = clist_new(); |
687 | for (unsigned j=0; j < path.count();++j) { | 692 | for (unsigned j=0; j < path.count();++j) { |
688 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 693 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
689 | *p_id = path[j]; | 694 | *p_id = path[j]; |
690 | clist_append(id_list,p_id); | 695 | clist_append(id_list,p_id); |
691 | } | 696 | } |
692 | section_part = mailimap_section_part_new(id_list); | 697 | section_part = mailimap_section_part_new(id_list); |
693 | section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | 698 | section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); |
694 | } | 699 | } |
695 | 700 | ||
696 | section = mailimap_section_new(section_spec); | 701 | section = mailimap_section_new(section_spec); |
697 | fetch_att = mailimap_fetch_att_new_body_section(section); | 702 | fetch_att = mailimap_fetch_att_new_body_section(section); |
698 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 703 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
699 | 704 | ||
700 | clist*result = 0; | 705 | clist*result = 0; |
701 | 706 | ||
702 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 707 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
703 | mailimap_set_free( set ); | 708 | mailimap_set_free( set ); |
704 | mailimap_fetch_type_free( fetchType ); | 709 | mailimap_fetch_type_free( fetchType ); |
705 | 710 | ||
706 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 711 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
707 | mailimap_msg_att * msg_att; | 712 | mailimap_msg_att * msg_att; |
708 | msg_att = (mailimap_msg_att*)current->data; | 713 | msg_att = (mailimap_msg_att*)current->data; |
709 | mailimap_msg_att_item*msg_att_item; | 714 | mailimap_msg_att_item*msg_att_item; |
710 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 715 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
711 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 716 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
712 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 717 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
713 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 718 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
714 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 719 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
715 | /* detach - we take over the content */ | 720 | /* detach - we take over the content */ |
716 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 721 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
717 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); | 722 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); |
718 | } | 723 | } |
719 | } | 724 | } |
720 | } | 725 | } |
721 | } else { | 726 | } else { |
722 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; | 727 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; |
723 | } | 728 | } |
724 | if (result) mailimap_fetch_list_free(result); | 729 | if (result) mailimap_fetch_list_free(result); |
725 | return res; | 730 | return res; |
726 | } | 731 | } |
727 | 732 | ||
728 | /* current_recursion is for recursive calls. | 733 | /* current_recursion is for recursive calls. |
729 | current_count means the position inside the internal loop! */ | 734 | current_count means the position inside the internal loop! */ |
730 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, | 735 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, |
731 | int current_recursion,QValueList<int>recList,int current_count) | 736 | int current_recursion,QValueList<int>recList,int current_count) |
732 | { | 737 | { |
733 | if (!body || current_recursion>=10) { | 738 | if (!body || current_recursion>=10) { |
734 | return; | 739 | return; |
735 | } | 740 | } |
736 | switch (body->bd_type) { | 741 | switch (body->bd_type) { |
737 | case MAILIMAP_BODY_1PART: | 742 | case MAILIMAP_BODY_1PART: |
738 | { | 743 | { |
739 | QValueList<int>countlist = recList; | 744 | QValueList<int>countlist = recList; |
740 | countlist.append(current_count); | 745 | countlist.append(current_count); |
741 | RecPartP currentPart = new RecPart(); | 746 | RecPartP currentPart = new RecPart(); |
742 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 747 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
743 | QString id(""); | 748 | QString id(""); |
744 | currentPart->setPositionlist(countlist); | 749 | currentPart->setPositionlist(countlist); |
745 | for (unsigned int j = 0; j < countlist.count();++j) { | 750 | for (unsigned int j = 0; j < countlist.count();++j) { |
746 | id+=(j>0?" ":""); | 751 | id+=(j>0?" ":""); |
747 | id+=QString("%1").arg(countlist[j]); | 752 | id+=QString("%1").arg(countlist[j]); |
748 | } | 753 | } |
749 | //odebug << "ID = " << id.latin1() << "" << oendl; | 754 | //odebug << "ID = " << id.latin1() << "" << oendl; |
750 | currentPart->setIdentifier(id); | 755 | currentPart->setIdentifier(id); |
751 | fillSinglePart(currentPart,part1); | 756 | fillSinglePart(currentPart,part1); |
752 | /* important: Check for is NULL 'cause a body can be empty! | 757 | /* important: Check for is NULL 'cause a body can be empty! |
753 | And we put it only into the mail if it is the FIRST part */ | 758 | And we put it only into the mail if it is the FIRST part */ |
754 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { | 759 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
755 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); | 760 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
756 | 761 | ||
757 | size_t index = 0; | 762 | size_t index = 0; |
758 | char*res = 0; | 763 | char*res = 0; |
759 | int err = MAILIMF_NO_ERROR; | 764 | int err = MAILIMF_NO_ERROR; |
760 | 765 | ||
761 | QString charset = currentPart->searchParamter( "charset"); | 766 | QString charset = currentPart->searchParamter( "charset"); |
762 | qDebug("CHARSET %s ",charset.latin1() ); | 767 | qDebug("CHARSET %s ",charset.latin1() ); |
763 | if ( false ) { | 768 | if ( false ) { |
764 | //if ( !charset.isEmpty() ) { | 769 | //if ( !charset.isEmpty() ) { |
765 | target_body->setCharset( charset ); | 770 | target_body->setCharset( charset ); |
766 | //err = mailmime_encoded_phrase_parse("iso-8859-1", | 771 | //err = mailmime_encoded_phrase_parse("iso-8859-1", |
767 | // text, strlen(text),&index, "iso-8859-1",&res); | 772 | // text, strlen(text),&index, "iso-8859-1",&res); |
768 | err = mailmime_encoded_phrase_parse(charset.latin1(), | 773 | err = mailmime_encoded_phrase_parse(charset.latin1(), |
769 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); | 774 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); |
770 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 775 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { |
771 | //qDebug("res %d %s ", index, res); | 776 | //qDebug("res %d %s ", index, res); |
772 | body_text = QString::fromUtf8(res); | 777 | body_text = QString::fromUtf8(res); |
773 | } | 778 | } |
774 | if (res) free(res); | 779 | if (res) free(res); |
775 | } | 780 | } |
776 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); | 781 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); |
777 | target_body->setDescription(currentPart); | 782 | target_body->setDescription(currentPart); |
778 | target_body->setBodytext(body_text); | 783 | target_body->setBodytext(body_text); |
779 | if (countlist.count()>1) { | 784 | if (countlist.count()>1) { |
780 | target_body->addPart(currentPart); | 785 | target_body->addPart(currentPart); |
781 | } | 786 | } |
782 | } else { | 787 | } else { |
783 | target_body->addPart(currentPart); | 788 | target_body->addPart(currentPart); |
784 | } | 789 | } |
785 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { | 790 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { |
786 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); | 791 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); |
787 | } | 792 | } |
788 | } | 793 | } |
789 | break; | 794 | break; |
790 | case MAILIMAP_BODY_MPART: | 795 | case MAILIMAP_BODY_MPART: |
791 | { | 796 | { |
792 | QValueList<int>countlist = recList; | 797 | QValueList<int>countlist = recList; |
793 | clistcell*current=0; | 798 | clistcell*current=0; |
794 | mailimap_body*current_body=0; | 799 | mailimap_body*current_body=0; |
795 | unsigned int ccount = 1; | 800 | unsigned int ccount = 1; |
796 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; | 801 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; |
797 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 802 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
798 | current_body = (mailimap_body*)current->data; | 803 | current_body = (mailimap_body*)current->data; |
799 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 804 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
800 | RecPartP targetPart = new RecPart(); | 805 | RecPartP targetPart = new RecPart(); |
801 | targetPart->setType("multipart"); | 806 | targetPart->setType("multipart"); |
802 | fillMultiPart(targetPart,mailDescription); | 807 | fillMultiPart(targetPart,mailDescription); |
803 | countlist.append(current_count); | 808 | countlist.append(current_count); |
804 | targetPart->setPositionlist(countlist); | 809 | targetPart->setPositionlist(countlist); |
805 | target_body->addPart(targetPart); | 810 | target_body->addPart(targetPart); |
806 | QString id(""); | 811 | QString id(""); |
807 | for (unsigned int j = 0; j < countlist.count();++j) { | 812 | for (unsigned int j = 0; j < countlist.count();++j) { |
808 | id+=(j>0?" ":""); | 813 | id+=(j>0?" ":""); |
809 | id+=QString("%1").arg(countlist[j]); | 814 | id+=QString("%1").arg(countlist[j]); |
810 | } | 815 | } |
811 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; | 816 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; |
812 | } | 817 | } |
813 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); | 818 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); |
814 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 819 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
815 | countlist = recList; | 820 | countlist = recList; |
816 | } | 821 | } |
817 | ++ccount; | 822 | ++ccount; |
818 | } | 823 | } |
819 | } | 824 | } |
820 | break; | 825 | break; |
821 | default: | 826 | default: |
822 | break; | 827 | break; |
823 | } | 828 | } |
824 | } | 829 | } |
825 | 830 | ||
826 | void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) | 831 | void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) |
827 | { | 832 | { |
828 | if (!Description) { | 833 | if (!Description) { |
829 | return; | 834 | return; |
830 | } | 835 | } |
831 | switch (Description->bd_type) { | 836 | switch (Description->bd_type) { |
832 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 837 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
833 | target_part->setType("text"); | 838 | target_part->setType("text"); |
834 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | 839 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); |
835 | break; | 840 | break; |
836 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | 841 | case MAILIMAP_BODY_TYPE_1PART_BASIC: |
837 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | 842 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); |
838 | break; | 843 | break; |
839 | case MAILIMAP_BODY_TYPE_1PART_MSG: | 844 | case MAILIMAP_BODY_TYPE_1PART_MSG: |
840 | target_part->setType("message"); | 845 | target_part->setType("message"); |
841 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); | 846 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); |
842 | break; | 847 | break; |
843 | default: | 848 | default: |
844 | break; | 849 | break; |
845 | } | 850 | } |
846 | } | 851 | } |
847 | 852 | ||
848 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) | 853 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) |
849 | { | 854 | { |
850 | if (!which) { | 855 | if (!which) { |
851 | return; | 856 | return; |
852 | } | 857 | } |
853 | QString sub; | 858 | QString sub; |
854 | sub = which->bd_media_text; | 859 | sub = which->bd_media_text; |
855 | //odebug << "Type= text/" << which->bd_media_text << "" << oendl; | 860 | //odebug << "Type= text/" << which->bd_media_text << "" << oendl; |
856 | target_part->setSubtype(sub.lower()); | 861 | target_part->setSubtype(sub.lower()); |
857 | target_part->setLines(which->bd_lines); | 862 | target_part->setLines(which->bd_lines); |
858 | fillBodyFields(target_part,which->bd_fields); | 863 | fillBodyFields(target_part,which->bd_fields); |
859 | } | 864 | } |
860 | 865 | ||
861 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) | 866 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) |
862 | { | 867 | { |
863 | if (!which) { | 868 | if (!which) { |
864 | return; | 869 | return; |
865 | } | 870 | } |
866 | target_part->setSubtype("rfc822"); | 871 | target_part->setSubtype("rfc822"); |
867 | //odebug << "Message part" << oendl; | 872 | //odebug << "Message part" << oendl; |
868 | /* we set this type to text/plain */ | 873 | /* we set this type to text/plain */ |
869 | target_part->setLines(which->bd_lines); | 874 | target_part->setLines(which->bd_lines); |
870 | fillBodyFields(target_part,which->bd_fields); | 875 | fillBodyFields(target_part,which->bd_fields); |
871 | } | 876 | } |
872 | 877 | ||
873 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) | 878 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) |
874 | { | 879 | { |
875 | if (!which) return; | 880 | if (!which) return; |
876 | QString sub = which->bd_media_subtype; | 881 | QString sub = which->bd_media_subtype; |
877 | target_part->setSubtype(sub.lower()); | 882 | target_part->setSubtype(sub.lower()); |
878 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { | 883 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { |
879 | clistcell*cur = 0; | 884 | clistcell*cur = 0; |
880 | mailimap_single_body_fld_param*param=0; | 885 | mailimap_single_body_fld_param*param=0; |
881 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 886 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
882 | param = (mailimap_single_body_fld_param*)cur->data; | 887 | param = (mailimap_single_body_fld_param*)cur->data; |
883 | if (param) { | 888 | if (param) { |
884 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 889 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
885 | } | 890 | } |
886 | } | 891 | } |
887 | } | 892 | } |
888 | } | 893 | } |
889 | 894 | ||
890 | void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) | 895 | void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) |
891 | { | 896 | { |
892 | if (!which) { | 897 | if (!which) { |
893 | return; | 898 | return; |
894 | } | 899 | } |
895 | QString type,sub; | 900 | QString type,sub; |
896 | switch (which->bd_media_basic->med_type) { | 901 | switch (which->bd_media_basic->med_type) { |
897 | case MAILIMAP_MEDIA_BASIC_APPLICATION: | 902 | case MAILIMAP_MEDIA_BASIC_APPLICATION: |
898 | type = "application"; | 903 | type = "application"; |
899 | break; | 904 | break; |
900 | case MAILIMAP_MEDIA_BASIC_AUDIO: | 905 | case MAILIMAP_MEDIA_BASIC_AUDIO: |
901 | type = "audio"; | 906 | type = "audio"; |
902 | break; | 907 | break; |
903 | case MAILIMAP_MEDIA_BASIC_IMAGE: | 908 | case MAILIMAP_MEDIA_BASIC_IMAGE: |
904 | type = "image"; | 909 | type = "image"; |
905 | break; | 910 | break; |
906 | case MAILIMAP_MEDIA_BASIC_MESSAGE: | 911 | case MAILIMAP_MEDIA_BASIC_MESSAGE: |
907 | type = "message"; | 912 | type = "message"; |
908 | break; | 913 | break; |
909 | case MAILIMAP_MEDIA_BASIC_VIDEO: | 914 | case MAILIMAP_MEDIA_BASIC_VIDEO: |
910 | type = "video"; | 915 | type = "video"; |
911 | break; | 916 | break; |
912 | case MAILIMAP_MEDIA_BASIC_OTHER: | 917 | case MAILIMAP_MEDIA_BASIC_OTHER: |
913 | default: | 918 | default: |
914 | if (which->bd_media_basic->med_basic_type) { | 919 | if (which->bd_media_basic->med_basic_type) { |
915 | type = which->bd_media_basic->med_basic_type; | 920 | type = which->bd_media_basic->med_basic_type; |
916 | } else { | 921 | } else { |
917 | type = ""; | 922 | type = ""; |
918 | } | 923 | } |
919 | break; | 924 | break; |
920 | } | 925 | } |
921 | if (which->bd_media_basic->med_subtype) { | 926 | if (which->bd_media_basic->med_subtype) { |
922 | sub = which->bd_media_basic->med_subtype; | 927 | sub = which->bd_media_basic->med_subtype; |
923 | } else { | 928 | } else { |
924 | sub = ""; | 929 | sub = ""; |
925 | } | 930 | } |
926 | // odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; | 931 | // odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; |
927 | target_part->setType(type.lower()); | 932 | target_part->setType(type.lower()); |
928 | target_part->setSubtype(sub.lower()); | 933 | target_part->setSubtype(sub.lower()); |
929 | fillBodyFields(target_part,which->bd_fields); | 934 | fillBodyFields(target_part,which->bd_fields); |
930 | } | 935 | } |
931 | 936 | ||
932 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) | 937 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) |
933 | { | 938 | { |
934 | if (!which) return; | 939 | if (!which) return; |
935 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 940 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
936 | clistcell*cur; | 941 | clistcell*cur; |
937 | mailimap_single_body_fld_param*param=0; | 942 | mailimap_single_body_fld_param*param=0; |
938 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 943 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
939 | param = (mailimap_single_body_fld_param*)cur->data; | 944 | param = (mailimap_single_body_fld_param*)cur->data; |
940 | if (param) { | 945 | if (param) { |
941 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 946 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
942 | } | 947 | } |
943 | } | 948 | } |
944 | } | 949 | } |
945 | mailimap_body_fld_enc*enc = which->bd_encoding; | 950 | mailimap_body_fld_enc*enc = which->bd_encoding; |
946 | QString encoding(""); | 951 | QString encoding(""); |
947 | switch (enc->enc_type) { | 952 | switch (enc->enc_type) { |
948 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 953 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
949 | encoding = "7bit"; | 954 | encoding = "7bit"; |
950 | break; | 955 | break; |
951 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 956 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
952 | encoding = "8bit"; | 957 | encoding = "8bit"; |
953 | break; | 958 | break; |
954 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 959 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
955 | encoding="binary"; | 960 | encoding="binary"; |
956 | break; | 961 | break; |
957 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 962 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
958 | encoding="base64"; | 963 | encoding="base64"; |
959 | break; | 964 | break; |
960 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 965 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
961 | encoding="quoted-printable"; | 966 | encoding="quoted-printable"; |
962 | break; | 967 | break; |
963 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 968 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
964 | default: | 969 | default: |
965 | if (enc->enc_value) { | 970 | if (enc->enc_value) { |
966 | char*t=enc->enc_value; | 971 | char*t=enc->enc_value; |
967 | encoding=QString(enc->enc_value); | 972 | encoding=QString(enc->enc_value); |
968 | enc->enc_value=0L; | 973 | enc->enc_value=0L; |
969 | free(t); | 974 | free(t); |
970 | } | 975 | } |
971 | } | 976 | } |
972 | if (which->bd_description) { | 977 | if (which->bd_description) { |
973 | target_part->setDescription(QString(which->bd_description)); | 978 | target_part->setDescription(QString(which->bd_description)); |
974 | } | 979 | } |
975 | target_part->setEncoding(encoding); | 980 | target_part->setEncoding(encoding); |
976 | target_part->setSize(which->bd_size); | 981 | target_part->setSize(which->bd_size); |
977 | } | 982 | } |
978 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | 983 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) |
979 | { | 984 | { |
980 | //#if 0 | 985 | //#if 0 |
981 | mailimap_flag_list*flist; | 986 | mailimap_flag_list*flist; |
982 | mailimap_set *set; | 987 | mailimap_set *set; |
983 | mailimap_store_att_flags * store_flags; | 988 | mailimap_store_att_flags * store_flags; |
984 | int err; | 989 | int err; |
985 | login(); | 990 | login(); |
986 | //#endif | 991 | //#endif |
987 | if (!m_imap) { | 992 | if (!m_imap) { |
988 | return; | 993 | return; |
989 | } | 994 | } |
990 | int iii = 0; | 995 | int iii = 0; |
991 | int count = target.count(); | 996 | int count = target.count(); |
992 | // qDebug("imap remove count %d ", count); | 997 | // qDebug("imap remove count %d ", count); |
993 | 998 | ||
994 | 999 | ||
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp index c4731a7..d21696a 100644 --- a/kmicromail/viewmailbase.cpp +++ b/kmicromail/viewmailbase.cpp | |||
@@ -1,104 +1,104 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #include <qtextbrowser.h> | 2 | #include <qtextbrowser.h> |
3 | #include <qlistview.h> | 3 | #include <qlistview.h> |
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qvbox.h> | 6 | #include <qvbox.h> |
7 | 7 | ||
8 | #include <qtoolbar.h> | 8 | #include <qtoolbar.h> |
9 | #include <qmenubar.h> | 9 | #include <qmenubar.h> |
10 | #include <kiconloader.h> | 10 | #include <kiconloader.h> |
11 | //#include <qpe/resource.h> | 11 | //#include <qpe/resource.h> |
12 | #include <klocale.h> | 12 | #include <klocale.h> |
13 | 13 | ||
14 | #include "viewmailbase.h" | 14 | #include "viewmailbase.h" |
15 | //#include "opendiag.h" | 15 | //#include "opendiag.h" |
16 | 16 | ||
17 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 17 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) |
18 | : QMainWindow(parent, name, fl) | 18 | : QMainWindow(parent, name, fl) |
19 | { | 19 | { |
20 | 20 | ||
21 | setToolBarsMovable(false); | 21 | setToolBarsMovable(false); |
22 | 22 | ||
23 | toolbar = new QToolBar(this); | 23 | toolbar = new QToolBar(this); |
24 | menubar = new QMenuBar( toolbar ); | 24 | menubar = new QMenuBar( toolbar ); |
25 | mailmenu = new QPopupMenu( menubar ); | 25 | mailmenu = new QPopupMenu( menubar ); |
26 | menubar->insertItem( i18n( "Mail" ), mailmenu ); | 26 | menubar->insertItem( i18n( "Mail" ), mailmenu ); |
27 | 27 | ||
28 | toolbar->setHorizontalStretchable(true); | 28 | toolbar->setHorizontalStretchable(true); |
29 | addToolBar(toolbar); | 29 | addToolBar(toolbar); |
30 | 30 | ||
31 | reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); | 31 | reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); |
32 | reply->addTo(toolbar); | 32 | reply->addTo(toolbar); |
33 | reply->addTo(mailmenu); | 33 | reply->addTo(mailmenu); |
34 | 34 | ||
35 | forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); | 35 | forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); |
36 | forward->addTo(toolbar); | 36 | forward->addTo(toolbar); |
37 | forward->addTo(mailmenu); | 37 | forward->addTo(mailmenu); |
38 | 38 | ||
39 | attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); | 39 | attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); |
40 | attachbutton->addTo(toolbar); | 40 | attachbutton->addTo(toolbar); |
41 | attachbutton->addTo(mailmenu); | 41 | attachbutton->addTo(mailmenu); |
42 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); | 42 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); |
43 | 43 | ||
44 | 44 | ||
45 | showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); | 45 | showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); |
46 | showHtml->addTo( toolbar ); | 46 | showHtml->addTo( toolbar ); |
47 | showHtml->addTo( mailmenu ); | 47 | showHtml->addTo( mailmenu ); |
48 | 48 | ||
49 | deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); | 49 | deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); |
50 | deleteMail->addTo(toolbar); | 50 | deleteMail->addTo(toolbar); |
51 | deleteMail->addTo(mailmenu); | 51 | deleteMail->addTo(mailmenu); |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("add"), 0, 0, this); | 55 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); |
56 | QLabel *spacer = new QLabel(toolbar); | 56 | QLabel *spacer = new QLabel(toolbar); |
57 | nextMail->addTo(toolbar); | 57 | nextMail->addTo(toolbar); |
58 | nextMail->addTo(mailmenu); | 58 | nextMail->addTo(mailmenu); |
59 | 59 | ||
60 | 60 | ||
61 | 61 | ||
62 | 62 | ||
63 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 63 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
64 | //QLabel *spacer = new QLabel(toolbar); | 64 | //QLabel *spacer = new QLabel(toolbar); |
65 | spacer->setBackgroundMode(QWidget::PaletteButton); | 65 | spacer->setBackgroundMode(QWidget::PaletteButton); |
66 | toolbar->setStretchableWidget(spacer); | 66 | toolbar->setStretchableWidget(spacer); |
67 | closeMail->addTo(toolbar); | 67 | closeMail->addTo(toolbar); |
68 | closeMail->addTo(mailmenu); | 68 | closeMail->addTo(mailmenu); |
69 | QVBox *view = new QVBox(this); | 69 | QVBox *view = new QVBox(this); |
70 | setCentralWidget(view); | 70 | setCentralWidget(view); |
71 | 71 | ||
72 | attachments = new QListView(view); | 72 | attachments = new QListView(view); |
73 | attachments->setMinimumHeight(90); | 73 | attachments->setMinimumHeight(90); |
74 | attachments->setMaximumHeight(90); | 74 | attachments->setMaximumHeight(90); |
75 | attachments->setAllColumnsShowFocus(true); | 75 | attachments->setAllColumnsShowFocus(true); |
76 | attachments->addColumn("Mime Type", 60); | 76 | attachments->addColumn("Mime Type", 60); |
77 | attachments->addColumn(i18n("Description"), 100); | 77 | attachments->addColumn(i18n("Description"), 100); |
78 | attachments->addColumn(i18n("Filename"), 80); | 78 | attachments->addColumn(i18n("Filename"), 80); |
79 | attachments->addColumn(i18n("Size"), 80); | 79 | attachments->addColumn(i18n("Size"), 80); |
80 | attachments->setSorting(-1); | 80 | attachments->setSorting(-1); |
81 | attachments->hide(); | 81 | attachments->hide(); |
82 | 82 | ||
83 | browser = new QTextBrowser(view); | 83 | browser = new QTextBrowser(view); |
84 | 84 | ||
85 | //openDiag = new OpenDiag(view); | 85 | //openDiag = new OpenDiag(view); |
86 | //openDiag->hide(); | 86 | //openDiag->hide(); |
87 | 87 | ||
88 | } | 88 | } |
89 | 89 | ||
90 | void ViewMailBase::slotChangeAttachview(bool state) | 90 | void ViewMailBase::slotChangeAttachview(bool state) |
91 | { | 91 | { |
92 | if (state) attachments->show(); | 92 | if (state) attachments->show(); |
93 | else attachments->hide(); | 93 | else attachments->hide(); |
94 | } | 94 | } |
95 | 95 | ||
96 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) | 96 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) |
97 | { | 97 | { |
98 | if( e->key()==Qt::Key_Escape ) { | 98 | if( e->key()==Qt::Key_Escape ) { |
99 | close(); | 99 | close(); |
100 | e->accept(); | 100 | e->accept(); |
101 | return; | 101 | return; |
102 | } | 102 | } |
103 | QWidget::keyPressEvent(e); | 103 | QWidget::keyPressEvent(e); |
104 | } | 104 | } |