msgIAccountBackend.idl
author Joshua Cranmer <Pidgeot18@gmail.com>
Mon, 10 Jan 2011 17:21:54 -0500
changeset 1 cd512d141f98
parent 0 c58f0b382747
permissions -rw-r--r--
I hate message URIs.
/* ***** BEGIN LICENSE BLOCK *****
 * Copyright (c) 2011 Joshua Cranmer
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

interface nsIMsgDBHdr;
interface nsIMsgWindow;
interface nsIInputStream;
interface nsIChannel;
interface nsIRequest;

interface msgIMessageReceiver;

/**
 * The background implementation of an account extension.
 *
 * The methods of this class are intended to support the new-account-type
 * framework implementation.
 */
[scriptable, uuid(fe973cb6-e161-4be6-9d99-7f1d9a46edac)]
interface msgIAccountBackend : nsISupports {
  /**
   * Asynchronously retrieve the contents of a message.
   *
   * Note that aMsgWindow could potentially be null, while the other parameters
   * should never be null.
   *
   * @param aMsgHdr     The message to get the contents for
   * @param aMsgWindow  A standard message window object, for error callbacks.
   * @param aCallback   A callback object to receive the message contents.
   */
  void getMessageContents(in nsIMsgDBHdr aMsgHdr, in nsIMsgWindow aMsgWindow,
                          in msgIMessageReceiver aCallback);
};

/**
 * A method that gets the contents of a message.
 *
 * Methods on this interface can be called either synchronously or
 * asynchronously, depending on the whim of the caller. However, the methods
 * that being with "deliverMessage" MUST be called last, as it will be at that
 * time that the message is delivered to the downstream consumer.
 *
 * Standard headers (To, From, CC, Date, Subject, References, Content-Type) are
 * automatically filled in from the message header object. In addition, the
 * string property "replyTo" is used to generate the Reply-To: header.
 */
[scriptable, uuid(0f9856ad-75cc-4d7d-8ba4-29086516a6c3)]
interface msgIMessageReceiver : nsISupports {
  /**
   * This returns the message as an input stream containing only the body.
   *
   * @param aInputStream  The contents of the message body.
   * @param aContentType  The content-type of the message body.
   * @param aRequest      A request object to handle suspend/resume callbacks.
   */
  void deliverMessageBodyAsStream(in nsIInputStream aInputStream,
                                  in AUTF8String aContentType,
                                  [optional] in nsIRequest aRequest);
  /**
   * This returns the message as a channel, which will output only the body.
   *
   * Note that only a subset of the methods may be called on aChannel. In
   * particular, besides asyncOpen, isPending, cancel, suspend, and resume may
   * be called. All other attributes or methods are ignored; in particular, no
   * load group will be set, and the channel's content-type will be ignored in
   * favor of the one passed in here.
   *
   * @param aChannel      The source channel for the message body.
   * @param aContentType  The content-type of the message body.
   */
  void deliverMessageBodyAsChannel(in nsIChannel aChannel,
                                   in AUTF8String aContentType);
};