Fixes for OpenBSD
[oweals/cde.git] / cde / programs / dtmail / dtmailpr / dmx.hh
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: dmx.hh /main/5 1996/04/21 19:43:59 drk $ */
24
25 #ifndef _DMX_HH
26 #define _DMX_HH
27
28 /*
29  *+SNOTICE
30  *
31  *      $:$
32  *
33  *      RESTRICTED CONFIDENTIAL INFORMATION:
34  *      
35  *      The information in this document is subject to special
36  *      restrictions in a confidential disclosure agreement between
37  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
38  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
39  *      Sun's specific written approval.  This document and all copies
40  *      and derivative works thereof must be returned or destroyed at
41  *      Sun's request.
42  *
43  *      Copyright 1994 Sun Microsystems, Inc.  All rights reserved.
44  *
45  *+ENOTICE
46  */
47
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <unistd.h>
51
52 #include <string.h>
53
54 #include <sys/types.h>
55 #include <ctype.h>
56
57 #if defined(sun) && defined(_XOPEN_SOURCE)
58 #ifndef B_TRUE
59 #define B_TRUE _B_TRUE
60 #endif
61 #ifndef B_FALSE
62 #define B_FALSE _B_FALSE
63 #endif
64 #endif   /* sun && _XOPEN_SOURCE */
65
66 #if defined(_AIX)
67 #ifndef B_FALSE
68 #define B_FALSE 0
69 #endif
70 #ifndef B_TRUE
71 #define B_TRUE 1
72 #endif
73 #endif /* _AIX */
74
75
76
77 #include <DtMail/DtMail.hh>
78 #include <DtMail/DtMailError.hh>
79 #include <DtMail/DtMailValues.hh>
80 #include <Dt/Dts.h>
81
82 extern const char *const        dmxversion;
83
84 enum DmxHeaderType { MSGLIST, MSGHEADER, NUMHDRTYPES };
85 enum DmxHeaders
86 {
87         DMXFROM,
88         DMXSUBJ,
89         DMXCLENGTH,
90         DMXSTATUS,
91         DMXDATE,
92         DMXTO,
93         DMXV3CHARSET,
94         DMXCONTENTTYPE,
95         DMXNUMHDRS
96 };
97
98 // This is undoubtedly illegal, unethical, and immoral.  So sue me.
99 #if !defined(SunOS) && !defined(_AIX)
100 #undef boolean_t
101 typedef enum { B_FALSE, B_TRUE } boolean_t;
102 #endif // SunOS
103
104 // utils
105 char            *convertValueToString (DtMailValueSeq *value, int s);
106 boolean_t       handleError (DtMailEnv &, char *);
107 char            *formatHeader (DtMailHeaderLine &, enum DmxHeaderType);
108
109 class DmxMsg
110 {
111         public:
112                 DmxMsg (void);
113
114                 char    *printHeader (enum DmxHeaderType);
115                 void    display (void);
116                 void    setHandle (DtMailMessageHandle &);
117                 void    setHeader (DtMailHeaderLine &);
118                 void    setMessage (DtMail::Message *);
119                 void    setInfo (char *);
120                 void    parse (void);
121                 void    getFlags (void);
122         
123         
124                 DtMailMessageHandle     msgHandle;
125                 DtMailHeaderLine        msgHeader;
126                 DtMail::Message         *message;
127
128                 DtMail::BodyPart        **bodyParts;
129                 int     numBPs;
130
131                 char            *addlInfo;
132                 boolean_t       cachedValues;
133                 boolean_t       isCurrent;
134                 boolean_t       hasAttachments;
135                 boolean_t       isNew;
136                 // other flags for status (read, unopened, etc.)
137 };
138
139
140 class DmxMailbox
141 {
142         public:
143                 DmxMailbox (void);
144
145                 DtMail::MailBox *mbox;
146                 int             messageCount;
147                 int             newMessages;
148                 int             firstNew;
149                 char            *name;
150
151                 void            loadMessages (void);
152                 void            createHeaderRequest (DtMailHeaderRequest &);
153                 void            printMailboxInfo (void);
154
155                 DmxMsg          msg [1024];
156 };
157
158
159
160 #endif // _DMX_HH