Update of /cvsroot/mahogany/M/include
In directory usw-pr-cvs1:/tmp/cvs-serv7121/include
Modified Files:
MEvent.h MFPrivate.h MFolder.h MailFolder.h MailFolderCC.h
lists.h
Removed Files:
MFFactory.h MMailFolder.h
Log Message:
redesigned the MailFolder and related classes to virtualize access to the folder
functions via folder drivers -- this should allow to plug in a virtual folder
implementation easily now
WARNING: many untested changes, don't use for now for anything but testing!
Index: MEvent.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MEvent.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -b -u -2 -r1.47 -r1.48
--- MEvent.h 19 Nov 2001 20:32:27 -0000 1.47
+++ MEvent.h 14 Jul 2002 23:41:22 -0000 1.48
@@ -100,6 +100,6 @@
/// ctor takes the (string) id for the event
MEventWithFolderData(MEventId id = MEventId_Null,
- MailFolder *folder = NULL)
- : MEventData(id) { m_Folder = folder; SafeIncRef(m_Folder); }
+ MailFolder *mf = NULL)
+ : MEventData(id) { m_Folder = mf; SafeIncRef(m_Folder); }
/// virtual dtor as in any base class
@@ -201,7 +201,7 @@
{
public:
- /// ctor takes the array of deleted msgnos which will be deleted by us
- MEventFolderClosedData(MailFolder *folder)
- : MEventWithFolderData(MEventId_FolderClosed, folder)
+ /// ctor takes the pointer to the folder which had been closed
+ MEventFolderClosedData(MailFolder *mf)
+ : MEventWithFolderData(MEventId_FolderClosed, mf)
{
}
Index: MFPrivate.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MFPrivate.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -u -2 -r1.3 -r1.4
--- MFPrivate.h 4 Jul 2002 17:22:36 -0000 1.3
+++ MFPrivate.h 14 Jul 2002 23:41:22 -0000 1.4
@@ -13,8 +13,8 @@
#include "MEvent.h"
-// ----------------------------------------------------------------------------
-// MFSuspendInteractivity: resets the folders interactive frame thus suppresing
-// any dialogs/... during the life time of this object
-// ----------------------------------------------------------------------------
+/**
+ MFSuspendInteractivity: resets the folders interactive frame thus preventing
+ any GUI dialogs from showing showing during the life time of this object
+*/
class MFSuspendInteractivity
@@ -50,5 +50,5 @@
};
-/*
+/**
This class is used to restore the folders interactive frame "later", i.e.
during the next idle loop iteration. To do this, we just send an event of
@@ -76,5 +76,5 @@
};
-/*
+/**
This class sends MEventFolderRestoreInterData if necessary: it suspends the
interactive notifications in its ctor and sends an event to restore them
@@ -133,4 +133,40 @@
private:
MFSuspendInteractivity *m_suspender;
+};
+
+/**
+ MFSubSystem: define an object of this class if you want to be called
+ during the mail subsystem initialization and/or shutdown
+ */
+class MFSubSystem
+{
+public:
+ /// return the first initializer in the linked list or NULL if none
+ static MFSubSystem *GetFirst() { return ms_initilizers; }
+
+ /// return the next initializer in the linked list or NULL if no more
+ MFSubSystem *GetNext() const { return m_next; }
+
+ typedef bool (*InitFunction)();
+ typedef void (*CleanupFunction)();
+
+ MFSubSystem(InitFunction init, CleanupFunction cleanup)
+ : m_next(ms_initilizers),
+ m_init(init),
+ m_cleanup(cleanup)
+ {
+ ms_initilizers = this;
+ }
+
+ bool Init() { return m_init ? (*m_init)() : true; }
+ void CleanUp() { if ( m_cleanup ) (*m_cleanup)(); }
+
+private:
+ static MFSubSystem *ms_initilizers;
+
+ MFSubSystem * const m_next;
+
+ InitFunction m_init;
+ CleanupFunction m_cleanup;
};
Index: MFolder.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MFolder.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -b -u -2 -r1.48 -r1.49
--- MFolder.h 5 Jul 2002 17:58:35 -0000 1.48
+++ MFolder.h 14 Jul 2002 23:41:22 -0000 1.49
@@ -101,4 +101,7 @@
virtual String GetPassword() const = 0;
+ /// save the login and password (will be encrypted here) for this folder
+ virtual void SetAuthInfo(const String& login, const String& password) = 0;
+
/// the folder name must be unique among its siblings
virtual String GetName() const = 0;
@@ -111,5 +114,5 @@
/// folder class: cclient or virtual currently, default "" == cclient
- virtual const char *GetClass() const = 0;
+ virtual String GetClass() const = 0;
/**
Index: MailFolder.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MailFolder.h,v
retrieving revision 1.178
retrieving revision 1.179
diff -b -u -2 -r1.178 -r1.179
--- MailFolder.h 5 Jul 2002 15:57:06 -0000 1.178
+++ MailFolder.h 14 Jul 2002 23:41:22 -0000 1.179
@@ -20,5 +20,4 @@
#include "MObject.h"
#include "FolderType.h"
-#include "kbList.h"
#include <wx/fontenc.h>
@@ -36,4 +35,5 @@
class Profile;
class Sequence;
+class ServerInfoEntry;
class UIdArray;
@@ -225,12 +225,4 @@
/**
- Get all currently opened folders. The returned pointer must be delete[]d
- by the caller if not NULL.
-
- @return the NULL-terminated array of currently opened MailFolders
- */
- static MailFolder **GetAllOpened();
-
- /**
Return the currently opened mailfolder for the given MFolder or NULL if it
is not opened.
@@ -262,5 +254,5 @@
//@{
- /** Phyically deletes this folder.
+ /** Phyically deletes this folder and all of the messages in it.
@return true on success
*/
@@ -282,20 +274,4 @@
static long ClearFolder(const MFolder *folder);
- /**
- Creates a mailbox profile and checks the settings to be
- sensible.
- @param name name of new folder profile
- @param type type of folder
- @param flags folder flags
- @param optional path for folder
- @param comment optional comment for the folder
- @return false on error or true on success
- */
- static bool CreateFolder(const String &name,
- MFolderType type = MF_FILE,
- int flags = MF_FLAGS_DEFAULT,
- const String &path = "",
- const String &comment = "");
-
/** Checks if it is OK to exit the application now.
@param which Will either be set to empty or a '\n' delimited
@@ -413,10 +389,17 @@
virtual bool CanSetFlag(int flags) const = 0;
- /** Get name of mailbox.
- @return the symbolic name of the mailbox
+ /**
+ Get the name of the mail folder: this is the user visible name which
+ appears in the folder tree (for the folders which live there), not the
+ path of the mailbox.
+
+ @return the full symbolic name of the mailbox
*/
virtual String GetName(void) const = 0;
- /// Return IMAP spec
+ /**
+ Return the full specification of the folder, i.e. what makes it unique
+ among all folders of this class.
+ */
virtual String GetImapSpec(void) const = 0;
@@ -432,4 +415,7 @@
virtual Profile *GetProfile(void) const = 0;
+ /// Checks if the folder is in a critical section.
+ virtual bool IsInCriticalSection(void) const = 0;
+
/// return class name
const char *GetClassName(void) const
@@ -437,4 +423,11 @@
/**
+ Create the server info entry for the given folder -- this is a backdoor
+ used by static ServerInfoEntry::GetOrCreate() to behave polymorphically
+ and shouldn't be used by anything else.
+ */
+ virtual ServerInfoEntry *CreateServerInfo(const MFolder *folder) const = 0;
+
+ /**
Returns the delimiter used to separate the components of the folder
name
@@ -841,9 +834,14 @@
//@}
- /// Initialize the underlying mail library
+ /** @name mail subsystem initialization and shutdown */
+ //@{
+
+ /// Initialize the underlying mail library, return false on error
static bool Init();
/// Clean up for program exit.
- static void CleanUp(void);
+ static void CleanUp();
+
+ //@}
/** @name Interactivity control */
@@ -893,4 +891,50 @@
virtual void Close(void) = 0;
+ /**
+ Check if the network connectivity is up if the given folder requires it
+
+ @param folder the folder we're going to access
+ @param frame the parent window for the dialog boxes
+ @return true if network is up or not required, false otherwise
+ */
+ static bool CheckNetwork(const MFolder *folder, wxFrame *frame);
+
+ /** @name Authentification info */
+ //@{
+
+ /**
+ Try to find login/password for the given folder looking among the
+ logins/passwords previosuly entered by user if they are not stored in the
+ folder itself. If it doesn't find it there neither, asks the user for the
+ password (and sets didAsk to true then)
+
+ @param mfolder the folder we need auth info for
+ @param login the variable containing username
+ @param password the variable containing password
+ @param didAsk a pointer (may be NULL) set to true if password was entered
+ @return true if the password is either not needed or was entered
+ */
+ static bool GetAuthInfoForFolder(const MFolder *mfolder,
+ String& login,
+ String& password,
+ bool *didAsk = NULL);
+
+ /**
+ Propose to the user to save the login and password temporarily (i.e. in
+ memory only for the duration of this session) or permanently (in config).
+
+ @param mf the opened folder with correct GetLogin()/GetPassword() values
+ @param folder for which the login and/or password should be saved
+ @param login the login name to save
+ @param password the password to save
+ */
+ static void ProposeSavePassword(MailFolder *mf,
+ MFolder *folder,
+ const String& login,
+ const String& password);
+
+ //@}
+
+
/// the folder for which we had set default interactive frame
static String ms_interactiveFolder;
@@ -906,23 +950,4 @@
// MailFolder_obj is a smart reference to MailFolder
DECLARE_AUTOPTR_WITH_CONVERSION(MailFolder);
-
-// ----------------------------------------------------------------------------
-// global (but private to MailFolder) functions
-//
-// unfortunately for now these functions have to live here, it would be much
-// better to have some less clumsy initialization code... (FIXME)
-// ----------------------------------------------------------------------------
-
-/// init common MF code
-extern bool MailFolderCmnInit();
-
-// clean up common MF code data
-extern void MailFolderCmnCleanup();
-
-/// init cclient
-extern bool MailFolderCCInit();
-
-/// shutdown cclient
-extern void MailFolderCCCleanup();
#endif // _MAILFOLDER_H
Index: MailFolderCC.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MailFolderCC.h,v
retrieving revision 1.207
retrieving revision 1.208
diff -b -u -2 -r1.207 -r1.208
--- MailFolderCC.h 5 Jul 2002 17:58:35 -0000 1.207
+++ MailFolderCC.h 14 Jul 2002 23:41:22 -0000 1.208
@@ -63,13 +63,11 @@
//@{
static MailFolder *OpenFolder(const MFolder *mfolder,
+ const String& login,
+ const String& password,
OpenMode openmode,
wxFrame *frame);
- static bool CloseFolder(const MFolder *mfolder);
//@}
- static int CloseAll();
- static MailFolder **GetAllOpened();
-
/** Phyically deletes this folder.
@return true on success
@@ -117,4 +115,7 @@
virtual String GetImapSpec(void) const { return m_ImapSpec; }
+ /// return full IMAP spec including the login name
+ static String GetFullImapSpec(const MFolder *folder, const String& login);
+
/** Get the profile.
@return Pointer to the profile.
@@ -123,5 +124,7 @@
/// Checks if the folder is in a critical section.
- bool InCritical(void) const { return m_InCritical; }
+ virtual bool IsInCriticalSection(void) const { return m_InCritical; }
+
+ virtual ServerInfoEntry *CreateServerInfo(const MFolder *folder) const;
/// @name Folder operations
@@ -471,26 +474,4 @@
{ return !HasLogin() && m_mfolder->NeedsLogin(); }
- /// propose the user to save the password temporarily or permanently
- void ProposeSavePassword();
-
- /// temporarily (i.e. for this session only) save password if we have it
- void SavePasswordForSession();
-
- /**
- Try to find login/password for the given folder looking among the
- logins/passwords previosuly entered by user if they are not stored in the
- folder itself. If it doesn't find it there neither, asks the user for the
- password (and sets didAsk to true then)
-
- @param mfolder the folder we need auth info for
- @param login the variable containing username
- @param password the variable containing password
- @param didAsk a pointer (may be NULL) set to true if password was entered
- @return true if the password is either not needed or was entered
- */
- static bool GetAuthInfoForFolder(const MFolder *mfolder,
- String& login,
- String& password,
- bool *didAsk = NULL);
//@}
@@ -640,16 +621,7 @@
static MailFolderCC *ms_StreamListDefaultObj;
- /// adds this object to Map
- void AddToMap(const MAILSTREAM *stream, const String& login) const;
-
- /// remove this object from Map
- void RemoveFromMap(void) const;
+ /// lookup object in map by its stream
+ static MailFolderCC *LookupObject(const MAILSTREAM *stream);
- /// find the stream in the map
- static MailFolderCC *LookupStream(const MAILSTREAM *stream);
-
- /// lookup object in map first by stream, then by name
- static MailFolderCC *LookupObject(const MAILSTREAM *stream,
- const char *name = NULL);
//@}
@@ -675,9 +647,4 @@
String m_SshPath;
//@}
-
-#ifdef DEBUG
- /// print a list of all streams
- static void DebugStreams(void);
-#endif
friend bool MailFolderCCInit();
Index: lists.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/lists.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -u -2 -r1.7 -r1.8
--- lists.h 27 Apr 2002 21:47:07 -0000 1.7
+++ lists.h 14 Jul 2002 23:41:22 -0000 1.8
@@ -290,5 +290,5 @@
*/
#define M_LIST(name,type) \
-M_LIST_common(name,type);
+ M_LIST_common(name,type)
/** Macro to define a list with a given name, having elements of pointer
--- MFFactory.h DELETED ---
--- MMailFolder.h DELETED ---
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates