Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
/* $XConsortium: AliasListUiItem.hh /main/4 1996/04/21 19:44:13 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _ALIASLISTUIITEM_HH
#define _ALIASLISTUIITEM_HH
#ifdef DEAD_WOOD
extern void handleDoubleSelection(Widget w, XtPointer clientdata, XtPointer calldata);
#endif /* DEAD_WOOD */
// CLASS AliasListUiItem
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class AliasListUiItem : public ListUiItem {
public:
AliasListUiItem(Widget w, int source, char *search_key, Widget w_k, Widget w_v);
virtual ~AliasListUiItem(){;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
Widget getKeyWidget(){ return key_widget;};
Widget getValueWidget(){ return value_widget;};
DtVirtArray<PropStringPair *> *getItemList(){ return list_items; };
virtual void handleAddButtonPress();
virtual void handleChangeButtonPress();
virtual void handleDeleteButtonPress();
private:
DtVirtArray<PropStringPair *> *list_items;
DtVirtArray<char *> *deleted_items;
Widget key_widget;
Widget value_widget;
};
#endif

View File

@@ -0,0 +1,50 @@
/* $XConsortium: AlternatesListUiItem.hh /main/3 1996/04/21 19:44:17 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _ALTERNATESLISTUIITEM_HH
#define _ALTERNATESLISTUIITEM_HH
// CLASS AlternatesListUiItem
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class AlternatesListUiItem : public ListUiItem {
public:
AlternatesListUiItem(Widget w, int source, char *search_key, Widget w_list);
virtual ~AlternatesListUiItem(){;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
Widget getEntryFieldWidget(){ return entry_field_widget;};
DtVirtArray<PropStringPair *> *getItemList(){ return list_items; };
virtual void handleAddButtonPress();
virtual void handleChangeButtonPress();
virtual void handleDeleteButtonPress();
private:
DtVirtArray<PropStringPair *> *list_items;
DtVirtArray<char *> *deleted_items;
Widget entry_field_widget;
};
#endif

View File

@@ -0,0 +1,50 @@
/* $XConsortium: AntiCheckBoxUiItem.hh /main/4 1996/04/21 19:44:20 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include "CheckBoxUiItem.hh"
#ifndef _ANTICHECKBOXUIITEM_HH
#define _ANTICHECKBOXUIITEM_HH
// CLASS AntiCheckBoxUiItem
// derived class for prop sheet glue items for CheckBox
///////////////////////////////////////////////////////////
class AntiCheckBoxUiItem : public CheckBoxUiItem {
public:
AntiCheckBoxUiItem(Widget w, int source, char *search_key);
virtual ~AntiCheckBoxUiItem(){;}; // we don't alloc any memory
#ifdef DEAD_WOOD
virtual int getType(){ return _ANTICHECKBOX_ITEM; };
virtual int getSource(){ return data_source; };
#endif /* DEAD_WOOD */
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
private:
#ifdef DEAD_WOOD
int data_source;
#endif /* DEAD_WOOD */
};
#endif

View File

@@ -0,0 +1,163 @@
/*
*+SNOTICE
*
*
* $XConsortium: Buffer.hh /main/4 1996/04/21 19:44:23 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILBUFFER_HH
#define _DTMAILBUFFER_HH
#include <stdarg.h>
// these classes are provided in order to have a logical array whose
// size is not known at creation time. The DtMailBuffer class
// holds the data, and for the moment holds the only "write" operation
// (which is append). In addition, to be thread safe, there is
// a separate class for reading, so that you can have separate
// "seek points" in the read buffer in different procedures.
class BufReader;
class Buffer {
protected:
static const int defaultchunksize;
public:
Buffer();
// actually add data. result is # of bytes written. Can
// fail if underlying write fails, or if out of memory.
virtual int appendData(const char *user_buffer, int length) = 0;
// an interator function that gets called so that eventually
// the entire buffer has been passed through
typedef unsigned long (*CallBack)(const char *buffer, int len, va_list);
virtual unsigned long iterate(CallBack, ...) = 0;
// get a new reader object
virtual BufReader *getReader(void) = 0;
virtual int getSize(void) = 0; // get total size of the buffer
protected:
virtual ~Buffer(void);
private:
Buffer(const Buffer&); // try and avoid copies
};
// subsidiary classes
class BufReader {
public:
// actually read data into a user specified buffer
virtual int getData(char *user_buffer, int length) = 0;
virtual ~BufReader(void);
protected:
BufReader();
private:
BufReader(const BufReader &);
};
class BufReaderMemory;
class BufferMemory : public Buffer {
public:
class Chunk;
friend class BufReaderMemory;
BufferMemory(int chunksize);
BufferMemory();
virtual ~BufferMemory(void);
// actually add data. result is # of bytes written. Can
// fail if underlying write fails, or if out of memory.
virtual int appendData(const char *user_buffer, int length);
virtual unsigned long iterate(Buffer::CallBack, ...);
// get a new reader object
virtual BufReader *getReader(void);
virtual int getSize(void); // get total size of the buffer
private:
class Chunk;
BufferMemory(const Buffer&); // try and avoid copies
void initBuffer(int size); // common constructor
int newChunk(int size); // get a new data chunk
Chunk *_firstchunk; // first chunk
Chunk *_lastchunk; // last chunk
int _totalsize; // total size in all buffers
int _chunksize; // size to allocate new buffers
void *_mutex;
BufReaderMemory *_firstreader; // linked list of readers
public:
// aux structure to hold data; no active functions
struct Chunk {
struct Chunk *_nextchunk; // next element in linked list
char *_buffer; // data buffer
int _chunksize; // allocated size of buffer
int _currentend; // current used space
};
// subsidiary classes
};
class BufReaderMemory : protected BufReader {
friend class BufferMemory;
public:
// actually read data into a user specified buffer
virtual int getData(char *user_buffer, int length);
virtual ~BufReaderMemory(void);
private:
BufReaderMemory(const BufReaderMemory &);
BufReaderMemory(BufferMemory *);
BufferMemory::Chunk *_currentchunk;
int _currentoffset;
BufferMemory *_buffer;
BufReaderMemory *_nextreader; // maintain linked list of readers
BufReaderMemory *_prevreader; // maintain linked list of readers
};
#endif // _DTMAILBUFFER_HH

View File

@@ -0,0 +1,49 @@
/* $TOG: CheckBoxUiItem.hh /main/5 1997/11/07 15:44:05 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _CHECKBOXUIITEM_HH
#define _CHECKBOXUIITEM_HH
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <DtMail/PropUi.hh>
// CLASS CheckBoxUiItem
// derived class for prop sheet glue items for CheckBox
///////////////////////////////////////////////////////////
class CheckBoxUiItem : public PropUiItem {
public:
CheckBoxUiItem(Widget w, int source, char *search_key);
virtual ~CheckBoxUiItem(){;}; // we don't alloc any memory
#ifdef DEAD_WOOD
virtual int getType(){ return _CHECKBOX_ITEM; };
virtual int getSource(){ return data_source; };
#endif /* DEAD_WOOD */
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
private:
#ifdef DEAD_WOOD
int data_source;
#endif /* DEAD_WOOD */
};
#endif

View File

@@ -0,0 +1,49 @@
/* $TOG: CheckForMailUiItem.hh /main/1 1998/02/17 15:19:39 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <DtMail/SpinBoxUiItem.hh>
#ifndef _CHECKFORMAILUIITEM_HH
#define _CHECKFORMAILUIITEM_HH
// CLASS CheckForMailUiItem
// derived class for prop sheet glue items for SpinBox
///////////////////////////////////////////////////////////
class CheckForMailUiItem : public SpinBoxUiItem {
public:
static DtVirtArray<CheckForMailUiItem *> *_checkformail_ui;
static int _initialized;
int _valueChanged;
CheckForMailUiItem(Widget w, int source, char *search_key);
virtual ~CheckForMailUiItem(){;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
static void valueChangedCB(Widget, XtPointer, XtPointer);
private:
DtVirtArray<PropUiItem*> *_linked_pui;
};
#endif

View File

@@ -0,0 +1,38 @@
/*
*+SNOTICE
*
* $XConsortium: Common.h /main/4 1996/04/21 19:44:30 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement between
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel without
* Sun's specific written approval. This document and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _COMMON_H
#define _COMMON_H
#include <unistd.h>
#include <nl_types.h>
// XPG3 compatible. NL_CAT_LOCALE is set to non-zero in XPG4. Use NL_CAT_LOCALE
// for all catopen() calls.
#if defined(sun) && (_XOPEN_VERSION == 3)
#undef NL_CAT_LOCALE
#define NL_CAT_LOCALE 0
// If NL_CAT_LOCALE is not defined in other platforms, set it to 0
#elif !defined(NL_CAT_LOCALE)
#define NL_CAT_LOCALE 0
#endif
#endif // _COMMON_H

View File

@@ -0,0 +1,56 @@
/* $XConsortium: CustomListUiItem.hh /main/4 1996/04/21 19:44:33 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _CUSTOMLISTUIITEM_HH
#define _CUSTOMLISTUIITEM_HH
#ifdef DEAD_WOOD
void handleDoubleSelection(Widget w, XtPointer clientdata, XtPointer calldata);
#endif /* DEAD_WOOD */
// CLASS CustomListUiItem
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class CustomListUiItem : public ListUiItem {
public:
CustomListUiItem(Widget w, int source, char *search_key, Widget w_k, Widget w_v);
virtual ~CustomListUiItem(){;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
Widget getKeyWidget(){ return key_widget;};
Widget getValueWidget(){ return value_widget;};
DtVirtArray<PropStringPair *> *getItemList(){ return list_items; };
virtual void handleAddButtonPress();
virtual void handleChangeButtonPress();
virtual void handleDeleteButtonPress();
private:
DtVirtArray<PropStringPair *> *list_items;
DtVirtArray<char *> *deleted_items;
Widget key_widget;
Widget value_widget;
};
#endif

View File

@@ -0,0 +1,75 @@
/*
*+SNOTICE
*
*
* $XConsortium: Dictionary.hh /main/4 1996/04/21 19:44:36 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTM_DICTIONARY_HH
#define _DTM_DICTIONARY_HH
#include "DtVirtArray.hh"
class DtMailDictionaryImpl : public DtCPlusPlusAllocator {
public:
// The hash_size must be <= 256. Setting to smaller sizes
// will reduce the memory used by the dictionary, but may increase
// the hash collisions resulting in slower performance.
//
DtMailDictionaryImpl(int hash_size = 256);
~DtMailDictionaryImpl(void);
void set(const char * key, const void * value);
const void * lookup(const char * key);
void remove(const char * key);
private:
struct Entry : public DtCPlusPlusAllocator {
char * key;
const void * value;
};
typedef DtVirtArray<Entry *> * HashTable_t;
HashTable_t *_hash_table;
int _hash_size;
void *_obj_mutex;
int hashValue(const char * key);
void locate(int hash_value, const char * key, Entry ** entry);
};
template <class Element>
class DtMailDictionary : public DtCPlusPlusAllocator {
public:
DtMailDictionary(int hash_size = 256) : _dict(hash_size) { }
~DtMailDictionary(void) { }
void set(const char * key, const Element value) { _dict.set(key, value); }
const Element lookup(const char * key) {
return((const Element)_dict.lookup(key));
}
void remove(const char * key) { _dict.remove(key); }
private:
DtMailDictionaryImpl _dict;
};
#endif

View File

@@ -0,0 +1,37 @@
/*
*+SNOTICE
*
*
* $XConsortium: DtLanguages.hh /main/4 1996/04/21 19:44:39 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTLANGUAGES_HH
#define _DTLANGUAGES_HH
#include <stddef.h>
// The DtCPlusPlusAllocator class is provided to allow C applications
// to access the C++ implementation. C applications will not typically
// have access to new and delete so they are over ridden here.
//
class DtCPlusPlusAllocator {
public:
static void * operator new(size_t size);
static void operator delete(void * ptr);
};
#endif

View File

@@ -0,0 +1,278 @@
/*
*+SNOTICE
*
*
* $XConsortium: DtMail.h /main/4 1996/04/21 19:44:43 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAIL_H
#define _DTMAIL_H
#include <Tt/tttk.h>
#include "DtMailTypes.h"
#include "DtMailProps.h"
#include "DtMailError.hh"
#include "DtMailValues.hh"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__STDC__) || defined(__cplusplus)
/* Mail Session and Administration API */
/* API spec sections 3.2.1 - 3.2.8 */
extern DtMailSession DtMailCreateSession(DtMailEnv *,
const char *);
extern void DtMailCloseSession(DtMailEnv *,
DtMailSession,
DtMailBoolean);
extern int DtMailGetMinorCode(DtMailEnv *);
extern const char * DtMailGetErrorString(DtMailEnv *);
extern const char ** DtMailEnumerateImpls(DtMailSession,
DtMailEnv *);
extern void DtMailSetDefaultImpl(DtMailSession,
DtMailEnv *,
const char *);
extern const char * DtMailGetDefaultImpl(DtMailSession,
DtMailEnv *);
extern void DtMailQueryImpl(DtMailSession,
DtMailEnv *,
const char *,
const char *,
...);
/* MailBox methods. */
/* API spec sections 3.2.9 - 3.2.20 */
extern DtMailMailBox DtMailMailBoxConstruct(DtMailSession,
DtMailEnv *,
DtMailObjectSpace,
void *,
DtMailCallback,
void *);
extern void DtMailMailBoxDestruct(DtMailMailBox);
extern void DtMailMailBoxCreate(DtMailMailBox,
DtMailEnv *);
extern void DtMailMailBoxOpen(DtMailMailBox,
DtMailEnv *,
DtMailBoolean);
extern DtMailMessageHandle DtMailMailBoxGetFirstMessageSummary (DtMailMailBox,
DtMailEnv *,
const DtMailHeaderRequest *,
DtMailHeaderLine **);
extern DtMailMessageHandle DtMailMailBoxGetNextMessageSummary (DtMailMailBox,
DtMailEnv *,
DtMailMessageHandle,
const DtMailHeaderRequest *,
DtMailHeaderLine **);
extern DtMailMessage DtMailMailBoxGetMessage(DtMailMailBox,
DtMailEnv *
DtMailMessageHandle);
extern DtMailMessage DtMailMailBoxGetFirstMessage(DtMailMailBox,
DtMailEnv *);
extern DtMailMessage DtMailMailBoxGetNextMessage(DtMailMailBox,
DtMailEnv *,
DtMailMessage);
extern DtMailMessage DtMailMailBoxNewMessage(DtMailMailBox,
DtMailEnv *);
extern const char * DtMailMailBoxImpl(DtMailMailBox,
DtMailEnv *);
/* Header API Methods */
/* API spec sections 3.2.21 - 3.2.23 */
extern DtMailHeaderRequest * DtMailHeaderRequestCreate(DtMailEnv *,
const int);
extern void DtMailHeaderRequestDestroy(DtMailHeaderRequest *,
DtMailEnv *);
extern void DtMailHeaderLineDestroy (DtMailHeaderLine *,
DtMailEnv *);
/* Message methods. */
/* API spec sections 3.2.24 - 3.2.35 */
extern DtMailMessage DtMailMessageConstruct(DtMailEnv *,
DtMailSession,
const char *,
DtMailCallback,
void *);
extern void DtMailMessageCreate(DtMailMessage,
DtMailEnv *);
extern void DtMailMessageOpen(DtMailMessage,
DtMailEnv *
DtMailBoolean);
extern void DtMailMessageDestruct(DtMailMessage);
extern DtMailEnvelope DtMailMessageGetEnvelope(DtMailMessage,
DtMailEnv *);
extern int DtMailMessageGetBodyCount(DtMailMessage,
DtMailEnv *);
extern DtMailBodyPart DtMailMessageGetFirstBodyPart(DtMailMessage,
DtMailEnv *);
extern DtMailBodyPart DtMailMessageGetNextBodyPart(DtMailMessage,
DtMailEnv *,
DtMailBodyPart);
extern DtMailBodyPart DtMailMessageNewBodyPart(DtMailMessage,
DtMailEnv *,
DtMailBodyPart);
extern void DtMailMessageNewBodyPartOrder (DtMailMessage,
DtMailEnv *,
DtMailBodyPart *,
int);
// TOGO extern CMContainer DtMailMessageContainer(DtMailMessage,
// TOGO DtMailEnv *);
extern const char * DtMailMessageImpl(DtMailMessage,
DtMailEnv *);
/* Envelope Methods */
/* API spec sections 3.2.36 - 3.2.41 */
extern DtMailHeaderHandle DtMailEnvelopeGetFirstHeader(DtMailEnvelope,
DtMailEnv *,
char **,
DtMailValueSeq *);
extern DtMailHeaderHandle DtMailEnvelopeGetNextHeader(DtMailEnvelope,
DtMailEnv *,
DtMailHeaderHandle,
char **,
DtMailValueSeq *);
extern void DtMailEnvelopeGetHeader(DtMailEnvelope,
DtMailEnv *,
const char *,
const DtMailBoolean,
DtMailValueSeq *);
extern void DtMailEnvelopeSetHeaderSeq(DtMailEnvelope,
DtMailEnv *,
const char *,
const DtMailValueSeq *);
extern void DtMailEnvelopeSetHeader(DtMailEnvelope,
DtMailEnv *,
const char *,
const DtMailValueSeq *,
DtMailBoolean);
extern void DtMailEnvelopeDestruct(DtMailEnvelope);
/* BodyPart methods. */
/* API spec sections 3.2.42 - 3.2.49 */
extern DtMailHeaderHandle DtMailBodyPartGetFirstHeader(DtMailBodyPart,
DtMailEnv *,
char **,
DtMailValueSeq **);
extern DtMailHeaderHandle DtMailBodyPartGetNextHeader(DtMailBodyPart,
DtMailEnv *,
DtMailHeaderHandle,
char **,
DtMailValueSeq **);
extern void DtMailBodyPartGetHeader(DtMailBodyPart,
DtMailEnv *,
const char *,
const DtMailBoolean,
DtMailValueSeq *);
extern void DtMailBodyPartSetHeaderSeq(DtMailBodyPart,
DtMailEnv *,
const char *,
const DtMailValueSeq *);
extern void DtMailBodyPartSetHeader(DtMailBodyPart,
DtMailEnv *,
const DtMailValueSeq *,
DtMailBoolean);
extern void DtMailBodyPartGetContents(DtMailBodyPart,
DtMailEnv *,
void **,
unsigned long *,
char **,
char **,
int *,
char *);
extern void DtMailBodyPartSetContents(DtMailBodyPart,
DtMailEnv *,
const void *,
const unsigned long,
const char *,
const char *,
const int,
const char *);
extern void DtMailBodyPartDestruct(DtMailBodyPart);
/* Transport Methods. */
/* API spec sections 3.2.57 - 3.2.59 */
extern DtMailTransport DtMailTranportConstruct(DtMailSession,
DtMailEnv *,
const char *);
extern const char ** DtMailTransportEnumerate(DtMailSession,
DtMailEnv *);
extern DtMailTransportSubmit(DtMailTransport,
DtMailEnv *,
DtMailMessage);
#else /* __STDC__ */
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,914 @@
/*
*+SNOTICE
*
*
* $TOG: DtMail.hh /main/18 1998/11/10 17:02:07 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef I_HAVE_NO_IDENT
#endif
#ifndef _DTMAIL_HH
#define _DTMAIL_HH
#include <stdio.h>
#include <stdarg.h>
#include <sys/stat.h>
/*#include <nl_types.h>*/
#include <DtMail/DtMailError.hh>
#include <DtMail/DtMailProps.h>
#include <DtMail/DtMailTypes.h>
#include <DtMail/DtVirtArray.hh>
#include <DtMail/DtLanguages.hh>
#include <Tt/tttk.h>
#include <fcntl.h>
// Define a type for the handler used in RFCTransport::launchSendmail
typedef void SubProcessFinishedProc (int pid, int status, void *data);
//
// Gorp to get mailrc to work
//
#define HSHSIZE 40
#define MAILRC_NOFILE 20 /* this define is here for */
/* compatibility purposes only */
/* and will be removed in a */
/* later release */
#ifdef __osf__
struct hash;
struct var;
#endif
// enums cannot be declared inside of classes because the enum scope rules
// changed from V2 to V3 compilers causing incompatibilities
//
enum DtmFileLocality {
Dtm_FL_UNKNOWN, // cannot determine file locality
Dtm_FL_LOCAL, // file is local to this system (eg ufs)
Dtm_FL_LOCAL_AND_REMOTE, // file is remote with local copy (eg cachefs)
Dtm_FL_REMOTE // file is remote (e.g. nfs)
};
class DtMail {
public:
// Returns the minor code set by a DtMail routine. This method
// should only be called if error._major is not NO_EXCEPTION.
//
// Parameters:
// error - The environment returned from any DtMail method.
//
// Returns - The error code as defined in DtMailError.h
//
static DTMailError_t getMinorCode(DtMailEnv & error);
// Returns the internationalized error text for an error. This
// method should only be called if error._major is not NO_EXCEPTION.
//
// Parameters:
// error - The environment returned from any DtMail method.
//
// Returns - The error text string. This string is valid until
// error.clear() is called on the error.
//
static const char * getErrorString(DtMailEnv & error);
// Determine locality of referenced path object
// This is not part of the public interface, do not call
// as a client of this class.
static enum DtmFileLocality DetermineFileLocality(const char * path);
class MailBox;
class Message;
class Transport;
class MailRc;
class Session : public DtCPlusPlusAllocator {
public:
Session(DtMailEnv &, const char * app_name);
~Session(void);
const char ** enumerateImpls(DtMailEnv & error);
void setDefaultImpl(DtMailEnv & error, const char * impl);
const char * getDefaultImpl(DtMailEnv & error);
void queryImpl(DtMailEnv & error,
const char * impl,
const char * capability,
...);
void queryImplV(DtMailEnv & error,
const char * impl,
const char * capability,
va_list args);
// Create a mail box object, after selecting an implementation.
MailBox * mailBoxConstruct(DtMailEnv & error,
DtMailObjectSpace space,
void * arg,
DtMailCallback open_callback,
void * client_data,
const char * impl = NULL);
Message * messageConstruct(DtMailEnv & error,
DtMailObjectSpace space,
void * arg,
DtMailCallback open_callback,
void * client_data,
const char * impl = NULL);
// Create a transport object after selecting an implementation.
Transport * transportConstruct(DtMailEnv & error,
const char * impl,
DtMailStatusCallback call_back,
void * client_data);
// Retrieve a copy of the MailRc handle.
MailRc * mailRc(DtMailEnv & error);
// The following methods set up the polling requirements for
// the DtMail library.
//
DtMailBoolean pollRequired(DtMailEnv & error);
int eventFileDesc(DtMailEnv & error);
void poll(DtMailEnv & error);
// The expandPath method will turn a relative path, with
// variable's into an absolute path, relative to the current
// network node.
//
char * expandPath(DtMailEnv & error, const char * path);
char * getRelativePath(DtMailEnv & error, const char * path);
// Accessors to session data.
const char * appName(void) const { return _app_name; }
char * ttChannel(void) const { return _tt_channel; }
int ttFile(void) const { return _tt_fd; }
// Meta factory type. This method gives access to the
// factory and the implementations specific query
// mechanisms.
typedef void * (*MetaImplFactory)(const char * operation);
// The setError method needs to be here so it can be accessed
// by the drivers.
//
void setError(DtMailEnv & error, const DTMailError_t);
// Add an event routine.
void addEventRoutine(DtMailEnv &,
DtMailEventFunc,
void * client_data,
time_t interval);
// Remove an event routine.
void removeEventRoutine(DtMailEnv &,
DtMailEventFunc,
void * client_data);
// Push some data into the event queue.
//
void writeEventData(DtMailEnv & error,
const void * buf,
const unsigned long size);
// These routines check the list to make sure the created
// object is still valid. This is used by the event handlers
// to make sure events don't appear for deleted objects.
//
DtMailBoolean validObjectKey(DtMailObjectKey);
DtMailObjectKey newObjectKey(void);
void removeObjectKey(DtMailObjectKey);
// This method allows the client to register a busy callback.
// Any time the library is going to be busy for a while, it will
// call this handler to set the app state to busy, and unbusy
// the app when it is done. This is an optional interface.
//
typedef void (*BusyApplicationCallback)(DtMailEnv &error,
DtMailBusyState busy_state,
void * client_data);
void registerBusyCallback(DtMailEnv &,
BusyApplicationCallback,
void * client_data);
#ifdef DEAD_WOOD
void unregisterBusyCallback(DtMailEnv &);
#endif /* DEAD_WOOD */
void setBusyState(DtMailEnv &, DtMailBusyState busy_state);
void setAutoSaveFlag(DtMailBoolean flag);
DtMailBoolean getAutoSaveFlag();
// These methods allow disabling and enabling of group privileges
//
typedef void (*DisableGroupPrivilegesCallback)(void * client_data);
typedef void (*EnableGroupPrivilegesCallback)(void * client_data);
void registerDisableGroupPrivilegesCallback(
DisableGroupPrivilegesCallback,
void * client_data);
void registerEnableGroupPrivilegesCallback(
EnableGroupPrivilegesCallback,
void * client_data);
void disableGroupPrivileges(void);
void enableGroupPrivileges(void);
// This method allows the client to register a callback that
// can be called to return the last time() an interactive X
// event was processed.
// Any time the library is about to be busy for a while, it
// may call this handler to get the time() that the last
// interactive X event was processed. It was very recent, the
// library may wish to delay the busy event for a while.
//
typedef long (*LastInteractiveEventTimeCallback)(void * client_data);
void registerLastInteractiveEventTimeCallback(
LastInteractiveEventTimeCallback,
void * client_data);
long lastInteractiveEventTime(void);
// For CHARSET
int OpenLcxDb(void);
void DtXlateStdToOpLocale(char *op, char *std, char *dflt,
char **ret);
void DtXlateOpToStdLocale(char *op, char *opLoc, char **retLoc,
char **ret_retLang, char **retSet);
void DtXlateStdToOpCodeset(char *op, char *std, char *dflt,
char **ret);
void DtXlateMimeToIconv(const char *, const char *, const char *,
char **, char **);
void DtXlateLocaleToMime(const char *, const char *,
const char *, char **);
char *csToConvName(char *);
char *locToConvName();
char *targetConvName();
char *targetTagName();
char *targetTagName(char *);
int csConvert(char **, unsigned long &, int, char *, char *);
// End of For CHARSET
private:
unsigned long _object_signature;
void *_obj_mutex;
char * _tt_channel;
int _tt_fd;
int _event_fd[2];
char *_app_name;
MailRc * _mail_rc;
DtMailBoolean _canAutoSave;
/* Implementation structure. */
struct Impls {
char *impl_name;
MetaImplFactory impl_meta_factory;
void *impl_lib;
};
Impls *_impls;
const char **_impl_names; // Used to return names from enumerate.
int _num_impls;
int _default_impl;
struct EventRoutine : public DtCPlusPlusAllocator {
DtMailEventFunc routine;
void * client_data;
time_t interval;
time_t last_ran;
};
DtVirtArray<EventRoutine *> _events;
DtVirtArray<DtMailObjectKey> _valid_keys;
DtMailObjectKey _cur_key;
void buildImplTable(DtMailEnv & error);
void buildTypeTable(DtMailEnv & error);
int lookupImpl(const char * impl);
BusyApplicationCallback _busy_cb;
void * _busy_cb_data;
DisableGroupPrivilegesCallback _disableGroupPrivileges_cb;
void * _disableGroupPrivileges_cb_data;
EnableGroupPrivilegesCallback _enableGroupPrivileges_cb;
void * _enableGroupPrivileges_cb_data;
LastInteractiveEventTimeCallback _interactive_time_cb;
void * _interactive_time_cb_data;
};
//==================NEW MAILRC CLASS
class MailRc {
public:
MailRc(DtMailEnv &, Session *);
~MailRc();
int encryptedLength(int length);
void encryptValue(char *to, char *from, int length);
int decryptValue(char *to, char *from, int length);
void getValue(
DtMailEnv &,
const char * var, const char ** value,
DtMailBoolean decrypt = DTM_FALSE);
void setValue(
DtMailEnv &,
const char * var, const char * value,
DtMailBoolean encrypt = DTM_FALSE);
void removeValue(DtMailEnv &, const char * var);
const char * getAlias(DtMailEnv &, const char * name);
typedef void (*hm_callback)(char * key, void * value,
void * client_data);
void getAliasList(hm_callback stuffing_func, void *client_data);
void setAlias(DtMailEnv &, const char * name, const char * value);
void removeAlias(DtMailEnv &, const char * name);
DtVirtArray<char *> *getAliasList();
DtMailBoolean ignore(DtMailEnv &, const char *name);
void addIgnore(DtMailEnv &, const char * name);
void removeIgnore(DtMailEnv &, const char * name);
DtVirtArray<char *> *getIgnoreList();
const char * getAlternates(DtMailEnv &);
void setAlternate(DtMailEnv &, const char * alt);
void removeAlternate(DtMailEnv &, const char * alt);
void update(DtMailEnv &);
// Methods below this line are not part of the public interface.
// They must be declared public due to implementation restrictions.
// DO NOT CALL THESE AS A CLIENT OF THIS CLASS.
//
int load(char *filename, char* line);
void init_globals();
static void add_alias(char *name, char *value);
static void mt_assign(char *name,char * val);
static int mt_deassign(char *s);
static void mt_puthash(
char *name,
char * val,
struct var **hasharray);
static void mt_scan(FILE * outf);
static char *vcopy(char *str);
static int group(char **argv, DtMail::MailRc *);
static void wgroup(const char *, char **, FILE *);
static void ngroup(char * key, void * value, void * client_data);
static void nalias(char * key, void * data, void * client_data);
static void nignorelist(char *key, void *data, void *client_data);
static int unset(char **arglist, DtMail::MailRc *);
static void wunset(
const char * verbatim,
char ** arglist,
FILE * outf);
static int set(char **arglist, DtMail::MailRc *);
static void wset(const char *, char **, FILE *);
static int source(char **arglist, DtMail::MailRc *);
static void wsource(const char *, char **, FILE *);
static int ifcmd(char **arglist, DtMail::MailRc *);
static void wifcmd(const char *, char **, FILE *);
static int elsecmd(char **arglist, DtMail::MailRc *);
static void welsecmd(const char *, char **, FILE *);
static int endifcmd(char **arglist, DtMail::MailRc *);
static void wendifcmd(const char *, char **, FILE *);
static int igfield(char **list, DtMail::MailRc *);
static void wigfield(const char *, char **, FILE *);
static void nigfield(char * key, void * value, void * client_data);
static int clearaliases(char **list, DtMail::MailRc *);
static void wclearaliases(const char *, char **, FILE *);
static void *hm_alloc();
static void *hm_test(struct hash **table, char *key);
static void hm_delete(struct hash **table, char *key);
static void hm_add(struct hash **table,
char *key,
void *value,
int size);
static void hm_mark(struct hash **table, char * key);
static int hm_ismarked(struct hash **table, char * key);
static void hm_scan(
struct hash **table,
hm_callback,
void * client_data);
static void free_hash(struct hash *h);
static int hash_index(char *key);
static void add_ignore(char *name);
static void add_alternates(char *name);
static int alternates(char **namelist, DtMail::MailRc *);
static void walternates(const char *, char **, FILE *);
static void nalternates(
char * key,
void * value,
void * client_data);
static char *nullfield;
static Boolean clearAliases;
struct globals {
char *g_myname;
void *g_ignore; /* hash list of ignored fields */
void *g_retain; /* hash list of retained fields */
void *g_alias; /* hash list of alias names */
void *g_alternates; /* hash list of alternate names */
int g_nretained; /* the number of retained fields */
};
static struct globals glob;
/* Pointer to active var list */
static struct var *variables[HSHSIZE];
DTMailError_t getParseError(void) { return _parseError; }
protected:
void updateByLine(FILE * in, FILE * out);
void outputLine(
const char * verbatim,
const char * parseable,
FILE * out);
int commands(char* line);
int execute(char linebuf[]);
int readline(FILE *ibuf, char *linebuf);
void unstack();
int isprefix(char *as1, char *as2);
void *lex(char word[]);
int getrawlist(char line[], char ** argv, int argc);
void freerawlist(char **argv);
char *mt_value(char name[]);
char *expand(char *);
int getfolderdir(char *);
static int hash(char *name);
static void vfree(char *cp);
private:
DTMailError_t _parseError;
FILE *input;
int sourcing;
int cond;
int ssp; /* Top of file stack */
char *alternate_list;
char *_mailrc_name;
static struct var *lookup(char *name, struct var **hasharray);
struct sstack {
FILE *s_file; /* File we were in. */
int s_cond; /* Saved state of conditionals */
};
struct sstack sstack[MAILRC_NOFILE];
};
class Envelope;
class BodyPart;
class Message : public DtCPlusPlusAllocator {
public:
virtual ~Message(void);
virtual Envelope * getEnvelope(DtMailEnv &) = 0;
// This should only be used when you REALLY need to know
// how many body parts are present before actually traversing
// the body parts (i.e. like when writing a MIME format message).
virtual int getBodyCount(DtMailEnv &) = 0;
virtual BodyPart * getFirstBodyPart(DtMailEnv &) = 0;
virtual BodyPart * getNextBodyPart(DtMailEnv &,
BodyPart * last) = 0;
virtual BodyPart * newBodyPart(DtMailEnv &,
BodyPart * after) = 0;
#ifdef DEAD_WOOD
virtual void newBodyPartOrder(DtMailEnv &,
BodyPart * new_order,
const int bodypart_count) = 0;
#endif /* DEAD_WOOD */
virtual void setFlag(DtMailEnv &,
const DtMailMessageState) = 0;
virtual void resetFlag(DtMailEnv &,
const DtMailMessageState) = 0;
virtual DtMailBoolean flagIsSet(DtMailEnv &,
const DtMailMessageState) = 0;
virtual time_t getDeleteTime(DtMailEnv &) = 0;
virtual void toBuffer(DtMailEnv & error, DtMailBuffer &) = 0;
virtual const char * impl(DtMailEnv & error) = 0;
// The mail box method is used by the components of
// the message object to determine which mail box the
// belong to, and in turn which session.
//
MailBox * mailBox(void);
Session * session(void);
protected:
Message(DtMailEnv &,
MailBox * parent);
MailBox * _parent;
Session * _session;
Envelope * _envelope;
void * _obj_mutex;
};
class Envelope : public DtCPlusPlusAllocator {
public:
virtual DtMailHeaderHandle getFirstHeader(
DtMailEnv &,
char ** name,
DtMailValueSeq & value) = 0;
virtual DtMailHeaderHandle getNextHeader(
DtMailEnv &,
DtMailHeaderHandle last,
char ** name,
DtMailValueSeq & value) = 0;
virtual void getHeader(DtMailEnv &,
const char * name,
const DtMailBoolean abstract,
DtMailValueSeq & value) = 0;
virtual void setHeaderSeq(DtMailEnv &,
const char * header_name,
const DtMailValueSeq & val) = 0;
// The last parameter is left to the client to provide
// because it can not be done in a type safe manner.
//
virtual void setHeader(DtMailEnv &,
const char * header_name,
const DtMailBoolean replace,
const char *) = 0;
virtual void removeHeader(DtMailEnv &,
const char * header_name) = 0;
//
// fix for the defect 177527
// when a reply-to field is in a message headers, the reply-to is
// going to be displayed as the send in RMW's msg list scrolled window
// instead of the real sender. The following three public methods are
// going to access _use_reply_to.
//
virtual void setUseReplyTo(void) = 0;
virtual void unsetUseReplyTo(void) = 0;
virtual DtMailBoolean getUseReplyTo(void) = 0;
protected:
Envelope(DtMailEnv & error, Message * parent);
friend Message::~Message(void);
virtual ~Envelope(void); // Only called from Message destructor.
void * _obj_mutex;
Message * _parent;
};
class BodyPart : public DtCPlusPlusAllocator {
public:
virtual void lockContents(DtMailEnv &, const DtMailLock) = 0;
virtual void unlockContents(DtMailEnv &) = 0;
virtual void getContents(DtMailEnv &,
const void ** contents,
unsigned long * length,
char ** type,
char ** name,
int * mode,
char ** description) = 0;
virtual void getContentType(DtMailEnv &,
char ** content_type) = 0;
virtual void setContents(DtMailEnv &,
const void * contents,
const unsigned long length,
const char * type,
const char * name,
const int mode,
const char * description) = 0;
virtual void setFlag(DtMailEnv &,
DtMailBodyPartState) = 0;
virtual void resetFlag(DtMailEnv &,
DtMailBodyPartState) = 0;
virtual DtMailBoolean flagIsSet(DtMailEnv &,
DtMailBodyPartState) = 0;
virtual time_t getDeleteTime(DtMailEnv &) = 0;
virtual void getHeader(DtMailEnv &,
const char * name,
const DtMailBoolean abstract,
DtMailValueSeq & value) = 0;
// For CHARSET
//-------------------------------------------
// These methods are duplicated in class BodyPart
// (also being implemented in class Session) because
// RFCFormat and RFCBodyPart need to access them.
// Duplicating routines like what is being done here is a workaround
// for an implementation bug/hole because there is no class where global
// routines can be defined (and be accessed by any class).
// class Session is not a proper place to put (global) methods because
// not every class can get at Session.
// RFCFormat accesses these routines through its private Session handle.
// RFCBodyPart does not have a Session handle.
// Hence the need to duplicate the following routines.
virtual int OpenLcxDb(void) = 0;
virtual void DtXlateStdToOpLocale(char *op, char *std, char *dflt,
char **ret) = 0;
virtual void DtXlateOpToStdLocale(char *op, char *opLoc, char **retLoc,
char **ret_retLang, char **retSet) = 0;
virtual void DtXlateMimeToIconv(const char *, const char *,
const char *, char **, char **) = 0;
virtual void DtXlateLocaleToMime(const char *, const char *,
const char *, char **) = 0;
virtual char *csToConvName(char *) = 0;
virtual char *locToConvName() = 0;
virtual char *targetConvName() = 0;
virtual char *targetTagName() = 0;
virtual int csConvert(char **, unsigned long &, int,
char *, char *) = 0;
//-------------------------------------------
virtual char *csFromContentType(DtMailValueSeq & value) = 0;
// End of For CHARSET
#ifdef DEAD_WOOD
virtual DtMailChecksumState checksum(DtMailEnv &) = 0;
#endif /* DEAD_WOOD */
protected:
BodyPart(DtMailEnv &, Message * parent);
friend Message::~Message(void);
virtual ~BodyPart(void); // Only called from Message destructor.
void * _obj_mutex;
Message * _parent;
};
// The MailBox encapsulates the concept of a mail box as a container.
// This class should be used for manipulating mail containers.
class MailBox : public DtCPlusPlusAllocator {
public:
// Create a MailBox. The constructor simply initializes the
// instance and sets the appropriate meta handlers for mail
// containers.
//
// Errors:
// None.
//
MailBox(DtMailEnv &,
Session * session,
DtMailObjectSpace space,
void * arg,
DtMailCallback cb,
void * clientData);
// Returns DTM_TRUE if the is mail box is writable and DTM_FALSE
// if the mail box is read only.
//
DtMailBoolean mailBoxWritable(DtMailEnv &);
// Destroy a MailBox. The destructor will close the open mail
// container, and any embedded containers.
//
virtual ~MailBox(void);
static void appendCB(DtMailEnv&, char*, int, void *clientData);
virtual void append(DtMailEnv &error, char *buf, int len) = 0;
// Create a named mail container in the file system. The
// container will be truncated if it already exists, otherwise
// it will be created. The mode in this case will be set to
// DTMAIL_DEFAULT_CREATE_MODE, the default for mail.
//
// Errors:
// DTME_ObjectInvalid - The instance was not proprerly initialized.
// DTME_BadArg - The file_name parameter was invalid.
// DTME_ObjectInUse - This object already has an open container.
// DTME_ObjectCreationFailed - A required object could not
// be created.
//
virtual void create(DtMailEnv &,
mode_t mode = DTMAIL_DEFAULT_CREATE_MODE) = 0;
// Open a named mail container in the file system. The container
// must exist, and be readable (at least) by the user.
// If the container is writable by the user it will be opened
// for update.
//
// Parameters:
// auto_create - Create the container if it doesn't exist, using
// MailBox::create.
//
// Errors:
// DTME_ObjectInvalid - The instance was not proprerly initialized.
// DTME_BadArg - The file_name parameter was invalid.
// DTME_ObjectInUse - This object already has an open container.
// DTME_ObjectCreationFailed - A required object could not
// be created.
// DTME_NoSuchFile - The file doesn't exist & auto_create is false.
// DTME_NotMailBox - The object is a container, but not a mail box.
// DTME_NoMemory - A memory allocation failed.
//
virtual void open(DtMailEnv & error,
DtMailBoolean auto_create = DTM_TRUE,
int open_mode = DTMAIL_DEFAULT_OPEN_MODE,
mode_t create_mode = DTMAIL_DEFAULT_CREATE_MODE,
DtMailBoolean lock_flag = DTM_TRUE,
DtMailBoolean auto_parse = DTM_TRUE) = 0;
// (Un)locks an open mailbox.
virtual void lock() = 0;
virtual void unlock() = 0;
virtual void save() = 0;
#ifdef DEAD_WOOD
virtual int messageCount(DtMailEnv & error) = 0;
#endif /* DEAD_WOOD */
virtual DtMailMessageHandle getFirstMessageSummary(
DtMailEnv & error,
const DtMailHeaderRequest & header_list,
DtMailHeaderLine & header_line) = 0;
virtual DtMailMessageHandle getNextMessageSummary(
DtMailEnv & error,
DtMailMessageHandle last,
const DtMailHeaderRequest & header_list,
DtMailHeaderLine & header_line) = 0;
virtual void getMessageSummary(
DtMailEnv & error,
DtMailMessageHandle handle,
const DtMailHeaderRequest &,
DtMailHeaderLine &) = 0;
virtual void clearMessageSummary(
DtMailHeaderLine &) = 0;
virtual Message * getMessage(
DtMailEnv & error,
DtMailMessageHandle message_handle) = 0;
virtual Message * getFirstMessage(DtMailEnv &) = 0;
virtual Message * getNextMessage(DtMailEnv &, Message * last) = 0;
virtual Message * newMessage(DtMailEnv &) = 0;
virtual void copyMessage(DtMailEnv &, Message *) = 0;
virtual void copyMailBox(DtMailEnv &, MailBox *) = 0;
virtual void disableMailRetrieval() = 0;
virtual void enableMailRetrieval() = 0;
virtual void checkForMail(
DtMailEnv &,
const DtMailBoolean already_locked = DTM_FALSE) = 0;
virtual void createMailRetrievalAgent(char *password = NULL) = 0;
virtual void deleteMailRetrievalAgent() = 0;
virtual void updateMailRetrievalPassword(char *password = NULL) = 0;
virtual void expunge(DtMailEnv &) = 0;
virtual const char * impl(DtMailEnv & error) = 0;
// This method is typically used to propagate the session
// to embedded objects, such as Messages which may need to
// acquire the session to which it belongs.
//
virtual Session * session(void);
virtual void callCallback(DtMailCallbackOp, void *) = 0;
virtual void startAutoSave(
DtMailEnv & error,
DtMailBoolean start=DTM_TRUE) = 0;
typedef void (*err_func)(char *,Boolean,void *);
void registerErrMsgFunc(err_func,void * client_data);
void unregisterErrMsgFunc(DtMailEnv &);
void showError(char *);
void hideAccessEvents(DtMailBoolean onoff)
{_hide_access_events = onoff;}
DtMailObjectKey getObjectKey(void)
{return _key;}
private:
err_func _errmsg_func;
void * _err_data;
protected:
DtMailBoolean _hide_access_events;
DtMailObjectKey _key;
Session *_session;
void *_arg;
DtMailObjectSpace _space;
DtMailCallback _callback;
void *_cb_data;
void *_obj_mutex;
DtMailBoolean _mail_box_writable;
mode_t _default_mode; // Default mode for file.
};
class Transport : public DtCPlusPlusAllocator {
public:
virtual DtMailOperationId submit(
DtMailEnv &,
Message * msg,
DtMailBoolean log_msg = DTM_FALSE) = 0;
// SendMsgDialog initiates a send. It needs to set information
// needed to exec sendmail by calling these init functions.
// getSendmailReturnProc returns a handler so that SendMsgDialog
// can use it in XtAppAddInput.
virtual void initTransportData(int fds[2],
SubProcessFinishedProc proc, void *ptr) = 0;
virtual void *getSendmailReturnProc(void) = 0;
virtual void callCallback(DtMailOperationId, void * arg);
protected:
Transport(DtMailEnv &, Session *, DtMailStatusCallback, void *);
virtual ~Transport(void);
DtMailObjectKey _key;
Session * _session;
DtMailStatusCallback _callback;
void * _cb_data;
void * _obj_mutex;
};
private:
friend class MailBox;
friend class Message;
friend class Envelope;
friend class BodyPart;
friend class Transport;
friend class EmbeddedMessage;
friend class FileMessage;
friend class FileShare;
friend class Session;
static void setError(
Session &,
DtMailEnv & error,
DTMailError_t minor_code);
};
#endif

View File

@@ -0,0 +1,412 @@
/*
*+SNOTICE
*
*
* $TOG: DtMailError.hh /main/15 1999/03/26 16:59:10 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILERROR_H
#define _DTMAILERROR_H
#include <DtMail/DtMailTypes.h>
#include <stdlib.h>
#include <stdarg.h>
#include <Tt/tt_c.h>
#include <nl_types.h>
//
// Name of the messaging database file.
//
extern const char * DtMailCatalogDataFile;
static const int MailErrorSet = 1;
static const int SockErrorSet = 2;
static const int ValuesErrorSet = 2;
static const int FileShareMsgSet = 2;
//
// NOTE - IMPORTANT -- READ ME
//
// The order of the definitions below must match the
// strings in libDtMail/Common/DtMailError.C
//
typedef enum {
DTME_NoError,
DTME_AlreadyLocked,
DTME_BadArg,
DTME_BadMailAddress,
DTME_BadRunGroup,
DTME_FileCreateFailed,
DTME_FolderNotSet,
DTME_GetLockRefused,
DTME_ImplFailure,
DTME_InitializationFailed,
DTME_InternalFailure,
DTME_InvalidError,
DTME_InvalidOperationSequence,
DTME_MD5ChecksumFailed,
DTME_MailTransportFailed,
DTME_NoDataType,
DTME_NoImplementations,
DTME_NoMailBox,
DTME_NoMemory,
DTME_NoMsgCat,
DTME_NoNewMail,
DTME_NoObjectValue,
DTME_NoSuchFile,
DTME_NoSuchImplementation,
DTME_NoSuchType,
DTME_NoUser,
DTME_NotInbox,
DTME_NotLocked,
DTME_NotMailBox,
DTME_NotSupported,
DTME_ObjectAccessFailed,
DTME_ObjectCreationFailed,
DTME_ObjectInUse,
DTME_ObjectInvalid,
DTME_OpenContainerInterrupted,
DTME_OperationInvalid,
DTME_OtherOwnsWrite,
DTME_RequestDenied,
DTME_TTFailure,
DTME_TransportFailed,
DTME_UnknownFormat,
DTME_UnknownOpenError,
DTME_UserAbort,
DTME_UserInterrupted,
DTME_ObjectReadOnly,
DTME_NoPermission,
DTME_IsDirectory,
DTME_CannotRemoveStaleMailboxLockFile,
DTME_CannotCreateMailboxLockFile,
DTME_CannotCreateMailboxLockFile_NoPermission,
DTME_CannotCreateMailboxLockFile_IsDirectory,
DTME_CannotCreateMailboxLockFile_NoSuchFile,
DTME_CannotCreateMailboxLockFile_RemoteAccessLost,
DTME_CannotObtainInformationOnOpenMailboxFile,
DTME_CannotCreateTemporaryMailboxFile,
DTME_CannotCreateTemporaryMailboxFile_NoPermission,
DTME_CannotCreateTemporaryMailboxFile_IsDirectory,
DTME_CannotCreateTemporaryMailboxFile_NoSuchFile,
DTME_CannotCreateTemporaryMailboxFile_RemoteAccessLost,
DTME_CannotSetPermissionsOfTemporaryMailboxFile,
DTME_CannotSetOwnerOfTemporaryMailboxFile,
DTME_CannotSetGroupOfTemporaryMailboxFile,
DTME_CannotWriteToTemporaryMailboxFile,
DTME_CannotWriteToTemporaryMailboxFile_ProcessLimitsExceeded,
DTME_CannotWriteToTemporaryMailboxFile_RemoteAccessLost,
DTME_CannotWriteToTemporaryMailboxFile_NoFreeSpaceLeft,
DTME_CannotReadNewMailboxFile,
DTME_CannotReadNewMailboxFile_OutOfMemory,
DTME_CannotRemoveMailboxLockFile,
DTME_CannotRenameNewMailboxFileOverOld,
DTME_InternalAssertionFailure,
DTME_ResourceParsingNoEndif,
DTME_AlreadyOpened,
DTME_OutOfSpace,
DTME_CannotCreateMailboxDotDtmailLockFile,
DTME_MailboxInodeChanged,
DTME_MailServerAccess_AuthorizationFailed,
DTME_MailServerAccess_Error,
DTME_MailServerAccess_MissingPassword,
DTME_MailServerAccess_ProtocolViolation,
DTME_MailServerAccess_ServerTimeoutError,
DTME_MailServerAccess_SocketIOError,
DTME_AppendMailboxFile_Error,
DTME_AppendMailboxFile_FileTooBig,
DTME_AppendMailboxFile_LinkLost,
DTME_AppendMailboxFile_NoSpaceLeft,
DTME_AppendMailboxFile_SystemError,
DTME_GetmailCommandRetrieval_SystemError,
DTME_GetmailCommandRetrieval_AbnormalExit,
DTME_PathElementPermissions,
DTME_PathElementNotDirectory,
DTME_PathElementDoesNotExist,
DTME_MailServerAccessInfo_SocketOpen,
DTME_MailServerAccessInfo_NoMessages,
DTME_MailServerAccessInfo_RetrievingMessage,
DTME_MailServerAccessInfo_MessageTooLarge,
DTME_MAXDTME
} DTMailError_t;
//
// Make a class wrapper for errors so that we can set/clear
// errors easier.
//
class DtMailEnv {
public:
void clear(); // Sets everything to no error, and frees memory.
//
// logError() and logFatalError():
//
// This will print out in a formated way all of the error information
// that it can. it also sends the results to the system log device for
// bug tracking.
//
// First it will format the error message to be returned.
// Then if the _client message is set it will be printed.
//
// %m is used to insert the system supplied message into the supplied
// format (see syslog(3)):
//
// error.logError(DTM_FALSE, "I got an error: number %d\n %m , error_code);
//
// The format may be in a system specific way.
//
void logError(DtMailBoolean criticalError,
const char *format, ...) const;
#ifdef DEAD_WOOD
//
// This one is the same as logError() plus it sets _fatal.
//
void logFatalError(DtMailBoolean criticalError,
const char *format, ...);
#endif /* DEAD_WOOD */
//
// Set the error code. Tt_message is optional.
//
// Fatal here is within the scope of the function called,
// not necessarily the program. If the program can recover - it should.
//
void setError(const DTMailError_t,
DtMailBoolean fatal,
Tt_message = NULL);
void vSetError(const DTMailError_t minor_code,
DtMailBoolean fatal,
Tt_message msg,
... );
void setError(const DTMailError_t,
const Tt_message = NULL);
const char * errnoMessage(int systemErrorNumber);
const char * errnoMessage();
void setClient(void *);
void * getClient(void) { return _client; }
DtMailBoolean isSet() const; // Returns DTM_TRUE if there was an error.
DtMailBoolean isNotSet() const; // !IsSet()
DtMailBoolean isFatal() const;// Returns DTM_TRUE if the error was fatal.
DtMailBoolean isNotFatal() const; // !IsFatal()
//
// Cast operators. While:
//
// DtMailEnv error;
//
// // You can say....
//
// const Tt_message msg = (const Tt_message)error;
//
// const CMEnv env = (const CMEnv*)error;
//
// printf("%s %d", (const char*)error, (DTMailError_t)error);
//
operator const char*();
operator const Tt_message() const;
operator DTMailError_t() const;
//
// Constructor/Destructor
//
DtMailEnv(); // The constructor will set everything to no error.
~DtMailEnv(); // Sets everything to no error, and frees memory.
//
// Message catalog.
//
static nl_catd _errorCatalog;
static char *getMessageText(int set, int msg, char *dft);
protected:
//
// The implementation specific function pointer and the _client
// variable below was designed for use C++ API.
//
//
// NOTES:
// 1) CPP == C++.
// 2) THESE FUNCTON POINTERS >>>EXPECT<<< TO CALL MT-SAFE FUNCTIONS.
//
// Implmentation specific error messages are here.
// The pointer to the client data is in _client.
//
// Pointer to function for C++ 'clear', 'message', and
// 'code' functions provided to this class from the implementation.
// They are set using setCPP(...) function.
//
// This is for functions that use the C++ calling conventions.
//
// The CPPclearF points to a function provided by
// the implementation to clear the error and free any
// data assoicated with the _client specific data.
//
// The CPPmessageF points to a function provided by
// the implementation to return the error 'message' assoicated with
// the _client specific data.
// --THE PROVIDED FUNCTION MUST RETURN NULL WHEN THERE IS NO ERROR.
//
// The CPPerrorF points to a function provided by
// the implementation to return the error 'code' assoicated with
// the _client specific data.
// --THE PROVIDED FUNCTION MUST RETURN ZERO (0) WHEN THERE IS NO ERROR.
//
// void setClient(void *), sets the value of _client.
//
// C
typedef void (*CPPclearF)(void *);
typedef const char * (*CPPmessageF)(void *);
typedef int (*CPPerrorF)(void *);
void setCPP(CPPclearF, CPPmessageF, CPPerrorF);
void implClear();
#ifdef DEAD_WOOD
const char * implGetMessage();
int implGetError();
#endif /* DEAD_WOOD */
private:
DTMailError_t _error; // The corrected error number.
DTMailError_t _error_minor_code; // The original error number
const char *_message; // The error message.
Tt_message _tt_message; // ToolTalk error message.
DtMailBoolean _fatal; // DTM_TRUE if this is a fatal error.
void getErrorMessageText(void);
//
// Function pointers for implementation specific clear,
// get message, and get error functions.
//
CPPclearF _implClearFunc; // C function that will clear the error.
CPPmessageF _implMessageFunc; // C function that will get the error msg.
CPPerrorF _implErrorFunc; // C function that will get the error code.
//
// Where the implementation stores the data.
//
void *_client; // Implmentation specific message.
//
// Has syslog been opened?
//
static DtMailBoolean _syslog_open;
//
// Message catalog.
//
static const char * DtMailCatalogDataFile;
};
// Inline member functions.
inline void
DtMailEnv::setCPP(CPPclearF clear, CPPmessageF message, CPPerrorF code)
{
_implClearFunc = clear;
_implMessageFunc = message;
_implErrorFunc = code;
}
inline
DtMailEnv::~DtMailEnv()
{
clear();
if (_client)
free(_client);
}
inline void
DtMailEnv::setError(const DTMailError_t err, const Tt_message msg)
{
setError(err, DTM_FALSE, msg);
}
inline DtMailBoolean
DtMailEnv::isSet() const
{
return(_error == DTME_NoError ? DTM_FALSE : DTM_TRUE);
}
inline DtMailBoolean
DtMailEnv::isNotSet() const
{
return(_error == DTME_NoError ? DTM_TRUE : DTM_FALSE);
}
inline DtMailBoolean
DtMailEnv::isFatal() const
{
return(_fatal);
}
inline DtMailBoolean
DtMailEnv::isNotFatal() const
{
return(_fatal == DTM_TRUE ? DTM_FALSE : DTM_TRUE);
}
inline void
DtMailEnv::setClient(void *client)
{
_client = client;
}
inline
DtMailEnv::operator const char*()
{
if (_message == NULL)
getErrorMessageText();
return(_message == NULL ? "Unknown" : _message);
}
inline
DtMailEnv::operator const Tt_message() const
{
return(_tt_message);
}
inline
DtMailEnv::operator DTMailError_t() const
{
return(_error);
}
inline void
DtMailEnv::implClear()
{
if (_client != NULL && _implClearFunc != NULL) {
(*_implClearFunc)(_client);
}
}
#ifdef DEAD_WOOD
inline Tt_message
DtMailError_getTTmsg(DtMailEnv & error)
{
return((const Tt_message)error); // The prefered way.
}
#endif /* DEAD_WOOD */
#endif // _DTCM_HH

