mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-28 11:27:32 +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
132
mailnews/mime/cthandlers/glue/mimexpcom.cpp
Normal file
132
mailnews/mime/cthandlers/glue/mimexpcom.cpp
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/* -*- 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/. */
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIMimeObjectClassAccess.h"
|
||||
#include "nsMsgMimeCID.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
static NS_DEFINE_CID(kMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID);
|
||||
|
||||
/*
|
||||
* These calls are necessary to expose the object class hierarchy
|
||||
* to externally developed content type handlers.
|
||||
*/
|
||||
extern "C" void *
|
||||
COM_GetmimeInlineTextClass(void)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeInlineTextClass(&ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
extern "C" void *
|
||||
COM_GetmimeLeafClass(void)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeLeafClass(&ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
extern "C" void *
|
||||
COM_GetmimeObjectClass(void)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeObjectClass(&ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
extern "C" void *
|
||||
COM_GetmimeContainerClass(void)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeContainerClass(&ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
extern "C" void *
|
||||
COM_GetmimeMultipartClass(void)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeMultipartClass(&ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
extern "C" void *
|
||||
COM_GetmimeMultipartSignedClass(void)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeMultipartSignedClass(&ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
COM_MimeObject_write(void *mimeObject, char *data, int32_t length,
|
||||
bool user_visible_p)
|
||||
{
|
||||
int32_t rc = -1;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
{
|
||||
if (NS_SUCCEEDED(objAccess->MimeObjectWrite(mimeObject, data, length, user_visible_p)))
|
||||
rc = length;
|
||||
else
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
extern "C" void *
|
||||
COM_MimeCreate(char * content_type, void * hdrs, void * opts)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->MimeCreate(content_type, hdrs, opts, &ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
93
mailnews/mime/cthandlers/glue/mimexpcom.h
Normal file
93
mailnews/mime/cthandlers/glue/mimexpcom.h
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
/*
|
||||
* This is the definitions for the Content Type Handler plugins to
|
||||
* access internals of libmime via XP-COM calls
|
||||
*/
|
||||
#ifndef _MIMEXPCOM_H_
|
||||
#define _MIMEXPCOM_H_
|
||||
|
||||
/*
|
||||
This header exposes functions that are necessary to access the
|
||||
object hierarchy for the mime chart. The class hierarchy is:
|
||||
|
||||
MimeObject (abstract)
|
||||
|
|
||||
|--- MimeContainer (abstract)
|
||||
| |
|
||||
| |--- MimeMultipart (abstract)
|
||||
| | |
|
||||
| | |--- MimeMultipartMixed
|
||||
| | |
|
||||
| | |--- MimeMultipartDigest
|
||||
| | |
|
||||
| | |--- MimeMultipartParallel
|
||||
| | |
|
||||
| | |--- MimeMultipartAlternative
|
||||
| | |
|
||||
| | |--- MimeMultipartRelated
|
||||
| | |
|
||||
| | |--- MimeMultipartAppleDouble
|
||||
| | |
|
||||
| | |--- MimeSunAttachment
|
||||
| | |
|
||||
| | |--- MimeMultipartSigned (abstract)
|
||||
| | |
|
||||
| | |--- MimeMultipartSigned
|
||||
| |
|
||||
| |--- MimeXlateed (abstract)
|
||||
| | |
|
||||
| | |--- MimeXlateed
|
||||
| |
|
||||
| |--- MimeMessage
|
||||
| |
|
||||
| |--- MimeUntypedText
|
||||
|
|
||||
|--- MimeLeaf (abstract)
|
||||
| |
|
||||
| |--- MimeInlineText (abstract)
|
||||
| | |
|
||||
| | |--- MimeInlineTextPlain
|
||||
| | |
|
||||
| | |--- MimeInlineTextHTML
|
||||
| | |
|
||||
| | |--- MimeInlineTextRichtext
|
||||
| | | |
|
||||
| | | |--- MimeInlineTextEnriched
|
||||
| | |
|
||||
| | |--- MimeInlineTextVCard
|
||||
| |
|
||||
| |--- MimeInlineImage
|
||||
| |
|
||||
| |--- MimeExternalObject
|
||||
|
|
||||
|--- MimeExternalBody
|
||||
*/
|
||||
|
||||
/*
|
||||
* These functions are exposed by libmime to be used by content type
|
||||
* handler plugins for processing stream data.
|
||||
*/
|
||||
/*
|
||||
* This is the write call for outputting processed stream data.
|
||||
*/
|
||||
extern "C" int COM_MimeObject_write(void *mimeObject, const char *data,
|
||||
int32_t length,
|
||||
bool user_visible_p);
|
||||
/*
|
||||
* The following group of calls expose the pointers for the object
|
||||
* system within libmime.
|
||||
*/
|
||||
extern "C" void *COM_GetmimeInlineTextClass(void);
|
||||
extern "C" void *COM_GetmimeLeafClass(void);
|
||||
extern "C" void *COM_GetmimeObjectClass(void);
|
||||
extern "C" void *COM_GetmimeContainerClass(void);
|
||||
extern "C" void *COM_GetmimeMultipartClass(void);
|
||||
extern "C" void *COM_GetmimeMultipartSignedClass(void);
|
||||
|
||||
extern "C" void *COM_MimeCreate(char * content_type, void * hdrs, void * opts);
|
||||
|
||||
#endif /* _MIMEXPCOM_H_ */
|
||||
18
mailnews/mime/cthandlers/glue/moz.build
Normal file
18
mailnews/mime/cthandlers/glue/moz.build
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
EXPORTS += [
|
||||
'nsMimeContentTypeHandler.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'mimexpcom.cpp',
|
||||
'nsMimeContentTypeHandler.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'mail'
|
||||
|
||||
Library('mimecthglue_s')
|
||||
|
||||
60
mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp
Normal file
60
mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- 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/. */
|
||||
#include <stdio.h>
|
||||
#include "nscore.h"
|
||||
#include "plstr.h"
|
||||
//#include "mimecth.h"
|
||||
#include "nsMimeContentTypeHandler.h"
|
||||
|
||||
/*
|
||||
* The following macros actually implement addref, release and
|
||||
* query interface for our component.
|
||||
*/
|
||||
NS_IMPL_ISUPPORTS(nsMimeContentTypeHandler, nsIMimeContentTypeHandler)
|
||||
|
||||
/*
|
||||
* nsIMimeEmitter definitions....
|
||||
*/
|
||||
nsMimeContentTypeHandler::nsMimeContentTypeHandler(const char *aMimeType,
|
||||
MCTHCreateCTHClass callback)
|
||||
{
|
||||
NS_ASSERTION(aMimeType, "nsMimeContentTypeHandler should be initialized with non-null mime type");
|
||||
NS_ASSERTION(callback, "nsMimeContentTypeHandler should be initialized with non-null callback");
|
||||
mimeType = PL_strdup(aMimeType);
|
||||
realCreateContentTypeHandlerClass = callback;
|
||||
}
|
||||
|
||||
nsMimeContentTypeHandler::~nsMimeContentTypeHandler(void)
|
||||
{
|
||||
if (mimeType) {
|
||||
NS_Free(mimeType);
|
||||
mimeType = 0;
|
||||
}
|
||||
realCreateContentTypeHandlerClass = 0;
|
||||
}
|
||||
|
||||
// Get the content type if necessary
|
||||
nsresult
|
||||
nsMimeContentTypeHandler::GetContentType(char **contentType)
|
||||
{
|
||||
*contentType = PL_strdup(mimeType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Set the output stream for processed data.
|
||||
nsresult
|
||||
nsMimeContentTypeHandler::CreateContentTypeHandlerClass(const char *content_type,
|
||||
contentTypeHandlerInitStruct *initStruct,
|
||||
MimeObjectClass **objClass)
|
||||
{
|
||||
*objClass = realCreateContentTypeHandlerClass(content_type, initStruct);
|
||||
if (!*objClass)
|
||||
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
47
mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.h
Normal file
47
mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
/*
|
||||
* This interface is implemented by content type handlers that will be
|
||||
* called upon by libmime to process various attachments types. The primary
|
||||
* purpose of these handlers will be to represent the attached data in a
|
||||
* viewable HTML format that is useful for the user
|
||||
*
|
||||
* Note: These will all register by their content type prefixed by the
|
||||
* following: mimecth:text/vcard
|
||||
*
|
||||
* libmime will then use the XPCOM Component Manager to
|
||||
* locate the appropriate Content Type handler
|
||||
*/
|
||||
#ifndef nsMimeContentTypeHandler_h_
|
||||
#define nsMimeContentTypeHandler_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIMimeContentTypeHandler.h"
|
||||
|
||||
typedef MimeObjectClass *
|
||||
(* MCTHCreateCTHClass)(const char *content_type,
|
||||
contentTypeHandlerInitStruct *initStruct);
|
||||
|
||||
class nsMimeContentTypeHandler : public nsIMimeContentTypeHandler {
|
||||
public:
|
||||
nsMimeContentTypeHandler (const char *aMimeType,
|
||||
MCTHCreateCTHClass callback);
|
||||
|
||||
/* this macro defines QueryInterface, AddRef and Release for this class */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetContentType(char **contentType) override;
|
||||
|
||||
NS_IMETHOD CreateContentTypeHandlerClass(const char *content_type,
|
||||
contentTypeHandlerInitStruct *initStruct,
|
||||
MimeObjectClass **objClass) override;
|
||||
private:
|
||||
virtual ~nsMimeContentTypeHandler();
|
||||
char *mimeType;
|
||||
MCTHCreateCTHClass realCreateContentTypeHandlerClass;
|
||||
};
|
||||
|
||||
#endif /* nsMimeContentTypeHandler_h_ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue