From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- comm/mailnews/news/public/moz.build | 18 +++ comm/mailnews/news/public/nsIMsgNewsFolder.idl | 151 +++++++++++++++++++++ .../news/public/nsIMsgOfflineNewsState.idl | 22 +++ comm/mailnews/news/public/nsINNTPNewsgroupPost.idl | 51 +++++++ .../news/public/nsINewsDownloadDialogArgs.idl | 19 +++ .../mailnews/news/public/nsINntpIncomingServer.idl | 136 +++++++++++++++++++ comm/mailnews/news/public/nsINntpService.idl | 50 +++++++ comm/mailnews/news/public/nsINntpUrl.idl | 102 ++++++++++++++ 8 files changed, 549 insertions(+) create mode 100644 comm/mailnews/news/public/moz.build create mode 100644 comm/mailnews/news/public/nsIMsgNewsFolder.idl create mode 100644 comm/mailnews/news/public/nsIMsgOfflineNewsState.idl create mode 100644 comm/mailnews/news/public/nsINNTPNewsgroupPost.idl create mode 100644 comm/mailnews/news/public/nsINewsDownloadDialogArgs.idl create mode 100644 comm/mailnews/news/public/nsINntpIncomingServer.idl create mode 100644 comm/mailnews/news/public/nsINntpService.idl create mode 100644 comm/mailnews/news/public/nsINntpUrl.idl (limited to 'comm/mailnews/news/public') diff --git a/comm/mailnews/news/public/moz.build b/comm/mailnews/news/public/moz.build new file mode 100644 index 0000000000..c6c6b27c6f --- /dev/null +++ b/comm/mailnews/news/public/moz.build @@ -0,0 +1,18 @@ +# vim: set filetype=python: +# 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/. + +XPIDL_SOURCES += [ + "nsIMsgNewsFolder.idl", + "nsIMsgOfflineNewsState.idl", + "nsINewsDownloadDialogArgs.idl", + "nsINntpIncomingServer.idl", + "nsINNTPNewsgroupPost.idl", + "nsINntpService.idl", + "nsINntpUrl.idl", +] + +XPIDL_MODULE = "msgnews" + +EXPORTS += [] diff --git a/comm/mailnews/news/public/nsIMsgNewsFolder.idl b/comm/mailnews/news/public/nsIMsgNewsFolder.idl new file mode 100644 index 0000000000..683c566595 --- /dev/null +++ b/comm/mailnews/news/public/nsIMsgNewsFolder.idl @@ -0,0 +1,151 @@ +/* -*- Mode: C++; 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 "nsIMsgFolder.idl" + +%{C++ +#include "nsTArray.h" +%} + +interface nsIMsgWindow; +interface nsINntpIncomingServer; + +[scriptable, uuid(9a12c3a5-9de5-4c57-ace3-d51802b525a9)] +interface nsIMsgNewsFolder : nsISupports { + readonly attribute AString unicodeName; + /**|rawName| is an 8-bit string to represent the name of a newsgroup used by + * a news server. It's offered for the convenience of callers so that they + * don't have to convert |unicodeName| to the server-side name when + * communicating with a news server. It's US-ASCII except for some + * 'stand-alone' Chinese news servers that use GB2312 for newsgroup names + * violating RFC 1036. For those servers, it's GB2312. However, it can be any + * other single and multibyte encoding in principle. The encoding of this + * string is stored in |nsINntpIncomingServer| because that's a server-wide + * property. + **/ + readonly attribute ACString rawName; + readonly attribute nsINntpIncomingServer nntpServer; + attribute boolean saveArticleOffline; + + /** + * @name Authentication methods + * NNTP authentication is slightly wonky, due to edge cases that are not seen + * in other protocols. Authentication is not necessary; if authentication is + * used, it could be configured on a per-group basis or even require only a + * username and not a password. + * + * Since passwords could be per-group, it is necessary to refer to passwords + * using the methods on this interface and not nsIMsgIncomingServer. Passwords + * for the server as a whole are found via the root folder. If the server is + * configured to use single sign-on (the default), asking any group for its + * password will result in the server's password, otherwise, each group stores + * its password individually. + * + * Due to this setup, most of the password management functions on + * nsIMsgIncomingServer do not correctly work. The only one that would affect + * the passwords stored on folders correctly is forgetPassword; using any + * other on a news server would result in inconsistent state. + * + * Before requesting either the username or password for authentication, it is + * first necessary to call getAuthenticationCredentials. If the method returns + * true, then groupUsername and groupPassword are appropriately set up for + * necessary authentication; if not, then authentication must be stopped. + */ + /// @{ + + /** + * Gets the authentication credentials, returning if the results are valid. + * + * If mustPrompt is true, then the user will always be asked for the + * credentials. Otherwise, if mayPrompt is true, then the user will be asked + * for credentials if there are no saved credentials. If mayPrompt is false, + * then no prompt will be shown, even if there are no saved credentials. + * + * If this method returns true, then groupUsername and groupPassword will + * contain non-empty results that could be used for authentication. If this + * method returns false, then the values of groupUsername and groupPassword + * will be cleared if they had previously been set. This could happen if + * mustPrompt were true and the user decided to cancel the authentication + * prompt. + * + * Note that this method will be executed synchronously; if an async prompt + * is wanted, it is the responsibility of the caller to manage it explicitly + * with nsIMsgAsyncPrompter. + */ + bool getAuthenticationCredentials(in nsIMsgWindow aMsgWindow, + in bool mayPrompt, in bool mustPrompt); + + /// The username that should be used for this group + attribute ACString groupUsername; + + /// The password that should be used for this group + attribute ACString groupPassword; + + /// Forgets saved authentication credentials permanently. + void forgetAuthenticationCredentials(); + /// @} + + void reorderGroup(in nsIMsgFolder aNewsgroupToMove, in nsIMsgFolder aRefNewsgroup); + + nsIMsgFolder addNewsgroup(in AUTF8String newsgroupName, in ACString setStr); + + void setReadSetFromStr(in ACString setStr); + + /// returns the server's default charset. + readonly attribute ACString charset; + + readonly attribute AUTF8String newsrcLine; + readonly attribute ACString optionLines; + readonly attribute ACString unsubscribedNewsgroupLines; + void SetNewsrcHasChanged(in boolean newsrcHasChanged); + void updateSummaryFromNNTPInfo(in long oldest, in long youngest, in long total); + void removeMessage(in nsMsgKey key); + void removeMessages(in Array keys); + void cancelComplete(); + void cancelFailed(); + + ACString getMessageIdForKey(in nsMsgKey key); + + void getNextNMessages(in nsIMsgWindow aMsgWindow); + + /** + * Begin loading a message into the folder's offline store. + * @param key - the key of the message being loaded (the folder must + * already have the message in it's DB) + */ + void notifyDownloadBegin(in nsMsgKey key); + + /** + * Feed the next line of a message into the folder, to be invoked multiple + * times between notifyDownloadBegin() and notifyDownloadEnd(). + * + * @param line - a single line of data to append to the message, including + * end-of-line terminator. + */ + void notifyDownloadedLine(in ACString line); + + /** + * Finish loading a message into the folder. If an error occurs, the + * folder hears about it via this function, and should abort the message. + * + * @param status - NS_OK if the operation was completed, an error code + * otherwise. + */ + void notifyDownloadEnd(in nsresult status); + + void notifyFinishedDownloadinghdrs(); + + /** + * Requests that a message be canceled. + * + * Note that, before sending the news cancel, this method will check to make + * sure that the user has proper permission to cancel the message. + * + * @param aMsgHdr The header of the message to be canceled. + * @param aMsgWindow The standard message window object, for error dialogs. + */ + void cancelMessage(in nsIMsgDBHdr aMsgHdr, in nsIMsgWindow aMsgWindow); +}; diff --git a/comm/mailnews/news/public/nsIMsgOfflineNewsState.idl b/comm/mailnews/news/public/nsIMsgOfflineNewsState.idl new file mode 100644 index 0000000000..eef1e88db6 --- /dev/null +++ b/comm/mailnews/news/public/nsIMsgOfflineNewsState.idl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* 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/. */ + +/* + * offline news message state. Interface for old MSG_OfflineNewsArtState + */ + +#include "nsISupports.idl" + +[scriptable, uuid(921AC210-96B5-11d2-B7EB-00805F05FFA5)] +interface nsIMsgOfflineNewsState : nsISupports { + + /* outputBuffer is actually + * a buffer to dump data into, but we normally pass it NET_Socket_Buffer, + * which is constant. The implementation should only allocate a new + * buffer if *outputBuffer is NULL. + */ + long Process(out string outputBuffer, in long bufferSize); + long Interrupt(); +}; diff --git a/comm/mailnews/news/public/nsINNTPNewsgroupPost.idl b/comm/mailnews/news/public/nsINNTPNewsgroupPost.idl new file mode 100644 index 0000000000..95f3cbb2bf --- /dev/null +++ b/comm/mailnews/news/public/nsINNTPNewsgroupPost.idl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* 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/. */ + +/* This object represents the stream of data which will be sent to an + NNTP server. You basically set up all the RFC850 required headers, etc, + then pass it to something that reads off the nsIInputStream interface. +*/ + +#include "nsISupports.idl" + +interface nsIFile; + +[scriptable, uuid(9979a2cb-a4e6-45e6-bfeb-b08e704c5a2b)] +interface nsINNTPNewsgroupPost : nsISupports { + + /* from RFC850 */ + /* section 2.1 - required headers */ + attribute string relayVersion; + attribute string postingVersion; + attribute string from; + attribute string date; + + void AddNewsgroup(in string newsgroupName); + readonly attribute string newsgroups; + + attribute string subject; + attribute string path; + + /* Section 2.2 - optional headers */ + attribute string replyTo; + attribute string sender; + attribute string followupTo; + attribute string dateReceived; + attribute string expires; + + readonly attribute string references; + + attribute string control; + attribute string distribution; + attribute string organization; + + /* the message itself */ + attribute string body; + + /* is this a control message? */ + readonly attribute boolean isControl; + + attribute nsIFile postMessageFile; +}; diff --git a/comm/mailnews/news/public/nsINewsDownloadDialogArgs.idl b/comm/mailnews/news/public/nsINewsDownloadDialogArgs.idl new file mode 100644 index 0000000000..8641a56034 --- /dev/null +++ b/comm/mailnews/news/public/nsINewsDownloadDialogArgs.idl @@ -0,0 +1,19 @@ +/* -*- Mode: C++; 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" + +[scriptable, uuid(3634327c-392b-4686-adf5-576e6cef9196)] +interface nsINewsDownloadDialogArgs: nsISupports { + attribute AString groupName; + attribute long articleCount; + attribute string serverKey; + attribute boolean hitOK; + attribute boolean downloadAll; +}; + +%{ C++ +#define DOWNLOAD_HEADERS_URL "chrome://messenger/content/downloadheaders.xhtml" +%} diff --git a/comm/mailnews/news/public/nsINntpIncomingServer.idl b/comm/mailnews/news/public/nsINntpIncomingServer.idl new file mode 100644 index 0000000000..548b62da24 --- /dev/null +++ b/comm/mailnews/news/public/nsINntpIncomingServer.idl @@ -0,0 +1,136 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* 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 nsIFile; +interface nsIMsgNewsFolder; +interface nsIChannel; +interface nsIURI; +interface nsIMsgWindow; + +[scriptable, uuid(077620ed-c6c4-4d4d-bed5-4d041f924002)] +interface nsINntpIncomingServer : nsISupports { + /* the on-disk path to the newsrc file for this server */ + attribute nsIFile newsrcFilePath; + + /* the newsrc root path (the directories all the newsrc files live) */ + attribute nsIFile newsrcRootPath; + + /* ask the user before downloading more than maxArticles? */ + attribute boolean notifyOn; + + /* the max articles to download */ + attribute long maxArticles; + + /* when we don't download all, do we mark the rest read? */ + attribute boolean markOldRead; + + /* abbreviate the newsgroup names in the folder pane? */ + attribute boolean abbreviate; + + /* do we use a single login per server or do we login per group */ + attribute boolean singleSignon; + + /** the server charset and it may be needed to display newsgroup folder + * names correctly + **/ + attribute ACString charset; + + /* the server keeps track of all the newsgroups we are subscribed to */ + void addNewsgroup(in AString name); + void removeNewsgroup(in AString name); + + void writeNewsrcFile(); + + attribute boolean newsrcHasChanged; + + /** + * The maximum number of connections to make to the server. + * + * This preference (internally max_cached_connections) controls how many + * connections we can make. A negative connection count is treated as only + * one connection, while 0 (the default) loads the default number of + * connections, presently 2. + */ + attribute long maximumConnectionsNumber; + + void displaySubscribedGroup(in nsIMsgNewsFolder msgFolder, + in long firstMessage, in long lastMessage, + in long totalMessages); + + + /** + * Get a new NNTP channel to run the URI. + * + * If the server has used up all of its connections, this will place the URI + * in the queue to be run when one is freed. + * + * @param uri The URI to run. + * @param window The standard message window object. + */ + nsIChannel getNntpChannel(in nsIURI uri, in nsIMsgWindow window); + /** + * Enqueues a URI to be run when we have a free connection. + * + * If there is one already free, it will be immediately started. + * + * @param uri The URI to run. + * @param window The standard message window object. + * @param consumer A listener for the response data. + */ + void loadNewsUrl(in nsIURI uri, in nsIMsgWindow window, + in nsISupports consumer); + + /** + * Returns whether or not the server has subscribed to the given newsgroup. + * + * Note that the name here is intended to be escaped; however, since `%' is + * not a legal newsgroup name, it is possibly safe to pass in an unescaped + * newsgroup name. + */ + boolean containsNewsgroup(in AUTF8String escapedName); + + void subscribeToNewsgroup(in AUTF8String name); + + /* used for the subscribe dialog. + name is encoded in |charset| (attribute declared above) */ + void addNewsgroupToList(in string name); + + attribute boolean supportsExtensions; + void addExtension(in string extension); + boolean queryExtension(in string extension); + + attribute boolean postingAllowed; + attribute boolean pushAuth; + attribute unsigned long lastUpdatedTime; + + void addPropertyForGet(in string name, in string value); + string queryPropertyForGet(in string name); + + void addSearchableGroup(in AString name); + boolean querySearchableGroup(in AString name); + + void addSearchableHeader(in string headerName); + boolean querySearchableHeader(in string headerName); + + /** + * Returns the folder corresponding to the given group. + * + * Note that this name is expected to be unescaped. + * @note If the group does not exist, a bogus news folder will be returned. + * DO NOT call this method unless you are sure that the newsgroup + * is subscribed to (e.g., by containsNewsgroup) + */ + nsIMsgNewsFolder findGroup(in AUTF8String name); + + readonly attribute AUTF8String firstGroupNeedingExtraInfo; + void setGroupNeedsExtraInfo(in AUTF8String name, in boolean needsExtraInfo); + + void groupNotFound(in nsIMsgWindow window, in AString group, + in boolean opening); + + void setPrettyNameForGroup(in AString name, in AString prettyName); +}; diff --git a/comm/mailnews/news/public/nsINntpService.idl b/comm/mailnews/news/public/nsINntpService.idl new file mode 100644 index 0000000000..ec1b0b3efe --- /dev/null +++ b/comm/mailnews/news/public/nsINntpService.idl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* 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 "nsIUrlListener.idl" +#include "nsINntpIncomingServer.idl" +#include "MailNewsTypes2.idl" + +interface nsIURI; +interface nsIFile; +interface nsIMsgWindow; +interface nsIMsgFolder; +interface nsICacheStorage; + +[scriptable, uuid(dc5cadb0-966c-4ef1-a4c8-cc1e48d1ac61)] +interface nsINntpService : nsISupports { + + /* newsgroupsList is a comma separated list of newsgroups, which may be + * in news://host/group or group form + * "news://host/group1,news://host/group2" or "group1,group2" + * + * newsgroupsHeaderVal is a comma separated list of groups in the group form + * "group1,group2" + * + * newshostHeaderVal is a single hostname. + * "host" + */ + void generateNewsHeaderValsForPosting(in ACString newsgroupsList, out string newsgroupsHeaderVal, out string newshostHeaderVal); + + nsIURI postMessage(in nsIFile aFileToPost, in string newsgroupNames, in string aAccountKey, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow); + + nsIURI getNewNews(in nsINntpIncomingServer nntpServer, in AUTF8String uri, in boolean getOld, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow); + + nsIURI cancelMessage(in AUTF8String cancelURL, in AUTF8String messageURI, in nsISupports aConsumer, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow); + + void getListOfGroupsOnServer(in nsINntpIncomingServer nntpServer, in nsIMsgWindow aMsgWindow, in boolean getOnlyNew); + + nsIURI fetchMessage(in nsIMsgFolder newsFolder, in nsMsgKey key, in nsIMsgWindow aMsgWindow, in nsISupports aConsumer, in nsIUrlListener aUrlListener); + + void downloadNewsgroupsForOffline(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener); + /** + * can handle news-message:// and news:// + */ + void decomposeNewsURI(in AUTF8String uri, out nsIMsgFolder folder, out nsMsgKey key); + + // handle to the cache session used by news.... + readonly attribute nsICacheStorage cacheStorage; +}; diff --git a/comm/mailnews/news/public/nsINntpUrl.idl b/comm/mailnews/news/public/nsINntpUrl.idl new file mode 100644 index 0000000000..33b82b6687 --- /dev/null +++ b/comm/mailnews/news/public/nsINntpUrl.idl @@ -0,0 +1,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; +}; -- cgit v1.2.3