home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mm / mm-0.90 / mm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-18  |  5.2 KB  |  164 lines

  1. /*
  2.  * Copyright (c) 1986, 1990 by The Trustees of Columbia University in
  3.  * the City of New York.  Permission is granted to any individual or
  4.  * institution to use, copy, or redistribute this software so long as it
  5.  * is not sold for profit, provided this copyright notice is retained.
  6.  */
  7.  
  8. #ifdef RCSID
  9. #ifndef lint
  10. static char *mm_rcsid = "$Header: /f/src2/encore.bin/cucca/mm/tarring-it-up/RCS/mm.h,v 2.2 90/10/04 18:25:00 melissa Exp $";
  11. #endif
  12. #endif /* RCSID */
  13.  
  14. #include "stdio.h"
  15. #include "config.h"            /* site configuration file */
  16. #include "osfiles.h"            /* standard system header files */
  17. #include "compat.h"            /* compatibility macros */
  18. #include "chartype.h"            /* private version of <ctype.h> */
  19. #include "pathnames.h"            /* filename defaults */
  20. #include "address.h"            /* address list definitions */
  21.  
  22. #define true    1
  23. #define false    0
  24. #define nil    NULL            /* XXX */
  25.  
  26. #if MDEBUG
  27. #define malloc dmalloc
  28. #define calloc dcalloc
  29. #define realloc drealloc
  30. #define free dfree
  31. #define cmrealloc safe_realloc
  32. #endif
  33.  
  34. /*
  35.  * Global state flags
  36.  */
  37. #define MM_TOP_LEVEL    0x00        /* in the top-level command parser */
  38. #define MM_READ        0x01        /* in "read mode" */
  39. #define MM_SEND        0x02        /* in "send mode" */
  40. #define MM_REPLY    0x04        /* replying to a sequence */
  41. #define MM_ANSWER    0x08        /* answering a message */
  42. #define MM_BROWSE    0x10        /* browsing a file */
  43.  
  44. #define KEYLEN    64            /* header keyword size */
  45. #define STRLEN    256            /* string length */
  46. #define BUFLEN    512            /* size of parse buffers, etc */
  47.  
  48. typedef char keyword[KEYLEN];        /* XXX this is a bad idea... */
  49. typedef char buffer[BUFLEN];
  50. typedef char string[STRLEN];
  51. typedef char **keylist;
  52.  
  53. #include "seq.h"
  54.  
  55. /*
  56.  * variables accessible to the user are defined using the "variable" type.
  57.  */
  58.  
  59. typedef struct {
  60.     char *name;                /* variable name */
  61.     int type;                /* variable type */
  62.     char *addr;                /* address of the variable */
  63.     int size;                /* max length for string variables */
  64.     int changed;            /* modified by user? */
  65. } variable;
  66.  
  67. /*
  68.  * i don't think this structure isn't used right now 
  69.  */
  70.  
  71. typedef struct address {
  72.     char *name;                /* name for a group list, or ";" */
  73.     char *phrase;            /* introductory comment */
  74.     char *route;            /* route */
  75.     char *user;                /* local-part */
  76.     char *host;                /* domain */
  77.     char *comment;            /* comment from parens */
  78.     struct address *next;        /* next addr in list */
  79.     struct address *sublist;        /* sublist if group list */
  80. } address;
  81.  
  82. #define M_SEEN        0001        /* seen */
  83. #define M_DELETED    0002        /* deleted */
  84. #define M_FLAGGED    0004        /* flagged */
  85. #define M_ANSWERED    0010        /* answered */
  86. #define M_FILED        0020        /* filed */
  87. #define M_RECENT    0040        /* recent */
  88. #define M_MODIFIED    0100        /* message flags modified */
  89. #define M_EDITED    0200        /* edited the message text */
  90. #define M_FORWARDED    0400        /* forwarded the message */
  91. #define M_INTERNAL    ~(M_MODIFIED|M_RECENT)    /* flags stored in file */
  92.  
  93. /*
  94.  * The message struct describes a single message in a mail file
  95.  */
  96. typedef struct {
  97.     long offset;            /* position in file */
  98.     unsigned long size;            /* message size */
  99.     unsigned long flags;        /* message flags */
  100.     unsigned long keybits;        /* funky keyword bits */
  101.     char *from;                /* sender */
  102.     time_t date;            /* date received */
  103.     char *text;                /* address in memory */
  104.     char *hdrsum;            /* cached line for "headers" cmd */
  105.     int next;                /* next message in sequence */
  106.     int prev;                /* previous message in sequence */
  107.     char **keywords;            /* list of keywords */
  108. } message;
  109.  
  110. #define MF_MAILBOX    0x01        /* user's primary mailbox  */
  111. #define MF_SPOOL    0x02        /* user's spool file */
  112. #define MF_RDONLY    0x04        /* read-only mode */
  113. #define MF_DIRTY    0x08        /* mail file is dirty */
  114. #define MF_MODIFIED    0x10        /* some flags have been changed */
  115. #define MF_WRITERR    0x20        /* write error */
  116. #define MF_SAVEONLY    0x40        /* save even if read-only */
  117.  
  118. /*
  119.  * msgvec describes a mail file
  120.  */
  121.  
  122. typedef struct msgvec {
  123.     string filename;            /* name of the file these came from */
  124.     time_t when_read;            /* when we opened the file */
  125.     time_t mtime;            /* file's mtime when we opened it */
  126.     FILE *filep;            /* pointer to the file */
  127.     int type;                /* what type of mail file is it? */
  128.     unsigned long flags;        /* message flags */
  129.     int current;            /* current message number */
  130.     int last_read;            /* last message read from the file */
  131.     int count;                /* total number of messages in file */
  132.     unsigned long size;            /* length of file (in bytes) */
  133.  
  134.     sequence_t sequence;        /* current message sequence */
  135.     sequence_t prev_sequence;        /* previous message sequence */
  136.     sequence_t read_sequence;        /* read sequence */
  137.  
  138.     /* note that we waste the zeroth entry of this array -- it's never used */
  139.     message *msgs;            /* pointer to the message array */
  140.     keylist keywords;            /* keywords for this file */
  141. } msgvec;
  142.  
  143. /* exit codes for getmsg (send.c and sendcmds.c) */
  144. #define GET_EDIT  1
  145. #define GET_ESC   2
  146. #define GET_CTRLD 3
  147. #define GET_ABORT 4
  148.  
  149. /* flags for the update() routine */
  150. #define UPD_ALWAYS    0x01
  151. #define UPD_SAVEMOD    0x02
  152. #define UPD_EXPUNGE    0x04
  153. #define UPD_ALTFILE    0x08
  154. #define UPD_QUIET    0x10
  155.  
  156. /* a few things for yesno and yesnoask variables */
  157. #define SET_ASK -1
  158. #define SET_NO 0
  159. #define SET_NEVER 0
  160. #define SET_YES 1
  161. #define SET_ALWAYS 1
  162.  
  163. #include "extern.h"            /* external declarations */
  164.