summaryrefslogtreecommitdiffstats
path: root/mailnews/import/oexpress/nsOE5File.h
blob: 07498acfd93c8e4be791a899243f513170eb7d40 (plain)
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
/* -*- 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 nsOE5File_h___
#define nsOE5File_h___

#include "nsStringGlue.h"
#include "nsIFile.h"
#include "nsIMsgFolder.h"
#include <windows.h>

class nsIInputStream;

class nsOE5File
{
public:
    /* pFile must already be open for reading. */
  static bool    VerifyLocalMailFile(nsIFile *pFile);
    /* pFile must NOT be open for reading   */
  static bool    IsLocalMailFile(nsIFile *pFile);

  static bool    ReadIndex(nsIInputStream *pFile, uint32_t **ppIndex, uint32_t *pSize);

  static nsresult ImportMailbox(uint32_t *pBytesDone, bool *pAbort,
                                nsString& name, nsIFile *inFile,
                                nsIMsgFolder *pDstFolder, uint32_t *pCount);

  static void FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm);

private:
  typedef struct {
    uint32_t *  pIndex;
    uint32_t  count;
    uint32_t  alloc;
  } PRUint32Array;

  static const char *m_pFromLineSep;

  static bool    ReadBytes(nsIInputStream *stream, void *pBuffer, uint32_t offset, uint32_t bytes);
  static uint32_t ReadMsgIndex(nsIInputStream *file, uint32_t offset, PRUint32Array *pArray);
  static void  ConvertIndex(nsIInputStream *pFile, char *pBuffer, uint32_t *pIndex,
                            uint32_t size, uint32_t *pFlags, uint64_t *pTime);
  static bool    IsFromLine(char *pLine, uint32_t len);


};



#endif /* nsOE5File_h___ */