nsIMimeConverter

  • Revision slug: nsIMimeConverter
  • Revision title: nsIMimeConverter
  • Revision id: 463111
  • Created:
  • Creator: Oeekker
  • Is current revision? Yes
  • Comment

Revision Content

The nsIMimeConverter service allows you to convert headers into and out of MIME format.

{{ tbInterfaceStatus("nsIMimeConverter", "mailnews/mime/public/nsIMimeConverter.idl", "unfrozen", "Mozilla 1.9", "yes") }}

Inherits from: {{ Interface("nsISupports") }}

Implemented by: @mozilla.org/messenger/mimeconverter;1.

Method overview

 

string encodeMIMEPartIIStr(in string header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedwordsize);
string encodeMIMEPartIIStr_UTF8(in AUTF8String header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedwordsize);
string decodeMimeHeaderToCharPtr(in string header, in string default_charset, in boolean override_charset, in boolean eatContinuations);
AString decodeMimeHeader(in string header, in string default_charset, in boolean override_charset, in boolean eatContinuations);
MimeEncoderData *B64EncoderInit(in MimeConverterOutputCallback output_fn, in void *closure);
MimeEncoderData *QPEncoderInit(in MimeConverterOutputCallback output_fn, in void *closure);
void EncoderDestroy(in MimeEncoderData *data, in boolean abort_p);
long EncoderWrite(in MimeEncoderData *data, in string buffer, in long size);

 

Methods

encodeMimePartIIStr()

An variant of {{ manch("encodeMimePartIIStr_UTF8") }} which treats the header as written in the given charset. This should only be used by native code, as xpconnect translation causes it to not work properly.

string encodeMimePartIIStr(in string  header,
                           in boolean structured,
                           in string  mailCharset,
                           in long    fieldnamelen,
                           in long    encodedWordSize);
Parameters
propertyName
The name of the property to retrieve.
Return Value

The value of the property.

encodeMimePartIIStr_UTF8()

Encodes a string into a MIME-encoded form according to RFC 2047.

string encodeMimePartIIStr_UTF8(in AUTF8String header,
                                in boolean     structured,
                                in string      mailCharset,
                                in long        fieldnamelen,
                                in long        encodedWordSize);
Parameters
header
The string to encode into the MIME-encoded form.
structured
Whether or not this string may contain <> blocks which should not be encoded (e.g., the From and To headers).
mailCharset
The charset to encode into.
fieldnamelen
The length of the header field including the colon and space (": ").
encodedWordSize
The maximum line length of the encoded string.

decodeMimeHeaderToCharPtr()

 void setStringProperty(in string propertyName,
                        in string propertyValue);
Parameters
propertyName
The name of the property to set.
propertyValue
The value of the property.

decodeMimeHeader()

 string getStringProperty(in string propertyName);
Parameters
propertyName
The name of the property to retrieve.
Return Value

The value of the property.

B64EncoderInit()

Get an integer property. Usually you would use this to store you own properties.

 unsigned long getUint32Property(in string propertyName);
Parameters
propertyName
The name of the property to retrieve. Thunderbird stored Uint32 properties (not a complete list):
indexed
Used for Spotlight integration on OSX.
notAPhishMessage
Indicates whether phisihing filters have been run on a message yet.

 

Return Value

The value of the property.

QPEncoderInit()

 void setUint32Property(in string propertyName,
                        in unsigned long propertyVal);
Parameters
propertyName
The name of the property to set.
propertyVal
The value of the property.

EncoderDestroy()

Marks this header as read. Thunderbird provides a utility function which performs this for the currently selected message: MarkCurrentMessageAsRead().

 void markRead(in boolean read);
Parameters
read
If true, mark as read. If false mark as undread.

EncoderWrite()

 void markFlagged(in boolean flagged);
Parameters
flagged
If true, mark as flagged. If false remove flag.

Revision Source

<p>The <code>nsIMimeConverter</code> service allows you to convert headers into and out of MIME format.</p>
<p>{{ tbInterfaceStatus("nsIMimeConverter", "mailnews/mime/public/nsIMimeConverter.idl", "unfrozen", "Mozilla 1.9", "yes") }}</p>
<p>Inherits from: {{ Interface("nsISupports") }}</p>
<p>Implemented by: <code>@mozilla.org/messenger/mimeconverter;1<span style="font-family: Verdana,Tahoma,sans-serif;">.</span></code></p>
<h2 id="Method_overview" name="Method_overview">Method overview</h2>
<p>&nbsp;</p>
<table class="standard-table">
  <tbody>
    <tr>
      <td><code>string <a href="/#encodeMIMEPartIIStr.28.29" title="#encodeMIMEPartIIStr.28.29">encodeMIMEPartIIStr</a>(in string header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedwordsize);</code></td>
    </tr>
    <tr>
      <td><code>string <a href="/#encodeMIMEPartIIStr_UTF8.28.29" title="#encodeMIMEPartIIStr UTF8.28.29">encodeMIMEPartIIStr_UTF8</a>(in AUTF8String header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedwordsize);</code></td>
    </tr>
    <tr>
      <td><code>string <a href="/#decodeMimeHeaderToCharPtr.28.29" title="#decodeMimeHeaderToCharPtr.28.29">decodeMimeHeaderToCharPtr</a>(in string header, in string default_charset, in boolean override_charset, in boolean eatContinuations);</code></td>
    </tr>
    <tr>
      <td><code>AString <a href="/#decodeMimeHeader.28.29" title="#decodeMimeHeader.28.29">decodeMimeHeader</a>(</code><code>in string header, in string default_charset, in boolean override_charset, in boolean eatContinuations);</code></td>
    </tr>
    <tr>
      <td><code>MimeEncoderData *<a href="/#B64EncoderInit.28.29" title="#B64EncoderInit.28.29">B64EncoderInit</a>(in MimeConverterOutputCallback output_fn, in void *closure);</code></td>
    </tr>
    <tr>
      <td><code>MimeEncoderData *<a href="/#QPEncoderInit.28.29" title="#QPEncoderInit.28.29">QPEncoderInit</a></code><code>(in MimeConverterOutputCallback output_fn, in void *closure);</code></td>
    </tr>
    <tr>
      <td><code>void <a href="/#EncoderDestroy.28.29" title="#EncoderDestroy.28.29">EncoderDestroy</a>(in MimeEncoderData *data, in boolean abort_p);</code></td>
    </tr>
    <tr>
      <td><code>long <a href="/#EncoderWrite.28.29" title="#EncoderWrite.28.29">EncoderWrite</a>(in MimeEncoderData *data, in string buffer, in long size);</code></td>
    </tr>
  </tbody>
</table>
<p>&nbsp;</p>
<h2 id="Methods" name="Methods">Methods</h2>
<h3 id="getProperty.28.29" name="getProperty.28.29">encodeMimePartIIStr()</h3>
<p>An variant of {{ manch("encodeMimePartIIStr_UTF8") }} which treats the header as written in the given charset. This should only be used by native code, as xpconnect translation causes it to not work properly.</p>
<pre class="eval">
string encodeMimePartIIStr(in string  header,
                           in boolean structured,
                           in string  mailCharset,
                           in long    fieldnamelen,
                           in long    encodedWordSize);
</pre>
<h6 id="Parameters" name="Parameters">Parameters</h6>
<dl>
  <dt>
    <code>propertyName</code></dt>
  <dd>
    The name of the property to retrieve.</dd>
</dl>
<h6 id="Return_Value" name="Return_Value">Return Value</h6>
<p>The value of the property.</p>
<h3 id="setProperty.28.29" name="setProperty.28.29">encodeMimePartIIStr_UTF8()</h3>
<p>Encodes a string into a MIME-encoded form according to RFC 2047.</p>
<pre class="eval">
string encodeMimePartIIStr_UTF8(in AUTF8String header,
                                in boolean     structured,
                                in string      mailCharset,
                                in long        fieldnamelen,
                                in long        encodedWordSize);
</pre>
<h6 id="Parameters_2" name="Parameters_2">Parameters</h6>
<dl>
  <dt>
    <code>header</code></dt>
  <dd>
    The string to encode into the MIME-encoded form.</dd>
  <dt>
    <code>structured</code></dt>
  <dd>
    Whether or not this string may contain &lt;&gt; blocks which should not be encoded (e.g., the From and To headers).</dd>
  <dt>
    <code>mailCharset</code></dt>
  <dd>
    The charset to encode into.</dd>
  <dt>
    <code>fieldnamelen</code></dt>
  <dd>
    The length of the header field including the colon and space (": ").</dd>
  <dt>
    <code>encodedWordSize</code></dt>
  <dd>
    The maximum line length of the encoded string.</dd>
