mailnews/news/public/nsINntpUrl.idl
author calbld
Wed, 14 Nov 2012 11:09:35 -0800
branchCAL180_20121114_RELBRANCH
changeset 13940 3f39ecc81f6e3332f88bed4806b8fc11081ee291
parent 13324 3f9b812e72471c2172bfde0ebbeeb210bf5f1a95
child 19756 edbe40b94a4d60c66d45c3a9d3a163908cdda053
permissions -rw-r--r--
Automated checkin: version bump remove "pre" from version number for lightning 2.0b1 release on CAL180_20121114_RELBRANCH CLOSED TREE a=release

/* -*- 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 nsIMsgDBHdr;
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(5f250c8c-d6b7-48b7-8ff4-7ff51dba19ae)]
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 unsigned long 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;
};