Back to index

lightning-sunbird  0.9+nobinonly
nsIMimeConverter.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsISupports.idl"
00039 
00040 %{C++
00041 
00042 #include "prtypes.h"
00043 
00044 // default line length for calling the encoder
00045 #define kMIME_ENCODED_WORD_SIZE       72 
00046 
00047 // Max length of charset name. 
00048 #define kMAX_CSNAME                   64 
00049 
00050 /* Opaque objects used by the encoder/decoder to store state. */
00051 typedef struct MimeDecoderData MimeDecoderData;
00052 typedef struct MimeEncoderData MimeEncoderData;
00053 
00054 %}
00055 
00056 [scriptable, uuid(59B73615-2285-4d88-A31C-1ABFE4773F4F)]
00057 interface nsIMimeConverter : nsISupports {
00058 
00059   // These methods are all implemented by libmime to be used by 
00060   // modules that need to encode/decode mail headers
00061 
00062   // Decode routine.
00063   // If header does not need decoding, places nsnull in decodedString
00064 
00065   // Encode routine
00066   string encodeMimePartIIStr(in string  header, 
00067                              in boolean structured, 
00068                              in string  mailCharset, 
00069                              in long    fieldnamelen,
00070                              in long    encodedWordSize);
00071 
00072   // Encode routine (utf-8 input)
00073   string encodeMimePartIIStr_UTF8(in string  header, 
00074                                   in boolean structured, 
00075                                   in string  mailCharset, 
00076                                   in long    fieldnamelen,
00077                                   in long    encodedWordSize);
00078 
00079   // TO DO: Comeback and convert the rest of these methods into scriptable methods when we have more time...
00080 %{C++
00081   NS_IMETHOD DecodeMimeHeader(const char *header, 
00082                               char **decodedString,
00083                               const char *default_charset = nsnull,
00084                               PRBool override_charset = PR_FALSE,
00085                               PRBool eatContinuations = PR_TRUE) = 0;
00086 
00087   // Decode routine (also converts output to unicode)
00088   // On success, decodedString is never null
00089   NS_IMETHOD DecodeMimeHeader(const char *header, 
00090                               PRUnichar **decodedString,
00091                               const char *default_charset = nsnull,
00092                               PRBool override_charset = PR_FALSE,
00093                               PRBool eatContinuations = PR_TRUE) = 0;
00094 
00095   // Decode routine (also converts output to unicode)
00096   // On success, decodedString is never null
00097   NS_IMETHOD DecodeMimeHeader(const char *header, 
00098                               nsAString& decodedString,
00099                               const char *default_charset = nsnull,
00100                               PRBool override_charset = PR_FALSE,
00101                               PRBool eatContinuations = PR_TRUE) = 0;
00102 
00103   NS_IMETHOD B64EncoderInit(nsresult (*PR_CALLBACK output_fn) (const char *buf, PRInt32 size, void *closure), 
00104                                 void *closure, MimeEncoderData **returnEncoderData)  = 0;
00105 
00106   NS_IMETHOD QPEncoderInit (nsresult (*PR_CALLBACK output_fn) (const char *buf, 
00107                                 PRInt32 size, void *closure), void *closure, 
00108                                 MimeEncoderData ** returnEncoderData) = 0;
00109 
00110   NS_IMETHOD UUEncoderInit (char *filename, nsresult (*PR_CALLBACK output_fn) 
00111                                (const char *buf, PRInt32 size, void *closure), void *closure, 
00112                                MimeEncoderData ** returnEncoderData) = 0;
00113 
00114   NS_IMETHOD EncoderDestroy(MimeEncoderData *data, PRBool abort_p) = 0;
00115 
00116   NS_IMETHOD EncoderWrite (MimeEncoderData *data, const char *buffer, PRInt32 size, PRInt32 *written) = 0;
00117 %}
00118 
00119 };
00120