View File

@@ -0,0 +1,35 @@
/*
*+SNOTICE
*
*
* $XConsortium: DtMailP.hh /main/4 1996/04/21 19:44:46 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILP_HH
#define _DTMAILP_HH
// This method will write a single mail message to a file, in
// the correct SVID format.
//
void RFCWriteMessage(DtMailEnv & error,
DtMail::Session * session,
const char * path,
DtMail::Message * msg);
void DtMailProcessClientEvents(void);
#endif

View File

@@ -0,0 +1,58 @@
/*
*+SNOTICE
*
*
* $TOG: DtMailProps.h /main/5 1998/02/17 12:33:15 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILPROPS_H
#define _DTMAILPROPS_H
/*
* The following list of properties represent the abstract names
* that are understood by the mail library.
*/
#define DtMailMessageTo "Dt:Mail:Message:To"
#define DtMailMessageSender "Dt:Mail:Message:Sender"
#define DtMailMessageCc "Dt:Mail:Message:Cc"
#define DtMailMessageBcc "Dt:Mail:Message:Bcc"
#define DtMailMessageReceivedTime "Dt:Mail:Message:ReceivedTime"
#define DtMailMessageSentTime "Dt:Mail:Message:SentTime"
#define DtMailMessageMessageId "Dt:Mail:Message:MessageId"
#define DtMailMessageSubject "Dt:Mail:Message:Subject"
#define DtMailMessageContentLength "Dt:Mail:Message:ContentLength"
#define DtMailMessageStatus "Dt:Mail:Message:Status"
#define DtMailMessageDeleteState "Dt:Mail:Message:Delete:State"
#define DtMailMessageV3charset "Dt:Mail:Message:V3charset"
#define DtMailMessageContentType "Dt:Mail:Message:ContentType"
/*
* The following 2 headers are used to retrieve the To and CC lines,
* modified for replying to the message. This may be different than
* the entire To and CC contents.
*/
#define DtMailMessageToReply "Dt:Mail:Message:To:Reply"
#define DtMailMessageCcReply "Dt:Mail:Message:Cc:Reply"
/* The following properties are defined for DtMailQueryImpl use. */
#define DtMailCapabilityPropsSupported "Dt:Mail:Capability:PropsSupported"
#define DtMailCapabilityImplVersion "Dt:Mail:Capability:ImplVersion"
#define DtMailCapabilityInboxName "Dt:Mail:Capability:InboxName"
#define DtMailCapabilityMailspoolName "Dt:Mail:Capability:MailspoolName"
#define DtMailCapabilityTransport "Dt:Mail:Capability:Transport"
#endif

