mailnews/news/public/nsINntpUrl.idl
author Mark Banner <standard8@mozilla.com>
Mon, 23 Feb 2015 19:39:03 +0000
changeset 21654 88c94d18cfc49e2d1611517c282f80aae1a19cca
parent 21463 34afccc6f8f755638c6fe79ed257a34df37a8050
permissions -rw-r--r--
No Bug. Bump uuids that weren't bumped when the interfaces were changed to fix binary compatibility issues. rs=fix-issues-that-should-have-been-fixed-before-landing. CLOSED TREE

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

interface nsINNTPNewsgroupPost;

typedef long nsNewsAction;

/**
 * Represents specific attributes to a URL for news usage.
 *
 * Note that the urls represented by this interface can be one of five schemes:
 * [s]news, nntp[s], or news-message. Any URI that is valid under RFC 5538 will
 * be accepted. However, it is possible for some queries to be invalid. There
 * are also a few important things to note:
 *
 * - Missing authorities in [s]news: URIs cause nsIMsgMailNewsUrl::server and
 *   nsIMsgMessageUrl::folder to be null.
 * - nsIMsgMailNewsUrl::server and nsIMsgMessageUrl::folder will be null if the
 *   specified server does not actually exist. In addition, the folder is null
 *   if the group is not currently subscribed on that server.
 * - Although news-message URIs are parsable, there is no protocol handler
 *   associated with this url. To run these, you should convert these to the
 *   corresponding [s]news or nntp URL, and set the original one in
 *   nsIMsgMessageUrl::uri and ::originalSpec.
 * - A URI that results in an ActionUnknown will not be run.
 * - Cancel URIs require the original spec to also be set, so it can find both
 *   the message ID and the group/key combination.
 * * Some actions require either a group or a message id. Since actions can be
 *   set after the fact, these conditions are not verified.
 */
[scriptable, uuid(ef920ca3-9c46-48b8-9fa3-cb430d3681ea)]
interface nsINntpUrl : nsISupports {
  /// For ActionPostArticle URIs, the message to be posted.
  attribute nsINNTPNewsgroupPost messageToPost;

  /**
   * The action that this URL will take when run.
   *
   * Most actions can be automatically determined from the URL spec as follows:
   *
   * 1. The query string is searched for the appropriate action.
   *
   * 2. A non-empty message ID or key is found (sets ActionFetchArticle).
   *
   * 3. A non-empty group is found (ActionGetNewNews or ActionListGroups).
   */
  attribute nsNewsAction newsAction;

  /// For ActionGetNewNews URIs, whether or not to get older messages.
  attribute boolean getOldMessages;

  /**
   * The group portion of the URI, if one is present.
   *
   * This group name is fully unescaped; if you need to construct news URLs with
   * this value, be sure to escape it first.
   */
  readonly attribute ACString group;

  /// The message ID portion of the URI, if one is present
  readonly attribute ACString messageID;

  /// The message key portion of the URI or nsMsgKey_None if not present
  readonly attribute nsMsgKey key;

  /// The action of this news URI could not be determined
  const nsNewsAction ActionUnknown = 0;
  /// Fetch the contents of an article
  const nsNewsAction ActionFetchArticle = 1;
  /// Fetch the part of an article (requires ?part=)
  const nsNewsAction ActionFetchPart = 2;
  /// Save the contents of an article to disk
  const nsNewsAction ActionSaveMessageToDisk = 3;
  /// Cancel the article (requires ?cancel)
  const nsNewsAction ActionCancelArticle = 4;
  /// Post an article
  const nsNewsAction ActionPostArticle = 5;
  /// List the non-expired ids in the newsgroup (requires ?list-ids)
  const nsNewsAction ActionListIds = 6;
  /// Do an online newsgroup search (requires ?search)
  const nsNewsAction ActionSearch = 7;
  /// Retrieve new messages from the server
  const nsNewsAction ActionGetNewNews = 8;
  /// List groups for subscribe
  const nsNewsAction ActionListGroups = 9;
  /// List new groups for subscribe (requires ?new-groups)
  const nsNewsAction ActionListNewGroups = 10;

  /// Constant for the default NNTP over ssl port number
  const int32_t DEFAULT_NNTP_PORT = 119;

  /// Constant for the default NNTP over ssl port number
  const int32_t DEFAULT_NNTPS_PORT = 563;
};