mailnews/mime/public/nsIPgpMimeProxy.idl
author Patrick Cloke <clokep@gmail.com>
Thu, 16 Oct 2014 18:05:41 -0400
changeset 20883 56fe4fac57d0916883a373cb7640681631ee0fe0
parent 15364 8e1af095f1bb8e9236c1c0de897fa0aa0cc09004
child 23892 364ce3053ab9f1ace8e2a09f484dbd1b92ca0e72
permissions -rw-r--r--
Backout part of 2f79b0b939ed that's unrelated. a=Standard8

/* 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 "nsIStreamListener.idl"
#include "nsIURI.idl"

%{C++
typedef int (*MimeDecodeCallbackFun)(const char *buf, int32_t buf_size, void *output_closure);

#define NS_PGPMIMEPROXY_CLASSNAME "PGP/Mime Decryption"
#define NS_PGPMIMEPROXY_CONTRACTID "@mozilla.org/mime/pgp-mime-decrypt;1"

#define NS_PGPMIMEPROXY_CID                     \
{ /* da0a2b4c-cef3-4631-9371-a23f15a1aba6 */      \
   0xda0a2b4c, 0xcef3, 0x4631,                    \
{0x93, 0x71, 0xa2, 0x3f, 0x15, 0xa1, 0xab, 0xa6 } }
%}

native MimeDecodeCallbackFun(MimeDecodeCallbackFun);

/**
 * nsIPgpMimeProxy is a proxy for a (JS-)addon for OpenPGP/MIME decryption
 */

[scriptable, uuid(da0a2b4c-cef3-4631-9371-a23f15a1aba6)]
interface nsIPgpMimeProxy : nsIStreamListener
{
  /**
   * set the decoder callback into mimelib
   */
  [noscript] void setMimeCallback(in MimeDecodeCallbackFun outputFun,
                                  in voidPtr outputClosure,
                                  in nsIURI myUri);

  /**
   * init function
   */
  void init();

  /**
   * process encoded data received from mimelib
   */
  void write(in string buf, in unsigned long count);

  /**
   * finish writing (EOF) from mimelib
   */
  void finish();

  /**
   * the listener that receives the OpenPGP/MIME data stream and decrypts
   * the message
   */
  attribute nsIStreamListener     decryptor;

  attribute ACString              contentType;
};


///////////////////////////////////////////////////////////////////////////////