Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtmail / dtmailpr / dmx.hh
1 /* $XConsortium: dmx.hh /main/5 1996/04/21 19:43:59 drk $ */
2
3 #ifndef _DMX_HH
4 #define _DMX_HH
5
6 /*
7  *+SNOTICE
8  *
9  *      $:$
10  *
11  *      RESTRICTED CONFIDENTIAL INFORMATION:
12  *      
13  *      The information in this document is subject to special
14  *      restrictions in a confidential disclosure agreement between
15  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
16  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
17  *      Sun's specific written approval.  This document and all copies
18  *      and derivative works thereof must be returned or destroyed at
19  *      Sun's request.
20  *
21  *      Copyright 1994 Sun Microsystems, Inc.  All rights reserved.
22  *
23  *+ENOTICE
24  */
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <unistd.h>
29
30 #include <string.h>
31
32 #include <sys/types.h>
33 #include <ctype.h>
34
35 #if defined(sun) && defined(_XOPEN_SOURCE)
36 #ifndef B_TRUE
37 #define B_TRUE _B_TRUE
38 #endif
39 #ifndef B_FALSE
40 #define B_FALSE _B_FALSE
41 #endif
42 #endif   /* sun && _XOPEN_SOURCE */
43
44 #if defined(_AIX)
45 #ifndef B_FALSE
46 #define B_FALSE 0
47 #endif
48 #ifndef B_TRUE
49 #define B_TRUE 1
50 #endif
51 #endif /* _AIX */
52
53
54
55 #include <DtMail/DtMail.hh>
56 #include <DtMail/DtMailError.hh>
57 #include <DtMail/DtMailValues.hh>
58 #include <Dt/Dts.h>
59
60 extern const char *const        dmxversion;
61
62 enum DmxHeaderType { MSGLIST, MSGHEADER, NUMHDRTYPES };
63 enum DmxHeaders
64 {
65         DMXFROM,
66         DMXSUBJ,
67         DMXCLENGTH,
68         DMXSTATUS,
69         DMXDATE,
70         DMXTO,
71         DMXV3CHARSET,
72         DMXCONTENTTYPE,
73         DMXNUMHDRS
74 };
75
76 // This is undoubtedly illegal, unethical, and immoral.  So sue me.
77 #if !defined(SunOS) && !defined(USL) && !defined(_AIX) && !defined(__uxp__)
78 #undef boolean_t
79 typedef enum { B_FALSE, B_TRUE } boolean_t;
80 #endif // SunOS
81
82 // utils
83 char            *convertValueToString (DtMailValueSeq *value, int s);
84 boolean_t       handleError (DtMailEnv &, char *);
85 char            *formatHeader (DtMailHeaderLine &, enum DmxHeaderType);
86
87 class DmxMsg
88 {
89         public:
90                 DmxMsg (void);
91
92                 char    *printHeader (enum DmxHeaderType);
93                 void    display (void);
94                 void    setHandle (DtMailMessageHandle &);
95                 void    setHeader (DtMailHeaderLine &);
96                 void    setMessage (DtMail::Message *);
97                 void    setInfo (char *);
98                 void    parse (void);
99                 void    getFlags (void);
100         
101         
102                 DtMailMessageHandle     msgHandle;
103                 DtMailHeaderLine        msgHeader;
104                 DtMail::Message         *message;
105
106                 DtMail::BodyPart        **bodyParts;
107                 int     numBPs;
108
109                 char            *addlInfo;
110                 boolean_t       cachedValues;
111                 boolean_t       isCurrent;
112                 boolean_t       hasAttachments;
113                 boolean_t       isNew;
114                 // other flags for status (read, unopened, etc.)
115 };
116
117
118 class DmxMailbox
119 {
120         public:
121                 DmxMailbox (void);
122
123                 DtMail::MailBox *mbox;
124                 int             messageCount;
125                 int             newMessages;
126                 int             firstNew;
127                 char            *name;
128
129                 void            loadMessages (void);
130                 void            createHeaderRequest (DtMailHeaderRequest &);
131                 void            printMailboxInfo (void);
132
133                 DmxMsg          msg [1024];
134 };
135
136
137
138 #endif // _DMX_HH