diff options
author | Alain Magloire <alainm@gnu.org> | 2001-10-20 04:19:38 +0000 |
---|---|---|
committer | Alain Magloire <alainm@gnu.org> | 2001-10-20 04:19:38 +0000 |
commit | 149583b547636023968c738295a0042e7cd80174 (patch) | |
tree | ec71b92aa771a203253e86f537119beb14c7503c /mailbox2 | |
parent | bd6da6fcb7b48ebe041eabeb1e14d87cea908980 (diff) | |
download | mailutils-149583b547636023968c738295a0042e7cd80174.tar.gz mailutils-149583b547636023968c738295a0042e7cd80174.tar.bz2 |
* 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.
Diffstat (limited to 'mailbox2')
-rw-r--r-- | mailbox2/include/mailutils/mbox.h | 7 | ||||
-rw-r--r-- | mailbox2/include/mailutils/pop3.h | 27 | ||||
-rw-r--r-- | mailbox2/include/mailutils/sys/mbox.h | 8 | ||||
-rw-r--r-- | mailbox2/mbox/mbox_attribute.c | 2 | ||||
-rw-r--r-- | mailbox2/mbox/mbox_expunge.c | 24 | ||||
-rw-r--r-- | mailbox2/mbox/mbox_scan.c | 16 | ||||
-rw-r--r-- | mailbox2/mbox/mbox_separator.c | 2 | ||||
-rw-r--r-- | mailbox2/mbox/mbox_stream.c | 2 | ||||
-rw-r--r-- | mailbox2/mbox/mbox_uidnext.c | 2 | ||||
-rw-r--r-- | mailbox2/mbox/mbox_uidvalidity.c | 2 | ||||
-rw-r--r-- | mailbox2/pop3/pop3_capa.c | 30 | ||||
-rw-r--r-- | mailbox2/pop3/pop3_lista.c | 27 | ||||
-rw-r--r-- | mailbox2/pop3/pop3_uidla.c | 24 |
13 files changed, 148 insertions, 25 deletions
diff --git a/mailbox2/include/mailutils/mbox.h b/mailbox2/include/mailutils/mbox.h index a679b0b3b..cae795935 100644 --- a/mailbox2/include/mailutils/mbox.h +++ b/mailbox2/include/mailutils/mbox.h @@ -63,7 +63,8 @@ extern int mbox_get_size __P ((mbox_t, off_t *)); extern int mbox_get_separator __P ((mbox_t, unsigned int, char **)); extern int mbox_set_separator __P ((mbox_t, unsigned int, const char *)); -extern int mbox_expunge __P ((mbox_t, int)); +extern int mbox_expunge __P ((mbox_t)); +extern int mbox_save __P ((mbox_t)); extern int mbox_has_newmail __P ((mbox_t)); extern int mbox_set_progress_cb __P ((mbox_t, @@ -73,8 +74,8 @@ extern int mbox_set_newmsg_cb __P ((mbox_t, extern int mbox_set_error_cb __P ((mbox_t, int (*) __P ((int, void *)), void *)); -extern int mbox_scan __P ((mbox_t, unsigned int, - unsigned int *, int)); +extern int mbox_scan __P ((mbox_t, unsigned int, unsigned int *)); +extern int mbox_count __P ((mbox_t, unsigned int *)); extern int mbox_append __P ((mbox_t, const char *, attribute_t, stream_t)); diff --git a/mailbox2/include/mailutils/pop3.h b/mailbox2/include/mailutils/pop3.h index edf4a3107..f1240c8a4 100644 --- a/mailbox2/include/mailutils/pop3.h +++ b/mailbox2/include/mailutils/pop3.h @@ -36,6 +36,9 @@ extern "C" { struct _pop3; typedef struct _pop3* pop3_t; +typedef iterator_t pop3_capa_iterator_t; +typedef iterator_t pop3_list_iterator_t; +typedef iterator_t pop3_uidl_iterator_t; extern int pop3_create __P ((pop3_t *)); extern void pop3_destroy __P ((pop3_t *)); @@ -55,13 +58,22 @@ extern int pop3_get_debug __P ((pop3_t, mu_debug_t *)); extern int pop3_apop __P ((pop3_t, const char *, const char *)); extern int pop3_capa __P ((pop3_t, iterator_t *)); -extern int pop3_capa_current __P ((iterator_t, char **)); +extern int pop3_capa_first __P ((pop3_capa_iterator_t)); +extern int pop3_capa_current __P ((pop3_capa_iterator_t, char **)); +extern int pop3_capa_next __P ((pop3_capa_iterator_t)); +extern int pop3_capa_is_done __P ((pop3_capa_iterator_t)); +extern void pop3_capa_destroy __P ((pop3_capa_iterator_t *)); extern int pop3_dele __P ((pop3_t, unsigned int)); extern int pop3_list __P ((pop3_t, unsigned int, size_t *)); -extern int pop3_list_all __P ((pop3_t, iterator_t *)); -extern int pop3_list_current __P ((iterator_t, unsigned int *, size_t *)); +extern int pop3_list_all __P ((pop3_t, pop3_list_iterator_t *)); +extern int pop3_list_first __P ((pop3_list_iterator_t)); +extern int pop3_list_current __P ((pop3_list_iterator_t, + unsigned int *, size_t *)); +extern int pop3_list_next __P ((pop3_list_iterator_t)); +extern int pop3_list_is_done __P ((pop3_list_iterator_t)); +extern void pop3_list_destroy __P ((pop3_list_iterator_t *)); extern int pop3_noop __P ((pop3_t)); extern int pop3_pass __P ((pop3_t, const char *)); @@ -73,8 +85,13 @@ extern int pop3_top __P ((pop3_t, unsigned int, unsigned int, stream_t *)); extern int pop3_uidl __P ((pop3_t, unsigned int, char **)); -extern int pop3_uidl_all __P ((pop3_t, iterator_t *)); -extern int pop3_uidl_current __P ((iterator_t, unsigned int *, char **)); +extern int pop3_uidl_all __P ((pop3_t, pop3_uidl_iterator_t *)); +extern int pop3_uidl_first __P ((pop3_uidl_iterator_t)); +extern int pop3_uidl_is_done __P ((pop3_uidl_iterator_t)); +extern int pop3_uidl_current __P ((pop3_uidl_iterator_t, + unsigned int *, char **)); +extern int pop3_uidl_next __P ((pop3_uidl_iterator_t)); +extern void pop3_uidl_destroy __P ((pop3_uidl_iterator_t *)); extern int pop3_user __P ((pop3_t, const char *)); diff --git a/mailbox2/include/mailutils/sys/mbox.h b/mailbox2/include/mailutils/sys/mbox.h index f84483daa..d523c0a47 100644 --- a/mailbox2/include/mailutils/sys/mbox.h +++ b/mailbox2/include/mailutils/sys/mbox.h @@ -128,11 +128,11 @@ extern int mbox_set_default_hcache __P ((mbox_t)); extern int mbox_debug_print __P ((mbox_t, const char *, ...)); extern int stream_mbox_create __P ((stream_t *, mbox_t, unsigned int, int)); -extern int stream_mbox_msgno __P ((stream_t, unsigned int)); -extern void _stream_mbox_dtor __P ((stream_t)); +extern int stream_mbox_set_msgno __P ((stream_t, unsigned int)); +extern void _stream_mbox_dtor __P ((stream_t)); extern int attribute_mbox_create __P ((attribute_t *, mbox_t, unsigned int)); -extern int attribute_mbox_msgno __P ((attribute_t, unsigned int)); +extern int attribute_mbox_set_msgno __P ((attribute_t, unsigned int)); extern int mbox_attribute_to_status __P ((attribute_t, char *, size_t, size_t *)); extern void _attribute_mbox_dtor __P ((attribute_t)); @@ -143,6 +143,8 @@ extern void mbox_release_hstream __P ((mbox_t, unsigned int)); extern void mbox_release_bstream __P ((mbox_t, unsigned int)); extern void mbox_release_msg __P ((mbox_t, unsigned int)); +extern int mbox_scan0 __P ((mbox_t, unsigned int, unsigned int *, int)); + #ifdef __cplusplus } #endif diff --git a/mailbox2/mbox/mbox_attribute.c b/mailbox2/mbox/mbox_attribute.c index 075df89a5..9ab2968d1 100644 --- a/mailbox2/mbox/mbox_attribute.c +++ b/mailbox2/mbox/mbox_attribute.c @@ -217,7 +217,7 @@ attribute_mbox_create (attribute_t *pattribute, mbox_t mbox, } int -attribute_mbox_msgno (attribute_t attribute, unsigned int msgno) +attribute_mbox_set_msgno (attribute_t attribute, unsigned int msgno) { struct _attribute_mbox *ma = (struct _attribute_mbox *)attribute; if (ma) diff --git a/mailbox2/mbox/mbox_expunge.c b/mailbox2/mbox/mbox_expunge.c index ee82879b3..ccea64396 100644 --- a/mailbox2/mbox/mbox_expunge.c +++ b/mailbox2/mbox/mbox_expunge.c @@ -113,8 +113,8 @@ mbox_tmpfile (mbox_t mbox, char **pbox) The real downside to the approach is that when things go wrong the temporary file may be left in /tmp, which is not all that bad because at least, we have something to recuperate when failure. */ -int -mbox_expunge (mbox_t mbox, int remove_deleted) +static int +mbox_expunge0 (mbox_t mbox, int remove_deleted) { mbox_message_t mum; int status = 0; @@ -382,9 +382,9 @@ mbox_expunge (mbox_t mbox, int remove_deleted) mum->from_ = mum->header.start = 0; mum->body.start = mum->body.end = 0; mum->header.lines = mum->body.lines = 0; - stream_mbox_msgno (mum->header.stream, j + 1); - stream_mbox_msgno (mum->body.stream, j + 1); - attribute_mbox_msgno (mum->attribute, j + 1); + stream_mbox_set_msgno (mum->header.stream, j + 1); + stream_mbox_set_msgno (mum->body.stream, j + 1); + attribute_mbox_set_msgno (mum->attribute, j + 1); } } @@ -396,7 +396,19 @@ mbox_expunge (mbox_t mbox, int remove_deleted) /* This should reset the messages_count, the last argument 0 means not to send event notification. */ - mbox_scan (mbox, dirty, NULL, 0); + mbox_scan0 (mbox, dirty, NULL, 0); } return status; } + +int +mbox_expunge (mbox_t mbox) +{ + return mbox_expunge0 (mbox, 1); +} + +int +mbox_save (mbox_t mbox) +{ + return mbox_expunge0 (mbox, 0); +} diff --git a/mailbox2/mbox/mbox_scan.c b/mailbox2/mbox/mbox_scan.c index 7cfacdc97..18027c817 100644 --- a/mailbox2/mbox/mbox_scan.c +++ b/mailbox2/mbox/mbox_scan.c @@ -134,9 +134,9 @@ mbox_alloc_umessages (mbox_t mbox) The approach is to detect the "From " at the start of a new message, give the position of the header and scan until "\n" then set header and body position, scan until we it another "From ". */ - int -mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif) +mbox_scan0 (mbox_t mbox, unsigned int msgno, unsigned int *pcount, + int do_notif) { #define MSGLINELEN 1024 char buf[MSGLINELEN]; @@ -418,3 +418,15 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif) lockfile_unlock (mbox->lockfile); return status; } + +int +mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount) +{ + return mbox_scan0 (mbox, msgno, pcount, 1); +} + +int +mbox_count (mbox_t mbox, unsigned int *pcount) +{ + return mbox_scan0 (mbox, 1, pcount, 0); +} diff --git a/mailbox2/mbox/mbox_separator.c b/mailbox2/mbox/mbox_separator.c index 2a740cba1..b9eaf89b0 100644 --- a/mailbox2/mbox/mbox_separator.c +++ b/mailbox2/mbox/mbox_separator.c @@ -97,6 +97,6 @@ mbox_set_separator (mbox_t mbox, unsigned int msgno, const char *sep) if (mbox->umessages[msgno]->separator) free (mbox->umessages[msgno]->separator); mbox->umessages[msgno]->separator = (sep) ? strdup (sep) : NULL; - mbox->umessage[msgno]->attr_flags |= MU_ATTRIBUTE_MODIFIED; + mbox->umessages[msgno]->attr_flags |= MU_ATTRIBUTE_MODIFIED; return 0; } diff --git a/mailbox2/mbox/mbox_stream.c b/mailbox2/mbox/mbox_stream.c index d88fa3400..64269f667 100644 --- a/mailbox2/mbox/mbox_stream.c +++ b/mailbox2/mbox/mbox_stream.c @@ -368,7 +368,7 @@ _stream_mbox_dtor (stream_t stream) } int -stream_mbox_msgno (stream_t stream, unsigned int msgno) +stream_mbox_set_msgno (stream_t stream, unsigned int msgno) { struct _stream_mbox *ms = (struct _stream_mbox *)stream; if (ms) diff --git a/mailbox2/mbox/mbox_uidnext.c b/mailbox2/mbox/mbox_uidnext.c index 3721092cd..1237936f7 100644 --- a/mailbox2/mbox/mbox_uidnext.c +++ b/mailbox2/mbox/mbox_uidnext.c @@ -35,7 +35,7 @@ mbox_get_uidnext (mbox_t mbox, unsigned long *puidnext) the mailbox as change on disk. */ if (mbox->messages_count == 0) { - int status = mbox_scan (mbox, 0, NULL, 0); + int status = mbox_count (mbox, NULL); if (status != 0) return status; } diff --git a/mailbox2/mbox/mbox_uidvalidity.c b/mailbox2/mbox/mbox_uidvalidity.c index 1f517532c..475d9c817 100644 --- a/mailbox2/mbox/mbox_uidvalidity.c +++ b/mailbox2/mbox/mbox_uidvalidity.c @@ -34,7 +34,7 @@ mbox_get_uidvalidity (mbox_t mbox, unsigned long *puidvalidity) /* If we did not start a scanning yet do it now. */ if (mbox->messages_count == 0) { - int status = mbox_scan (mbox, 0, NULL, 0); + int status = mbox_count (mbox, NULL); if (status != 0) return status; } diff --git a/mailbox2/pop3/pop3_capa.c b/mailbox2/pop3/pop3_capa.c index 68a2d3295..1b364dea7 100644 --- a/mailbox2/pop3/pop3_capa.c +++ b/mailbox2/pop3/pop3_capa.c @@ -69,3 +69,33 @@ pop3_capa (pop3_t pop3, iterator_t *piterator) return status; } + +int +pop3_capa_first (pop3_capa_iterator_t iterator) +{ + return iterator_first (iterator); +} + +int +pop3_capa_current (pop3_capa_iterator_t iterator, char **s) +{ + return iterator_current (iterator, s); +} + +int +pop3_capa_next (pop3_capa_iterator_t iterator) +{ + return iterator_next (iterator); +} + +int +pop3_capa_is_done (pop3_capa_iterator_t iterator) +{ + return iterator_is_done (iterator); +} + +void +pop3_capa_destroy (pop3_capa_iterator_t *piterator) +{ + iterator_destroy (piterator); +} diff --git a/mailbox2/pop3/pop3_lista.c b/mailbox2/pop3/pop3_lista.c index a0377ff89..466027708 100644 --- a/mailbox2/pop3/pop3_lista.c +++ b/mailbox2/pop3/pop3_lista.c @@ -76,7 +76,32 @@ pop3_list_all (pop3_t pop3, iterator_t *piterator) } int -pop3_list_current (iterator_t iterator, unsigned int *pno, size_t *plen) +pop3_list_first (pop3_list_iterator_t iterator) +{ + return iterator_first (iterator); +} + +int +pop3_list_next (pop3_list_iterator_t iterator) +{ + return iterator_next (iterator); +} + +int +pop3_list_is_done (pop3_list_iterator_t iterator) +{ + return iterator_is_done (iterator); +} + +void +pop3_list_destroy (pop3_list_iterator_t *piterator) +{ + iterator_destroy (piterator); +} + +int +pop3_list_current (pop3_list_iterator_t iterator, unsigned int *pno, + size_t *plen) { char *buf; int status = iterator_current (iterator, (void *)&buf); diff --git a/mailbox2/pop3/pop3_uidla.c b/mailbox2/pop3/pop3_uidla.c index d01871706..3ee8d6cc0 100644 --- a/mailbox2/pop3/pop3_uidla.c +++ b/mailbox2/pop3/pop3_uidla.c @@ -75,6 +75,30 @@ pop3_uidl_all (pop3_t pop3, iterator_t *piterator) } int +pop3_uidl_first (pop3_uidl_iterator_t iterator) +{ + return iterator_first (iterator); +} + +int +pop3_uidl_is_done (pop3_uidl_iterator_t iterator) +{ + return iterator_is_done (iterator); +} + +int +pop3_uidl_next (pop3_uidl_iterator_t iterator) +{ + return iterator_next (iterator); +} + +void +pop3_uidl_destroy (pop3_uidl_iterator_t *piterator) +{ + iterator_destroy (piterator); +} + +int pop3_uidl_current (iterator_t iterator, unsigned int *pno, char **puidl) { char *buf; |