tttm

git clone https://orangeshoelaces.net/git/tttm.git

/imap.h

   1 enum { IS_GREET, IS_NAUTH, IS_AUTH, IS_SEL, IS_LOGOUT };
   2 
   3 enum { CAP_KNOWN = 1, CAP_IMAP4R1, CAP_NOLOGIN, CAP_AUTHPLAIN };
   4 
   5 struct imapctx {
   6         int           state;
   7         int           in;
   8         int           out;
   9 
  10         unsigned int  tag;
  11         char         *resp;
  12         size_t        rlen;
  13         size_t        rcap;
  14         size_t        rpar;
  15         union parnode par[1024];
  16 
  17         int           caps;
  18         struct {
  19                 uint32_t exists;
  20         } mb;
  21 };
  22 
  23 struct msgd {
  24         off_t  off;
  25         size_t len;
  26 };
  27 
  28 int     imap_init(struct imapctx *, int, int);
  29 void    imap_free(struct imapctx *);
  30 int     imap_discocap(struct imapctx *);
  31 int     imap_login(struct imapctx *, const char *, const char *);
  32 int     imap_select(struct imapctx *, const char *);
  33 int     imap_fetch(struct imapctx *, uint32_t, uint32_t, struct msgd *);
  34 int     imap_delete(struct imapctx *, uint32_t, uint32_t);
  35 int     imap_expunge(struct imapctx *);
  36 int     imap_nop(struct imapctx *);
  37 int     imap_close(struct imapctx *);
  38 int     imap_logout(struct imapctx *);