View File

@@ -0,0 +1,397 @@
/*
*+SNOTICE
*
*
* $TOG: DtMailServer.hh /main/11 1999/01/29 11:49:00 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef I_HAVE_NO_IDENT
#endif
#ifndef _DTMAIL_SERVER_HH
#define _DTMAIL_SERVER_HH
#include <stdio.h>
#include <stdarg.h>
#include <DtMail/DtMail.hh>
#include <DtMail/DtMailTypes.h>
#include <DtMail/DtVirtArray.hh>
#define DTMAS_INBOX "INBOX"
#define DTMAS_PROTO_NONE "NONE"
#define DTMAS_PROTO_APOP "APOP"
#define DTMAS_PROTO_AUTO "AUTO"
#define DTMAS_PROTO_IMAP "IMAP"
#define DTMAS_PROTO_POP2 "POP2"
#define DTMAS_PROTO_POP3 "POP3"
/* definitions for buffer sizes -- somewhat arbitrary */
#define DTMAS_TIMEOUT 10 /* timeout with server */
#define DTMAS_IDSIZE 128 /* length of UIDL message ID */
#define DTMAS_MSGBUFSIZE 4096 /* size of msg read buffer */
#define DTMAS_POPBUFSIZE 512 /* per RFC 937 */
#define DTMAS_TAGSIZE 6 /* len of tagged proto tag */
#define DTMAS_PROPKEY_GETMAILCOMMAND "getmailcommand"
#define DTMAS_PROPKEY_GETMAILVIACOMMAND "getmailviacommand"
#define DTMAS_PROPKEY_GETMAILVIASERVER "getmailviaserver"
#define DTMAS_PROPKEY_GETMAILVIASYSTEM "getmailviasystem"
#define DTMAS_PROPKEY_INBOXPATH "inboxpath"
#define DTMAS_PROPKEY_PASSWORD "password"
#define DTMAS_PROPKEY_PROTOCOL "protocol"
#define DTMAS_PROPKEY_PROTOLOGGING "protologging"
#define DTMAS_PROPKEY_PROTOLOGGINGPLUS "protologgingplus"
#define DTMAS_PROPKEY_REMEMBERPASSWORD "rememberpassword"
#define DTMAS_PROPKEY_REMOTENAME "remotename"
#define DTMAS_PROPKEY_REMOVEAFTERDELIVERY "removeafterdelivery"
#define DTMAS_PROPKEY_RETRIEVEOLD "retrieveold"
#define DTMAS_PROPKEY_SERVERNAME "servername"
#define DTMAS_PROPKEY_SHOWCONFIRMATION "showretrievalconfirmation"
#define DTMAS_PROPKEY_TIMEOUT "timeout"
#define DTMAS_PROPKEY_USERNAME "username"
#define DTMAS_PROPDFLT_GETMAILCOMMAND ""
#define DTMAS_PROPDFLT_GETMAILVIACOMMAND "f"
#define DTMAS_PROPDFLT_GETMAILVIASERVER "f"
#define DTMAS_PROPDFLT_GETMAILVIASYSTEM ""
#define DTMAS_PROPDFLT_PASSWORD ""
#define DTMAS_PROPDFLT_PROTOCOL DTMAS_PROTO_POP3
#define DTMAS_PROPDFLT_PROTOLOGGING "f"
#define DTMAS_PROPDFLT_PROTOLOGGINGPLUS "f"
#define DTMAS_PROPDFLT_REMEMBERPASSWORD "f"
#define DTMAS_PROPDFLT_REMOVEAFTERDELIVERY ""
#define DTMAS_PROPDFLT_RETRIEVEOLD ""
#define DTMAS_PROPDFLT_SERVERNAME ""
#define DTMAS_PROPDFLT_SHOWCONFIRMATION "f"
#define DTMAS_PROPDFLT_TIMEOUT "30"
#define DTMAS_PROTOCOL_ERROR(pname) \
{ \
if (_errorlogging) \
{ \
DtMailEnv error; \
error.logError(DTM_FALSE, (const char*) "%s: protocol error\n", pname); \
} \
return PS_ERROR; \
}
#define DTMAS_CONCAT_MAILRC_KEY(buf, pfx, key) \
{ if (NULL==(pfx)) (void) sprintf((buf), "%s", (key)); \
else (void) sprintf((buf), "%s_%s", (pfx), (key)); }
typedef void (*DtMailAppendCallback)(DtMailEnv&, char*, int, void*);
class DtMailServer : public DtCPlusPlusAllocator
{
public:
friend class AUTOServer;
DtMailServer(char*, DtMail::Session*, DtMail::MailBox*,
DtMailAppendCallback, void*);
~DtMailServer();
static int get_mailrc_value(
DtMail::Session*,
char*, char*,
int dflt = 0);
static char *get_mailrc_value(
DtMail::Session*,
char*, char*,
char*dflt = NULL,
DtMailBoolean decrypt = DTM_FALSE);
static Boolean get_mailrc_value(
DtMail::Session*,
char*, char*,
Boolean dflt = False);
void set_password(char *);
virtual void retrieve_messages(DtMailEnv&);
protected:
//
// Protocol specific access methods
//
virtual DTMailError_t ptrans_authorize(char*) = 0;
virtual DTMailError_t ptrans_delete(int) = 0;
virtual int ptrans_msgisold(int) = 0;
virtual DTMailError_t ptrans_fldstate_expunge() = 0;
virtual DTMailError_t ptrans_fldstate_read(int*, int*)= 0;
virtual DTMailError_t ptrans_msgsizes(int, int*) = 0;
virtual DTMailError_t ptrans_parse_response(char*) = 0;
virtual DTMailError_t ptrans_quit() = 0;
virtual DTMailError_t ptrans_retrieve_start(int, int*) = 0;
virtual DTMailError_t ptrans_retrieve_end(int) = 0;
//
// Protocol specific characteristics
//
virtual int proto_is_delimited() = 0;
virtual int proto_is_peek_capable() = 0;
virtual int proto_is_tagged() = 0;
virtual char *proto_name() = 0;
virtual int proto_port() = 0;
virtual int proto_requires_password() = 0;
//
// Server related Access Protocol data
//
DtMailAppendCallback _append_mailbox_cb;
void *_append_mailbox_cb_data;
char *_errorstring;
char *_folder;
DtMailEnv _info;
DtMailEnv _logger;
char _msgbuf[DTMAS_MSGBUFSIZE];
char *_password;
Boolean _protologging;
Boolean _protologgingplus;
Boolean _removeafterdelivery;
Boolean _retrieveold;
int _retrieveerrors;
char *_servername;
DtMail::Session *_session;
DtMail::MailBox *_mailbox;
int _sizelimit;
void *_sockfp;
char *_shroud; // String to shroud in debug output.
char _transtag[DTMAS_TAGSIZE];
// Tag of the current transaction.
int _transnum; // Number of the current transaction.
int _timeout; // Timeout seconds waiting for server.
char *_username;
//
// Generic Access Protocol methods
//
DTMailError_t do_send(char *fmt, ...);
DTMailError_t do_transaction(char *fmt, ...);
Boolean is_inbox();
DTMailError_t ptrans_retrieve_readandappend(DtMailEnv&, long);
void send_info_message(DtMailCallbackOp);
static void vtalarm_handler(int);
void vtalarm_setitimer(int);
};
class AUTOServer : public DtMailServer
{
public:
AUTOServer(char*, DtMail::Session*, DtMail::MailBox*,
DtMailAppendCallback, void*);
~AUTOServer();
virtual void retrieve_messages(DtMailEnv&);
protected:
//
// Protocol specific methods
//
virtual DTMailError_t ptrans_authorize(char*);
virtual DTMailError_t ptrans_delete(int);
virtual int ptrans_msgisold(int);
virtual DTMailError_t ptrans_fldstate_expunge();
virtual DTMailError_t ptrans_fldstate_read(int*, int*);
virtual DTMailError_t ptrans_msgsizes(int, int*);
virtual DTMailError_t ptrans_parse_response(char*);
virtual DTMailError_t ptrans_quit();
virtual DTMailError_t ptrans_retrieve_start(int, int*);
virtual DTMailError_t ptrans_retrieve_end(int);
//
// Protocol characteristics
//
virtual int proto_is_delimited()
{ return _server->proto_is_delimited(); }
virtual int proto_is_peek_capable()
{ return _server->proto_is_peek_capable(); }
virtual int proto_is_tagged()
{ return _server->proto_is_tagged(); }
virtual char *proto_name()
{ return _server->proto_name(); }
virtual int proto_port()
{ return _server->proto_port(); }
virtual int proto_requires_password()
{ return _server->proto_requires_password(); }
#define AUTO_POP3 0
#define AUTO_APOP 1
#define AUTO_IMAP 2
#define AUTO_POP2 3
#define AUTO_NPROTOCOLS 4
DtMailServer *_server;
};
class IMAPServer : public DtMailServer
{
public:
IMAPServer(char*, DtMail::Session*, DtMail::MailBox*,
DtMailAppendCallback, void*);
~IMAPServer();
virtual void retrieve_messages(DtMailEnv&);
protected:
//
// Protocol specific methods
//
virtual DTMailError_t ptrans_authorize(char*);
virtual DTMailError_t ptrans_delete(int);
virtual int ptrans_msgisold(int);
virtual DTMailError_t ptrans_fldstate_expunge()
{ return do_transaction("EXPUNGE"); }
virtual DTMailError_t ptrans_fldstate_read(int*, int*);
virtual DTMailError_t ptrans_msgsizes(int, int*);
virtual DTMailError_t ptrans_parse_response(char*);
virtual DTMailError_t ptrans_quit()
{ return do_transaction("LOGOUT"); }
virtual DTMailError_t ptrans_retrieve_start(int, int*);
virtual DTMailError_t ptrans_retrieve_end(int);
//
// Protocol characteristics
//
virtual int proto_is_delimited() { return FALSE; }
virtual int proto_is_peek_capable() { return TRUE; }
virtual int proto_is_tagged() { return TRUE; }
virtual char *proto_name() { return strdup(DTMAS_PROTO_IMAP); }
virtual int proto_port() { return 143; }
virtual int proto_requires_password() { return TRUE; }
int _count;
int _imap4;
int _recent;
int _seen;
int _unseen;
};
class POP2Server : public DtMailServer
{
public:
POP2Server(char*, DtMail::Session*, DtMail::MailBox*,
DtMailAppendCallback, void*);
~POP2Server();
virtual void retrieve_messages(DtMailEnv&);
protected:
//
// Protocol specific methods
//
virtual DTMailError_t ptrans_authorize(char*);
virtual DTMailError_t ptrans_delete(int)
{ return DTME_NoError; }
virtual int ptrans_msgisold(int);
virtual DTMailError_t ptrans_fldstate_expunge()
{ return DTME_NoError; }
virtual DTMailError_t ptrans_fldstate_read(int*, int*);
virtual DTMailError_t ptrans_msgsizes(int, int*);
virtual DTMailError_t ptrans_parse_response(char*);
virtual DTMailError_t ptrans_quit()
{ return do_transaction("QUIT"); }
virtual DTMailError_t ptrans_retrieve_start(int, int*);
virtual DTMailError_t ptrans_retrieve_end(int);
//
// Protocol characteristics
//
virtual int proto_is_delimited() { return FALSE; }
virtual int proto_is_peek_capable() { return FALSE; }
virtual int proto_is_tagged() { return FALSE; }
virtual char *proto_name() { return strdup(DTMAS_PROTO_POP2); }
virtual int proto_port() { return 109; }
virtual int proto_requires_password() { return TRUE; }
int _pound_arg;
int _equal_arg;
};
class POP3Server : public DtMailServer
{
public:
POP3Server(char*, DtMail::Session*, DtMail::MailBox*,
DtMailAppendCallback, void*);
~POP3Server();
virtual void retrieve_messages(DtMailEnv&);
protected:
//
// Protocol specific methods
//
virtual DTMailError_t ptrans_authorize(char*);
virtual DTMailError_t ptrans_delete(int);
virtual int ptrans_msgisold(int);
virtual DTMailError_t ptrans_fldstate_expunge()
{ return DTME_NoError; }
virtual DTMailError_t ptrans_fldstate_read(int*, int*);
virtual DTMailError_t ptrans_msgsizes(int, int*);
virtual DTMailError_t ptrans_parse_response(char*);
virtual DTMailError_t ptrans_quit()
{ return do_transaction("QUIT"); }
virtual DTMailError_t ptrans_retrieve_start(int, int*);
virtual DTMailError_t ptrans_retrieve_end(int)
{ return DTME_NoError; }
//
// Protocol characteristics
//
virtual int proto_is_delimited() { return TRUE; }
virtual int proto_is_peek_capable() { return FALSE; }
virtual int proto_is_tagged() { return FALSE; }
virtual char *proto_name() { return strdup(DTMAS_PROTO_POP3); }
virtual int proto_port() { return 110; }
virtual int proto_requires_password() { return TRUE; }
int _lastretrieved;
DtVirtArray<char*> *_uidlist_current;
DtVirtArray<char*> *_uidlist_old;
char *_uidlist_file;
DtVirtArray<char*> *uidlist_create();
void uidlist_destroy(DtVirtArray<char*> *uidlist);
char *uidlist_find(
DtVirtArray<char*> *uidlist,
int msg,
char *uid);
void uidlist_read(DtVirtArray<char*> *uidlist);
void uidlist_write(DtVirtArray<char*> *uidlist);
};
class APOPServer : public POP3Server
{
public:
APOPServer(char*, DtMail::Session*, DtMail::MailBox*,
DtMailAppendCallback, void*);
~APOPServer();
protected:
//
// Protocol specific methods
//
virtual DTMailError_t ptrans_authorize(char*);
//
// Protocol characteristics
//
virtual char *proto_name() { return strdup(DTMAS_PROTO_APOP); }
virtual int proto_requires_password() { return TRUE; }
};
#endif // _DTMAIL_SERVER_HH

View File

@@ -0,0 +1,35 @@
/*
*+SNOTICE
*
*
* $XConsortium: DtMailSigChld.h /main/4 1996/04/21 19:44:52 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILSIGCHLD_H
#define _DTMAILSIGCHLD_H
#ifdef __cplusplus
extern "C" {
#endif
void ChildExitNotify(const int pid, const int status);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,173 @@
/*
*+SNOTICE
*
*
* $TOG: DtMailTypes.h /main/9 1998/11/10 17:02:58 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILTYPES_H
#define _DTMAILTYPES_H
#include <DtMail/DtMailValues.hh>
//
// Default file open mode when creating a new mail file (i.e. folder),
// or opening an existing one.
// NOTE: there are two create modes, one for use if mail groups are not
// required, and the other for use if mail groups are required. This
// decision is made in the creating code
#define DTMAIL_DEFAULT_CREATE_MODE 0600
#define DTMAIL_DEFAULT_CREATE_MODE_MAILGROUP 0660
#define DTMAIL_DEFAULT_CREATE_UMASK 0177
#define DTMAIL_DEFAULT_CREATE_UMASK_MAILGROUP 0117
#define DTMAIL_DEFAULT_CREATE_MAILGROUP "mail"
#define DTMAIL_DEFAULT_OPEN_MODE O_RDWR
typedef void * DtMailSession;
typedef void * DtMailMailBox;
typedef void * DtMailMessage;
typedef void * DtMailEnvelope;
typedef void * DtMailBodyPart;
typedef void * DtMailMessageHandle;
typedef void * DtMailHeaderHandle;
typedef void * DtMailTransport;
typedef unsigned long DtMailObjectKey;
typedef enum { DTM_FALSE, DTM_TRUE } DtMailBoolean;
/*
* The callback ops are passed back to the client when the DtMail library
* needs information from the user. Additional operations can be defined by
* specific implementations. These should begin after the DTMC_RESERVED constant.
*/
typedef enum {
DTMC_NOOP = 0,
DTMC_SAVE = 1,
DTMC_REVERT = 2,
DTMC_RAISE = 3,
DTMC_PASSWD = 4,
DTMC_NEWMAIL = 5,
DTMC_DELETEMSG = 6,
DTMC_BADSTATE = 7,
DTMC_UNLOCK = 8,
DTMC_LOSTLOCK = 9,
DTMC_QUERYLOCK = 10,
DTMC_READONLY = 11,
DTMC_READWRITEOVERRIDE = 12,
DTMC_DOTDTMAILLOCKFAILED = 13,
DTMC_INODECHANGED = 14,
DTMC_ACCESSFAILED = 15,
DTMC_SERVERACCESSFAILED = 16,
DTMC_SERVERPASSWORDNEEDED = 17,
DTMC_GETMAILCOMMANDFAILED = 18,
DTMC_SERVERACCESSINFO = 19,
DTMC_SERVERACCESSINFOERROR = 20,
DTMC_RESERVED = 8192
} DtMailCallbackOp;
typedef DtMailBoolean (*DtMailCallback)(DtMailCallbackOp op,
const char * path,
const char * prompt_hint,
void * client_data,
...);
// This forward declaration is needed to resolve a circular dependency
// between DtMailTypes.h and DtMailError.hh
//
class DtMailEnv;
typedef void * DtMailOperationId;
typedef void (*DtMailStatusCallback)(DtMailOperationId,
DtMailEnv & error,
void * client_data);
typedef DtMailBoolean (*DtMailEventFunc)(void * client_data);
typedef struct {
char ** header_name;
int number_of_names;
} DtMailHeaderRequest;
typedef struct {
DtMailValueSeq *header_values;
int number_of_names;
} DtMailHeaderLine;
typedef enum {
DtMailMessageNew = 1,
DtMailMessageDeletePending = 2,
DtMailMessageAnswered = 3,
DtMailMessageMultipart = 4,
DtMailMessagePartial = 8,
DtMailMessageReservedLimit = 8192
} DtMailMessageState;
typedef enum {
DtMailBodyPartDeletePending = 1,
DtMailBodyPartReservedLimit = 8192
} DtMailBodyPartState;
typedef enum {
DtMailCheckUnknown = 0,
DtMailCheckGood = 1,
DtMailCheckBad = 2
} DtMailChecksumState;
typedef enum {
DtMailBusyState_NotBusy = 0,
DtMailBusyState_AutoSave = 1,
DtMailBusyState_NewMail = 2
} DtMailBusyState;
typedef enum {
DtMailFileObject = 1,
DtMailBufferObject = 2,
DtMailReservedObject = 8192
} DtMailObjectSpace;
typedef struct {
void * buffer;
unsigned long size;
} DtMailBuffer;
/* The event packet is written to the event file descriptor.
* This structure is only useful to programs dealing directly with
* the DtMail library events.
*/
typedef enum {
DTM_TARGET_MAILBOX,
DTM_TARGET_TRANSPORT
} DtMailCallbackTarget;
typedef struct {
DtMailObjectKey key;
DtMailCallbackTarget target;
void * target_object;
void * operation;
void * argument;
time_t event_time;
} DtMailEventPacket;
typedef enum {
DtMailLockRead = 1,
DtMailLockWrite = 2
} DtMailLock;
#endif

