mailnews/imap/public/nsIImapUrl.idl
author Frank-Rainer Grahl <frgrahl@gmx.net>
Tue, 06 Jun 2017 10:15:42 +0200
branchSEA248b1_2017021701_RELBRANCH
changeset 31408 156fd1a6486a07df761b712c01621a37716f36b2
parent 19756 edbe40b94a4d60c66d45c3a9d3a163908cdda053
permissions -rw-r--r--
Bug 1364977 - Followup fix for older parameters in branches. rs=bustage-fix a=me

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "nsISupports.idl"

interface nsIImapMailFolderSink;
interface nsIImapMessageSink;
interface nsIImapServerSink;
interface nsIImapMockChannel;
interface nsIFile;

typedef long nsImapAction;
typedef long nsImapState;

typedef unsigned short imapMessageFlagsType;

typedef long nsImapContentModifiedType;

[scriptable, uuid(2e91901e-ff6c-11d3-b9fa-00108335942a)]
interface nsImapContentModifiedTypes
{
  const long IMAP_CONTENT_NOT_MODIFIED = 0;
  const long IMAP_CONTENT_MODIFIED_VIEW_INLINE = 1;
  const long IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS = 2;
  const long IMAP_CONTENT_FORCE_CONTENT_NOT_MODIFIED = 3;
} ;

[scriptable, uuid(fe2a8f9e-2886-4146-9896-27fff660c69f)]
interface nsIImapUrl : nsISupports
{
  ///////////////////////////////////////////////////////////////////////////////
  // Getters and Setters for the imap specific event sinks to bind to to the url
  ///////////////////////////////////////////////////////////////////////////////
  attribute nsIImapMailFolderSink imapMailFolderSink;
  attribute nsIImapMessageSink imapMessageSink;
  attribute nsIImapServerSink imapServerSink;

  ///////////////////////////////////////////////////////////////////////////////
  // Getters and Setters for the imap url state
  ///////////////////////////////////////////////////////////////////////////////
  attribute nsImapAction imapAction;
  readonly attribute nsImapState requiredImapState;
  readonly attribute string imapPartToFetch;
  readonly attribute ACString customAttributeToFetch;
  attribute ACString customAttributeResult;
  readonly attribute ACString command;
  attribute ACString customCommandResult;
  readonly attribute ACString customAddFlags;
  readonly attribute ACString customSubtractFlags;
  void allocateCanonicalPath(in string aServerPath, in char aOnlineDelimiter, out string aAllocatedPath);
  void allocateServerPath(in string aCanonicalPath, in char aOnlineDelimiter, out string aAllocatedPath);
  string createServerSourceFolderPathString();
  string createCanonicalSourceFolderPathString();
  string createServerDestinationFolderPathString();

  string addOnlineDirectoryIfNecessary(in string onlineMailboxName);
  void createSearchCriteriaString (out string aResult);
  readonly attribute ACString listOfMessageIds;

  boolean messageIdsAreUids();
  readonly attribute imapMessageFlagsType msgFlags; // kAddMsgFlags or kSubtractMsgFlags only

  readonly attribute long numBytesToFetch;
  attribute char onlineSubDirSeparator;
  attribute boolean allowContentChange;
  attribute boolean mimePartSelectorDetected;
  attribute nsImapContentModifiedType contentModified;
  attribute boolean fetchPartsOnDemand;  // set to true if we're fetching a msg for display and want to not download parts
  attribute boolean msgLoadingFromCache; // true if this msg load is coming from a cache, so we can know to mark it read
  attribute boolean externalLinkUrl; // true if we ran this url because the user clicked on a link.
  attribute boolean validUrl; // false if we couldn't parse url for whatever reason.
  attribute nsISupports copyState;
  attribute nsIFile msgFile;
  attribute nsIImapMockChannel mockChannel;
  /**
   * Set to true if we should store the msg(s) for offline use if we can,
   * e.g., we're fetching a message and the folder is configured for offline
   * use and we're not doing mime parts on demand.
   */
  attribute boolean storeResultsOffline;
  /**
   * If we fallback from fetching by parts to fetching the whole message,
   *  because all the parts were inline, this tells us we should store
   * the message offline.
   */
  attribute boolean storeOfflineOnFallback;

  /**
   * This attribute defaults to false, but if we only want to use the offline
   * cache (disk, memory, or offline store) to fetch the message, then we set
   * this to true. Currently, nsIMsgMessageService.streamMessage does this.
   */
  attribute boolean localFetchOnly;

  /// Server disconnected first time so we're retrying.
  attribute boolean rerunningUrl;

  /**
   * Do we have more headers to download? This is set when we decide to
   * download newest headers first, followed by older headers in a subsequent
   * run of the url, which allows other urls to run against the folder in the
   * meantime.
   */
  attribute boolean moreHeadersToDownload;

  /**
   * @{
   * This is used to tell the runner of the url more about the status of
   * the command, beyond whether it was successful or not. For example,
   * subtracting flags from a UID that doesn't exist isn't an error
   * (the server returns OK), but the backend code may want to know about it.
   */
  attribute long extraStatus;

  /**
   * Current possible extra status values
   */
  const long ImapStatusNone = 0;
  const long ImapStatusFlagChangeFailed = 1;
  const long ImapStatusFlagsNotSettable = 2;
  /** @} */

  ///////////////////////////////////////////////////////////////////////////////
  // Enumerated types specific to imap urls...
  ///////////////////////////////////////////////////////////////////////////////

  // the following are nsImapState enums.
  // we have a basic set of imap url actions. These actions are nsImapActions.
  // Certain actions require us to be in the authenticated state and others require us to
  // be in the selected state. nsImapState is used to store the state the url needs to
  // be in. You'll later see us refer to the imap url state in the imap protocol when we
  // are processing the current url. Don't confuse nsImapState with the generic url state
  // used to keep track of whether the url is running or not...
  const long nsImapAuthenticatedState = 0;
  const long nsImapSelectedState = 1;

  const long nsImapActionSendText = 0;      // a state used for testing purposes to send raw url text straight to the server....
  // nsImapAuthenticatedStateUrl urls
  // since the following url actions require us to be in the authenticated
  // state, the high bit is left blank....
  const long nsImapTest  = 0x00000001;
  const long nsImapCreateFolder  = 0x00000005;
  const long nsImapDeleteFolder  = 0x00000006;
  const long nsImapRenameFolder  = 0x00000007;
  const long nsImapMoveFolderHierarchy = 0x00000008;
  const long nsImapLsubFolders  = 0x00000009;
  const long nsImapGetMailAccountUrl = 0x0000000A;
  const long nsImapDiscoverChildrenUrl = 0x0000000B;
  const long nsImapDiscoverAllBoxesUrl = 0x0000000D;
  const long nsImapDiscoverAllAndSubscribedBoxesUrl  = 0x0000000E;
  const long nsImapAppendMsgFromFile = 0x0000000F;
  const long nsImapSubscribe = 0x00000010;
  const long nsImapUnsubscribe = 0x00000011;
  const long nsImapRefreshACL  = 0x00000012;
  const long nsImapRefreshAllACLs  = 0x00000013;
  const long nsImapListFolder  = 0x00000014;
  const long nsImapUpgradeToSubscription = 0x00000015;
  const long nsImapFolderStatus  = 0x00000016;
  const long nsImapRefreshFolderUrls = 0x00000017;
  const long nsImapEnsureExistsFolder = 0x00000018;
  const long nsImapOfflineToOnlineCopy = 0x00000019;
  const long nsImapOfflineToOnlineMove = 0x0000001A;
  const long nsImapVerifylogon = 0x0000001B;
  // it's okay to add more imap actions that require us to
  // be in the authenticated state here without renumbering
  // the imap selected state url actions. just make sure you don't
  // set the high bit...

  // nsImapSelectedState urls. Note, the high bit is always set for
  // imap actions which require us to be in the selected state
  const long nsImapSelectFolder  = 0x10000002;
  const long nsImapLiteSelectFolder = 0x10000003;
  const long nsImapExpungeFolder = 0x10000004;
  const long nsImapMsgFetch  = 0x10000018;
  const long nsImapMsgHeader = 0x10000019;
  const long nsImapSearch  = 0x1000001A;
  const long nsImapDeleteMsg = 0x1000001B;
  const long nsImapDeleteAllMsgs = 0x1000001C;
  const long nsImapAddMsgFlags = 0x1000001D;
  const long nsImapSubtractMsgFlags  = 0x1000001E;
  const long nsImapSetMsgFlags = 0x1000001F;
  const long nsImapOnlineCopy  = 0x10000020;
  const long nsImapOnlineMove  = 0x10000021;
  const long nsImapOnlineToOfflineCopy = 0x10000022;
  const long nsImapOnlineToOfflineMove = 0x10000023;
  const long nsImapMsgPreview = 0x10000024;
  const long nsImapBiff  = 0x10000026;
  const long nsImapSelectNoopFolder  = 0x10000027;
  const long nsImapAppendDraftFromFile = 0x10000028;
  const long nsImapUidExpunge = 0x10000029;
  const long nsImapSaveMessageToDisk = 0x10000030;
  const long nsImapOpenMimePart = 0x10000031;
  const long nsImapMsgDownloadForOffline  = 0x10000032;
  const long nsImapDeleteFolderAndMsgs = 0x10000033;
  const long nsImapUserDefinedMsgCommand = 0x10000034;
  const long nsImapUserDefinedFetchAttribute = 0x10000035;
  const long nsImapMsgFetchPeek = 0x10000036;
  const long nsImapMsgStoreCustomKeywords = 0x10000037;

  /// Constant for the default IMAP port number
  const int32_t DEFAULT_IMAP_PORT = 143;

  /// Constant for the default IMAP over ssl port number
  const int32_t DEFAULT_IMAPS_PORT = 993;
};