summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/news/public/nsINntpUrl.idl
blob: 33b82b6687883a2e0866aa54e4b0d0232a933ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* -*- 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;

  /// returns the server's default charset.
  readonly attribute ACString charset;

  /// 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;
};