</dl>
<h3 id="setStringProperty.28.29" name="setStringProperty.28.29">decodeMimeHeaderToCharPtr()</h3>
<pre class="eval">
 void setStringProperty(in string propertyName,
                        in string propertyValue);
</pre>
<h6 id="Parameters_3" name="Parameters_3">Parameters</h6>
<dl>
  <dt>
    <code>propertyName</code></dt>
  <dd>
    The name of the property to set.</dd>
  <dt>
    <code>propertyValue</code></dt>
  <dd>
    The value of the property.</dd>
</dl>
<h3 id="getStringProperty.28.29" name="getStringProperty.28.29">decodeMimeHeader()</h3>
<pre class="eval">
 string getStringProperty(in string propertyName);
</pre>
<h6 id="Parameters_4" name="Parameters_4">Parameters</h6>
<dl>
  <dt>
    <code>propertyName</code></dt>
  <dd>
    The name of the property to retrieve.</dd>
</dl>
<h6 id="Return_Value_2" name="Return_Value_2">Return Value</h6>
<p>The value of the property.</p>
<h3 id="getUint32Property.28.29" name="getUint32Property.28.29">B64EncoderInit()</h3>
<p>Get an integer property. Usually you would use this to store you own properties.</p>
<pre class="eval">
 unsigned long getUint32Property(in string propertyName);
</pre>
<h6 id="Parameters_5" name="Parameters_5">Parameters</h6>
<dl>
  <dt>
    <code>propertyName</code></dt>
  <dd>
    The name of the property to retrieve. <a href="/en/Thunderbird" title="en/Thunderbird">Thunderbird</a> stored Uint32 properties (not a complete list):
    <dl>
      <dt>
        <code>indexed</code></dt>
      <dd>
        Used for Spotlight integration on <a href="/en/OSX" title="en/OSX">OSX</a>.</dd>
      <dt>
        <code>notAPhishMessage</code></dt>
      <dd>
        Indicates whether phisihing filters have been run on a message yet.</dd>
    </dl>
  </dd>
</dl>
<p>&nbsp;</p>
<h6 id="Return_Value_3" name="Return_Value_3">Return Value</h6>
<p>The value of the property.</p>
<h3 id="setUint32Property.28.29" name="setUint32Property.28.29">QPEncoderInit()</h3>
<pre class="eval">
 void setUint32Property(in string propertyName,
                        in unsigned long propertyVal);
</pre>
<h6 id="Parameters_6" name="Parameters_6">Parameters</h6>
<dl>
  <dt>
    <code>propertyName</code></dt>
  <dd>
    The name of the property to set.</dd>
  <dt>
    <code>propertyVal</code></dt>
  <dd>
    The value of the property.</dd>
</dl>
<h3 id="markRead.28.29" name="markRead.28.29">EncoderDestroy()</h3>
<p>Marks this header as read. <a href="/en/Thunderbird" title="en/Thunderbird">Thunderbird</a> provides a utility function which performs this for the currently selected message: <a class="external" href="http://mxr.mozilla.org/mozilla/source/mail/base/content/mailWindowOverlay.js#2629">MarkCurrentMessageAsRead()</a>.</p>
<pre class="eval">
 void markRead(in boolean read);
</pre>
<h6 id="Parameters_7" name="Parameters_7">Parameters</h6>
<dl>
  <dt>
    <code>read</code></dt>
  <dd>
    If <code>true</code>, mark as read. If <code>false</code> mark as undread.</dd>
</dl>
<h3 id="markFlagged.28.29" name="markFlagged.28.29">EncoderWrite()</h3>
<pre class="eval">
 void markFlagged(in boolean flagged);
</pre>
<h6 id="Parameters_8" name="Parameters_8">Parameters</h6>
<dl>
  <dt>
    <code>flagged</code></dt>
  <dd>
    If <code>true</code>, mark as flagged. If <code>false</code> remove flag.</dd>
</dl>
Revert to this revision