* move all Maildir funcs to mu-maildir.[ch]

This commit is contained in:
Dirk-Jan C. Binnema
2010-01-01 15:51:50 +02:00
parent 1cd004c9b7
commit 5b0fb90230
4 changed files with 319 additions and 9 deletions

View File

@ -21,6 +21,10 @@
#define __MU_MAILDIR_H__
#include <glib.h>
#include <time.h>
#include <sys/types.h> /* for mode_t */
#include "mu-result.h" /* for MuResult */
/**
* create a new maildir. Note, if the function fails 'halfway', it
@ -53,4 +57,50 @@ gboolean mu_maildir_mkmdir (const char* path, int mode,
gboolean mu_maildir_link (const char* src, const char *targetpath,
GError **err);
/**
* MuMaildirWalkMsgCallback -- callback function for mu_path_walk_maildir;
* see the documentation there. It will be called for each message
* found, with fullpath contain the full path to the message, a
* timestamp of the last modification time of this file, and a user_data
* pointer
*/
typedef MuResult (*MuMaildirWalkMsgCallback)
(const char* fullpath, time_t timestamp, void *user_data);
/**
* MuPathWalkDirCallback -- callback function for mu_path_walk_maildir; see the
* documentation there. It will be called each time a dir is entered or left,
* with 'enter' being TRUE upon entering, FALSE otherwise
*/
typedef MuResult (*MuMaildirWalkDirCallback)
(const char* fullpath, gboolean enter, void *user_data);
/**
* start a recursive walk of a maildir; for each file found, we call
* callback with the path (with the Maildir path of scanner_new as
* root), the filename, the timestamp (mtime) of the file,and the
* *data pointer, for user data. dot-files are ignored, as well as
* files outside cur/ and new/ dirs and unreadable files; however,
* dotdirs are visited (ie. '.dotdir/cur'), so this enables Maildir++.
* (http://www.inter7.com/courierimap/README.maildirquota.html, search
* for 'Mission statement')
*
* mu_walk_maildir stops if the callbacks return something different
* from MU_OK. For example, it can return MU_STOP to stop the scan, or
* some error.
*
* @param path the maildir path to scan
* @param cb_msg the callback function called for each msg
* @param cb_dir the callback function called for each dir
* @param data user data pointer
*
* @return a scanner result; MU_OK if everything went ok,
* MU_STOP if we want to stop, or MU_ERROR in
* case of error
*/
MuResult mu_maildir_walk (const char *path, MuMaildirWalkMsgCallback cb_msg,
MuMaildirWalkDirCallback cb_dir, void *data);
#endif /*__MU_MAILDIR_H__*/