home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Mail / mailapp-utilities-2.1-MIHS / Source / mailtoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-02  |  3.6 KB  |  101 lines

  1. /* -*-C-*-
  2. *******************************************************************************
  3. *
  4. * File:         mailtoc.h
  5. * RCS:          /usr/local/sources/CVS/mailapp-utilities/mailtoc.h,v 1.5 1998/02/02 21:52:00 tom Exp
  6. * Description:  Structure and access routine declarations for Mail.app mailboxes
  7. * Author:       Carl Edman
  8. * Created:      Sun Apr 25 10:25:29 1993
  9. * Modified:     Sat Apr 19 14:38:11 1997 Tom Hageman <tom@basil.icce.rug.nl>
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       Experimental (Do Not Distribute)
  13. *
  14. * (C) Copyright 1993, but otherwise this file is perfect freeware.
  15. *
  16. *******************************************************************************
  17. */
  18.  
  19. #if (NS_TARGET_MAJOR < 4) /* NEXTSTEP */
  20. #  import <appkit/graphics.h>
  21. #else /* OPENSTEP/Rhapsody */
  22. #  import <Foundation/NSGeometry.h>
  23. #  define NXCoord   float
  24. #  define NXRect    NSRect
  25. #endif
  26.  
  27. #import <stdio.h>
  28.  
  29. /* The following two structures have been stolen from Chris Paris excellent
  30.    exposition of the NeXT mailbox format */
  31.  
  32. struct table_of_contents_header
  33. {
  34.    int magic;           /* magic number: 890712 */
  35.    int num_msgs;        /* number of messages in mbox */
  36.    time_t mbox_time;    /* the m_time of mbox */
  37.    NXCoord list;        /* height of upper section of split view containing list */
  38.    NXRect window;       /* Mail window */
  39. };
  40.  
  41. struct message_index
  42. {
  43.    int record_length;   /* the length of this record, including this word */
  44.    int mes_offset;      /* offset in mbox where this message begins */
  45.    int mes_length;      /* length in bytes of this message in mbox */
  46.    int mes_date;        /* the date of this message */
  47.    char status;         /* read ' ' or '>', unread '*', deleted 'd' or 'D', flagged '+' */
  48.    char msgtype;        /* regular ' ', NeXT mail 'r'/'n' or Mime Mail 'm' */
  49.    char encrypted;      /* Is this message encrypted 'e' or not ' '? */
  50.    char sync;           /* always ' ' */
  51.    char data[0];
  52. };
  53.  
  54. struct table_of_contents_header *get_table_of_contents_header(FILE *f,int createflag);
  55. struct message_index *get_message_index(FILE *f);
  56.  
  57. char *message_from(const struct message_index *mi);
  58. char *message_subject(const struct message_index *mi);
  59. char *message_reference(const struct message_index *mi);
  60.  
  61. int message_attachsize(const struct message_index *mi);
  62. time_t message_attachtime(const struct message_index *mi);
  63. int message_priority(const struct message_index *mi);
  64.  
  65. int message_set_attachsize(struct message_index *mi,int size);
  66. time_t message_set_attachtime(struct message_index *mi,time_t time);
  67. int message_set_priority(struct message_index *mi,int priority);
  68.  
  69. long message_current_date(void);
  70. long message_date(int year, const char *month, int day);
  71.  
  72. void message_get_date(const struct message_index *mi, int *year, int *month, int *day);
  73. int message_age(const struct message_index *mi);
  74.    /* age in days. */
  75.  
  76. int put_message_index(FILE *f,struct message_index *mi);
  77. int put_table_of_contents_header(FILE *f,struct table_of_contents_header *toc);
  78.  
  79. #if _MAILTOC_DEFINES
  80. #  define MT_UNSET        ' '
  81. #  define MT_STATUS_READ_1    MT_UNSET
  82. #  define MT_STATUS_READ_2    '>'
  83. #  define MT_STATUS_READ    MT_STATUS_READ_1
  84. #  define MT_STATUS_NEW        '*'
  85. #  define MT_STATUS_DELETED_1    'd'
  86. #  define MT_STATUS_DELETED_2    'D'
  87. #  define MT_STATUS_DELETED    MT_STATUS_DELETED_1
  88. #  define MT_STATUS_UNREAD_1    'u'
  89. #  define MT_STATUS_UNREAD_2    'U'
  90. #  define MT_STATUS_UNREAD    MT_STATUS_UNREAD_1
  91. #  define MT_STATUS_FLAGGED    '+'
  92.  
  93. #  define MT_TYPE_ASCII        MT_UNSET
  94. #  define MT_TYPE_NEXT_1    'r' /* NEXTSTEP/OPENSTEP */
  95. #  define MT_TYPE_NEXT_2    'n' /* (alleged) Rhapsody */
  96. #  define MT_TYPE_NEXT        MT_TYPE_NEXT_1
  97. #  define MT_TYPE_MIME        'm'
  98.  
  99. #  define MT_ENCRYPTED        'e'
  100. #endif
  101.