View File

@@ -0,0 +1,103 @@
/*
*+SNOTICE
*
* $TOG: DtMailValues.hh /main/7 1997/09/03 17:27:15 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreementbertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILVALUE_HH
#define _DTMAILVALUE_HH
#include <DtMail/DtVirtArray.hh>
// Dates consist of a date, and an offset from GMT.
//
#include <time.h>
struct DtMailValueDate : public DtCPlusPlusAllocator {
time_t dtm_date;
time_t dtm_tz_offset_secs;
};
// An address consists of 3 components. The addressee is the string that
// is used by the transport to deliver the mail to the user. The person
// is the string that represents this person in the real world (e.g. Bob Patterson).
// The namespace is used to identify which address space the name belongs to.
// This can be set to DtMailAddressDefault to specify the library should figure
// out the appropriate name space.
//
#define DtMailAddressDefault "Dt:Mail:Address:Default"
struct DtMailValueAddress : public DtCPlusPlusAllocator {
char *dtm_address;
char *dtm_person;
char *dtm_namespace;
DtMailValueAddress(void);
DtMailValueAddress(const DtMailValueAddress &);
DtMailValueAddress(const char * address,
const char * person,
const char * nameSpace);
DtMailValueAddress(const char * address, const int addr_len,
const char * person, const int per_len,
const char * nameSpace);
~DtMailValueAddress(void);
};
class DtMailAddressSeq : public DtVirtArray<DtMailValueAddress *> {
public:
DtMailAddressSeq(int size = 8);
~DtMailAddressSeq(void);
};
class DtMailValue : public DtCPlusPlusAllocator {
public:
DtMailValue(const char * value);
virtual ~DtMailValue(void);
virtual operator const char *(void);
virtual const char * operator= (const char *);
virtual DtMailValueDate toDate(void);
#ifdef DEAD_WOOD
virtual void fromDate(const DtMailValueDate &);
#endif /* DEAD_WOOD */
virtual DtMailAddressSeq * toAddress(void);
#ifdef DEAD_WOOD
virtual void fromAddress(const DtMailAddressSeq & list);
#endif /* DEAD_WOOD */
// This method gives the raw format used to store the value.
//
virtual const char * raw(void);
protected:
char * _value;
};
class DtMailValueSeq : public DtVirtArray<DtMailValue *> {
public:
DtMailValueSeq(int size = 8);
~DtMailValueSeq(void);
void clear(void);
};
#endif

View File

@@ -0,0 +1,39 @@
/*
*+SNOTICE
*
*
* $XConsortium: DtMailXtProc.h /main/4 1996/04/21 19:45:02 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _DTMAILXTPROC_H
#define _DTMAILXTPROC_H
#include <X11/Intrinsic.h>
#ifdef __cplusplus
extern "C" {
#endif
void DtMailXtInputProc(XtPointer, int *, XtInputId *);
extern XtAppContext DtMailDamageContext;
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,72 @@
/*
*+SNOTICE
*
* $TOG: DtVirtArray.hh /main/5 1997/12/23 09:08:16 bill $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement between
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel without
* Sun's specific written approval. This document and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _VIRTARRAY_HH
#define _VIRTARRAY_HH
#include <DtMail/DtLanguages.hh>
class DtVirtArrayImpl : public DtCPlusPlusAllocator {
public:
DtVirtArrayImpl(const int size);
~DtVirtArrayImpl(void);
int length(void);
void * operator[](const int at);
int indexof(void * handle);
int append(void * handle);
void insert(void * handle, const int at);
void remove(const int at);
void remove(void * handle);
private:
void make_slot(const int at);
void grow(void);
void **_elements;
int _size;
int _count;
void *_mutex;
};
template <class Element>
class DtVirtArray : public DtCPlusPlusAllocator {
public:
DtVirtArray(const int size)
: my_array(size) {}
~DtVirtArray(void) {}
int length(void) { return(my_array.length()); }
Element operator[](const int at) { return((Element)my_array[at]); }
int indexof(Element handle) { return(my_array.indexof((void *)handle)); }
int append(Element handle) { return(my_array.append((void *)handle)); }
void insert(Element handle, const int at) { my_array.insert((void *)handle, at); }
void remove(const int at) { my_array.remove(at); }
void remove(Element handle) { my_array.remove((void *)handle); }
private:
DtVirtArrayImpl my_array;
};
#endif

View File

@@ -0,0 +1,56 @@
/* $TOG: EncryptedTextFieldUiItem.hh /main/1 1997/11/07 15:44:39 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _ENCRYPTEDTEXTFIELDUIITEM_HH
#define _ENCRYPTEDTEXTFIELDUIITEM_HH
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <DtMail/DtMailTypes.h>
// derived class for prop sheet glue items for textfield
////////////////////////////////////////////////////////
class EncryptedTextFieldUiItem : public PropUiItem {
public:
EncryptedTextFieldUiItem(
Widget w,
int source,
char *search_key,
PropUiCallback validator = NULL,
void * validator_data = NULL);
virtual ~EncryptedTextFieldUiItem() {if (NULL!=_text) free(_text);};
void writeAllowed(DtMailBoolean);
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
private:
DtMailBoolean _loading;
int _maxtextlen;
char *_text;
DtMailBoolean _writeAllowed;
void validateLength(int);
void verify(XmTextVerifyPtr);
static void verifyCB(Widget, XtPointer, XtPointer);
};
#endif

View File

@@ -0,0 +1,89 @@
/*
*+SNOTICE
*
*
* $TOG: FileShare.hh /main/5 1997/04/29 16:45:06 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _FILESHARE_HH
#define _FILESHARE_HH
#include <DtMail/DtMail.hh>
#include <Tt/tt_c.h>
class FileShare : public DtCPlusPlusAllocator {
public:
FileShare(DtMailEnv & error,
DtMail::Session * session,
const char * path,
DtMailCallback cb_func,
void * clientData);
virtual ~FileShare(void);
void lockFile(DtMailEnv & error);
DtMailBoolean readOnly(DtMailEnv & error);
DtMailBoolean readWriteOverride(DtMailEnv & error);
#ifdef DEAD_WOOD
DtMailBoolean locked(void);
#endif /* DEAD_WOOD */
private:
struct TTHandle : public DtCPlusPlusAllocator {
DtMail::Session *session;
DtMailObjectKey key;
FileShare * self;
};
DtMailObjectKey _key;
DtMail::Session *_session;
char *_path;
TTHandle *_tt_handle;
Tt_pattern *_file_pats;
DtMailBoolean _have_write_access;
DtMailBoolean _other_modified;
DtMailCallback _cb_func;
void *_cb_data;
enum PendingOp {
PENDING_LOCK = 1,
PENDING_SAVE = 2,
PENDING_DESTROY = 3
};
PendingOp _pending;
DtMailBoolean _outstanding;
DtMailBoolean isModified(DtMailEnv & error);
static Tt_message fileCB(Tt_message msg, Tttk_op op,
char * path, void *clientData, int same_euid,
int same_proc);
static Tt_callback_action mt_lock_cb(Tt_message m, Tt_pattern p);
static Tt_message fileRequestCB(Tt_message, Tttk_op,
char *, void *, int, int);
/* _mt_pattern is used to handle tlock and rulock messages from mailtool */
Tt_pattern _mt_pattern;
/* _mt_lock is DTM_TRUE is we use the mailtool locking protocol */
int _mt_lock;
};
#endif

View File

@@ -0,0 +1,83 @@
/*
*+SNOTICE
*
*
* $XConsortium: HashTable.hh /main/4 1996/04/21 19:45:12 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _HASHTABLE_HH
#define _HASHTABLE_HH
#include <DtMail/ObjectKey.hh>
class HashTableImpl : public DtCPlusPlusAllocator {
public:
HashTableImpl(int table_size);
virtual ~HashTableImpl(void);
virtual void * lookup(ObjectKey &);
virtual void set(ObjectKey & key, void * value);
virtual void * remove(ObjectKey & key);
// HP can not support this construct.
// UXP/DS can not support this construct either.
//
#if !defined(HPUX) && !defined(__uxp__)
//
#define HASHTABLE_HASFOREACH
typedef int (*HashImplIterator)(ObjectKey &, void * value, void * client_data);
virtual void forEach(HashImplIterator, void * client_data);
#endif
protected:
struct HashEntry : public DtCPlusPlusAllocator {
ObjectKey * key;
void * value;
HashEntry *next;
};
HashEntry * _hash_table;
int _table_size;
};
template <class Object>
class HashTable : public DtCPlusPlusAllocator {
public:
HashTable(int table_size) : _table(table_size) { }
Object lookup(ObjectKey & key) { return( (Object)((long)_table.lookup(key)) ); }
void set(ObjectKey & key, Object obj) {
_table.set(key, (void *)obj);
}
Object remove(ObjectKey & key) { return( (Object)((long)_table.remove(key)) ); }
#if !defined(HPUX) && !defined(__uxp__)
typedef int (*HashIterator)(ObjectKey &, Object, void * client_data);
void forEach(HashTableImpl::HashImplIterator iterator, void * client_data) {
_table.forEach((HashTableImpl::HashImplIterator)iterator, client_data);
}
#endif
protected:
HashTableImpl _table;
};
#endif

View File

@@ -0,0 +1,104 @@
/*
*+SNOTICE
*
*
* $TOG: IO.hh /main/10 1999/01/29 14:43:20 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef I_HAVE_NO_IDENT
#endif
#ifndef _IO_HH
#define _IO_HH
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <utime.h>
#include <pwd.h>
#include <grp.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <stdio.h>
#include <DtMail/DtMailError.hh>
//
// The following I/O routines are wrappers for the normal routines,
// but they deal with EINTR, and partial read/write situations.
//
int SafeAccess(const char * path, int amode);
int SafeClose(int fd);
int SafeDup2(int fd1, int fd2);
int SafeExecvp(const char * file, char *const *argv);
int SafeFchown(int fd, uid_t owner, gid_t group);
int SafeFChmod(int fd, mode_t mode);
int SafeFStat(int fd, struct stat * buf);
int SafeFTruncate(int fd, off_t len);
int SafeGuaranteedStat(const char * path, struct stat * buf);
int SafeLStat(const char * path, struct stat * buf);
int SafeLink(const char * existingPath, const char * newPath);
int SafeLockf(int fd, int func, long size);
int SafeOpen(const char * path, int oflag, mode_t mode = 0644);
void SafePathIsAccessible(DtMailEnv &error, const char * path);
ssize_t SafeRead(int fd, void * buf, size_t bytes);
int SafeRename(const char * oldPath, const char * newPath);
int SafeRemove(const char * path);
int SafeStat(const char * path, struct stat * buf);
int SafeTruncate(const char * path, off_t len);
int SafeUTime(const char * path, utimbuf * ntime);
int SafeUnlink(const char * path);
ssize_t SafeWrite(int fd, const void * buf, size_t bytes);
unsigned long
SafeWritev(int fd, struct iovec *iov, int iovcnt);
ssize_t SafeWriteStrip(int fd, const void * buf, size_t bytes);
int SafeWaitpid(pid_t proc, int * status, int options);
int SafeWait(int * status);
// The time routines deal with MT and reentrant issues in a platform
// independent way.
//
void SafeCtime(const time_t *clock, char * buf, int buflen = 26);
void SafeLocaltime(const time_t *clock, tm & result);
time_t SafeMktime(tm * timeptr);
size_t SafeStrftime(
char * buf, size_t buf_size,
const char * format, const tm * timeptr);
//
// Interface routines to AF_INET, SOCK_STREAM sockets with line-based
// buffering.
//
void *SockOpen(char *host, int clientPort, char **errorstring);
char *SockGets(char *buf, int len, void *sockfp);
int SockPrintf(void *sockfp, char *format, ...);
int SockRead(char *buf, int size, int nels, void *sockfp);
int SockWrite(char *buf, int size, int nels, void *sockfp);
void SockClose(void *sockfp);
//
// The group and password routines will retrieve the group and
// password names in an MT-Safe way.
//
int FileSystemSpace(const char *file_path, size_t bytes, char **fsname);
void GetGroupName(char * grp_name);
gid_t GetIdForGroupName(char * grp_name);
void GetPasswordEntry(passwd & result);
int isSetMailGidNeeded(const char * mailboxPath);
#endif

View File

@@ -0,0 +1,52 @@
/* $XConsortium: IgnoreListUiItem.hh /main/3 1995/11/06 16:27:06 rswiston $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _IGNORELISTUIITEM_HH
#define _IGNORELISTUIITEM_HH
void handleSelection(Widget, XtPointer, XtPointer );
// CLASS IgnoreListUiItem
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class IgnoreListUiItem : public ListUiItem {
public:
IgnoreListUiItem(Widget w, int source, char *search_key, Widget w_list);
virtual ~IgnoreListUiItem(){;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
virtual void AddDefaults();
Widget getEntryFieldWidget(){ return entry_field_widget;};
DtVirtArray<PropStringPair *> *getItemList(){ return list_items; };
virtual void handleAddButtonPress();
virtual void handleChangeButtonPress();
virtual void handleDeleteButtonPress();
private:
DtVirtArray<PropStringPair *> *list_items;
DtVirtArray<char *> *deleted_items;
Widget entry_field_widget;
};
#endif

View File

@@ -0,0 +1,67 @@
/*
*+SNOTICE
*
*
* $XConsortium: ImplDriver.hh /main/4 1996/04/21 19:45:15 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _IMPLDRIVER_HH
#define _IMPLDRIVER_HH
#include <DtMail/DtMail.hh>
#include <stdarg.h>
static const char * QueryImplEntryOp = "QueryImplEntry";
typedef void (*QueryImplEntry)(DtMail::Session &,
DtMailEnv &,
const char * capability,
va_list args);
static const char * QueryOpenEntryOp = "QueryOpenEntry";
typedef DtMailBoolean (*QueryOpenEntry)(DtMail::Session &,
DtMailEnv &,
DtMailObjectSpace space,
void * arg);
static const char * MailBoxConstructEntryOp = "MailBoxConstructEntryOp";
typedef DtMail::MailBox * (*MailBoxConstructEntry)(DtMail::Session &,
DtMailEnv &,
DtMailObjectSpace space,
void * arg,
DtMailCallback cb,
void * client_data);
static const char * QueryMessageEntryOp = "QueryMessageEntry";
typedef DtMailBoolean (*QueryMessageEntry)(DtMail::Session &,
DtMailEnv &,
DtMailObjectSpace space,
void * arg);
static const char * MessageConstructEntryOp = "MessageConstructEntryOp";
typedef DtMail::Message * (*MessageConstructEntry)(DtMail::Session &,
DtMailEnv &,
DtMailObjectSpace space,
void * arg,
DtMailCallback cb,
void * client_data);
static const char * TransportConstructEntryOp = "TransportConstructEntryOp";
typedef DtMail::Transport * (*TransportConstructEntry)(DtMail::Session &,
DtMailEnv &,
DtMailStatusCallback,
void *);
#endif

View File

@@ -0,0 +1,42 @@
/* $TOG: InboxTextFieldUiItem.hh /main/1 1998/02/17 12:28:13 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _INBOXTEXTFIELDUIITEM_HH
#define _INBOXTEXTFIELDUIITEM_HH
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class InboxTextFieldUiItem : public PropUiItem
{
public:
InboxTextFieldUiItem(
Widget w,
int source,
char *search_key,
PropUiCallback validator = NULL,
void * validator_data = NULL);
virtual ~InboxTextFieldUiItem() {;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
};
#endif

View File

@@ -0,0 +1,81 @@
/* $TOG: IndexedOptionMenuUiItem.hh /main/3 1997/11/07 15:44:49 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
/*
* Common Desktop Environment
*
* (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1995 Novell, Inc.
* (c) Copyright 1995 Digital Equipment Corp.
* (c) Copyright 1995 Fujitsu Limited
* (c) Copyright 1995 Hitachi, Ltd.
*
*
* RESTRICTED RIGHTS LEGEND
*
*Use, duplication, or disclosure by the U.S. Government is subject to
*restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
*Technical Data and Computer Software clause in DFARS 252.227-7013. Rights
*for non-DOD U.S. Government Departments and Agencies are as set forth in
*FAR 52.227-19(c)(1,2).
*Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
*International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A.
*Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
*Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
*Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
*Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
*Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <DtMail/PropUi.hh>
#include "IndexedOptionMenu.h"
#ifndef _INDEXEDOPTIONMENUUIITEM_HH
#define _INDEXEDOPTIONMENUUIITEM_HH
// CLASS IndexedOptionMenuUiItem
// derived class for prop sheet glue items for option menu
///////////////////////////////////////////////////////////
class IndexedOptionMenuUiItem : public PropUiItem {
public:
IndexedOptionMenuUiItem(IndexedOptionMenu *iom, int source, char *search_key);
virtual ~IndexedOptionMenuUiItem(){;}; // we don't alloc any memory
#ifdef DEAD_WOOD
virtual int getType(){ return _INDEXED_OPTIONMENU_ITEM; };
virtual int getSource(){ return data_source; };
#endif /* DEAD_WOOD */
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
private:
static void valueChangedCB(Widget, XtPointer, XtPointer);
#ifdef DEAD_WOOD
int data_source;
#endif /* DEAD_WOOD */
IndexedOptionMenu *_iom;
};
#endif

View File

@@ -0,0 +1,52 @@
/* $XConsortium: ListUiItem.hh /main/4 1996/04/21 19:45:18 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include "PropUi.hh"
#ifndef _LISTUIITEM_HH
#define _LISTUIITEM_HH
// CLASS ListUiItem
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class ListUiItem : public PropUiItem {
public:
ListUiItem(Widget w, int source, char *search_key, DtVirtArray<char *> *alias_list);
virtual ~ListUiItem(){;}; // we don't alloc any memory
#ifdef DEAD_WOOD
virtual int getType(){ return _LIST_ITEM; };
virtual int getSource(){ return data_source; };
#endif /* DEAD_WOOD */
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
virtual void AddDefaults();
virtual void handleAddButtonPress(){;};
virtual void handleChangeButtonPress(){;};
virtual void handleDeleteButtonPress(){;};
private:
#ifdef DEAD_WOOD
int data_source;
#endif /* DEAD_WOOD */
};
#endif

View File

@@ -0,0 +1,52 @@
/* $XConsortium: MoveMenuListUiItem.hh /main/3 1996/04/21 19:45:22 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _MOVEMENULISTUIITEM_HH
#define _MOVEMENULISTUIITEM_HH
void handleMMSelection(Widget, XtPointer, XtPointer);
// CLASS MoveMenuListUiItem
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class MoveMenuListUiItem : public ListUiItem {
public:
MoveMenuListUiItem(Widget w, int source, char *search_key, Widget w_list);
virtual ~MoveMenuListUiItem(){;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
Widget getEntryFieldWidget(){ return entry_field_widget;};
DtVirtArray<PropStringPair *> *getItemList(){ return list_items; };
virtual void handleAddButtonPress();
virtual void handleChangeButtonPress();
virtual void handleDeleteButtonPress();
private:
DtVirtArray<PropStringPair *> *list_items;
DtVirtArray<char *> *deleted_items;
Widget entry_field_widget;
};
#endif

View File

@@ -0,0 +1,50 @@
/*
*+SNOTICE
*
*
* $XConsortium: ObjectKey.hh /main/4 1996/04/21 19:45:25 drk $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _OBJECTKEY_HH
#define _OBJECTKEY_HH
#include <DtMail/DtLanguages.hh>
typedef char * ObjectKeyType;
typedef short HashVal;
class ObjectKey : public DtCPlusPlusAllocator {
public:
ObjectKey(ObjectKeyType type);
ObjectKey(ObjectKey &);
virtual ~ObjectKey(void);
virtual int operator==(ObjectKey &) = 0;
virtual int operator!=(ObjectKey &) = 0;
virtual int operator<(ObjectKey &) = 0;
virtual int operator>(ObjectKey &) = 0;
virtual int operator<=(ObjectKey &) = 0;
virtual int operator>=(ObjectKey &) = 0;
virtual HashVal hashValue(void) = 0;
protected:
ObjectKeyType _type;
HashVal genericHashValue(void * buf, int len);
};
#endif

View File

@@ -0,0 +1,140 @@
/*
*+SNOTICE
*
* $TOG: OptCmd.h /main/12 1999/07/13 08:42:43 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement between
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel without
* Sun's specific written approval. This document and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// This example code is from the book:
//
// Object-Oriented Programming with C++ and OSF/Motif
// by
// Douglas Young
// Prentice Hall, 1992
// ISBN 0-13-630252-1
//
// Copyright 1991 by Prentice Hall
// All Rights Reserved
//
// Permission to use, copy, modify, and distribute this software for
// any purpose except publication and without fee is hereby granted, provided
// that the above copyright notice appear in all copies of the software.
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// OptCmd.h: Display the Mail Options dialog
////////////////////////////////////////////////////////////
#ifndef OPTCMD_H
#define OPTCMD_H
#include "PropUi.hh"
#include "DtVirtArray.hh"
#include "DmxPrintOptions.h"
#include "DtMailGenDialog.hh"
#include "MainWindow.h"
#include "MailRetrievalOptions.h"
#include "WarnNoUndoCmd.h"
#include "options_ui.h"
void vaca_msg_changedCB(Widget w,
XtPointer ClientData,
XtPointer calldata);
void options_set_category_pane(Widget pane);
void opt_help_button_CB(Widget wid, XtPointer clientData, XtPointer calldata);
class OptCmd: public WarnNoUndoCmd {
protected:
virtual void doit(); // Call exit
DtbOptionsDialogInfo _opt_dlog;
public:
OptCmd ( char *, char *, int, Widget parent);
virtual ~OptCmd();
void create_dlog();
void unmanage();
virtual const char *const className () { return "OptCmd"; }
virtual void execute(); // Overrides the AskFirstCmd member function
void update_panes(); // sync up ui with hash tables
void updateUiFromBackEnd(DtVirtArray<PropUiItem *> *list);
void update_source();
void updateBackEndFromUi(DtVirtArray<PropUiItem *> *list);
int doFileLockingCheck();
void doVacationCheck();
void setVacationChanged();
void set_vaca_msg_Changed();
Boolean startVacation();
void stopVacation();
void help_button_CB(Widget pane);
void setNewCategoryStr();
void setOldCategoryStr();
DtMailGenDialog *genDialog() { return generalDialog; }
void setCurrentPane(Widget pane) { CurrentPane = pane; }
Widget currentPane() { return CurrentPane; }
void displayAliasesOptionsPane();
void displayPrintingOptionsPane();
Boolean optionsAreValid();
void displayMailRetrievalOptionsPane();
private:
virtual void init_panes(); // hook up front and back ends
virtual void init_msg_hdr_pane();
virtual void init_msg_view_pane();
virtual void init_compose_pane();
virtual void init_msg_filing_pane();
virtual void init_vacation_pane();
virtual void init_template_pane();
virtual void init_aliases_pane();
virtual void init_advanced_pane();
virtual void init_printing_pane();
virtual void init_mailretrieval_pane();
DtVirtArray<PropUiItem *> *mh_pane_list;
DtVirtArray<PropUiItem *> *msg_view_pane_list;
DtVirtArray<PropUiItem *> *compose_pane_list;
DtVirtArray<PropUiItem *> *msg_filing_pane_list;
DtVirtArray<PropUiItem *> *vacation_pane_list;
DtVirtArray<PropUiItem *> *template_pane_list;
DtVirtArray<PropUiItem *> *aliases_pane_list;
DtVirtArray<PropUiItem *> *advanced_pane_list;
DtVirtArray<PropUiItem *> *printing_pane_list;
DtVirtArray<PropUiItem *> *mailretrieval_pane_list;
Boolean vacation_status_changed;
Boolean vacation_msg_changed;
Boolean _reopen_mailboxes;
XmString vaca_sub;
XmString vaca_msg;
XmString catstr;
DtMailGenDialog *generalDialog;
Widget CurrentPane;
DmxPrintOptions *_PrintingOptions;
MailRetrievalOptions *_MailRetrievalOptions;
};
#endif

View File

@@ -0,0 +1,76 @@
/* $TOG: PropSource.hh /main/6 1997/11/13 13:26:08 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include "DtMail.hh"
#include <DtMail/DtMailTypes.h>
#include <DtMail/DtVirtArray.hh>
#ifndef _PROPSOURCE_HH
#define _PROPSOURCE_HH
struct PropDefaults {
const char * key;
const char * value;
};
// Virtual class is base class for props data accessing funcs
////////////////////////////////////////////////////////////////
class PropSource
{
public:
#define PropSourceDEFAULTVALUE " "
PropSource(DtMail::MailRc *m_rc, char *key);
virtual ~PropSource();
virtual const char *getValue(DtMailBoolean decrypt = DTM_FALSE) = 0;
virtual void setValue(char*, DtMailBoolean encrypt=DTM_FALSE) = 0;
static void setDefaultValue(char *key, char *value);
virtual const char *getDefaultValue(void);
virtual DtMail::MailRc *getMailRc(void) { return _mail_rc; };
protected:
char *_key; // just a pointer NOT our memory
DtMail::MailRc *_mail_rc;
static DtVirtArray<PropDefaults*>
*_dynamic_defaults;
};
// Accesses the mailrc hash tables...
/////////////////////////////////////////////////////////////////
class MailRcSource : public PropSource {
public:
MailRcSource(DtMail::MailRc *m_rc, char *key) : PropSource(m_rc, key) {;};
virtual ~MailRcSource() {;}
virtual const char *getValue(DtMailBoolean decrypt = DTM_FALSE);
virtual void setValue(char *value, DtMailBoolean encrypt = DTM_TRUE);
private:
};
#endif

View File

@@ -0,0 +1,86 @@
/* $TOG: PropUi.hh /main/9 1998/02/17 13:45:35 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include "PropSource.hh"
#ifndef _PROPUI_HH
#define _PROPUI_HH
// This class is the 'glue' between the mail back end and the Props GUI as
// generated by dtbuilder
// defines the type of item one wishes to create
typedef enum {
_ANTICHECKBOX_ITEM,
_CHECKBOX_ITEM,
_TEXTFIELD_ITEM,
_LIST_ITEM,
_SPINBOX_ITEM,
_SCALE_ITEM,
_INDEXED_OPTIONMENU_ITEM
} PROP_UI_ITEM_TYPE;
// defines the possible sources for props variables
typedef enum {
_FROM_MAILRC,
_FROM_XRDB,
_FROM_FILE
} PROP_SOURCES;
// CLASS PropUiItem
// Base class for Prop sheet item glue list elements
///////////////////////////////////////////////////////////
class PropUiItem {
public:
typedef char* (*PropUiCallback)(PropUiItem*, void*);
PropUiItem(
Widget w,
int source,
char *search_key,
PropUiCallback validator = NULL,
void * validator_data = NULL);
virtual ~PropUiItem();
Widget getWidget(){ return prop_widget; };
virtual char * uiValueIsValid();
virtual void writeFromUiToSource() = 0;
virtual void writeFromSourceToUi() = 0;
Boolean getDirtyBit(){ return dirty_bit; };
void setDirtyBit(Boolean db) { dirty_bit = db; };
char *getKey(){ return key; };
PropSource *getPropSource(){ return prop_source; };
protected:
Boolean dirty_bit;
PropSource *prop_source;
private:
Widget prop_widget;
char *key;
PropUiCallback _uiValueValidator;
void *_uiValueValidatorData;
};
#endif

View File

@@ -0,0 +1,47 @@
/* $XConsortium: ScaleUiItem.hh /main/4 1996/04/21 19:45:38 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _SCALEUIITEM_HH
#define _SCALEUIITEM_HH
// CLASS ScaleUiItem
// derived class for prop sheet glue items for scale items
///////////////////////////////////////////////////////////
class ScaleUiItem : public PropUiItem {
public:
ScaleUiItem(Widget w, int source, char *search_key);
virtual ~ScaleUiItem(){;}; // we don't alloc any memory
#ifdef DEAD_WOOD
virtual int getType(){ return _SCALE_ITEM; };
virtual int getSource(){ return data_source; };
#endif /* DEAD_WOOD */
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
private:
#ifdef DEAD_WOOD
int data_source;
#endif /* DEAD_WOOD */
};
#endif

View File

@@ -0,0 +1,47 @@
/* $XConsortium: SpinBoxUiItem.hh /main/4 1996/04/21 19:45:42 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _SPINBOXUIITEM_HH
#define _SPINBOXUIITEM_HH
// CLASS SpinBoxUiItem
// derived class for prop sheet glue items for SpinBox
///////////////////////////////////////////////////////////
class SpinBoxUiItem : public PropUiItem {
public:
SpinBoxUiItem(Widget w, int source, char *search_key);
virtual ~SpinBoxUiItem(){;}; // we don't alloc any memory
#ifdef DEAD_WOOD
virtual int getType(){ return _SPINBOX_ITEM; };
virtual int getSource(){ return data_source; };
#endif /* DEAD_WOOD */
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
private:
#ifdef DEAD_WOOD
int data_source;
#endif /* DEAD_WOOD */
};
#endif

View File

@@ -0,0 +1,56 @@
/* $XConsortium: TemplateListUiItem.hh /main/4 1996/04/21 19:45:44 drk $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _TEMPLATESLISTUIITEM_HH
#define _TEMPLATESLISTUIITEM_HH
#ifdef DEAD_WOOD
extern void handleDoubleSelection(Widget w, XtPointer clientdata, XtPointer calldata);
#endif /* DEAD_WOOD */
// CLASS TemplateListUiItem
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class TemplateListUiItem : public ListUiItem {
public:
TemplateListUiItem(Widget w, int source, char *search_key, Widget w_k, Widget w_v);
virtual ~TemplateListUiItem(){;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
Widget getKeyWidget(){ return key_widget;};
Widget getValueWidget(){ return value_widget;};
DtVirtArray<PropStringPair *> *getItemList(){ return list_items; };
virtual void handleAddButtonPress();
virtual void handleChangeButtonPress();
virtual void handleDeleteButtonPress();
private:
DtVirtArray<PropStringPair *> *list_items;
DtVirtArray<char *> *deleted_items;
Widget key_widget;
Widget value_widget;
};
#endif

View File

@@ -0,0 +1,42 @@
/* $TOG: TextFieldUiItem.hh /main/6 1997/11/07 15:45:26 mgreess $ */
/*
*+SNOTICE
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#include <stdlib.h>
#include <X11/Intrinsic.h>
#ifndef _TEXTFIELDUIITEM_HH
#define _TEXTFIELDUIITEM_HH
// derived class for prop sheet glue items for textfield
///////////////////////////////////////////////////////////
class TextFieldUiItem : public PropUiItem
{
public:
TextFieldUiItem(
Widget w,
int source,
char *search_key,
PropUiCallback validator = NULL,
void * validator_data = NULL);
virtual ~TextFieldUiItem() {;}; // we don't alloc any memory
virtual void writeFromUiToSource();
virtual void writeFromSourceToUi();
};
#endif

View File

@@ -0,0 +1,155 @@
/*
*+SNOTICE
*
*
* $TOG: Threads.hh /main/5 1997/09/03 17:27:34 mgreess $
*
* RESTRICTED CONFIDENTIAL INFORMATION:
*
* The information in this document is subject to special
* restrictions in a confidential disclosure agreement bertween
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
* document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
* Sun's specific written approval. This documment and all copies
* and derivative works thereof must be returned or destroyed at
* Sun's request.
*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
*
*+ENOTICE
*/
#ifndef _THREADS_HH
#define _THREADS_HH
#include <sys/time.h>
#include <DtMail/DtLanguages.hh>
// This mutex must be used before calling any Dt* functions. They
// are extremely MT-UNSAFE and must be protected.
//
extern void * _DtMutex;
// This function will create an initialized mutex.
//
void * MutexInit(void);
void MutexDestroy(void * mutex);
// This class locks the specified mutex when constructed, and
// releases the lock on destruction. It is useful for mutexing
// a region of code automatically by including it in the scope
// of a set of braces.
//
class MutexLock : public DtCPlusPlusAllocator {
public:
MutexLock(void * mutex);
~MutexLock(void);
void unlock(void);
void unlock_and_destroy(void);
private:
void * _mutex;
int _locked;
};
// The SafeScalar class is designed to allow safe access to scalar values
// from within an MT app. It should only be used with the common 32 bit
// integral values.
//
class SafeScalarImpl : public DtCPlusPlusAllocator {
public:
SafeScalarImpl(void);
~SafeScalarImpl(void);
long operator = (const long);
long operator += (const long);
long operator -= (const long);
long operator *= (const long);
long operator /= (const long);
int operator == (const long);
int operator <= (const long);
int operator < (const long);
int operator >= (const long);
int operator > (const long);
int operator != (const long);
operator long(void);
private:
void * _mutex;
long _value;
};
template <class Scalar>
class SafeScalar : public DtCPlusPlusAllocator {
public:
SafeScalar(void) : _scalar() { }
~SafeScalar(void) { }
Scalar operator= (const Scalar val) { return((Scalar)(long)(_scalar = (long)val)); }
Scalar operator += (const Scalar val) { return((Scalar)(long)(_scalar += (long)val)); }
Scalar operator -= (const Scalar val) { return((Scalar)(long)(_scalar -= (long)val)); }
Scalar operator *= (const Scalar val) { return((Scalar)(long)(_scalar *= (long)val)); }
Scalar operator /= (const Scalar val) { return((Scalar)(long)(_scalar /= (long)val)); }
int operator == (const Scalar val) { return(_scalar == (long)val); }
int operator <= (const Scalar val) { return(_scalar <= (long)val); }
int operator < (const Scalar val) { return(_scalar < (long)val); }
int operator >= (const Scalar val) { return(_scalar >= (long)val); }
int operator > (const Scalar val) { return(_scalar > (long)val); }
int operator != (const Scalar val) { return(_scalar != (long)val); }
operator Scalar (void) { return((Scalar)(long)_scalar); }
private:
SafeScalarImpl _scalar;
};
// The condition class is used to block an appliction until the
// condition has changed. This is typically used while creating or
// destroying a class.
//
class Condition : public DtCPlusPlusAllocator {
public:
Condition(void);
~Condition(void);
void setTrue(void);
void setFalse(void);
int state(void);
int operator=(int);
operator += (int);
operator int(void);
void wait(void);
void waitTrue(void);
#ifdef DEAD_WOOD
void waitFalse(void);
void waitFor(int);
void waitGT(int); // wait >
void waitLT(int); // wait <
void waitProcStatus(void);
#endif /* DEAD_WOOD */
private:
void * _mutex;
void * _condition;
int _state;
};
typedef unsigned int Thread;
typedef void * (*ThreadEntryPoint)(void *);
Thread ThreadCreate(ThreadEntryPoint, void * client_data);
Thread ThreadSelf(void);
void ThreadPrio(Thread, const int prio);
void ThreadKill(Thread, const int signal);
void ThreadExit(const int status);
void ThreadJoin(Thread);
time_t ThreadSleep(time_t seconds);
#endif

View File

@@ -0,0 +1,120 @@
/* $XConsortium: options_util.h /main/4 1996/04/21 19:45:54 drk $ */
#ifndef _OPTIONS_UTIL_H_
#define _OPTIONS_UTIL_H_
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include "DtVirtArray.hh"
#include "ListUiItem.hh"
void options_checkbox_init(
Widget checkbox,
Boolean *dirty_bit
);
int options_checkbox_set_value(
Widget checkbox,
Boolean b_value,
Boolean set_dirty_bit
);
void options_list_init(Widget list_w, DtVirtArray<char *> *item_list);
Boolean options_checkbox_get_value(Widget checkbox);
void options_radiobox_init(Widget radiobox,
int num_items,
WidgetList items,
int *item_values,
Boolean *dirty_bit);
int options_radiobox_get_value(Widget radiobox);
int options_radiobox_set_value(Widget radiobox,
int value,
Boolean set_dirty_bit);
/*
* Callback: choice value has changed...turnon dirty bit
*/
void options_setting_chgCB(Widget widget,
XtPointer clientdata,
XtPointer calldata);
/*
* Callback: item in exclusive choice has been set...store it's
* value in the parent radiobox
*/
void options_radiobox_itemCB(Widget item,
XtPointer clientdata,
XtPointer calldata);
typedef enum
{
OPTIONS_LOAD,
OPTIONS_EDIT,
OPTIONS_NUM_VALUES
} OPTIONS_FIELD_STATE;
void options_field_init(Widget field,
Boolean *dirty_bit);
String options_field_get_value(Widget field);
int options_field_set_value(Widget field,
String value,
Boolean set_dirty_bit);
void options_field_chgCB(Widget widget,
XtPointer clientdata,
XtPointer calldata);
void options_spinbox_init(Widget spinbox,
Boolean *dirty_bit);
int options_spinbox_get_value(Widget spinbox);
int options_spinbox_set_value(Widget spinbox,
int value,
Boolean set_dirty_bit);
int options_scale_get_value(Widget scale);
int options_scale_set_value(Widget scale,
char *value,
Boolean set_dirty_bit);
void listAddButtonCB(
Widget widget,
XtPointer clientdata,
XtPointer calldata);
void listDeleteButtonCB(
Widget widget,
XtPointer clientdata,
XtPointer calldata);
void listChangeButtonCB(
Widget widget,
XtPointer clientdata,
XtPointer calldata);
void add_cbs_to_list(ListUiItem *list,
Widget add_butt,
Widget del_butt,
Widget chg_butt);
/*
** The following structs are used as the glue to stick together
** the props dialog and the back end.
*/
typedef enum {
SPINBOX_ITEM,
CHECKBOX_ITEM,
TEXTFIELD_ITEM,
LIST_ITEM,
SCALE_ITEM
} PROP_ITEM_TYPE;
#endif