Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions
nsSMimeJSHelper Class Reference

#include <nsSMimeJSHelper.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSISMIMEJSHELPER 
nsSMimeJSHelper ()
virtual ~nsSMimeJSHelper ()
void getRecipientCertsInfo (in nsIMsgCompFields compFields, out unsigned long count,[array, size_is(count)] out wstring emailAddresses,[array, size_is(count)] out long certVerification,[array, size_is(count)] out wstring certIssuedInfos,[array, size_is(count)] out wstring certExpiresInfos,[array, size_is(count)] out nsIX509Cert certs, out PRBool canEncrypt)
 Obtains detailed information about the certificate availability status of email recipients.
void getNoCertAddresses (in nsIMsgCompFields compFields, out unsigned long count,[array, size_is(count)] out wstring emailAddresses)
 Obtains a list of email addresses where valid email recipient certificates are not yet available.

Private Member Functions

nsresult getMailboxList (nsIMsgCompFields *compFields, PRUint32 *mailbox_count, char **mailbox_list)

Detailed Description

Definition at line 44 of file nsSMimeJSHelper.h.


Constructor & Destructor Documentation

Definition at line 53 of file nsSMimeJSHelper.cpp.

{
}

Definition at line 57 of file nsSMimeJSHelper.cpp.

{
}

Member Function Documentation

nsresult nsSMimeJSHelper::getMailboxList ( nsIMsgCompFields compFields,
PRUint32 mailbox_count,
char **  mailbox_list 
) [private]

Definition at line 380 of file nsSMimeJSHelper.cpp.

{
  NS_ENSURE_ARG(mailbox_count);
  NS_ENSURE_ARG(mailbox_list);

  if (!compFields)
    return NS_ERROR_INVALID_ARG;

  nsresult res;
  nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID, &res);
  if (NS_FAILED(res))
    return res;

  nsXPIDLString to, cc, bcc, ng;

  res = compFields->GetTo(to);
  if (NS_FAILED(res))
    return res;

  res = compFields->GetCc(cc);
  if (NS_FAILED(res))
    return res;

  res = compFields->GetBcc(bcc);
  if (NS_FAILED(res))
    return res;

  res = compFields->GetNewsgroups(ng);
  if (NS_FAILED(res))
    return res;

  *mailbox_list = nsnull;
  *mailbox_count = 0;
  
  {
    nsCString all_recipients;

    if (!to.IsEmpty()) {
      AppendUTF16toUTF8(to, all_recipients);
      all_recipients.Append(',');
    }

    if (!cc.IsEmpty()) {
      AppendUTF16toUTF8(cc, all_recipients);
      all_recipients.Append(',');
    }

    if (!bcc.IsEmpty()) {
      AppendUTF16toUTF8(bcc, all_recipients);
      all_recipients.Append(',');
    }

    if (!ng.IsEmpty()) {
      AppendUTF16toUTF8(ng, all_recipients);
    }

    char *unique_mailboxes = nsnull;

    {
      char *all_mailboxes = nsnull;
      parser->ExtractHeaderAddressMailboxes(nsnull, all_recipients.get(), &all_mailboxes);
      parser->RemoveDuplicateAddresses(nsnull, all_mailboxes, 0, PR_FALSE /*removeAliasesToMe*/, &unique_mailboxes);
      if (all_mailboxes) {
        nsMemory::Free(all_mailboxes);
      }
    }
    if (unique_mailboxes)
    {
      parser->ParseHeaderAddresses(nsnull, unique_mailboxes, 0, mailbox_list, mailbox_count);
    }
    if (unique_mailboxes) {
      nsMemory::Free(unique_mailboxes);
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

void nsISMimeJSHelper::getNoCertAddresses ( in nsIMsgCompFields  compFields,
out unsigned long  count,
[array, size_is(count)] out wstring  emailAddresses 
) [inherited]

Obtains a list of email addresses where valid email recipient certificates are not yet available.

Parameters:
compFields- Attributes of the composed message
count- The number of returned email addresses
emailAddresses- The list of email addresses without valid certs
Exceptions:
NS_ERROR_FAILURE- unexptected failure
NS_ERROR_OUT_OF_MEMORY- could not create the out list
NS_ERROR_INVALID_ARG
void nsISMimeJSHelper::getRecipientCertsInfo ( in nsIMsgCompFields  compFields,
out unsigned long  count,
[array, size_is(count)] out wstring  emailAddresses,
[array, size_is(count)] out long  certVerification,
[array, size_is(count)] out wstring  certIssuedInfos,
[array, size_is(count)] out wstring  certExpiresInfos,
[array, size_is(count)] out nsIX509Cert  certs,
out PRBool  canEncrypt 
) [inherited]

Obtains detailed information about the certificate availability status of email recipients.

Parameters:
compFields- Attributes of the composed message
count- The number of entries in returned arrays
emailAddresses- The list of all recipient email addresses
certVerification- The verification/validity status of recipient certs
certIssuedInfos- If a recipient cert was found, when has it been issued?
certExpiredInfos- If a recipient cert was found, when will it expire?
certs- The recipient certificates, which can contain null for not found
canEncrypt- whether valid certificates have been found for all recipients
Exceptions:
NS_ERROR_FAILURE- unexptected failure
NS_ERROR_OUT_OF_MEMORY- could not create the out list
NS_ERROR_INVALID_ARG

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