summaryrefslogtreecommitdiffstats
path: root/mailnews/import/oexpress/nsOEScanBoxes.h
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
commit302bf1b523012e11b60425d6eee1221ebc2724eb (patch)
treeb191a895f8716efcbe42f454f37597a545a6f421 /mailnews/import/oexpress/nsOEScanBoxes.h
parent21b3f6247403c06f85e1f45d219f87549862198f (diff)
downloadUXP-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/import/oexpress/nsOEScanBoxes.h')
-rw-r--r--mailnews/import/oexpress/nsOEScanBoxes.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/mailnews/import/oexpress/nsOEScanBoxes.h b/mailnews/import/oexpress/nsOEScanBoxes.h
new file mode 100644
index 000000000..e2e62b238
--- /dev/null
+++ b/mailnews/import/oexpress/nsOEScanBoxes.h
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; 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 nsOEScanBoxes_h___
+#define nsOEScanBoxes_h___
+
+#include "nsStringGlue.h"
+#include "nsIImportModule.h"
+#include "nsTArray.h"
+#include "nsCOMPtr.h"
+#include "nsIArray.h"
+#include "nsIMutableArray.h"
+#include "nsIFile.h"
+#include "nsIImportService.h"
+
+class nsIInputStream;
+
+class nsOEScanBoxes {
+public:
+ nsOEScanBoxes();
+ ~nsOEScanBoxes();
+
+ static bool FindMail(nsIFile *pWhere);
+
+ bool GetMailboxes(nsIFile *pWhere, nsIArray **pArray);
+
+
+private:
+ typedef struct {
+ uint32_t index;
+ uint32_t parent;
+ int32_t child;
+ int32_t sibling;
+ int32_t type;
+ nsString mailName;
+ nsCString fileName;
+ bool processed; // used by entries on m_pendingChildArray list
+ } MailboxEntry;
+
+ static bool Find50Mail(nsIFile *pWhere);
+
+ void Reset(void);
+ bool FindMailBoxes(nsIFile * descFile);
+ bool Find50MailBoxes(nsIFile * descFile);
+
+ // If find mailboxes fails you can use this routine to get the raw mailbox file names
+ void ScanMailboxDir(nsIFile * srcDir);
+ bool Scan50MailboxDir(nsIFile * srcDir);
+
+ MailboxEntry * GetIndexEntry(uint32_t index);
+ void AddChildEntry(MailboxEntry *pEntry, uint32_t rootIndex);
+ MailboxEntry * NewMailboxEntry(uint32_t id, uint32_t parent, const char *prettyName, char *pFileName);
+ void ProcessPendingChildEntries(uint32_t parent, uint32_t rootIndex, nsTArray<MailboxEntry*> &childArray);
+ void RemoveProcessedChildEntries();
+
+
+ bool ReadLong(nsIInputStream * stream, int32_t& val, uint32_t offset);
+ bool ReadLong(nsIInputStream * stream, uint32_t& val, uint32_t offset);
+ bool ReadString(nsIInputStream * stream, nsString& str, uint32_t offset);
+ bool ReadString(nsIInputStream * stream, nsCString& str, uint32_t offset);
+ uint32_t CountMailboxes(MailboxEntry *pBox);
+
+ void BuildMailboxList(MailboxEntry *pBox, nsIFile * root, int32_t depth, nsIMutableArray *pArray);
+ bool GetMailboxList(nsIFile * root, nsIArray **pArray);
+
+private:
+ MailboxEntry * m_pFirst;
+ nsTArray<MailboxEntry*> m_entryArray;
+ nsTArray<MailboxEntry*> m_pendingChildArray; // contains child folders whose parent folders have not showed up.
+
+ nsCOMPtr<nsIImportService> mService;
+};
+
+#endif // nsOEScanBoxes_h__