author John Hopkins <>
Fri, 26 Aug 2011 12:12:18 -0700
changeset 9059 088aec7c13fb376cbbf77b311fd54db833ebcf40
parent 7846 e545b6accf995657ca270f4666ae9aebabbc0cf4
child 12286 84ac3c71109811da751f0ef2d72108075938f094
permissions -rw-r--r--
Bug 656049 - teach comm-central to invoke p=callek,r=standard8

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 * The Original Code is code.
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2000
 * the Initial Developer. All Rights Reserved.
 * Contributor(s):
 * Alternatively, the contents of this file may be used under the terms of
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

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

typedef long nsImapAction;
typedef long nsImapState;

typedef unsigned short imapMessageFlagsType;

typedef long nsImapContentModifiedType;

[scriptable, uuid(2e91901e-ff6c-11d3-b9fa-00108335942a)]
interface nsImapContentModifiedTypes
} ;

[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 PRInt32 DEFAULT_IMAP_PORT = 143;

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