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/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp | |
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/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp')
-rw-r--r-- | mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp b/mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp new file mode 100644 index 000000000..369f8c4bf --- /dev/null +++ b/mailnews/mime/cthandlers/glue/nsMimeContentTypeHandler.cpp @@ -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; +} + + + |