DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (9bb7406580cd)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
/* -*- 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 nsMsgCopyService_h__
#define nsMsgCopyService_h__

#include "nscore.h"
#include "nsIMsgCopyService.h"
#include "nsCOMPtr.h"
#include "nsIMsgFolder.h"
#include "nsIMsgHdr.h"
#include "nsIMsgWindow.h"
#include "nsIMutableArray.h"
#include "nsITransactionManager.h"
#include "nsTArray.h"

typedef enum _nsCopyRequestType {
  nsCopyMessagesType = 0x0,
  nsCopyFileMessageType = 0x1,
  nsCopyFoldersType = 0x2
} nsCopyRequestType;

class nsCopyRequest;

class nsCopySource {
 public:
  nsCopySource();
  explicit nsCopySource(nsIMsgFolder* srcFolder);
  ~nsCopySource();
  void AddMessage(nsIMsgDBHdr* aMsg);

  nsCOMPtr<nsIMsgFolder> m_msgFolder;
  nsCOMPtr<nsIMutableArray> m_messageArray;
  bool m_processed;
};

class nsCopyRequest {
 public:
  nsCopyRequest();
  ~nsCopyRequest();

  nsresult Init(nsCopyRequestType type, nsISupports* aSupport,
                nsIMsgFolder* dstFolder, bool bVal, uint32_t newMsgFlags,
                const nsACString& newMsgKeywords,
                nsIMsgCopyServiceListener* listener, nsIMsgWindow* msgWindow,
                bool allowUndo);
  nsCopySource* AddNewCopySource(nsIMsgFolder* srcFolder);

  nsCOMPtr<nsISupports> m_srcSupport;  // ui source folder or file spec
  nsCOMPtr<nsIMsgFolder> m_dstFolder;
  nsCOMPtr<nsIMsgWindow> m_msgWindow;
  nsCOMPtr<nsIMsgCopyServiceListener> m_listener;
  nsCOMPtr<nsITransactionManager> m_txnMgr;
  nsCopyRequestType m_requestType;
  bool m_isMoveOrDraftOrTemplate;
  bool m_allowUndo;
  bool m_processed;
  uint32_t m_newMsgFlags;
  nsCString m_newMsgKeywords;
  nsString m_dstFolderName;                   // used for copy folder.
  nsTArray<nsCopySource*> m_copySourceArray;  // array of nsCopySource
};

class nsMsgCopyService : public nsIMsgCopyService {
 public:
  nsMsgCopyService();

  NS_DECL_THREADSAFE_ISUPPORTS

  NS_DECL_NSIMSGCOPYSERVICE

 private:
  virtual ~nsMsgCopyService();

  nsresult ClearRequest(nsCopyRequest* aRequest, nsresult rv);
  nsresult DoCopy(nsCopyRequest* aRequest);
  nsresult DoNextCopy();
  nsCopyRequest* FindRequest(nsISupports* aSupport, nsIMsgFolder* dstFolder);
  nsresult QueueRequest(nsCopyRequest* aRequest, bool* aCopyImmediately);
  void LogCopyCompletion(nsISupports* aSrc, nsIMsgFolder* aDest);
  void LogCopyRequest(const char* logMsg, nsCopyRequest* aRequest);

  nsTArray<nsCopyRequest*> m_copyRequests;
};

#endif