Back to index

courier  0.68.2
imapscanclient.h
Go to the documentation of this file.
00001 #ifndef       imapscanclient_h
00002 #define       imapscanclient_h
00003 
00004 #include "config.h"
00005 #include "maildir/maildirkeywords.h"
00006 
00007 /*
00008 ** Copyright 1998 - 2003 Double Precision, Inc.
00009 ** See COPYING for distribution information.
00010 */
00011 
00012 /*
00013 ** Stuff we want to know about an individual message in the maildir.
00014 */
00015 
00016 struct imapscanmessageinfo {
00017        unsigned long uid;   /* See RFC 2060 */
00018        char *filename;
00019        struct libmail_kwMessage *keywordMsg; /* If not NULL - keywords */
00020        char recentflag;
00021        char changedflags;   /* Set by imapscan_open */
00022        char copiedflag;     /* This message was copied to another folder */
00023 
00024        char storeflag;  /* Used by imap_addRemoveKeywords() */
00025 
00026        /* When reading keywords, hash messages by filename */
00027 
00028        struct imapscanmessageinfo *firstBucket, *nextBucket;
00029 
00030        } ;
00031 
00032 /*
00033 ** Stuff we want to know about the maildir.
00034 */
00035 
00036 struct imapscaninfo {
00037        unsigned long nmessages;    /* # of messages */
00038        unsigned long uidv;         /* See RFC 2060 */
00039        unsigned long left_unseen;
00040        unsigned long nextuid;
00041 
00042        struct libmail_kwHashtable *keywordList; /* All defined keywords */
00043 
00044        struct imapscanmessageinfo *msgs;
00045        struct maildirwatch *watcher;
00046        } ;
00047 
00048 /*
00049 ** In imapscan_maildir, move the following msgs to cur.
00050 */
00051 
00052 struct uidplus_info {
00053        struct uidplus_info *next;
00054        char *tmpfilename;
00055        char *curfilename;
00056 
00057        char *tmpkeywords;
00058        char *newkeywords;
00059 
00060        unsigned long uid; /* Initialized by imapscan_maildir2 */
00061        unsigned long old_uid; /* Initialized by do_copy() */
00062        
00063        time_t mtime;
00064 } ;
00065 
00066 
00067 void imapscan_init(struct imapscaninfo *p);
00068 void imapscan_copy(struct imapscaninfo *a,
00069                  struct imapscaninfo *b);
00070 
00071 int imapscan_maildir(struct imapscaninfo *, const char *, int, int,
00072                    struct uidplus_info *);
00073 void imapscan_free(struct imapscaninfo *);
00074 
00075 int imapscan_openfile(const char *, struct imapscaninfo *, unsigned);
00076 
00077 
00078 struct libmail_kwMessage *imapscan_createKeyword(struct imapscaninfo *,
00079                                          unsigned long n);
00080 
00081 int imapscan_updateKeywords(const char *filename,
00082                          struct libmail_kwMessage *newKeywords);
00083 
00084 int imapscan_restoreKeywordSnapshot(FILE *, struct imapscaninfo *);
00085 int imapscan_saveKeywordSnapshot(FILE *fp, struct imapscaninfo *);
00086 
00087 int imapmaildirlock(struct imapscaninfo *scaninfo,
00088                   const char *maildir,
00089                   int (*func)(void *),
00090                   void *void_arg);
00091 
00092 char *readline(unsigned, FILE *);
00093 
00094 #endif