From 302bf1b523012e11b60425d6eee1221ebc2724eb Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 3 Nov 2019 00:17:46 -0400 Subject: Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1 --- mailnews/base/src/nsMsgMailSession.h | 106 +++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 mailnews/base/src/nsMsgMailSession.h (limited to 'mailnews/base/src/nsMsgMailSession.h') diff --git a/mailnews/base/src/nsMsgMailSession.h b/mailnews/base/src/nsMsgMailSession.h new file mode 100644 index 000000000..6e4f57411 --- /dev/null +++ b/mailnews/base/src/nsMsgMailSession.h @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsMsgMailSession_h___ +#define nsMsgMailSession_h___ + +#include "nsIMsgMailSession.h" +#include "nsISupports.h" +#include "nsCOMPtr.h" +#include "nsIMsgStatusFeedback.h" +#include "nsIMsgWindow.h" +#include "nsCOMArray.h" +#include "nsIMsgShutdown.h" +#include "nsIObserver.h" +#include "nsIMutableArray.h" +#include "nsIMsgProgress.h" +#include "nsTArray.h" +#include "nsTObserverArray.h" +#include "nsIMsgUserFeedbackListener.h" +#include "nsIUrlListener.h" + +/////////////////////////////////////////////////////////////////////////////////// +// The mail session is a replacement for the old 4.x MSG_Master object. It contains +// mail session generic information such as the user's current mail identity, .... +// I'm starting this off as an empty interface and as people feel they need to +// add more information to it, they can. I think this is a better approach than +// trying to port over the old MSG_Master in its entirety as that had a lot of +// cruft in it.... +////////////////////////////////////////////////////////////////////////////////// + +class nsMsgMailSession : public nsIMsgMailSession, + public nsIFolderListener +{ +public: + nsMsgMailSession(); + + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSIMSGMAILSESSION + NS_DECL_NSIFOLDERLISTENER + + nsresult Init(); + nsresult GetSelectedLocaleDataDir(nsIFile *defaultsDir); + +protected: + virtual ~nsMsgMailSession(); + + struct folderListener { + nsCOMPtr mListener; + uint32_t mNotifyFlags; + + folderListener(nsIFolderListener *aListener, uint32_t aNotifyFlags) + : mListener(aListener), mNotifyFlags(aNotifyFlags) {} + folderListener(const folderListener &aListener) + : mListener(aListener.mListener), mNotifyFlags(aListener.mNotifyFlags) {} + ~folderListener() {} + + int operator==(nsIFolderListener* aListener) const { + return mListener == aListener; + } + int operator==(const folderListener &aListener) const { + return mListener == aListener.mListener && + mNotifyFlags == aListener.mNotifyFlags; + } + }; + + nsTObserverArray mListeners; + nsTObserverArray > mFeedbackListeners; + + nsCOMArray mWindows; + // stick this here temporarily + nsCOMPtr m_temporaryMsgWindow; +}; + +/********************************************************************************/ + +class nsMsgShutdownService : public nsIMsgShutdownService, + public nsIUrlListener, + public nsIObserver +{ +public: + nsMsgShutdownService(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIMSGSHUTDOWNSERVICE + NS_DECL_NSIURLLISTENER + NS_DECL_NSIOBSERVER + +protected: + nsresult ProcessNextTask(); + void AttemptShutdown(); + +private: + virtual ~nsMsgShutdownService(); + + nsCOMArray mShutdownTasks; + nsCOMPtr mMsgProgress; + uint32_t mTaskIndex; + uint32_t mQuitMode; + bool mProcessedShutdown; + bool mQuitForced; + bool mReadyToQuit; +}; + +#endif /* nsMsgMailSession_h__ */ -- cgit v1.2.3