Commit 149583b5 149583b547636023968c738295a0042e7cd80174 by Alain Magloire

* configure.in: Set to 0.0.9c.

	* doc/texinfo/mbox.texi: Update the doc for mbox(Unix).
	* doc/texinfo/pop.texi: Update the doc for mbox(Unix).

	* imap4d/expunge.c: Bug:  Expunge was not sending the
	untag "* %d EXPUNGED" for message deleted.  Call imap4d_sync ()
	which will do the right thing.
	* imap4d/noop.c: Bug: It should call imap4d_sync () to notify
	the client of any changes.
	* imap4d/sync.c (notify_deleted): Typo should be EXPUNGED
	with a D.
	(imap4d_sync): Bug: Checked also if the number of messages changed.

	* mailbox/folder_imap.c (imap_flags): Bug: Rewrite it to be generic
	and sets the flags for the attribute.
	(imap_fetch_flags): Call imap_flags().
	(imap_permanentflags): Call imap_flags().

	* mailbox2/include/mailutils/mbox.h: Update prototypes.
	* mailbox2/include/mailutils/sys/mbox.h: Update prototypes.
	* mailbox2/include/mailutils/pop3.h: Update prototypes.
	* mailbox2/mbox/mbox_expunge.c (mbox_expunge): Calls mbox_expunge0 ().
	(mbox_save): Calls mbox_expunge0().
	* mailbox2/mbox/mbox_scan.c (mbox_scan): Calls mbox_scan0 ().
	(mbox_count): Calls mbox_scan0().
	* mailbox2/pop3/pop3_capa.c: Provide a special iterator.
	* mailbox2/pop3/pop3_lista.c: Provide a special iterator.
	* mailbox2/pop3/pop3_uidla.c: Provide a special iterator.
1 parent bd6da6fc
1 2001-10-20 Alain Magloire
2
3 * configure.in: Set to 0.0.9c.
4
5 * doc/texinfo/mbox.texi: Update the doc for mbox(Unix).
6 * doc/texinfo/pop.texi: Update the doc for mbox(Unix).
7
8 * imap4d/expunge.c: Bug: Expunge was not sending the
9 untag "* %d EXPUNGED" for message deleted. Call imap4d_sync ()
10 which will do the right thing.
11 * imap4d/noop.c: Bug: It should call imap4d_sync () to notify
12 the client of any changes.
13 * imap4d/sync.c (notify_deleted): Typo should be EXPUNGED
14 with a D.
15 (imap4d_sync): Bug: Checked also if the number of messages changed.
16
17 * mailbox/folder_imap.c (imap_flags): Bug: Rewrite it to be generic
18 and sets the flags for the attribute.
19 (imap_fetch_flags): Call imap_flags().
20 (imap_permanentflags): Call imap_flags().
21
22 * mailbox2/include/mailutils/mbox.h: Update prototypes.
23 * mailbox2/include/mailutils/sys/mbox.h: Update prototypes.
24 * mailbox2/include/mailutils/pop3.h: Update prototypes.
25 * mailbox2/mbox/mbox_expunge.c (mbox_expunge): Calls mbox_expunge0 ().
26 (mbox_save): Calls mbox_expunge0().
27 * mailbox2/mbox/mbox_scan.c (mbox_scan): Calls mbox_scan0 ().
28 (mbox_count): Calls mbox_scan0().
29 * mailbox2/pop3/pop3_capa.c: Provide a special iterator.
30 * mailbox2/pop3/pop3_lista.c: Provide a special iterator.
31 * mailbox2/pop3/pop3_uidla.c: Provide a special iterator.
32
1 2001-10-19 Sergey Poznyakoff 33 2001-10-19 Sergey Poznyakoff
2 34
3 MH inc is fully functional: 35 MH inc is fully functional:
......
1 dnl Process this file with autoconf to procude a configure script. 1 dnl Process this file with autoconf to procude a configure script.
2 AC_INIT(mailbox/mailbox.c) 2 AC_INIT(mailbox/mailbox.c)
3 AM_INIT_AUTOMAKE(mailutils, 0.0.9b) 3 AM_INIT_AUTOMAKE(mailutils, 0.0.9c)
4 AM_CONFIG_HEADER(config.h) 4 AM_CONFIG_HEADER(config.h)
5 5
6 dnl Check for programs 6 dnl Check for programs
......
...@@ -4,7 +4,11 @@ ...@@ -4,7 +4,11 @@
4 4
5 @end example 5 @end example
6 6
7 Internet Message Access Protocol - Version (4rev1). Not implemented. 7 Internet Message Access Protocol - Version (4rev1). In IMAP the client
8 must be prepared to accept any responses at all times. The server responses
9 have three forms: status reponses, server data and command continuation
10 request. Untaged responses, for hitorical reasons are also call
11 "unsolicited responses".
8 12
9 @subsection Commands 13 @subsection Commands
10 14
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
4 4
5 @end example 5 @end example
6 6
7 The most common mailbox format on UNIX platform is @emph{mbox}. Mbox file 7 The most common mailbox format on UNIX platform is @emph{mbox}. Mbox is a
8 is messages separated by the special format string. 8 text file that contains messages separated by a special format string.
9 @example 9 @example
10 From SP envelope-sender SP date [SP moreinfo] 10 From SP envelope-sender SP date [SP moreinfo]
11 @end example 11 @end example
...@@ -24,15 +24,16 @@ is messages separated by the special format string. ...@@ -24,15 +24,16 @@ is messages separated by the special format string.
24 A @var{mbox_t} is created, initialized and destroyed by @code{mbox_create ()} 24 A @var{mbox_t} is created, initialized and destroyed by @code{mbox_create ()}
25 and @code{mbox_destroy ()}. When opening, @code{mbox_open ()} will do a quick 25 and @code{mbox_destroy ()}. When opening, @code{mbox_open ()} will do a quick
26 check to see if the format is a valid format or an empty file. The scanning 26 check to see if the format is a valid format or an empty file. The scanning
27 of the mailbox is done by @code{mbox_scan ()}. 27 of the mailbox is done by @code{mbox_scan ()}, the function, takes callback
28 The function, @code{mbox_scan ()}, takes callback functions called during the 28 functions called during the scanning to provide information on progress and
29 scanning to provide information. The scanning will cache some of the headers 29 new messages found. The scanning will cache some of the headers fields for
30 fields for speed. Closing the mailbox, @code{mbox_close ()} will free 30 speed, new fields could be add with @code{mbox_add_hcache ()}. On Closing
31 any resources like, headers cache, locks etc ... All the messages with 31 the @var{mbox_t}, @code{mbox_close ()} will free any resources like, headers
32 attributes marked deleted will only be removed on @code{mbox_expunge ()}. 32 cache, locks etc ... The messages with attributes marked deleted will only
33 If only the attributes need to be save but the messages not removed, this 33 be removed on @code{mbox_expunge ()}, if there is a need to save the
34 can be done by @code{mbox_save_attributes ()}. New messages are added with 34 modification without purging @code{mbox_save ()} is more appropriate.
35 @code{mbox_append ()}. Attributes are saved in the @emph{Status:} header 35 New messages are added to the mbox with @code{mbox_append ()}.
36 Attributes are saved in the @emph{Status:} header
36 field, Read is 'R', Seen is 'O', Deleted is 'd' and Reply is 'r'. 37 field, Read is 'R', Seen is 'O', Deleted is 'd' and Reply is 'r'.
37 38
38 @subsubsection Initialization 39 @subsubsection Initialization
...@@ -59,9 +60,9 @@ reclaim memory. ...@@ -59,9 +60,9 @@ reclaim memory.
59 60
60 @deftypefun int mbox_set_carrier (mbox_t, stream_t @var{carrier}); 61 @deftypefun int mbox_set_carrier (mbox_t, stream_t @var{carrier});
61 62
62 Another type of stream can be provided to work on, the @var{carrier} 63 Another type of stream can be provided, the @var{carrier}
63 is set in the @var{mbox_t} handle. Any previous @var{carrier} stream in 64 is set in the @var{mbox_t} handle. Any previous @var{carrier} stream in
64 the handle, will be close and release. Since the parsing code 65 the handle, will be close and destroy. Since the parsing code
65 maintain only the offsets off the message the @var{carrier} stream must be 66 maintain only the offsets off the message the @var{carrier} stream must be
66 seekable. 67 seekable.
67 68
...@@ -127,6 +128,15 @@ is called first. ...@@ -127,6 +128,15 @@ is called first.
127 @end table 128 @end table
128 @end deftypefun 129 @end deftypefun
129 130
131 @deftypefun int mbox_get_uid (mbox_t, unsigned int @var{msgno}, unsigned long *@var{uid})
132
133 Return the @var{uid} of the message @var{msgno}.
134
135 @table @code
136 @item MU_ERROR_INVALID_PARAMETER
137 @end table
138 @end deftypefun
139
130 @deftypefun int mbox_get_attribute (mbox_t, unsigned int @var{msgno}, attribute_t *@var{attribute}) 140 @deftypefun int mbox_get_attribute (mbox_t, unsigned int @var{msgno}, attribute_t *@var{attribute})
131 141
132 Return an @var{attribute} to indicate the status of message number @var{msgno}. 142 Return an @var{attribute} to indicate the status of message number @var{msgno}.
...@@ -245,28 +255,43 @@ Return the @var{size} of mailbox. ...@@ -245,28 +255,43 @@ Return the @var{size} of mailbox.
245 @end table 255 @end table
246 @end deftypefun 256 @end deftypefun
247 257
248 @deftypefun int mbox_save (mbox_t) 258 @deftypefun int mbox_set_hcache (mbox_t, const char **@var{array}, size_t @var{len})
249 259
250 Save the changes to the messages back to the mailbox, but do not 260 Set the @var{array} of fields as the header to cache when doing the scanning.
251 remove messages mark for deletion in the process. 261 If @var{array} is NULL the header cache is emptied.
262
263 @table @code
264 @item MU_ERROR_INVALID_PARAMETER
265 @item MU_ERROR_NO_MEMORY
266 @end table
267 @end deftypefun
268
269 @deftypefun int mbox_add_hcache (mbox_t, const char **@var{array}, size_t @var{len})
270
271 Add to the current cache for the scan, the fields in @var{array}.
252 272
253 @table @code 273 @table @code
254 @item MU_ERROR_INVALID_PARAMETER 274 @item MU_ERROR_INVALID_PARAMETER
275 @item MU_ERROR_NO_MEMORY
255 @end table 276 @end table
256 @end deftypefun 277 @end deftypefun
257 278
258 @deftypefun int mbox_mak_deleted (mbox_t, unsigned int @var{msgno}) 279 @deftypefun int mbox_value_hcache (mbox_t, unsigned int @var{msgno}, const char *@var{field}, char *@var{buffer}, size_t @var{buflen}, size_t *@var{writen})
259 280
260 Mark @var{msgno} for deletion. 281 Get the value of @var{field} in the header cache for @var{msgno}. The
282 result is copied in a @var{buffer} of @var{buflen} and @var{writen} is set
283 to the number of byte put in @var{buffer}.
261 284
262 @table @code 285 @table @code
263 @item MU_ERROR_INVALID_PARAMETER 286 @item MU_ERROR_INVALID_PARAMETER
287 @item MU_ERROR_NO_ENTRY
264 @end table 288 @end table
265 @end deftypefun 289 @end deftypefun
266 290
267 @deftypefun int mbox_unmak_deleted (mbox_t, unsigned int @var{msgno}) 291 @deftypefun int mbox_save (mbox_t)
268 292
269 Unmark @var{msgno} if it was marked for deletion. 293 Save the changes to the messages back to the mailbox, but do not
294 remove messages mark for deletion in the process.
270 295
271 @table @code 296 @table @code
272 @item MU_ERROR_INVALID_PARAMETER 297 @item MU_ERROR_INVALID_PARAMETER
...@@ -305,7 +330,7 @@ and a body, @var{bstream}. The variable @var{sep} should contain a valid ...@@ -305,7 +330,7 @@ and a body, @var{bstream}. The variable @var{sep} should contain a valid
305 @end table 330 @end table
306 @end deftypefun 331 @end deftypefun
307 332
308 @deftypefun int mbox_scan (mbox_t, unsigned int start, unsigned int *@var{count}) 333 @deftypefun int mbox_scan (mbox_t, unsigned int @var{start}, unsigned int *@var{count})
309 334
310 Start scanning the mailbox for new messages. The variable @var{start} can be 335 Start scanning the mailbox for new messages. The variable @var{start} can be
311 a message number starting point. The result of the scanning will be in 336 a message number starting point. The result of the scanning will be in
...@@ -322,21 +347,43 @@ MU_ERROR_INTERRUPTED. ...@@ -322,21 +347,43 @@ MU_ERROR_INTERRUPTED.
322 @end table 347 @end table
323 @end deftypefun 348 @end deftypefun
324 349
325 @deftypefun int mbox_set_progress_cb (mbox_t, int (*@var{callback}) (int, void *)), void *@var{arg}) 350 @deftypefun int mbox_count (mbox_t, unsigned int *@var{count})
351
352 Same as @code{mbox_scan ()} but does not call the callbacks.
353
354 @end deftypefun
355 @deftypefun int mbox_set_progress_cb (mbox_t, int (*@var{callback}) (int @var{percentage}, void *)), void *@var{arg})
326 356
327 Set the callback function for progress. The variable @var{arg} will be pass 357 Set the callback function for progress. The variable @var{arg} will be pass
328 back in the callback as the second argument. 358 back in the callback as the second argument. The first argument of the
359 callback represents a @var{percentage} of the scanning progress.
360
329 @table @code 361 @table @code
330 @item MU_ERROR_INVALID_PARAMETER 362 @item MU_ERROR_INVALID_PARAMETER
331 @end table 363 @end table
332 @end deftypefun 364 @end deftypefun
333 365
334 @deftypefun int mbox_set_newmsg_cb (mbox_t, int (*@var{callback}) (int, void *)), void *@var{arg}) 366 @deftypefun int mbox_set_newmsg_cb (mbox_t, int (*@var{callback}) (int @var{count}, void *)), void *@var{arg})
335 367
336 Set the callback function for new messages. The variable @var{arg} will be 368 Set the callback function for new messages. The variable @var{arg} will be
369 pass back in the callback as the second argument. The first argument
370 is the total of messages found.
371
372 @table @code
373 @item MU_ERROR_INVALID_PARAMETER
374 @end table
375 @end deftypefun
376
377 @deftypefun int mbox_set_error_cb (mbox_t, int (*@var{callback}) (int, void *)), void *@var{arg})
378
379 Set the callback function for errors. The variable @var{arg} will be
337 pass back in the callback as the second argument. 380 pass back in the callback as the second argument.
338 381
339 @table @code 382 @table @code
340 @item MU_ERROR_INVALID_PARAMETER 383 @item MU_ERROR_INVALID_PARAMETER
341 @end table 384 @end table
342 @end deftypefun 385 @end deftypefun
386 @deftypefun int mbox_has_newmail (mbox_t)
387
388 Return nonzero if there is new mail append to the mbox_t.
389 @end deftypefun
......
...@@ -81,9 +81,8 @@ means only one operation can be done at a time, all the functions will return ...@@ -81,9 +81,8 @@ means only one operation can be done at a time, all the functions will return
81 MU_ERROR_OPERATION_IN_PROGRESS if call during another operation. The 81 MU_ERROR_OPERATION_IN_PROGRESS if call during another operation. The
82 functions @code{pop3_list_all ()}, @code{pop3_uidl_all ()} and 82 functions @code{pop3_list_all ()}, @code{pop3_uidl_all ()} and
83 @code{pop3_capa ()} return iterators @code{pop3_list_current ()}, 83 @code{pop3_capa ()} return iterators @code{pop3_list_current ()},
84 @code{pop3_uidl_current ()} are provided as cover function to format the 84 @code{pop3_uidl_current ()} are provided as cover function. The iterator must
85 string return by @code{iterator_current ()}, @code{iterator_destroy ()} must 85 be destroy when finish.
86 be call to release any resources.
87 86
88 In a multithreaded application, only one thread should access @var{pop3_t} 87 In a multithreaded application, only one thread should access @var{pop3_t}
89 handles. 88 handles.
...@@ -197,16 +196,16 @@ any remaining responses from CAPA and clear the way for new operations. ...@@ -197,16 +196,16 @@ any remaining responses from CAPA and clear the way for new operations.
197 196
198 void print_capabilities (pop3_t pop3) 197 void print_capabilities (pop3_t pop3)
199 @{ 198 @{
200 iterator_t iterator; 199 pop3_capa_iterator_t iterator;
201 status = pop3_capa (pop3, &iterator); 200 status = pop3_capa (pop3, &iterator);
202 if (status == 0) 201 if (status == 0)
203 @{ 202 @{
204 for (iterator_first (iterator); 203 for (pop3_capa_first (iterator);
205 !iterator_is_done (iterator); 204 !pop3_capa_is_done (iterator);
206 iterator_next (iterator)) 205 pop3_capa_next (iterator))
207 @{ 206 @{
208 char *capa; 207 char *capa;
209 if (iterator_current (iterator, &capa) == 0) 208 if (pop3_capa_current (iterator, &capa) == 0)
210 @{; 209 @{;
211 printf ("CAPA: %s\n", capa); 210 printf ("CAPA: %s\n", capa);
212 free (capa); 211 free (capa);
...@@ -272,13 +271,13 @@ around to scan properly the string return by the @code{iterator_current ()}. ...@@ -272,13 +271,13 @@ around to scan properly the string return by the @code{iterator_current ()}.
272 271
273 void print_list (pop3_t pop3) 272 void print_list (pop3_t pop3)
274 @{ 273 @{
275 iterator_t iterator; 274 pop3_list_iterator_t iterator;
276 status = pop3_list_all (pop3, &iterator); 275 status = pop3_list_all (pop3, &iterator);
277 if (status == 0) 276 if (status == 0)
278 @{ 277 @{
279 for (iterator_first (iterator); 278 for (pop3_list_first (iterator);
280 !iterator_is_done (iterator); 279 !pop3_list_is_done (iterator);
281 iterator_next (iterator)) 280 pop3_list_next (iterator))
282 @{ 281 @{
283 unsigned int msgno, size; 282 unsigned int msgno, size;
284 if (pop3_list_current (iterator, &msgno, &size) == 0) 283 if (pop3_list_current (iterator, &msgno, &size) == 0)
...@@ -286,7 +285,7 @@ void print_list (pop3_t pop3) ...@@ -286,7 +285,7 @@ void print_list (pop3_t pop3)
286 printf ("LIST: %d %d\n", msgno, size); 285 printf ("LIST: %d %d\n", msgno, size);
287 @} 286 @}
288 @} 287 @}
289 iterator (&iterator); 288 pop3_list_destroy (&iterator);
290 @} 289 @}
291 else 290 else
292 printf ("NONE\n"); 291 printf ("NONE\n");
...@@ -392,7 +391,7 @@ print_message (pop3_t pop3, unsigned int msgno) ...@@ -392,7 +391,7 @@ print_message (pop3_t pop3, unsigned int msgno)
392 while ((stream_readline (stream, buf, sizeof buf, &n) == 0) 391 while ((stream_readline (stream, buf, sizeof buf, &n) == 0)
393 && n) 392 && n)
394 printf ("%s", buf); 393 printf ("%s", buf);
395 stream_release (stream); 394 stream_destroy (&stream);
396 @} 395 @}
397 return status; 396 return status;
398 @} 397 @}
...@@ -466,7 +465,7 @@ print_top (pop3_t pop3, unsigned int msgno, unsigned int lines) ...@@ -466,7 +465,7 @@ print_top (pop3_t pop3, unsigned int msgno, unsigned int lines)
466 while ((stream_readline (stream, buf, sizeof buf, &n) == 0) 465 while ((stream_readline (stream, buf, sizeof buf, &n) == 0)
467 && n) 466 && n)
468 printf ("%s", buf); 467 printf ("%s", buf);
469 stream_release (stream); 468 stream_destroy (&stream);
470 @} 469 @}
471 return status; 470 return status;
472 @} 471 @}
...@@ -510,13 +509,13 @@ must be destroyed by the caller. ...@@ -510,13 +509,13 @@ must be destroyed by the caller.
510 509
511 void print_uidl (pop3_t pop3) 510 void print_uidl (pop3_t pop3)
512 @{ 511 @{
513 iterator_t iterator; 512 pop3_uidl_iterator_t iterator;
514 status = pop3_uidl_all (pop3, &iterator); 513 status = pop3_uidl_all (pop3, &iterator);
515 if (status == 0) 514 if (status == 0)
516 @{ 515 @{
517 for (iterator_first (iterator); 516 for (pop3_uidl_first (iterator);
518 !iterator_is_done (iterator); 517 !pop3_uidl_is_done (iterator);
519 iterator_next (iterator)) 518 pop3_uidl_next (iterator))
520 @{ 519 @{
521 unsigned int msgno; 520 unsigned int msgno;
522 char *uidl; 521 char *uidl;
...@@ -526,7 +525,7 @@ void print_uidl (pop3_t pop3) ...@@ -526,7 +525,7 @@ void print_uidl (pop3_t pop3)
526 free (uidl); 525 free (uidl);
527 @} 526 @}
528 @} 527 @}
529 iterator (&iterator); 528 pop3_uidl_destroy (&iterator);
530 @} 529 @}
531 else 530 else
532 printf ("NONE\n"); 531 printf ("NONE\n");
...@@ -577,8 +576,9 @@ Sends the User command. ...@@ -577,8 +576,9 @@ Sends the User command.
577 576
578 @deftypefun int pop3_writeline (pop3_t, const char *@var{format}, ...); 577 @deftypefun int pop3_writeline (pop3_t, const char *@var{format}, ...);
579 578
580 Copy in the internal buffer of @code{pop3_t} the string, @code{pop3_send ()} 579 Copy in the internal buffer of @code{pop3_t} the formatted string,
581 should be called later to flush the string to the POP3 server. 580 @code{pop3_send ()} should be called later to flush the string to the
581 POP3 server.
582 582
583 @table @code 583 @table @code
584 @item MU_ERROR_INVALID_PARAMETER 584 @item MU_ERROR_INVALID_PARAMETER
......
...@@ -25,6 +25,7 @@ int ...@@ -25,6 +25,7 @@ int
25 imap4d_expunge (struct imap4d_command *command, char *arg) 25 imap4d_expunge (struct imap4d_command *command, char *arg)
26 { 26 {
27 char *sp = NULL; 27 char *sp = NULL;
28
28 if (! (command->states & state)) 29 if (! (command->states & state))
29 return util_finish (command, RESP_BAD, "Wrong state"); 30 return util_finish (command, RESP_BAD, "Wrong state");
30 if (util_getword (arg, &sp)) 31 if (util_getword (arg, &sp))
...@@ -32,5 +33,7 @@ imap4d_expunge (struct imap4d_command *command, char *arg) ...@@ -32,5 +33,7 @@ imap4d_expunge (struct imap4d_command *command, char *arg)
32 33
33 /* FIXME: check for errors. */ 34 /* FIXME: check for errors. */
34 mailbox_expunge (mbox); 35 mailbox_expunge (mbox);
36
37 imap4d_sync ();
35 return util_finish (command, RESP_OK, "Completed"); 38 return util_finish (command, RESP_OK, "Completed");
36 } 39 }
......
...@@ -22,10 +22,12 @@ int ...@@ -22,10 +22,12 @@ int
22 imap4d_noop (struct imap4d_command *command, char *arg) 22 imap4d_noop (struct imap4d_command *command, char *arg)
23 { 23 {
24 char *sp = NULL; 24 char *sp = NULL;
25
25 if (! (command->states & state)) 26 if (! (command->states & state))
26 return util_finish (command, RESP_BAD, "Wrong state"); 27 return util_finish (command, RESP_BAD, "Wrong state");
27 if (util_getword (arg, &sp)) 28 if (util_getword (arg, &sp))
28 return util_finish (command, RESP_BAD, "Too many args"); 29 return util_finish (command, RESP_BAD, "Too many args");
29 imap4d_select_status(); 30
31 imap4d_sync ();
30 return util_finish (command, RESP_OK, "Completed"); 32 return util_finish (command, RESP_OK, "Completed");
31 } 33 }
......
...@@ -113,7 +113,7 @@ notify_deleted (void) ...@@ -113,7 +113,7 @@ notify_deleted (void)
113 { 113 {
114 if (!(uid_table[i].notify)) 114 if (!(uid_table[i].notify))
115 { 115 {
116 util_out (RESP_NONE, "%d EXPUNGE", uid_table[i].msgno); 116 util_out (RESP_NONE, "%d EXPUNGED", uid_table[i].msgno);
117 uid_table[i].notify = 1; 117 uid_table[i].notify = 1;
118 } 118 }
119 } 119 }
...@@ -175,8 +175,8 @@ free_uids (void) ...@@ -175,8 +175,8 @@ free_uids (void)
175 attribute_destroy (&(uid_table[i].attr), NULL); 175 attribute_destroy (&(uid_table[i].attr), NULL);
176 free (uid_table); 176 free (uid_table);
177 uid_table = NULL; 177 uid_table = NULL;
178 uid_table_count = 0;
179 } 178 }
179 uid_table_count = 0;
180 } 180 }
181 181
182 static void 182 static void
...@@ -240,11 +240,19 @@ imap4d_sync_flags (size_t msgno) ...@@ -240,11 +240,19 @@ imap4d_sync_flags (size_t msgno)
240 int 240 int
241 imap4d_sync (void) 241 imap4d_sync (void)
242 { 242 {
243 /* if mbox --> NULL, it means to free all the ressources. 243 /* If mbox --> NULL, it means to free all the ressources.
244 it may be because of close or before select/examine a new mailbox. */ 244 It may be because of close or before select/examine a new mailbox.
245 If it was a close we do not send any notification. */
245 if (mbox == NULL) 246 if (mbox == NULL)
246 free_uids (); 247 free_uids ();
247 else if (uid_table == NULL || !mailbox_is_updated (mbox)) 248 else if (uid_table == NULL || !mailbox_is_updated (mbox))
248 reset_uids (); 249 reset_uids ();
250 else
251 {
252 size_t count = 0;
253 mailbox_messages_count (mbox, &count);
254 if (count != uid_table_count)
255 reset_uids ();
256 }
249 return 0; 257 return 0;
250 } 258 }
......
...@@ -91,7 +91,9 @@ static int imap_rfc822 __P ((f_imap_t, char **)); ...@@ -91,7 +91,9 @@ static int imap_rfc822 __P ((f_imap_t, char **));
91 static int imap_rfc822_size __P ((f_imap_t, char **)); 91 static int imap_rfc822_size __P ((f_imap_t, char **));
92 static int imap_rfc822_header __P ((f_imap_t, char **)); 92 static int imap_rfc822_header __P ((f_imap_t, char **));
93 static int imap_rfc822_text __P ((f_imap_t, char **)); 93 static int imap_rfc822_text __P ((f_imap_t, char **));
94 static int imap_flags __P ((f_imap_t, char **)); 94 static int imap_fetch_flags __P ((f_imap_t, char **));
95 static int imap_permanentflags __P ((f_imap_t, char **));
96 static int imap_flags __P ((char **, int *));
95 static int imap_bodystructure __P ((f_imap_t, char **)); 97 static int imap_bodystructure __P ((f_imap_t, char **));
96 static int imap_body __P ((f_imap_t, char **)); 98 static int imap_body __P ((f_imap_t, char **));
97 static int imap_internaldate __P ((f_imap_t, char **)); 99 static int imap_internaldate __P ((f_imap_t, char **));
...@@ -1266,12 +1268,27 @@ imap_bodystructure (f_imap_t f_imap, char **ptr) ...@@ -1266,12 +1268,27 @@ imap_bodystructure (f_imap_t f_imap, char **ptr)
1266 1268
1267 FIXME: User flags are not take to account. */ 1269 FIXME: User flags are not take to account. */
1268 static int 1270 static int
1269 imap_flags (f_imap_t f_imap, char **ptr) 1271 imap_fetch_flags (f_imap_t f_imap, char **ptr)
1272 {
1273 msg_imap_t msg_imap = f_imap->string.msg_imap;
1274 if (msg_imap)
1275 imap_flags (ptr, &msg_imap->flags);
1276 return 0;
1277 }
1278
1279 static int
1280 imap_permanentflags (f_imap_t f_imap, char **ptr)
1281 {
1282 imap_flags (ptr, &f_imap->flags);
1283 return 0;
1284 }
1285
1286 static int
1287 imap_flags (char **ptr, int *pflags)
1270 { 1288 {
1271 char *start; 1289 char *start;
1272 char *end; 1290 char *end;
1273 /* msg_imap may be null for an untag response deal with it. */ 1291 int flags = 0;
1274 msg_imap_t msg_imap = f_imap->string.msg_imap;
1275 1292
1276 /* Skip space. */ 1293 /* Skip space. */
1277 while (**ptr == ' ') 1294 while (**ptr == ' ')
...@@ -1290,12 +1307,11 @@ imap_flags (f_imap_t f_imap, char **ptr) ...@@ -1290,12 +1307,11 @@ imap_flags (f_imap_t f_imap, char **ptr)
1290 1307
1291 /* Save the beginning of the word. */ 1308 /* Save the beginning of the word. */
1292 start = *ptr; 1309 start = *ptr;
1293
1294 /* Get the next word boundary. */ 1310 /* Get the next word boundary. */
1295 while (**ptr && **ptr != ' ' && **ptr != ')') 1311 while (**ptr && **ptr != ' ' && **ptr != ')')
1296 ++(*ptr); 1312 ++(*ptr);
1297 1313
1298 /* Make a C string for the strcasecmp. */ 1314 /* Save the end for the strcasecmp. */
1299 end = *ptr; 1315 end = *ptr;
1300 1316
1301 /* Bail out. */ 1317 /* Bail out. */
...@@ -1305,46 +1321,34 @@ imap_flags (f_imap_t f_imap, char **ptr) ...@@ -1305,46 +1321,34 @@ imap_flags (f_imap_t f_imap, char **ptr)
1305 /* Guess the flag. */ 1321 /* Guess the flag. */
1306 if (strncasecmp (start, "\\Seen", end - start) == 0) 1322 if (strncasecmp (start, "\\Seen", end - start) == 0)
1307 { 1323 {
1308 if (msg_imap) 1324 flags |= MU_ATTRIBUTE_SEEN;
1309 { 1325 flags |= MU_ATTRIBUTE_READ;
1310 msg_imap->flags |= MU_ATTRIBUTE_SEEN;
1311 msg_imap->flags |= MU_ATTRIBUTE_READ;
1312 }
1313 else
1314 f_imap->flags |= MU_ATTRIBUTE_SEEN;
1315 } 1326 }
1316 else if (strncasecmp (start, "\\Answered", end - start) == 0) 1327 else if (strncasecmp (start, "\\Answered", end - start) == 0)
1317 { 1328 {
1318 if (msg_imap) 1329 flags |= MU_ATTRIBUTE_ANSWERED;
1319 msg_imap->flags |= MU_ATTRIBUTE_ANSWERED;
1320 else
1321 f_imap->flags |= MU_ATTRIBUTE_ANSWERED;
1322 } 1330 }
1323 else if (strncasecmp (start, "\\Flagged", end - start) == 0) 1331 else if (strncasecmp (start, "\\Flagged", end - start) == 0)
1324 { 1332 {
1325 if (msg_imap) 1333 flags |= MU_ATTRIBUTE_FLAGGED;
1326 msg_imap->flags |= MU_ATTRIBUTE_FLAGGED;
1327 else
1328 f_imap->flags |= MU_ATTRIBUTE_FLAGGED;
1329 } 1334 }
1330 else if (strncasecmp (start, "\\Deleted", end - start) == 0) 1335 else if (strncasecmp (start, "\\Deleted", end - start) == 0)
1331 { 1336 {
1332 if (msg_imap) 1337 flags |= MU_ATTRIBUTE_DELETED;
1333 msg_imap->flags |= MU_ATTRIBUTE_DELETED;
1334 else
1335 f_imap->flags |= MU_ATTRIBUTE_DELETED;
1336 } 1338 }
1337 else if (strncasecmp (start, "\\Draft", end - start) == 0) 1339 else if (strncasecmp (start, "\\Draft", end - start) == 0)
1338 { 1340 {
1339 if (msg_imap) 1341 flags |= MU_ATTRIBUTE_DRAFT;
1340 msg_imap->flags |= MU_ATTRIBUTE_DRAFT;
1341 else
1342 f_imap->flags |= MU_ATTRIBUTE_DRAFT;
1343 } 1342 }
1344 } 1343 }
1345 while (**ptr && **ptr != ')'); 1344 while (**ptr && **ptr != ')'); /* do {} */
1345
1346 /* Skip the last rparen. */
1346 if (**ptr == ')') 1347 if (**ptr == ')')
1347 (*ptr)++; 1348 (*ptr)++;
1349
1350 if (pflags)
1351 *pflags = flags;
1348 return 0; 1352 return 0;
1349 } 1353 }
1350 1354
...@@ -1548,7 +1552,7 @@ imap_fetch (f_imap_t f_imap) ...@@ -1548,7 +1552,7 @@ imap_fetch (f_imap_t f_imap)
1548 1552
1549 if (strncmp (token, "FLAGS", 5) == 0) 1553 if (strncmp (token, "FLAGS", 5) == 0)
1550 { 1554 {
1551 status = imap_flags (f_imap, &sp); 1555 status = imap_fetch_flags (f_imap, &sp);
1552 } 1556 }
1553 else if (strcasecmp (token, "BODY") == 0) 1557 else if (strcasecmp (token, "BODY") == 0)
1554 { 1558 {
...@@ -2053,7 +2057,7 @@ imap_parse (f_imap_t f_imap) ...@@ -2053,7 +2057,7 @@ imap_parse (f_imap_t f_imap)
2053 else if (strcasecmp (response, "FLAGS") == 0) 2057 else if (strcasecmp (response, "FLAGS") == 0)
2054 { 2058 {
2055 /* Flags define on the mailbox not a message flags. */ 2059 /* Flags define on the mailbox not a message flags. */
2056 status = imap_flags (f_imap, &remainder); 2060 status = imap_permanentflags (f_imap, &remainder);
2057 } 2061 }
2058 else if (strcasecmp (response, "LIST") == 0) 2062 else if (strcasecmp (response, "LIST") == 0)
2059 { 2063 {
......
...@@ -63,7 +63,8 @@ extern int mbox_get_size __P ((mbox_t, off_t *)); ...@@ -63,7 +63,8 @@ extern int mbox_get_size __P ((mbox_t, off_t *));
63 extern int mbox_get_separator __P ((mbox_t, unsigned int, char **)); 63 extern int mbox_get_separator __P ((mbox_t, unsigned int, char **));
64 extern int mbox_set_separator __P ((mbox_t, unsigned int, const char *)); 64 extern int mbox_set_separator __P ((mbox_t, unsigned int, const char *));
65 65
66 extern int mbox_expunge __P ((mbox_t, int)); 66 extern int mbox_expunge __P ((mbox_t));
67 extern int mbox_save __P ((mbox_t));
67 extern int mbox_has_newmail __P ((mbox_t)); 68 extern int mbox_has_newmail __P ((mbox_t));
68 69
69 extern int mbox_set_progress_cb __P ((mbox_t, 70 extern int mbox_set_progress_cb __P ((mbox_t,
...@@ -73,8 +74,8 @@ extern int mbox_set_newmsg_cb __P ((mbox_t, ...@@ -73,8 +74,8 @@ extern int mbox_set_newmsg_cb __P ((mbox_t,
73 extern int mbox_set_error_cb __P ((mbox_t, 74 extern int mbox_set_error_cb __P ((mbox_t,
74 int (*) __P ((int, void *)), void *)); 75 int (*) __P ((int, void *)), void *));
75 76
76 extern int mbox_scan __P ((mbox_t, unsigned int, 77 extern int mbox_scan __P ((mbox_t, unsigned int, unsigned int *));
77 unsigned int *, int)); 78 extern int mbox_count __P ((mbox_t, unsigned int *));
78 79
79 extern int mbox_append __P ((mbox_t, const char *, attribute_t, 80 extern int mbox_append __P ((mbox_t, const char *, attribute_t,
80 stream_t)); 81 stream_t));
......
...@@ -36,6 +36,9 @@ extern "C" { ...@@ -36,6 +36,9 @@ extern "C" {
36 36
37 struct _pop3; 37 struct _pop3;
38 typedef struct _pop3* pop3_t; 38 typedef struct _pop3* pop3_t;
39 typedef iterator_t pop3_capa_iterator_t;
40 typedef iterator_t pop3_list_iterator_t;
41 typedef iterator_t pop3_uidl_iterator_t;
39 42
40 extern int pop3_create __P ((pop3_t *)); 43 extern int pop3_create __P ((pop3_t *));
41 extern void pop3_destroy __P ((pop3_t *)); 44 extern void pop3_destroy __P ((pop3_t *));
...@@ -55,13 +58,22 @@ extern int pop3_get_debug __P ((pop3_t, mu_debug_t *)); ...@@ -55,13 +58,22 @@ extern int pop3_get_debug __P ((pop3_t, mu_debug_t *));
55 extern int pop3_apop __P ((pop3_t, const char *, const char *)); 58 extern int pop3_apop __P ((pop3_t, const char *, const char *));
56 59
57 extern int pop3_capa __P ((pop3_t, iterator_t *)); 60 extern int pop3_capa __P ((pop3_t, iterator_t *));
58 extern int pop3_capa_current __P ((iterator_t, char **)); 61 extern int pop3_capa_first __P ((pop3_capa_iterator_t));
62 extern int pop3_capa_current __P ((pop3_capa_iterator_t, char **));
63 extern int pop3_capa_next __P ((pop3_capa_iterator_t));
64 extern int pop3_capa_is_done __P ((pop3_capa_iterator_t));
65 extern void pop3_capa_destroy __P ((pop3_capa_iterator_t *));
59 66
60 extern int pop3_dele __P ((pop3_t, unsigned int)); 67 extern int pop3_dele __P ((pop3_t, unsigned int));
61 68
62 extern int pop3_list __P ((pop3_t, unsigned int, size_t *)); 69 extern int pop3_list __P ((pop3_t, unsigned int, size_t *));
63 extern int pop3_list_all __P ((pop3_t, iterator_t *)); 70 extern int pop3_list_all __P ((pop3_t, pop3_list_iterator_t *));
64 extern int pop3_list_current __P ((iterator_t, unsigned int *, size_t *)); 71 extern int pop3_list_first __P ((pop3_list_iterator_t));
72 extern int pop3_list_current __P ((pop3_list_iterator_t,
73 unsigned int *, size_t *));
74 extern int pop3_list_next __P ((pop3_list_iterator_t));
75 extern int pop3_list_is_done __P ((pop3_list_iterator_t));
76 extern void pop3_list_destroy __P ((pop3_list_iterator_t *));
65 77
66 extern int pop3_noop __P ((pop3_t)); 78 extern int pop3_noop __P ((pop3_t));
67 extern int pop3_pass __P ((pop3_t, const char *)); 79 extern int pop3_pass __P ((pop3_t, const char *));
...@@ -73,8 +85,13 @@ extern int pop3_top __P ((pop3_t, unsigned int, ...@@ -73,8 +85,13 @@ extern int pop3_top __P ((pop3_t, unsigned int,
73 unsigned int, stream_t *)); 85 unsigned int, stream_t *));
74 86
75 extern int pop3_uidl __P ((pop3_t, unsigned int, char **)); 87 extern int pop3_uidl __P ((pop3_t, unsigned int, char **));
76 extern int pop3_uidl_all __P ((pop3_t, iterator_t *)); 88 extern int pop3_uidl_all __P ((pop3_t, pop3_uidl_iterator_t *));
77 extern int pop3_uidl_current __P ((iterator_t, unsigned int *, char **)); 89 extern int pop3_uidl_first __P ((pop3_uidl_iterator_t));
90 extern int pop3_uidl_is_done __P ((pop3_uidl_iterator_t));
91 extern int pop3_uidl_current __P ((pop3_uidl_iterator_t,
92 unsigned int *, char **));
93 extern int pop3_uidl_next __P ((pop3_uidl_iterator_t));
94 extern void pop3_uidl_destroy __P ((pop3_uidl_iterator_t *));
78 95
79 extern int pop3_user __P ((pop3_t, const char *)); 96 extern int pop3_user __P ((pop3_t, const char *));
80 97
......
...@@ -128,11 +128,11 @@ extern int mbox_set_default_hcache __P ((mbox_t)); ...@@ -128,11 +128,11 @@ extern int mbox_set_default_hcache __P ((mbox_t));
128 extern int mbox_debug_print __P ((mbox_t, const char *, ...)); 128 extern int mbox_debug_print __P ((mbox_t, const char *, ...));
129 129
130 extern int stream_mbox_create __P ((stream_t *, mbox_t, unsigned int, int)); 130 extern int stream_mbox_create __P ((stream_t *, mbox_t, unsigned int, int));
131 extern int stream_mbox_msgno __P ((stream_t, unsigned int)); 131 extern int stream_mbox_set_msgno __P ((stream_t, unsigned int));
132 extern void _stream_mbox_dtor __P ((stream_t)); 132 extern void _stream_mbox_dtor __P ((stream_t));
133 133
134 extern int attribute_mbox_create __P ((attribute_t *, mbox_t, unsigned int)); 134 extern int attribute_mbox_create __P ((attribute_t *, mbox_t, unsigned int));
135 extern int attribute_mbox_msgno __P ((attribute_t, unsigned int)); 135 extern int attribute_mbox_set_msgno __P ((attribute_t, unsigned int));
136 extern int mbox_attribute_to_status __P ((attribute_t, char *, size_t, 136 extern int mbox_attribute_to_status __P ((attribute_t, char *, size_t,
137 size_t *)); 137 size_t *));
138 extern void _attribute_mbox_dtor __P ((attribute_t)); 138 extern void _attribute_mbox_dtor __P ((attribute_t));
...@@ -143,6 +143,8 @@ extern void mbox_release_hstream __P ((mbox_t, unsigned int)); ...@@ -143,6 +143,8 @@ extern void mbox_release_hstream __P ((mbox_t, unsigned int));
143 extern void mbox_release_bstream __P ((mbox_t, unsigned int)); 143 extern void mbox_release_bstream __P ((mbox_t, unsigned int));
144 extern void mbox_release_msg __P ((mbox_t, unsigned int)); 144 extern void mbox_release_msg __P ((mbox_t, unsigned int));
145 145
146 extern int mbox_scan0 __P ((mbox_t, unsigned int, unsigned int *, int));
147
146 #ifdef __cplusplus 148 #ifdef __cplusplus
147 } 149 }
148 #endif 150 #endif
......
...@@ -217,7 +217,7 @@ attribute_mbox_create (attribute_t *pattribute, mbox_t mbox, ...@@ -217,7 +217,7 @@ attribute_mbox_create (attribute_t *pattribute, mbox_t mbox,
217 } 217 }
218 218
219 int 219 int
220 attribute_mbox_msgno (attribute_t attribute, unsigned int msgno) 220 attribute_mbox_set_msgno (attribute_t attribute, unsigned int msgno)
221 { 221 {
222 struct _attribute_mbox *ma = (struct _attribute_mbox *)attribute; 222 struct _attribute_mbox *ma = (struct _attribute_mbox *)attribute;
223 if (ma) 223 if (ma)
......
...@@ -113,8 +113,8 @@ mbox_tmpfile (mbox_t mbox, char **pbox) ...@@ -113,8 +113,8 @@ mbox_tmpfile (mbox_t mbox, char **pbox)
113 The real downside to the approach is that when things go wrong 113 The real downside to the approach is that when things go wrong
114 the temporary file may be left in /tmp, which is not all that bad 114 the temporary file may be left in /tmp, which is not all that bad
115 because at least, we have something to recuperate when failure. */ 115 because at least, we have something to recuperate when failure. */
116 int 116 static int
117 mbox_expunge (mbox_t mbox, int remove_deleted) 117 mbox_expunge0 (mbox_t mbox, int remove_deleted)
118 { 118 {
119 mbox_message_t mum; 119 mbox_message_t mum;
120 int status = 0; 120 int status = 0;
...@@ -382,9 +382,9 @@ mbox_expunge (mbox_t mbox, int remove_deleted) ...@@ -382,9 +382,9 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
382 mum->from_ = mum->header.start = 0; 382 mum->from_ = mum->header.start = 0;
383 mum->body.start = mum->body.end = 0; 383 mum->body.start = mum->body.end = 0;
384 mum->header.lines = mum->body.lines = 0; 384 mum->header.lines = mum->body.lines = 0;
385 stream_mbox_msgno (mum->header.stream, j + 1); 385 stream_mbox_set_msgno (mum->header.stream, j + 1);
386 stream_mbox_msgno (mum->body.stream, j + 1); 386 stream_mbox_set_msgno (mum->body.stream, j + 1);
387 attribute_mbox_msgno (mum->attribute, j + 1); 387 attribute_mbox_set_msgno (mum->attribute, j + 1);
388 } 388 }
389 } 389 }
390 390
...@@ -396,7 +396,19 @@ mbox_expunge (mbox_t mbox, int remove_deleted) ...@@ -396,7 +396,19 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
396 396
397 /* This should reset the messages_count, the last argument 0 means 397 /* This should reset the messages_count, the last argument 0 means
398 not to send event notification. */ 398 not to send event notification. */
399 mbox_scan (mbox, dirty, NULL, 0); 399 mbox_scan0 (mbox, dirty, NULL, 0);
400 } 400 }
401 return status; 401 return status;
402 } 402 }
403
404 int
405 mbox_expunge (mbox_t mbox)
406 {
407 return mbox_expunge0 (mbox, 1);
408 }
409
410 int
411 mbox_save (mbox_t mbox)
412 {
413 return mbox_expunge0 (mbox, 0);
414 }
......
...@@ -134,9 +134,9 @@ mbox_alloc_umessages (mbox_t mbox) ...@@ -134,9 +134,9 @@ mbox_alloc_umessages (mbox_t mbox)
134 The approach is to detect the "From " at the start of a new message, give 134 The approach is to detect the "From " at the start of a new message, give
135 the position of the header and scan until "\n" then set header and body 135 the position of the header and scan until "\n" then set header and body
136 position, scan until we it another "From ". */ 136 position, scan until we it another "From ". */
137
138 int 137 int
139 mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif) 138 mbox_scan0 (mbox_t mbox, unsigned int msgno, unsigned int *pcount,
139 int do_notif)
140 { 140 {
141 #define MSGLINELEN 1024 141 #define MSGLINELEN 1024
142 char buf[MSGLINELEN]; 142 char buf[MSGLINELEN];
...@@ -418,3 +418,15 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif) ...@@ -418,3 +418,15 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
418 lockfile_unlock (mbox->lockfile); 418 lockfile_unlock (mbox->lockfile);
419 return status; 419 return status;
420 } 420 }
421
422 int
423 mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount)
424 {
425 return mbox_scan0 (mbox, msgno, pcount, 1);
426 }
427
428 int
429 mbox_count (mbox_t mbox, unsigned int *pcount)
430 {
431 return mbox_scan0 (mbox, 1, pcount, 0);
432 }
......
...@@ -97,6 +97,6 @@ mbox_set_separator (mbox_t mbox, unsigned int msgno, const char *sep) ...@@ -97,6 +97,6 @@ mbox_set_separator (mbox_t mbox, unsigned int msgno, const char *sep)
97 if (mbox->umessages[msgno]->separator) 97 if (mbox->umessages[msgno]->separator)
98 free (mbox->umessages[msgno]->separator); 98 free (mbox->umessages[msgno]->separator);
99 mbox->umessages[msgno]->separator = (sep) ? strdup (sep) : NULL; 99 mbox->umessages[msgno]->separator = (sep) ? strdup (sep) : NULL;
100 mbox->umessage[msgno]->attr_flags |= MU_ATTRIBUTE_MODIFIED; 100 mbox->umessages[msgno]->attr_flags |= MU_ATTRIBUTE_MODIFIED;
101 return 0; 101 return 0;
102 } 102 }
......
...@@ -368,7 +368,7 @@ _stream_mbox_dtor (stream_t stream) ...@@ -368,7 +368,7 @@ _stream_mbox_dtor (stream_t stream)
368 } 368 }
369 369
370 int 370 int
371 stream_mbox_msgno (stream_t stream, unsigned int msgno) 371 stream_mbox_set_msgno (stream_t stream, unsigned int msgno)
372 { 372 {
373 struct _stream_mbox *ms = (struct _stream_mbox *)stream; 373 struct _stream_mbox *ms = (struct _stream_mbox *)stream;
374 if (ms) 374 if (ms)
......
...@@ -35,7 +35,7 @@ mbox_get_uidnext (mbox_t mbox, unsigned long *puidnext) ...@@ -35,7 +35,7 @@ mbox_get_uidnext (mbox_t mbox, unsigned long *puidnext)
35 the mailbox as change on disk. */ 35 the mailbox as change on disk. */
36 if (mbox->messages_count == 0) 36 if (mbox->messages_count == 0)
37 { 37 {
38 int status = mbox_scan (mbox, 0, NULL, 0); 38 int status = mbox_count (mbox, NULL);
39 if (status != 0) 39 if (status != 0)
40 return status; 40 return status;
41 } 41 }
......
...@@ -34,7 +34,7 @@ mbox_get_uidvalidity (mbox_t mbox, unsigned long *puidvalidity) ...@@ -34,7 +34,7 @@ mbox_get_uidvalidity (mbox_t mbox, unsigned long *puidvalidity)
34 /* If we did not start a scanning yet do it now. */ 34 /* If we did not start a scanning yet do it now. */
35 if (mbox->messages_count == 0) 35 if (mbox->messages_count == 0)
36 { 36 {
37 int status = mbox_scan (mbox, 0, NULL, 0); 37 int status = mbox_count (mbox, NULL);
38 if (status != 0) 38 if (status != 0)
39 return status; 39 return status;
40 } 40 }
......
...@@ -69,3 +69,33 @@ pop3_capa (pop3_t pop3, iterator_t *piterator) ...@@ -69,3 +69,33 @@ pop3_capa (pop3_t pop3, iterator_t *piterator)
69 69
70 return status; 70 return status;
71 } 71 }
72
73 int
74 pop3_capa_first (pop3_capa_iterator_t iterator)
75 {
76 return iterator_first (iterator);
77 }
78
79 int
80 pop3_capa_current (pop3_capa_iterator_t iterator, char **s)
81 {
82 return iterator_current (iterator, s);
83 }
84
85 int
86 pop3_capa_next (pop3_capa_iterator_t iterator)
87 {
88 return iterator_next (iterator);
89 }
90
91 int
92 pop3_capa_is_done (pop3_capa_iterator_t iterator)
93 {
94 return iterator_is_done (iterator);
95 }
96
97 void
98 pop3_capa_destroy (pop3_capa_iterator_t *piterator)
99 {
100 iterator_destroy (piterator);
101 }
......
...@@ -76,7 +76,32 @@ pop3_list_all (pop3_t pop3, iterator_t *piterator) ...@@ -76,7 +76,32 @@ pop3_list_all (pop3_t pop3, iterator_t *piterator)
76 } 76 }
77 77
78 int 78 int
79 pop3_list_current (iterator_t iterator, unsigned int *pno, size_t *plen) 79 pop3_list_first (pop3_list_iterator_t iterator)
80 {
81 return iterator_first (iterator);
82 }
83
84 int
85 pop3_list_next (pop3_list_iterator_t iterator)
86 {
87 return iterator_next (iterator);
88 }
89
90 int
91 pop3_list_is_done (pop3_list_iterator_t iterator)
92 {
93 return iterator_is_done (iterator);
94 }
95
96 void
97 pop3_list_destroy (pop3_list_iterator_t *piterator)
98 {
99 iterator_destroy (piterator);
100 }
101
102 int
103 pop3_list_current (pop3_list_iterator_t iterator, unsigned int *pno,
104 size_t *plen)
80 { 105 {
81 char *buf; 106 char *buf;
82 int status = iterator_current (iterator, (void *)&buf); 107 int status = iterator_current (iterator, (void *)&buf);
......
...@@ -75,6 +75,30 @@ pop3_uidl_all (pop3_t pop3, iterator_t *piterator) ...@@ -75,6 +75,30 @@ pop3_uidl_all (pop3_t pop3, iterator_t *piterator)
75 } 75 }
76 76
77 int 77 int
78 pop3_uidl_first (pop3_uidl_iterator_t iterator)
79 {
80 return iterator_first (iterator);
81 }
82
83 int
84 pop3_uidl_is_done (pop3_uidl_iterator_t iterator)
85 {
86 return iterator_is_done (iterator);
87 }
88
89 int
90 pop3_uidl_next (pop3_uidl_iterator_t iterator)
91 {
92 return iterator_next (iterator);
93 }
94
95 void
96 pop3_uidl_destroy (pop3_uidl_iterator_t *piterator)
97 {
98 iterator_destroy (piterator);
99 }
100
101 int
78 pop3_uidl_current (iterator_t iterator, unsigned int *pno, char **puidl) 102 pop3_uidl_current (iterator_t iterator, unsigned int *pno, char **puidl)
79 { 103 {
80 char *buf; 104 char *buf;
......