Back to index

enigmail  1.4.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
nsEnigMimeVerify Class Reference

#include <nsEnigMimeVerify.h>

Inheritance diagram for nsEnigMimeVerify:
Inheritance graph
[legend]
Collaboration diagram for nsEnigMimeVerify:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIENIGMIMEVERIFY
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER 
nsEnigMimeVerify ()
virtual ~nsEnigMimeVerify ()
void init (in nsIDOMWindow window, in nsIURI uri, in nsIMsgWindow msgWindow, in AUTF8String msgUriSpec, in boolean pgpMime, in boolean isSubPart)
void initWithChannel (in nsIDOMWindow window, in nsIChannel channel, in nsIMsgWindow msgWindow, in AUTF8String msgUriSpec, in boolean pgpMime, in boolean isSubPart)

Static Public Member Functions

static NS_METHOD Create (nsISupports *aOuter, REFNSIID aIID, void **aResult)

Protected Member Functions

nsresult Finalize ()
NS_METHOD Finish ()

Protected Attributes

EMBool mInitialized
EMBool mPgpMime
EMBool mRequestStopped
EMBool mLastLinebreak
PRUint32 mStartCount
nsCString mContentBoundary
nsCString mLinebreak
nsCString mURISpec
nsCOMPtr< nsIMsgWindow > mMsgWindow
nsCOMPtr< nsIIPCBuffermOutBuffer
nsCOMPtr< nsIPipeTransportmPipeTrans
nsCOMPtr< nsIPipeFilterListenermArmorListener
nsCOMPtr< nsIPipeFilterListenermSecondPartListener
nsCOMPtr< nsIPipeFilterListenermFirstPartListener
nsCOMPtr< nsIEnigMimeListenermOuterMimeListener
nsCOMPtr< nsIEnigMimeListenermInnerMimeListener

Detailed Description

Definition at line 50 of file nsEnigMimeVerify.h.


Constructor & Destructor Documentation

NS_DECL_ISUPPORTS NS_DECL_NSIENIGMIMEVERIFY NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER nsEnigMimeVerify::nsEnigMimeVerify ( )

Definition at line 123 of file nsEnigMimeVerify.cpp.

{
  nsresult rv;
#ifdef FORCE_PR_LOG
  nsCOMPtr<nsIThread> myThread;
  rv = ENIG_GET_THREAD(myThread);
  DEBUG_LOG(("nsEnigMimeVerify:: >>>>>>>>> DTOR(%p): myThread=%p\n",
         this, myThread.get()));
#endif

  Finalize();
}

Here is the call graph for this function:


Member Function Documentation

static NS_METHOD nsEnigMimeVerify::Create ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]
nsresult nsEnigMimeVerify::Finalize ( ) [protected]

Definition at line 298 of file nsEnigMimeVerify.cpp.

{
  DEBUG_LOG(("nsEnigMimeVerify::Finalize:\n"));

  if (mPipeTrans) {
    mPipeTrans->Terminate();
    mPipeTrans = nsnull;
  }

  if (mOutBuffer) {
    mOutBuffer->Shutdown();
    mOutBuffer = nsnull;
  }

  mMsgWindow = nsnull;

  mArmorListener = nsnull;
  mFirstPartListener = nsnull;
  mSecondPartListener = nsnull;
  mOuterMimeListener = nsnull;
  mInnerMimeListener = nsnull;

  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsEnigMimeVerify::Finish ( ) [protected]

Definition at line 324 of file nsEnigMimeVerify.cpp.

{
  // Enigmail stuff
  nsresult rv;

  if (!mInitialized || !mPipeTrans)
    return NS_ERROR_NOT_INITIALIZED;

  if (!mRequestStopped)
    return NS_ERROR_FAILURE;

  // Wait for STDOUT to close
  rv = mPipeTrans->Join();
  if (NS_FAILED(rv)) return rv;

  // Count of STDOUT bytes
  PRUint32 outputLen;
  rv = mOutBuffer->GetTotalBytes(&outputLen);
  if (NS_FAILED(rv)) return rv;

  // Shutdown STDOUT console
  mOutBuffer->Shutdown();

  // Check input data consistency
  if (mStartCount < 2) {
    ERROR_LOG(("nsEnigMimeVerify::Finish: ERROR mStartCount=%d\n", mStartCount));
    return NS_ERROR_FAILURE;
  }

  nsCAutoString armorTail;
  rv = mArmorListener->GetEndLine(armorTail);
  if (NS_FAILED(rv)) return rv;

  if (armorTail.IsEmpty()) {
    ERROR_LOG(("nsEnigMimeVerify::Finish: ERROR No armor tail found\n"));
    return NS_ERROR_FAILURE;
  }

  nsCAutoString endBoundary;
  rv = mSecondPartListener->GetEndLine(endBoundary);
  if (NS_FAILED(rv)) return rv;

  // Trim leading/trailing whitespace
  endBoundary.Trim(" \t\r\n", PR_TRUE, PR_TRUE);

  nsCAutoString temBoundary("--");
  temBoundary += mContentBoundary;
  temBoundary += "--";

  if (!endBoundary.Equals(temBoundary)) {
    ERROR_LOG(("nsEnigMimeVerify::Finish: ERROR endBoundary=%s\n", endBoundary.get()));
    return NS_ERROR_FAILURE;
  }

  PRInt32 exitCode;
  PRUint32 statusFlags;

  nsString keyId;
  nsString userId;
  nsString sigDate;
  nsString errorMsg;
  nsString blockSeparation;

  nsCOMPtr<nsIEnigmail> enigmailSvc = do_GetService(NS_ENIGMAIL_CONTRACTID, &rv);
  if (NS_FAILED(rv)) return rv;

  PRUint32 uiFlags = nsIEnigmail::UI_PGP_MIME;
  EMBool verifyOnly = PR_TRUE;
  EMBool noOutput = PR_TRUE;

  rv = enigmailSvc->DecryptMessageEnd(uiFlags,
                                      outputLen,
                                      mPipeTrans,
                                      verifyOnly,
                                      noOutput,
                                      &statusFlags,
                                      getter_Copies(keyId),
                                      getter_Copies(userId),
                                      getter_Copies(sigDate),
                                      getter_Copies(errorMsg),
                                      getter_Copies(blockSeparation),
                                      &exitCode);
  if (NS_FAILED(rv)) return rv;

  nsCOMPtr<nsISupports> securityInfo;
  if (mMsgWindow) {
    nsCOMPtr<nsIMsgHeaderSink> headerSink;
    mMsgWindow->GetMsgHeaderSink(getter_AddRefs(headerSink));
    if (headerSink)
        headerSink->GetSecurityInfo(getter_AddRefs(securityInfo));
  }

  DEBUG_LOG(("nsEnigMimeVerify::Finish: securityInfo=%p\n", securityInfo.get()));

  if (securityInfo) {
    nsCOMPtr<nsIEnigMimeHeaderSink> enigHeaderSink = do_QueryInterface(securityInfo);
    if (enigHeaderSink) {
      rv = enigHeaderSink->UpdateSecurityStatus(mURISpec, exitCode, statusFlags, keyId.get(), userId.get(), sigDate.get(), errorMsg.get(), blockSeparation.get(), NULL);
    }
  }

  if (exitCode != 0) {
    DEBUG_LOG(("nsEnigMimeVerify::Finish: ERROR EXIT %d\n", exitCode));
    return NS_ERROR_FAILURE;
  }

  return NS_OK;
}
void nsIEnigMimeVerify::init ( in nsIDOMWindow  window,
in nsIURI  uri,
in nsIMsgWindow  msgWindow,
in AUTF8String  msgUriSpec,
in boolean  pgpMime,
in boolean  isSubPart 
) [inherited]
void nsIEnigMimeVerify::initWithChannel ( in nsIDOMWindow  window,
in nsIChannel  channel,
in nsIMsgWindow  msgWindow,
in AUTF8String  msgUriSpec,
in boolean  pgpMime,
in boolean  isSubPart 
) [inherited]

Member Data Documentation

Definition at line 87 of file nsEnigMimeVerify.h.

nsCString nsEnigMimeVerify::mContentBoundary [protected]

Definition at line 78 of file nsEnigMimeVerify.h.

Definition at line 89 of file nsEnigMimeVerify.h.

Definition at line 71 of file nsEnigMimeVerify.h.

Definition at line 91 of file nsEnigMimeVerify.h.

Definition at line 74 of file nsEnigMimeVerify.h.

nsCString nsEnigMimeVerify::mLinebreak [protected]

Definition at line 79 of file nsEnigMimeVerify.h.

nsCOMPtr<nsIMsgWindow> nsEnigMimeVerify::mMsgWindow [protected]

Definition at line 82 of file nsEnigMimeVerify.h.

Definition at line 84 of file nsEnigMimeVerify.h.

Definition at line 90 of file nsEnigMimeVerify.h.

Definition at line 72 of file nsEnigMimeVerify.h.

Definition at line 85 of file nsEnigMimeVerify.h.

Definition at line 73 of file nsEnigMimeVerify.h.

Definition at line 88 of file nsEnigMimeVerify.h.

PRUint32 nsEnigMimeVerify::mStartCount [protected]

Definition at line 76 of file nsEnigMimeVerify.h.

nsCString nsEnigMimeVerify::mURISpec [protected]

Definition at line 81 of file nsEnigMimeVerify.h.


The documentation for this class was generated from the following files: