Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsNntpService.cpp File Reference
#include "msgCore.h"
#include "nntpCore.h"
#include "nsISupportsObsolete.h"
#include "nsMsgNewsCID.h"
#include "nsINntpUrl.h"
#include "nsNNTPProtocol.h"
#include "nsNNTPNewsgroupPost.h"
#include "nsIMsgMailSession.h"
#include "nsIMsgIdentity.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsNewsUtils.h"
#include "nsNewsDatabase.h"
#include "nsMsgDBCID.h"
#include "nsMsgBaseCID.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsCRT.h"
#include "nsNntpService.h"
#include "nsIChannel.h"
#include "nsILoadGroup.h"
#include "nsCOMPtr.h"
#include "nsIDirectoryService.h"
#include "nsIMsgAccountManager.h"
#include "nsIMessengerMigrator.h"
#include "nsINntpIncomingServer.h"
#include "nsICategoryManager.h"
#include "nsIDocShell.h"
#include "nsIDocShellLoadInfo.h"
#include "nsIMessengerWindowService.h"
#include "nsIWindowMediator.h"
#include "nsIDOMWindowInternal.h"
#include "nsIMsgSearchSession.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIWebNavigation.h"
#include "nsIIOService.h"
#include "nsNetCID.h"
#include "nsIPrompt.h"
#include "nsIRDFService.h"
#include "nsNewsDownloader.h"
#include "prprf.h"
#include "nsICacheService.h"
#include "nsMsgUtils.h"
#include "nsEscape.h"
#include "nsNetUtil.h"
#include "nsIWindowWatcher.h"

Go to the source code of this file.

Classes

struct  findNewsServerEntry

Defines

#define PREF_NETWORK_HOSTS_NNTP_SERVER   "network.hosts.nntp_server"
#define PREF_MAIL_ROOT_NNTP   "mail.root.nntp"
#define PREF_MAIL_ROOT_NNTP_REL   "mail.root.nntp-rel"

Functions

static NS_DEFINE_CID (kMessengerMigratorCID, NS_MESSENGERMIGRATOR_CID)
static NS_DEFINE_CID (kIOServiceCID, NS_IOSERVICE_CID)
static NS_DEFINE_CID (kCacheServiceCID, NS_CACHESERVICE_CID)
 NS_IMPL_QUERY_INTERFACE7 (nsNntpService, nsINntpService, nsIMsgMessageService, nsIProtocolHandler, nsIMsgProtocolInfo, ICOMMANDLINEHANDLER, nsIMsgMessageFetchPartService, nsIContentHandler) NS_IMETHODIMP nsNntpService

Class Documentation

struct findNewsServerEntry

Definition at line 689 of file nsNntpService.cpp.

Collaboration diagram for findNewsServerEntry:
Class Members
const char * newsgroup
nsINntpIncomingServer * server

Define Documentation

#define PREF_MAIL_ROOT_NNTP   "mail.root.nntp"

Definition at line 98 of file nsNntpService.cpp.

#define PREF_MAIL_ROOT_NNTP_REL   "mail.root.nntp-rel"

Definition at line 99 of file nsNntpService.cpp.

#define PREF_NETWORK_HOSTS_NNTP_SERVER   "network.hosts.nntp_server"

Definition at line 97 of file nsNntpService.cpp.


Function Documentation

static NS_DEFINE_CID ( kMessengerMigratorCID  ,
NS_MESSENGERMIGRATOR_CID   
) [static]
static NS_DEFINE_CID ( kIOServiceCID  ,
NS_IOSERVICE_CID   
) [static]
static NS_DEFINE_CID ( kCacheServiceCID  ,
NS_CACHESERVICE_CID   
) [static]

Definition at line 119 of file nsNntpService.cpp.

{
    nsresult rv = NS_OK;
    NS_ENSURE_ARG_POINTER(aMessageURI);
 
    // double check it is a news-message:/ uri   
    if (PL_strncmp(aMessageURI, kNewsMessageRootURI, kNewsMessageRootURILen)) 
    {
        rv = NS_ERROR_UNEXPECTED;
        NS_ENSURE_SUCCESS(rv,rv);
    }

    nsCOMPtr <nsIMsgFolder> folder;
    nsMsgKey key = nsMsgKey_None;
    rv = DecomposeNewsMessageURI(aMessageURI, getter_AddRefs(folder), &key);
    NS_ENSURE_SUCCESS(rv,rv);
    
    nsXPIDLCString messageIdURL;
    rv = CreateMessageIDURL(folder, key, getter_Copies(messageIdURL));
    NS_ENSURE_SUCCESS(rv,rv);

    nsCOMPtr<nsIURI> url;
    rv = ConstructNntpUrl(messageIdURL.get(), aUrlListener, aMsgWindow, aMessageURI, nsINntpUrl::ActionSaveMessageToDisk, getter_AddRefs(url));
    NS_ENSURE_SUCCESS(rv,rv);

    nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(url);
    if (msgUrl) {
//        msgUrl->SetMessageFile(aFile);
        msgUrl->SetAddDummyEnvelope(aAddDummyEnvelope);
        msgUrl->SetCanonicalLineEnding(canonicalLineEnding);
    }   
    
    PRBool hasMsgOffline = PR_FALSE;

    nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(url);
    if (folder)
    {
      nsCOMPtr <nsIMsgNewsFolder> newsFolder = do_QueryInterface(folder);
      if (newsFolder)
      {
        if (mailNewsUrl)
        {
          folder->HasMsgOffline(key, &hasMsgOffline);
          mailNewsUrl->SetMsgIsInLocalCache(hasMsgOffline);
        }
      }
    }

    if (mailNewsUrl)
    {
      nsCOMPtr <nsIStreamListener> saveAsListener;
      mailNewsUrl->GetSaveAsListener(aAddDummyEnvelope, aFile, getter_AddRefs(saveAsListener));
    
      rv = DisplayMessage(aMessageURI, saveAsListener, /* nsIMsgWindow *aMsgWindow */nsnull, aUrlListener, nsnull /*aCharsetOverride */, aURL);
    }
    return rv;
}

Here is the call graph for this function: