2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
27 * $TOG: DtMail.hh /main/18 1998/11/10 17:02:07 mgreess $
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special
32 * restrictions in a confidential disclosure agreement bertween
33 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 * document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
35 * Sun's specific written approval. This documment and all copies
36 * and derivative works thereof must be returned or destroyed at
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 #ifndef I_HAVE_NO_IDENT
51 #if defined(sun) || defined(__FreeBSD__)
55 /*#include <nl_types.h>*/
56 #include <DtMail/DtMailError.hh>
57 #include <DtMail/DtMailProps.h>
58 #include <DtMail/DtMailTypes.h>
59 #include <DtMail/DtVirtArray.hh>
60 #include <DtMail/DtLanguages.hh>
64 // Define a type for the handler used in RFCTransport::launchSendmail
65 typedef void SubProcessFinishedProc (int pid, int status, void *data);
68 // Gorp to get mailrc to work
71 #define MAILRC_NOFILE 20 /* this define is here for */
72 /* compatibility purposes only */
73 /* and will be removed in a */
81 // enums cannot be declared inside of classes because the enum scope rules
82 // changed from V2 to V3 compilers causing incompatibilities
84 enum DtmFileLocality {
85 Dtm_FL_UNKNOWN, // cannot determine file locality
86 Dtm_FL_LOCAL, // file is local to this system (eg ufs)
87 Dtm_FL_LOCAL_AND_REMOTE, // file is remote with local copy (eg cachefs)
88 Dtm_FL_REMOTE // file is remote (e.g. nfs)
94 // Returns the minor code set by a DtMail routine. This method
95 // should only be called if error._major is not NO_EXCEPTION.
98 // error - The environment returned from any DtMail method.
100 // Returns - The error code as defined in DtMailError.h
102 static DTMailError_t getMinorCode(DtMailEnv & error);
104 // Returns the internationalized error text for an error. This
105 // method should only be called if error._major is not NO_EXCEPTION.
108 // error - The environment returned from any DtMail method.
110 // Returns - The error text string. This string is valid until
111 // error.clear() is called on the error.
113 static const char * getErrorString(DtMailEnv & error);
115 // Determine locality of referenced path object
116 // This is not part of the public interface, do not call
117 // as a client of this class.
118 static enum DtmFileLocality DetermineFileLocality(const char * path);
126 class Session : public DtCPlusPlusAllocator {
128 Session(DtMailEnv &, const char * app_name);
131 const char ** enumerateImpls(DtMailEnv & error);
132 void setDefaultImpl(DtMailEnv & error, const char * impl);
133 const char * getDefaultImpl(DtMailEnv & error);
134 void queryImpl(DtMailEnv & error,
136 const char * capability,
138 void queryImplV(DtMailEnv & error,
140 const char * capability,
143 // Create a mail box object, after selecting an implementation.
144 MailBox * mailBoxConstruct(DtMailEnv & error,
145 DtMailObjectSpace space,
147 DtMailCallback open_callback,
149 const char * impl = NULL);
151 Message * messageConstruct(DtMailEnv & error,
152 DtMailObjectSpace space,
154 DtMailCallback open_callback,
156 const char * impl = NULL);
158 // Create a transport object after selecting an implementation.
159 Transport * transportConstruct(DtMailEnv & error,
161 DtMailStatusCallback call_back,
164 // Retrieve a copy of the MailRc handle.
165 MailRc * mailRc(DtMailEnv & error);
167 // The following methods set up the polling requirements for
168 // the DtMail library.
170 DtMailBoolean pollRequired(DtMailEnv & error);
172 int eventFileDesc(DtMailEnv & error);
174 void poll(DtMailEnv & error);
176 // The expandPath method will turn a relative path, with
177 // variable's into an absolute path, relative to the current
180 char * expandPath(DtMailEnv & error, const char * path);
181 char * getRelativePath(DtMailEnv & error, const char * path);
183 // Accessors to session data.
184 const char * appName(void) const { return _app_name; }
185 char * ttChannel(void) const { return _tt_channel; }
186 int ttFile(void) const { return _tt_fd; }
188 // Meta factory type. This method gives access to the
189 // factory and the implementations specific query
191 typedef void * (*MetaImplFactory)(const char * operation);
193 // The setError method needs to be here so it can be accessed
196 void setError(DtMailEnv & error, const DTMailError_t);
198 // Add an event routine.
199 void addEventRoutine(DtMailEnv &,
204 // Remove an event routine.
205 void removeEventRoutine(DtMailEnv &,
209 // Push some data into the event queue.
211 void writeEventData(DtMailEnv & error,
213 const unsigned long size);
215 // These routines check the list to make sure the created
216 // object is still valid. This is used by the event handlers
217 // to make sure events don't appear for deleted objects.
219 DtMailBoolean validObjectKey(DtMailObjectKey);
220 DtMailObjectKey newObjectKey(void);
221 void removeObjectKey(DtMailObjectKey);
223 // This method allows the client to register a busy callback.
224 // Any time the library is going to be busy for a while, it will
225 // call this handler to set the app state to busy, and unbusy
226 // the app when it is done. This is an optional interface.
228 typedef void (*BusyApplicationCallback)(DtMailEnv &error,
229 DtMailBusyState busy_state,
231 void registerBusyCallback(DtMailEnv &,
232 BusyApplicationCallback,
236 void unregisterBusyCallback(DtMailEnv &);
237 #endif /* DEAD_WOOD */
239 void setBusyState(DtMailEnv &, DtMailBusyState busy_state);
241 void setAutoSaveFlag(DtMailBoolean flag);
242 DtMailBoolean getAutoSaveFlag();
244 // These methods allow disabling and enabling of group privileges
246 typedef void (*DisableGroupPrivilegesCallback)(void * client_data);
247 typedef void (*EnableGroupPrivilegesCallback)(void * client_data);
249 void registerDisableGroupPrivilegesCallback(
250 DisableGroupPrivilegesCallback,
252 void registerEnableGroupPrivilegesCallback(
253 EnableGroupPrivilegesCallback,
256 void disableGroupPrivileges(void);
257 void enableGroupPrivileges(void);
259 // This method allows the client to register a callback that
260 // can be called to return the last time() an interactive X
261 // event was processed.
262 // Any time the library is about to be busy for a while, it
263 // may call this handler to get the time() that the last
264 // interactive X event was processed. It was very recent, the
265 // library may wish to delay the busy event for a while.
267 typedef long (*LastInteractiveEventTimeCallback)(void * client_data);
269 void registerLastInteractiveEventTimeCallback(
270 LastInteractiveEventTimeCallback,
273 long lastInteractiveEventTime(void);
277 void DtXlateStdToOpLocale(char *op, char *std, char *dflt,
279 void DtXlateOpToStdLocale(char *op, char *opLoc, char **retLoc,
280 char **ret_retLang, char **retSet);
281 void DtXlateStdToOpCodeset(char *op, char *std, char *dflt,
283 void DtXlateMimeToIconv(const char *, const char *, const char *,
285 void DtXlateLocaleToMime(const char *, const char *,
286 const char *, char **);
288 char *csToConvName(char *);
289 char *locToConvName();
290 char *targetConvName();
291 char *targetTagName();
292 char *targetTagName(char *);
293 int csConvert(char **, unsigned long &, int, char *, char *);
294 // End of For CHARSET
297 unsigned long _object_signature;
304 DtMailBoolean _canAutoSave;
306 /* Implementation structure. */
309 MetaImplFactory impl_meta_factory;
314 const char **_impl_names; // Used to return names from enumerate.
318 struct EventRoutine : public DtCPlusPlusAllocator {
319 DtMailEventFunc routine;
325 DtVirtArray<EventRoutine *> _events;
326 DtVirtArray<DtMailObjectKey> _valid_keys;
327 DtMailObjectKey _cur_key;
329 void buildImplTable(DtMailEnv & error);
330 void buildTypeTable(DtMailEnv & error);
331 int lookupImpl(const char * impl);
333 BusyApplicationCallback _busy_cb;
334 void * _busy_cb_data;
336 DisableGroupPrivilegesCallback _disableGroupPrivileges_cb;
337 void * _disableGroupPrivileges_cb_data;
339 EnableGroupPrivilegesCallback _enableGroupPrivileges_cb;
340 void * _enableGroupPrivileges_cb_data;
342 LastInteractiveEventTimeCallback _interactive_time_cb;
343 void * _interactive_time_cb_data;
346 //==================NEW MAILRC CLASS
351 MailRc(DtMailEnv &, Session *);
355 int encryptedLength(int length);
356 void encryptValue(char *to, char *from, int length);
357 int decryptValue(char *to, char *from, int length);
361 const char * var, const char ** value,
362 DtMailBoolean decrypt = DTM_FALSE);
365 const char * var, const char * value,
366 DtMailBoolean encrypt = DTM_FALSE);
367 void removeValue(DtMailEnv &, const char * var);
369 const char * getAlias(DtMailEnv &, const char * name);
370 typedef void (*hm_callback)(char * key, void * value,
372 void getAliasList(hm_callback stuffing_func, void *client_data);
373 void setAlias(DtMailEnv &, const char * name, const char * value);
374 void removeAlias(DtMailEnv &, const char * name);
375 DtVirtArray<char *> *getAliasList();
377 DtMailBoolean ignore(DtMailEnv &, const char *name);
378 void addIgnore(DtMailEnv &, const char * name);
379 void removeIgnore(DtMailEnv &, const char * name);
380 DtVirtArray<char *> *getIgnoreList();
382 const char * getAlternates(DtMailEnv &);
383 void setAlternate(DtMailEnv &, const char * alt);
384 void removeAlternate(DtMailEnv &, const char * alt);
386 void update(DtMailEnv &);
389 // Methods below this line are not part of the public interface.
390 // They must be declared public due to implementation restrictions.
391 // DO NOT CALL THESE AS A CLIENT OF THIS CLASS.
393 int load(char *filename, char* line);
395 static void add_alias(char *name, char *value);
396 static void mt_assign(char *name,char * val);
397 static int mt_deassign(char *s);
398 static void mt_puthash(
401 struct var **hasharray);
402 static void mt_scan(FILE * outf);
403 static char *vcopy(char *str);
404 static int group(char **argv, DtMail::MailRc *);
405 static void wgroup(const char *, char **, FILE *);
406 static void ngroup(char * key, void * value, void * client_data);
407 static void nalias(char * key, void * data, void * client_data);
408 static void nignorelist(char *key, void *data, void *client_data);
409 static int unset(char **arglist, DtMail::MailRc *);
411 const char * verbatim,
414 static int set(char **arglist, DtMail::MailRc *);
415 static void wset(const char *, char **, FILE *);
416 static int source(char **arglist, DtMail::MailRc *);
417 static void wsource(const char *, char **, FILE *);
418 static int ifcmd(char **arglist, DtMail::MailRc *);
419 static void wifcmd(const char *, char **, FILE *);
420 static int elsecmd(char **arglist, DtMail::MailRc *);
421 static void welsecmd(const char *, char **, FILE *);
422 static int endifcmd(char **arglist, DtMail::MailRc *);
423 static void wendifcmd(const char *, char **, FILE *);
424 static int igfield(char **list, DtMail::MailRc *);
425 static void wigfield(const char *, char **, FILE *);
426 static void nigfield(char * key, void * value, void * client_data);
427 static int clearaliases(char **list, DtMail::MailRc *);
428 static void wclearaliases(const char *, char **, FILE *);
430 static void *hm_alloc();
431 static void *hm_test(struct hash **table, char *key);
432 static void hm_delete(struct hash **table, char *key);
433 static void hm_add(struct hash **table,
437 static void hm_mark(struct hash **table, char * key);
438 static int hm_ismarked(struct hash **table, char * key);
443 static void free_hash(struct hash *h);
444 static int hash_index(char *key);
445 static void add_ignore(char *name);
446 static void add_alternates(char *name);
447 static int alternates(char **namelist, DtMail::MailRc *);
448 static void walternates(const char *, char **, FILE *);
449 static void nalternates(
454 static char *nullfield;
455 static Boolean clearAliases;
459 void *g_ignore; /* hash list of ignored fields */
460 void *g_retain; /* hash list of retained fields */
461 void *g_alias; /* hash list of alias names */
462 void *g_alternates; /* hash list of alternate names */
463 int g_nretained; /* the number of retained fields */
466 static struct globals glob;
468 /* Pointer to active var list */
469 static struct var *variables[HSHSIZE];
471 DTMailError_t getParseError(void) { return _parseError; }
474 void updateByLine(FILE * in, FILE * out);
476 const char * verbatim,
477 const char * parseable,
479 int commands(char* line);
480 int execute(char linebuf[]);
481 int readline(FILE *ibuf, char *linebuf);
483 int isprefix(char *as1, char *as2);
484 void *lex(char word[]);
485 int getrawlist(char line[], char ** argv, int argc);
486 void freerawlist(char **argv);
487 char *mt_value(char name[]);
488 char *expand(char *);
489 int getfolderdir(char *, size_t);
490 static int hash(char *name);
491 static void vfree(char *cp);
495 DTMailError_t _parseError;
499 int ssp; /* Top of file stack */
500 char *alternate_list;
503 static struct var *lookup(char *name, struct var **hasharray);
507 FILE *s_file; /* File we were in. */
508 int s_cond; /* Saved state of conditionals */
511 struct sstack sstack[MAILRC_NOFILE];
520 class Message : public DtCPlusPlusAllocator {
522 virtual ~Message(void);
524 virtual Envelope * getEnvelope(DtMailEnv &) = 0;
526 // This should only be used when you REALLY need to know
527 // how many body parts are present before actually traversing
528 // the body parts (i.e. like when writing a MIME format message).
529 virtual int getBodyCount(DtMailEnv &) = 0;
531 virtual BodyPart * getFirstBodyPart(DtMailEnv &) = 0;
532 virtual BodyPart * getNextBodyPart(DtMailEnv &,
533 BodyPart * last) = 0;
535 virtual BodyPart * newBodyPart(DtMailEnv &,
536 BodyPart * after) = 0;
539 virtual void newBodyPartOrder(DtMailEnv &,
540 BodyPart * new_order,
541 const int bodypart_count) = 0;
542 #endif /* DEAD_WOOD */
544 virtual void setFlag(DtMailEnv &,
545 const DtMailMessageState) = 0;
547 virtual void resetFlag(DtMailEnv &,
548 const DtMailMessageState) = 0;
550 virtual DtMailBoolean flagIsSet(DtMailEnv &,
551 const DtMailMessageState) = 0;
553 virtual time_t getDeleteTime(DtMailEnv &) = 0;
555 virtual void toBuffer(DtMailEnv & error, DtMailBuffer &) = 0;
557 virtual const char * impl(DtMailEnv & error) = 0;
559 // The mail box method is used by the components of
560 // the message object to determine which mail box the
561 // belong to, and in turn which session.
563 MailBox * mailBox(void);
564 Session * session(void);
573 Envelope * _envelope;
577 class Envelope : public DtCPlusPlusAllocator {
579 virtual DtMailHeaderHandle getFirstHeader(
582 DtMailValueSeq & value) = 0;
584 virtual DtMailHeaderHandle getNextHeader(
586 DtMailHeaderHandle last,
588 DtMailValueSeq & value) = 0;
590 virtual void getHeader(DtMailEnv &,
592 const DtMailBoolean abstract,
593 DtMailValueSeq & value) = 0;
595 virtual void setHeaderSeq(DtMailEnv &,
596 const char * header_name,
597 const DtMailValueSeq & val) = 0;
599 // The last parameter is left to the client to provide
600 // because it can not be done in a type safe manner.
602 virtual void setHeader(DtMailEnv &,
603 const char * header_name,
604 const DtMailBoolean replace,
607 virtual void removeHeader(DtMailEnv &,
608 const char * header_name) = 0;
610 // fix for the defect 177527
611 // when a reply-to field is in a message headers, the reply-to is
612 // going to be displayed as the send in RMW's msg list scrolled window
613 // instead of the real sender. The following three public methods are
614 // going to access _use_reply_to.
616 virtual void setUseReplyTo(void) = 0;
617 virtual void unsetUseReplyTo(void) = 0;
618 virtual DtMailBoolean getUseReplyTo(void) = 0;
622 Envelope(DtMailEnv & error, Message * parent);
624 friend Message::~Message(void);
625 virtual ~Envelope(void); // Only called from Message destructor.
631 class BodyPart : public DtCPlusPlusAllocator {
634 virtual void lockContents(DtMailEnv &, const DtMailLock) = 0;
635 virtual void unlockContents(DtMailEnv &) = 0;
637 virtual void getContents(DtMailEnv &,
638 const void ** contents,
639 unsigned long * length,
643 char ** description) = 0;
645 virtual void getContentType(DtMailEnv &,
646 char ** content_type) = 0;
648 virtual void setContents(DtMailEnv &,
649 const void * contents,
650 const unsigned long length,
654 const char * description) = 0;
656 virtual void setFlag(DtMailEnv &,
657 DtMailBodyPartState) = 0;
659 virtual void resetFlag(DtMailEnv &,
660 DtMailBodyPartState) = 0;
662 virtual DtMailBoolean flagIsSet(DtMailEnv &,
663 DtMailBodyPartState) = 0;
665 virtual time_t getDeleteTime(DtMailEnv &) = 0;
667 virtual void getHeader(DtMailEnv &,
669 const DtMailBoolean abstract,
670 DtMailValueSeq & value) = 0;
673 //-------------------------------------------
674 // These methods are duplicated in class BodyPart
675 // (also being implemented in class Session) because
676 // RFCFormat and RFCBodyPart need to access them.
677 // Duplicating routines like what is being done here is a workaround
678 // for an implementation bug/hole because there is no class where global
679 // routines can be defined (and be accessed by any class).
680 // class Session is not a proper place to put (global) methods because
681 // not every class can get at Session.
682 // RFCFormat accesses these routines through its private Session handle.
683 // RFCBodyPart does not have a Session handle.
684 // Hence the need to duplicate the following routines.
686 virtual int OpenLcxDb(void) = 0;
687 virtual void DtXlateStdToOpLocale(char *op, char *std, char *dflt,
689 virtual void DtXlateOpToStdLocale(char *op, char *opLoc, char **retLoc,
690 char **ret_retLang, char **retSet) = 0;
691 virtual void DtXlateMimeToIconv(const char *, const char *,
692 const char *, char **, char **) = 0;
693 virtual void DtXlateLocaleToMime(const char *, const char *,
694 const char *, char **) = 0;
696 virtual char *csToConvName(char *) = 0;
697 virtual char *locToConvName() = 0;
698 virtual char *targetConvName() = 0;
699 virtual char *targetTagName() = 0;
700 virtual int csConvert(char **, unsigned long &, int,
702 //-------------------------------------------
704 virtual char *csFromContentType(DtMailValueSeq & value) = 0;
705 // End of For CHARSET
708 virtual DtMailChecksumState checksum(DtMailEnv &) = 0;
709 #endif /* DEAD_WOOD */
712 BodyPart(DtMailEnv &, Message * parent);
714 friend Message::~Message(void);
715 virtual ~BodyPart(void); // Only called from Message destructor.
722 // The MailBox encapsulates the concept of a mail box as a container.
723 // This class should be used for manipulating mail containers.
725 class MailBox : public DtCPlusPlusAllocator {
728 // Create a MailBox. The constructor simply initializes the
729 // instance and sets the appropriate meta handlers for mail
737 DtMailObjectSpace space,
742 // Returns DTM_TRUE if the is mail box is writable and DTM_FALSE
743 // if the mail box is read only.
745 DtMailBoolean mailBoxWritable(DtMailEnv &);
747 // Destroy a MailBox. The destructor will close the open mail
748 // container, and any embedded containers.
750 virtual ~MailBox(void);
752 static void appendCB(DtMailEnv&, char*, int, void *clientData);
753 virtual void append(DtMailEnv &error, char *buf, int len) = 0;
755 // Create a named mail container in the file system. The
756 // container will be truncated if it already exists, otherwise
757 // it will be created. The mode in this case will be set to
758 // DTMAIL_DEFAULT_CREATE_MODE, the default for mail.
761 // DTME_ObjectInvalid - The instance was not proprerly initialized.
762 // DTME_BadArg - The file_name parameter was invalid.
763 // DTME_ObjectInUse - This object already has an open container.
764 // DTME_ObjectCreationFailed - A required object could not
767 virtual void create(DtMailEnv &,
768 mode_t mode = DTMAIL_DEFAULT_CREATE_MODE) = 0;
770 // Open a named mail container in the file system. The container
771 // must exist, and be readable (at least) by the user.
772 // If the container is writable by the user it will be opened
776 // auto_create - Create the container if it doesn't exist, using
780 // DTME_ObjectInvalid - The instance was not proprerly initialized.
781 // DTME_BadArg - The file_name parameter was invalid.
782 // DTME_ObjectInUse - This object already has an open container.
783 // DTME_ObjectCreationFailed - A required object could not
785 // DTME_NoSuchFile - The file doesn't exist & auto_create is false.
786 // DTME_NotMailBox - The object is a container, but not a mail box.
787 // DTME_NoMemory - A memory allocation failed.
789 virtual void open(DtMailEnv & error,
790 DtMailBoolean auto_create = DTM_TRUE,
791 int open_mode = DTMAIL_DEFAULT_OPEN_MODE,
792 mode_t create_mode = DTMAIL_DEFAULT_CREATE_MODE,
793 DtMailBoolean lock_flag = DTM_TRUE,
794 DtMailBoolean auto_parse = DTM_TRUE) = 0;
796 // (Un)locks an open mailbox.
797 virtual void lock() = 0;
798 virtual void unlock() = 0;
799 virtual void save() = 0;
802 virtual int messageCount(DtMailEnv & error) = 0;
803 #endif /* DEAD_WOOD */
805 virtual DtMailMessageHandle getFirstMessageSummary(
807 const DtMailHeaderRequest & header_list,
808 DtMailHeaderLine & header_line) = 0;
810 virtual DtMailMessageHandle getNextMessageSummary(
812 DtMailMessageHandle last,
813 const DtMailHeaderRequest & header_list,
814 DtMailHeaderLine & header_line) = 0;
816 virtual void getMessageSummary(
818 DtMailMessageHandle handle,
819 const DtMailHeaderRequest &,
820 DtMailHeaderLine &) = 0;
822 virtual void clearMessageSummary(
823 DtMailHeaderLine &) = 0;
825 virtual Message * getMessage(
827 DtMailMessageHandle message_handle) = 0;
829 virtual Message * getFirstMessage(DtMailEnv &) = 0;
831 virtual Message * getNextMessage(DtMailEnv &, Message * last) = 0;
833 virtual Message * newMessage(DtMailEnv &) = 0;
835 virtual void copyMessage(DtMailEnv &, Message *) = 0;
837 virtual void copyMailBox(DtMailEnv &, MailBox *) = 0;
839 virtual void disableMailRetrieval() = 0;
840 virtual void enableMailRetrieval() = 0;
841 virtual void checkForMail(
843 const DtMailBoolean already_locked = DTM_FALSE) = 0;
845 virtual void createMailRetrievalAgent(char *password = NULL) = 0;
846 virtual void deleteMailRetrievalAgent() = 0;
847 virtual void updateMailRetrievalPassword(char *password = NULL) = 0;
849 virtual void expunge(DtMailEnv &) = 0;
851 virtual const char * impl(DtMailEnv & error) = 0;
853 // This method is typically used to propagate the session
854 // to embedded objects, such as Messages which may need to
855 // acquire the session to which it belongs.
857 virtual Session * session(void);
859 virtual void callCallback(DtMailCallbackOp, void *) = 0;
860 virtual void startAutoSave(
862 DtMailBoolean start=DTM_TRUE) = 0;
863 typedef void (*err_func)(char *,Boolean,void *);
864 void registerErrMsgFunc(err_func,void * client_data);
865 void unregisterErrMsgFunc(DtMailEnv &);
866 void showError(char *);
868 void hideAccessEvents(DtMailBoolean onoff)
869 {_hide_access_events = onoff;}
871 DtMailObjectKey getObjectKey(void)
875 err_func _errmsg_func;
880 DtMailBoolean _hide_access_events;
882 DtMailObjectKey _key;
885 DtMailObjectSpace _space;
886 DtMailCallback _callback;
889 DtMailBoolean _mail_box_writable;
890 mode_t _default_mode; // Default mode for file.
893 class Transport : public DtCPlusPlusAllocator {
895 virtual DtMailOperationId submit(
898 DtMailBoolean log_msg = DTM_FALSE) = 0;
900 // SendMsgDialog initiates a send. It needs to set information
901 // needed to exec sendmail by calling these init functions.
902 // getSendmailReturnProc returns a handler so that SendMsgDialog
903 // can use it in XtAppAddInput.
904 virtual void initTransportData(int fds[2],
905 SubProcessFinishedProc proc, void *ptr) = 0;
906 virtual void *getSendmailReturnProc(void) = 0;
909 virtual void callCallback(DtMailOperationId, void * arg);
912 Transport(DtMailEnv &, Session *, DtMailStatusCallback, void *);
913 virtual ~Transport(void);
915 DtMailObjectKey _key;
917 DtMailStatusCallback _callback;
924 friend class MailBox;
925 friend class Message;
926 friend class Envelope;
927 friend class BodyPart;
928 friend class Transport;
929 friend class EmbeddedMessage;
930 friend class FileMessage;
931 friend class FileShare;
932 friend class Session;
933 static void setError(
936 DTMailError_t minor_code);
939 #if defined(sun) || defined(__FreeBSD__)
940 template <typename T>
941 size_t iconv (iconv_t i, const T inbuf, size_t* inleft,
942 char** outbuf, size_t* outleft)
944 return iconv(i, const_cast<T>(inbuf), inleft, outbuf, outleft);