diff options
Diffstat (limited to 'mailnews/news/public')
-rw-r--r-- | mailnews/news/public/moz.build | 24 | ||||
-rw-r--r-- | mailnews/news/public/nsIMsgNewsFolder.idl | 132 | ||||
-rw-r--r-- | mailnews/news/public/nsIMsgOfflineNewsState.idl | 23 | ||||
-rw-r--r-- | mailnews/news/public/nsINNTPArticleList.idl | 17 | ||||
-rw-r--r-- | mailnews/news/public/nsINNTPNewsgroupList.idl | 93 | ||||
-rw-r--r-- | mailnews/news/public/nsINNTPNewsgroupPost.idl | 54 | ||||
-rw-r--r-- | mailnews/news/public/nsINNTPProtocol.idl | 31 | ||||
-rw-r--r-- | mailnews/news/public/nsINewsDownloadDialogArgs.idl | 19 | ||||
-rw-r--r-- | mailnews/news/public/nsINntpIncomingServer.idl | 152 | ||||
-rw-r--r-- | mailnews/news/public/nsINntpService.idl | 50 | ||||
-rw-r--r-- | mailnews/news/public/nsINntpUrl.idl | 99 | ||||
-rw-r--r-- | mailnews/news/public/nsMsgNewsCID.h | 117 |
12 files changed, 811 insertions, 0 deletions
diff --git a/mailnews/news/public/moz.build b/mailnews/news/public/moz.build new file mode 100644 index 000000000..b1e02bd5b --- /dev/null +++ b/mailnews/news/public/moz.build @@ -0,0 +1,24 @@ +# 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', + 'nsINNTPArticleList.idl', + 'nsINntpIncomingServer.idl', + 'nsINNTPNewsgroupList.idl', + 'nsINNTPNewsgroupPost.idl', + 'nsINNTPProtocol.idl', + 'nsINntpService.idl', + 'nsINntpUrl.idl', +] + +XPIDL_MODULE = 'msgnews' + +EXPORTS += [ + 'nsMsgNewsCID.h', +] + diff --git a/mailnews/news/public/nsIMsgNewsFolder.idl b/mailnews/news/public/nsIMsgNewsFolder.idl new file mode 100644 index 000000000..291fe3bfd --- /dev/null +++ b/mailnews/news/public/nsIMsgNewsFolder.idl @@ -0,0 +1,132 @@ +/* -*- 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; + +[ref] native nsMsgKeyArrayRef(nsTArray<nsMsgKey>); + +[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. + **/ + [noscript] 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 moveFolder(in nsIMsgFolder aNewsgroupToMove, in nsIMsgFolder aRefNewsgroup, in int32_t aOrientation); + + nsIMsgFolder addNewsgroup(in AUTF8String newsgroupName, in ACString setStr); + + void setReadSetFromStr(in ACString setStr); + + readonly attribute ACString 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); + [noscript] void removeMessages(in nsMsgKeyArrayRef aMsgKeys); + void cancelComplete(); + void cancelFailed(); + + ACString getMessageIdForKey(in nsMsgKey key); + + void getNextNMessages(in nsIMsgWindow aMsgWindow); + void notifyDownloadedLine(in string line, in nsMsgKey key); + void notifyFinishedDownloadinghdrs(); + + /** + * Retrieves the database, but does not cache it in mDatabase. + * + * This is useful for operations that shouldn't hold open the database. + */ + nsIMsgDatabase getDatabaseWithoutCache(); + + /** + * 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/mailnews/news/public/nsIMsgOfflineNewsState.idl b/mailnews/news/public/nsIMsgOfflineNewsState.idl new file mode 100644 index 000000000..7268ad6fd --- /dev/null +++ b/mailnews/news/public/nsIMsgOfflineNewsState.idl @@ -0,0 +1,23 @@ +/* -*- 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/mailnews/news/public/nsINNTPArticleList.idl b/mailnews/news/public/nsINNTPArticleList.idl new file mode 100644 index 000000000..a4ba9a967 --- /dev/null +++ b/mailnews/news/public/nsINNTPArticleList.idl @@ -0,0 +1,17 @@ +/* -*- 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 "MailNewsTypes2.idl" + +interface nsIMsgNewsFolder; + +[scriptable, uuid(043d9dd4-b133-4eb4-a1a8-71abff69b613)] +interface nsINNTPArticleList : nsISupports { + void initialize(in nsIMsgNewsFolder newsFolder); + void addArticleKey(in nsMsgKey key); + void finishAddingArticleKeys(); +}; + diff --git a/mailnews/news/public/nsINNTPNewsgroupList.idl b/mailnews/news/public/nsINNTPNewsgroupList.idl new file mode 100644 index 000000000..537293c44 --- /dev/null +++ b/mailnews/news/public/nsINNTPNewsgroupList.idl @@ -0,0 +1,93 @@ +/* -*- 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 nsIMsgNewsFolder; +interface nsINntpUrl; +interface nsIMsgWindow; + +/** + * A utility class for nsINNTPProtocol that handles the list of new headers. + */ +[scriptable, uuid(579aa17b-4c77-465d-8eb6-feaa927cb19c)] +interface nsINNTPNewsgroupList : nsISupports { + + void initialize(in nsINntpUrl runningURL, in nsIMsgNewsFolder newsFolder); + + long getRangeOfArtsToDownload(in nsIMsgWindow aMsgWindow, in long first_message, + in long last_message, + in long maxextra, + out long real_first_message, + out long real_last_message); + + void addToKnownArticles(in long first_message, in long last_message); + + /** + * Initializes the internal state to get the messages. + * + * This method should be called before sending the line + * <tt>XOVER @arg first_message-@arg last_message</tt> to the server. + * + * @param first_message The first message of the download range. + * @param last_message The last message of the download range. + */ + void initXOVER(in long first_message, in long last_message); + void processXOVERLINE(in string line, out unsigned long status); + void resetXOVER(); + void finishXOVERLINE(in long status, out long newstatus); + + /** + * Initalizes the state in preparation for a call to XHDR. + * + * @return The next header to get, or an empty string if done. + */ + ACString initXHDR(); + /** + * Processes a line of the server's response to XHDR. + * + * It will calculate the message number and other information itself, so the + * unadulterated line itself should be sent. + * + * @param aLine The line as sent from the server. + */ + void processXHDRLine(in ACString aLine); + + /** + * Initalizes the internal state to process a HEAD command. + * + * This method should be called before sending the line + * <tt>HEAD @arg aMessage</tt> to the server. + * + * @param aMessage The message number that will be sent. + */ + void initHEAD(in long aMessage); + /** + * Processes a line of the server's response to HEAD. + * + * This will not check for a quoted '.' at the beginning. + * + * @param aLine The line the server sent. + */ + void processHEADLine(in ACString aLine); + /** + * Manages the internal state if the call to HEAD failed. + * + * @param aMessage The message key that caused the HEAD failure. + */ + void HEADFailed(in long aMessage); + + /** + * Calls the filters after all messages have been processed. + * + * This method also cleans out some internal state relating to the messages + * that have been processed, so it should always be called at the end of + * XOVER/XHDR/HEAD processing. + */ + void callFilters(); + + attribute boolean getOldMessages; +}; + diff --git a/mailnews/news/public/nsINNTPNewsgroupPost.idl b/mailnews/news/public/nsINNTPNewsgroupPost.idl new file mode 100644 index 000000000..382ad5d65 --- /dev/null +++ b/mailnews/news/public/nsINNTPNewsgroupPost.idl @@ -0,0 +1,54 @@ +/* -*- 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; + + /* Secion 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/mailnews/news/public/nsINNTPProtocol.idl b/mailnews/news/public/nsINNTPProtocol.idl new file mode 100644 index 000000000..f7c9105bb --- /dev/null +++ b/mailnews/news/public/nsINNTPProtocol.idl @@ -0,0 +1,31 @@ +/* -*- 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 nsIURI; +interface nsIMsgFolder; +interface nsIMsgWindow; + +[scriptable, uuid(30106238-0991-11d4-a565-0060b0fc04b7)] +interface nsINNTPProtocol : nsISupports { + + ///////////////////////////////////////////////////////////////////////// + // isBusy is true if the connection is currently processing a url + // and false otherwise. + ///////////////////////////////////////////////////////////////////////// + attribute boolean isBusy; + + void LoadNewsUrl(in nsIURI aUri, in nsISupports aConsumer); + void Initialize(in nsIURI aURL, in nsIMsgWindow aMsgWindow); + + // Get last active time stamp + void GetLastActiveTimeStamp(out PRTime aTimeStamp); + + attribute boolean isCachedConnection; + readonly attribute nsIMsgFolder currentFolder; + + void CloseConnection(); +}; diff --git a/mailnews/news/public/nsINewsDownloadDialogArgs.idl b/mailnews/news/public/nsINewsDownloadDialogArgs.idl new file mode 100644 index 000000000..9d728a9bd --- /dev/null +++ b/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.xul" +%} diff --git a/mailnews/news/public/nsINntpIncomingServer.idl b/mailnews/news/public/nsINntpIncomingServer.idl new file mode 100644 index 000000000..c2ac6e9d7 --- /dev/null +++ b/mailnews/news/public/nsINntpIncomingServer.idl @@ -0,0 +1,152 @@ +/* -*- 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 nsINNTPProtocol; +interface nsNNTPProtocol; +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 An argument to be passed to nsINNTPProtocol:LoadNewUrl. + */ + void loadNewsUrl(in nsIURI uri, in nsIMsgWindow window, + in nsISupports consumer); + + /** + * Remove a connection from our connection cache. + * + * @param aNntpConnection The connection to be removed. + */ + void removeConnection(in nsINNTPProtocol aNntpConnection); + + /** + * Load the next URI in the queue to the given connection. + * + * @param aNntpConnection The newly-freed connection. + */ + [noscript] void prepareForNextUrl(in nsNNTPProtocol aNntpConnection); + + /** + * 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) */ + [noscript] 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/mailnews/news/public/nsINntpService.idl b/mailnews/news/public/nsINntpService.idl new file mode 100644 index 000000000..0383bf864 --- /dev/null +++ b/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 string uri, in boolean getOld, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow); + + nsIURI cancelMessage(in string cancelURL, in string 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 string uri, out nsIMsgFolder folder, out nsMsgKey key); + + // handle to the cache session used by news.... + readonly attribute nsICacheStorage cacheStorage; +}; diff --git a/mailnews/news/public/nsINntpUrl.idl b/mailnews/news/public/nsINntpUrl.idl new file mode 100644 index 000000000..d85b37e63 --- /dev/null +++ b/mailnews/news/public/nsINntpUrl.idl @@ -0,0 +1,99 @@ +/* -*- 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; +}; diff --git a/mailnews/news/public/nsMsgNewsCID.h b/mailnews/news/public/nsMsgNewsCID.h new file mode 100644 index 000000000..e56a93bb7 --- /dev/null +++ b/mailnews/news/public/nsMsgNewsCID.h @@ -0,0 +1,117 @@ +/* -*- 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/. */ + +#ifndef nsMsgNewsCID_h__ +#define nsMsgNewsCID_h__ + +#include "nsISupports.h" +#include "nsIFactory.h" +#include "nsIComponentManager.h" +#include "nsMsgBaseCID.h" + +// +// nsMsgNewsFolder +#define NS_NEWSFOLDERRESOURCE_CONTRACTID \ + NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX "news" +#define NS_NEWSFOLDERRESOURCE_CID \ +{ /* 4ace448a-f6d4-11d2-880d-004005263078 */ \ + 0x4ace448a, 0xf6d4, 0x11d2, \ + {0x88, 0x0d, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78} \ +} + +// +// nsNntpIncomingServer +// +#define NS_NNTPINCOMINGSERVER_CONTRACTID \ + NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "nntp" + +#define NS_NNTPINCOMINGSERVER_CID \ +{ /* 6ff28d0a-f776-11d2-87ca-004005263078 */ \ + 0x6ff28d0a, 0xf776, 0x11d2, \ + {0x87, 0xca, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78} \ +} + +// +// nsNntpService +// + +#define NS_NNTPPROTOCOLINFO_CONTRACTID \ + NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "nntp" + +#define NS_NEWSPROTOCOLHANDLER_CONTRACTID \ + NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "news" +#define NS_SNEWSPROTOCOLHANDLER_CONTRACTID \ + NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "snews" +#define NS_NNTPPROTOCOLHANDLER_CONTRACTID \ + NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "nntp" +#define NS_NEWSMESSAGESERVICE_CONTRACTID \ + "@mozilla.org/messenger/messageservice;1?type=news-message" +#define NS_NNTPMESSAGESERVICE_CONTRACTID \ + "@mozilla.org/messenger/messageservice;1?type=news" +#define NS_NNTPSERVICE_CONTRACTID \ + "@mozilla.org/messenger/nntpservice;1" +#define NS_NEWSSTARTUPHANDLER_CONTRACTID \ + "@mozilla.org/commandlinehandler/general-startup;1?type=news" + +#define NS_NNTPSERVICE_CID \ +{ /* 4C9F90E1-E19B-11d2-806E-006008128C4E */ \ + 0x4c9f90e1, 0xe19b, 0x11d2, \ + {0x80, 0x6e, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e} \ +} + +// +// nsNNTPNewsgroupPost +// +#define NS_NNTPNEWSGROUPPOST_CONTRACTID \ + "@mozilla.org/messenger/nntpnewsgrouppost;1" +#define NS_NNTPNEWSGROUPPOST_CID \ +{ /* 30c60228-187e-11d3-842f-004005263078 */ \ + 0x30c60228, 0x187e, 0x11d3, \ + {0x84, 0x2f, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78} \ +} + +// +// nsNNTPNewsgroupList +// +#define NS_NNTPNEWSGROUPLIST_CONTRACTID \ + "@mozilla.org/messenger/nntpnewsgrouplist;1" +#define NS_NNTPNEWSGROUPLIST_CID \ +{ /* 631e9054-1893-11d3-9916-004005263078 */ \ + 0x631e9054, 0x1893, 0x11d3, \ + {0x99, 0x16, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78} \ +} + +// +// nsNNTPArticleList +// +#define NS_NNTPARTICLELIST_CONTRACTID \ + "@mozilla.org/messenger/nntparticlelist;1" +#define NS_NNTPARTICLELIST_CID \ +{ /* 9f12bdf0-189f-11d3-973e-00805f916fd3 */ \ + 0x9f12bdf0, 0x189f, 0x11d3, \ + {0x97, 0x3e, 0x00, 0x80, 0x5f, 0x91, 0x6f, 0xd3} \ +} + +// +// nsNntpUrl +// +#define NS_NNTPURL_CONTRACTID \ + "@mozilla.org/messenger/nntpurl;1" +#define NS_NNTPURL_CID \ +{ /* 196B4B30-E18C-11d2-806E-006008128C4E */ \ + 0x196b4b30, 0xe18c, 0x11d2, \ + { 0x80, 0x6e, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e } } + +// +// nsNewsDownloadDialogArgs +// +#define NS_NEWSDOWNLOADDIALOGARGS_CONTRACTID \ + "@mozilla.org/messenger/newsdownloaddialogargs;1" +#define NS_NEWSDOWNLOADDIALOGARGS_CID \ +{ /* 1540689e-1dd2-11b2-933d-f0d1e460ef4a */ \ + 0x1540689e, 0x1dd2, 0x11b2, \ + { 0x93, 0x3d, 0xf0, 0xd1, 0xe4, 0x60, 0xef, 0x4a} } + +#endif // nsMsgNewsCID_h__ |