diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
commit | 302bf1b523012e11b60425d6eee1221ebc2724eb (patch) | |
tree | b191a895f8716efcbe42f454f37597a545a6f421 /mailnews/imap/src/nsImapUndoTxn.h | |
parent | 21b3f6247403c06f85e1f45d219f87549862198f (diff) | |
download | UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip |
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/imap/src/nsImapUndoTxn.h')
-rw-r--r-- | mailnews/imap/src/nsImapUndoTxn.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/mailnews/imap/src/nsImapUndoTxn.h b/mailnews/imap/src/nsImapUndoTxn.h new file mode 100644 index 000000000..cc910d768 --- /dev/null +++ b/mailnews/imap/src/nsImapUndoTxn.h @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* 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 nsImapUndoTxn_h__ +#define nsImapUndoTxn_h__ + +#include "mozilla/Attributes.h" +#include "nsIMsgFolder.h" +#include "nsImapCore.h" +#include "nsIImapService.h" +#include "nsIImapIncomingServer.h" +#include "nsIUrlListener.h" +#include "nsMsgTxn.h" +#include "MailNewsTypes.h" +#include "nsTArray.h" +#include "nsIMsgOfflineImapOperation.h" +#include "nsCOMPtr.h" +#include "nsWeakReference.h" +#include "nsCOMArray.h" + +class nsImapMoveCopyMsgTxn : public nsMsgTxn, nsIUrlListener +{ +public: + + nsImapMoveCopyMsgTxn(); + nsImapMoveCopyMsgTxn(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray, + const char* srcMsgIdString, nsIMsgFolder* dstFolder, + bool isMove); + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIURLLISTENER + + NS_IMETHOD UndoTransaction(void) override; + NS_IMETHOD RedoTransaction(void) override; + + // helper + nsresult SetCopyResponseUid(const char *msgIdString); + nsresult GetSrcKeyArray(nsTArray<nsMsgKey>& srcKeyArray); + void GetSrcMsgIds(nsCString &srcMsgIds) {srcMsgIds = m_srcMsgIdString;} + nsresult AddDstKey(nsMsgKey aKey); + nsresult UndoMailboxDelete(); + nsresult RedoMailboxDelete(); + nsresult Init(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray, + const char* srcMsgIdString, nsIMsgFolder* dstFolder, + bool idsAreUids, bool isMove); + +protected: + virtual ~nsImapMoveCopyMsgTxn(); + + nsWeakPtr m_srcFolder; + nsCOMArray<nsIMsgDBHdr> m_srcHdrs; + nsTArray<nsMsgKey> m_dupKeyArray; + nsTArray<nsMsgKey> m_srcKeyArray; + nsTArray<nsCString> m_srcMessageIds; + nsCString m_srcMsgIdString; + nsWeakPtr m_dstFolder; + nsCString m_dstMsgIdString; + bool m_idsAreUids; + bool m_isMove; + bool m_srcIsPop3; + nsTArray<uint32_t> m_srcSizeArray; + // this is used when we chain urls for imap undo, since "this" needs + // to be the listener, but the folder may need to also be notified. + nsWeakPtr m_onStopListener; + + nsresult GetImapDeleteModel(nsIMsgFolder* aFolder, nsMsgImapDeleteModel *aDeleteModel); +}; + +class nsImapOfflineTxn : public nsImapMoveCopyMsgTxn +{ +public: + nsImapOfflineTxn(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray, + const char* srcMsgIdString, + nsIMsgFolder* dstFolder, + bool isMove, + nsOfflineImapOperationType opType, + nsCOMArray<nsIMsgDBHdr> &srcHdrs); + + NS_IMETHOD UndoTransaction(void) override; + NS_IMETHOD RedoTransaction(void) override; + void SetAddFlags(bool addFlags) {m_addFlags = addFlags;} + void SetFlags(uint32_t flags) {m_flags = flags;} +protected: + virtual ~nsImapOfflineTxn(); + nsOfflineImapOperationType m_opType; + // these two are used to undo flag changes, which we don't currently do. + bool m_addFlags; + uint32_t m_flags; +}; +#endif |