Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / programs / dtmail / dtmail / MailSession.hh
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  *+SNOTICE
25  *
26  *      $TOG: MailSession.hh /main/8 1999/03/26 16:52:44 mgreess $
27  *
28  *      RESTRICTED CONFIDENTIAL INFORMATION:
29  *      
30  *      The information in this document is subject to special
31  *      restrictions in a confidential disclosure agreement between
32  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
33  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
34  *      Sun's specific written approval.  This document and all copies
35  *      and derivative works thereof must be returned or destroyed at
36  *      Sun's request.
37  *
38  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
39  *
40  *+ENOTICE
41  */
42
43 #ifndef _MAILSESSION_HH
44 #define _MAILSESSION_HH
45
46 #include <sys/stat.h>
47 #include <sys/types.h>
48
49 #include <DtMail/DtMail.hh>
50 #include "RoamMenuWindow.h"
51
52 class MailSession
53 {
54   public:
55     MailSession(DtMailEnv &, XtAppContext);
56     ~MailSession(void);
57
58     // raises ME_NotBento, ME_AlreadyLocked, ME_OtherAssumedRole, ME_NoSuchFile
59     DtMail::MailBox     *open(DtMailEnv&, const char*, DtMailCallback, void*,
60                               DtMailBoolean auto_create = DTM_TRUE,
61                               DtMailBoolean request_lock = DTM_TRUE,
62                               DtMailBoolean auto_parse = DTM_TRUE);
63
64     void                 close(DtMailEnv&, const DtMail::MailBox*);
65
66     // raises ME_UnknownFormat
67     void                 convert(DtMailEnv&, const char*, const char*,
68                                  DtMailStatusCallback cb_func = NULL,
69                                  void *client_data = NULL);
70
71     // raises ME_NotBento, ME_RequestDenied
72     void                 copy(DtMailEnv&, DtMail::Message&, const char*);
73
74     int                  isActiveRMW(RoamMenuWindow*);
75     void                 activateRMW(RoamMenuWindow*);
76     void                 deactivateRMW(RoamMenuWindow*);
77     RoamMenuWindow      *getRMW(DtMail::MailBox* mbox);
78     RoamMenuWindow      *getRMW(const char* path);
79     Boolean              isMboxOpen(const char* path);
80     int                  numDeactivatedRMW() { return _num_deactivated; }
81     DtMail::Session     *session(void) { return _app_session; }
82
83   private:
84     struct MailBoxItem
85     {
86         DtMail::MailBox         *handle;
87         int                      stated;
88         struct stat              statbuf;
89         int                      is_active;
90         int                      open_ref_count;
91         char                    *path;
92         RoamMenuWindow          *rmw;
93     };
94     DtVirtArray<MailBoxItem *>   _open_mailboxes;
95     static DtMail::Session      *_app_session;
96     static int                   _num_deactivated;
97
98     void        addToList(DtMail::MailBox*, const char*, RoamMenuWindow*);
99     int         locate(const char * path);
100     int         locate(const DtMail::MailBox *);
101     int         locate(const RoamMenuWindow *);
102     static Tt_status
103                 lockCB(Tt_message, Tttk_op, const char*, uid_t, int, void*);
104 };
105
106 #endif