mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 10:57:34 +09:00
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
This commit is contained in:
parent
23e0d82436
commit
e400f4130a
1564 changed files with 510348 additions and 0 deletions
73
mailnews/base/util/nsImapMoveCoalescer.h
Normal file
73
mailnews/base/util/nsImapMoveCoalescer.h
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/* -*- 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 _nsImapMoveCoalescer_H
|
||||
#define _nsImapMoveCoalescer_H
|
||||
|
||||
#include "msgCore.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIUrlListener.h"
|
||||
#include "nsIMsgCopyServiceListener.h"
|
||||
|
||||
// imap move coalescer class - in order to keep nsImapMailFolder from growing like Topsy
|
||||
// Logically, we want to keep track of an nsTArray<nsMsgKey> per nsIMsgFolder, and then
|
||||
// be able to retrieve them one by one and play back the moves.
|
||||
// This utility class will be used by both the filter code and the offline playback code,
|
||||
// to avoid multiple moves to the same folder.
|
||||
|
||||
class NS_MSG_BASE nsImapMoveCoalescer : public nsIUrlListener
|
||||
{
|
||||
public:
|
||||
friend class nsMoveCoalescerCopyListener;
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIURLLISTENER
|
||||
|
||||
nsImapMoveCoalescer(nsIMsgFolder *sourceFolder, nsIMsgWindow *msgWindow);
|
||||
|
||||
nsresult AddMove(nsIMsgFolder *folder, nsMsgKey key);
|
||||
nsresult PlaybackMoves(bool doNewMailNotification = false);
|
||||
// this lets the caller store keys in an arbitrary number of buckets. If the bucket
|
||||
// for the passed in index doesn't exist, it will get created.
|
||||
nsTArray<nsMsgKey> *GetKeyBucket(uint32_t keyArrayIndex);
|
||||
nsIMsgWindow *GetMsgWindow() {return m_msgWindow;}
|
||||
bool HasPendingMoves() {return m_hasPendingMoves;}
|
||||
protected:
|
||||
virtual ~nsImapMoveCoalescer();
|
||||
// m_sourceKeyArrays and m_destFolders are parallel arrays.
|
||||
nsTArray<nsTArray<nsMsgKey> > m_sourceKeyArrays;
|
||||
nsCOMArray<nsIMsgFolder> m_destFolders;
|
||||
nsCOMPtr <nsIMsgWindow> m_msgWindow;
|
||||
nsCOMPtr <nsIMsgFolder> m_sourceFolder;
|
||||
bool m_doNewMailNotification;
|
||||
bool m_hasPendingMoves;
|
||||
nsTArray<nsMsgKey> m_keyBuckets[2];
|
||||
int32_t m_outstandingMoves;
|
||||
};
|
||||
|
||||
class nsMoveCoalescerCopyListener final : public nsIMsgCopyServiceListener
|
||||
{
|
||||
public:
|
||||
nsMoveCoalescerCopyListener(nsImapMoveCoalescer * coalescer, nsIMsgFolder *destFolder);
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMSGCOPYSERVICELISTENER
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> m_destFolder;
|
||||
|
||||
nsImapMoveCoalescer *m_coalescer;
|
||||
// when we get OnStopCopy, update the folder. When we've finished all the copies,
|
||||
// send the biff notification.
|
||||
|
||||
private:
|
||||
~nsMoveCoalescerCopyListener();
|
||||
};
|
||||
|
||||
|
||||
#endif // _nsImapMoveCoalescer_H
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue