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/import/src/nsImportMimeEncode.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/import/src/nsImportMimeEncode.h')
-rw-r--r-- | mailnews/import/src/nsImportMimeEncode.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/mailnews/import/src/nsImportMimeEncode.h b/mailnews/import/src/nsImportMimeEncode.h new file mode 100644 index 000000000..1447d11c4 --- /dev/null +++ b/mailnews/import/src/nsImportMimeEncode.h @@ -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 nsImportMimeEncode_h__ +#define nsImportMimeEncode_h__ + +#include "mozilla/Attributes.h" +#include "nsImportScanFile.h" +#include "ImportOutFile.h" +#include "nsImportEncodeScan.h" +#include "nsStringGlue.h" +#include "nsIImportMimeEncode.h" + + +// Content-Type: image/gif; name="blah.xyz" +// Content-Transfer-Encoding: base64 +// Content-Disposition: attachment; filename="blah.xyz" + +class nsImportMimeEncode : public nsImportEncodeScan { +public: + nsImportMimeEncode(); + ~nsImportMimeEncode(); + + void EncodeFile(nsIFile *pInFile, ImportOutFile *pOut, const char *pFileName, const char *pMimeType); + + bool DoWork(bool *pDone); + + long NumBytesProcessed(void) { long val = m_bytesProcessed; m_bytesProcessed = 0; return val;} + +protected: + void CleanUp(void); + bool SetUpEncode(void); + bool WriteFileName(nsCString& fName, bool wasTrans, const char *pTag); + bool TranslateFileName(nsCString& inFile, nsCString& outFile); + + + virtual bool ScanBuffer(bool *pDone) override; + + +protected: + nsCString m_fileName; + nsCOMPtr <nsIFile> m_pMimeFile; + ImportOutFile * m_pOut; + nsCString m_mimeType; + + int m_state; + long m_bytesProcessed; + uint8_t * m_pInputBuf; + bool m_appleSingle; + + // Actual encoding variables + int m_lineLen; +}; + + +class nsIImportMimeEncodeImpl : public nsIImportMimeEncode { +public: + NS_DECL_ISUPPORTS + + NS_DECL_NSIIMPORTMIMEENCODE + + nsIImportMimeEncodeImpl(); + +private: + virtual ~nsIImportMimeEncodeImpl(); + ImportOutFile * m_pOut; + nsImportMimeEncode * m_pEncode; +}; + + +#endif /* nsImportMimeEncode_h__ */ + |