Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
nsNntpUrl Class Reference

#include <nsNntpUrl.h>

Inheritance diagram for nsNntpUrl:
Inheritance graph
[legend]
Collaboration diagram for nsNntpUrl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_NSINNTPURL
NS_DECL_NSIMSGMESSAGEURL
NS_DECL_NSIMSGI18NURL
NS_IMETHOD 
SetSpec (const nsACString &aSpec)
NS_IMETHOD IsUrlType (PRUint32 type, PRBool *isType)
NS_IMETHOD GetFolder (nsIMsgFolder **msgFolder)
NS_IMETHOD Clone (nsIURI **_retval)
 nsNntpUrl ()
virtual ~nsNntpUrl ()

Public Attributes

attribute nsINNTPNewsgroupPost messageToPost
attribute nsNewsAction newsAction
attribute boolean getOldMessages
const nsNewsAction ActionUnknown = 0
const nsNewsAction ActionGetNewNews = 1
const nsNewsAction ActionFetchArticle = 2
const nsNewsAction ActionSaveMessageToDisk = 3
const nsNewsAction ActionCancelArticle = 4
const nsNewsAction ActionPostArticle = 5
const nsNewsAction ActionSearch = 6
const nsNewsAction ActionUpdateCounts = 7
const nsNewsAction ActionListGroups = 8
const nsNewsAction ActionFetchPart = 9
const nsNewsAction ActionAutoSubscribe = 10
const nsNewsAction ActionListIds = 11
attribute string uri
attribute nsIFileSpec messageFile
attribute boolean AddDummyEnvelope
attribute boolean canonicalLineEnding
attribute string originalSpec
readonly attribute nsIMsgDBHdr messageHeader
readonly attribute string folderCharset
readonly attribute boolean folderCharsetOverride
attribute string charsetOverRide

Private Member Functions

virtual const char * GetUserName ()
nsresult DetermineNewsAction ()

Private Attributes

nsINNTPNewsgroupPostm_newsgroupPost
nsNewsAction m_newsAction
nsCString mURI
nsCString mCharsetOverride
nsCString mOriginalSpec
nsFileSpecm_filePath
nsCOMPtr< nsIFileSpecm_messageFileSpec
PRPackedBool m_addDummyEnvelope
PRPackedBool m_canonicalLineEnding
PRPackedBool m_getOldMessages

Detailed Description

Definition at line 47 of file nsNntpUrl.h.


Constructor & Destructor Documentation

nsNntpUrl::~nsNntpUrl ( ) [virtual]

Definition at line 79 of file nsNntpUrl.cpp.


Member Function Documentation

Definition at line 385 of file nsNntpUrl.cpp.

{
  nsresult rv;
  rv = nsMsgMailNewsUrl::Clone(_retval);
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIMsgMessageUrl> newsurl = do_QueryInterface(*_retval, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  return newsurl->SetUri(mURI.get());
}

Here is the call graph for this function:

Definition at line 107 of file nsNntpUrl.cpp.

{
  nsCAutoString path;
  nsresult rv = nsMsgMailNewsUrl::GetPath(path);
  NS_ENSURE_SUCCESS(rv,rv);

  if (!strcmp(path.get(),"/*")) {
    // news://news.mozilla.org/* 
    // get all newsgroups on the server, for subscribe
    m_newsAction = nsINntpUrl::ActionListGroups;
    return NS_OK;
  }

  if (!strcmp(path.get(),"/")) {
    // could be news:netscape.public.mozilla.mail-news or news://news.mozilla.org
    // news:netscape.public.mozilla.mail-news gets turned into news://netscape.public.mozilla.mail-news/ by nsStandardURL
    // news://news.mozilla.org gets turned in to news://news.mozilla.org/ by nsStandardURL
    // news://news.mozilla.org is nsINntpUrl::ActionUpdateCounts
    // (which is "update the unread counts for all groups that we're subscribed to on news.mozilla.org)
    // news:netscape.public.mozilla.mail-news is nsINntpUrl::AutoSubscribe
    //
    // also in here for, news:3B98D201.3020100@cs.com
    // and when posting, and during message display GetCodeBasePrinciple() and nsMimeNewURI()
    //
    // set it as unknown (so we won't try to check the cache for it
    // we'll figure out the action later, or it will be set on the url by the caller.
    m_newsAction = nsINntpUrl::ActionUnknown;
    return NS_OK;
  }
    
  if (PL_strcasestr(path.get(), "?part=") || PL_strcasestr(path.get(), "&part=")) {
    // news://news.mozilla.org:119/3B98D201.3020100%40cs.com?part=1
    // news://news.mozilla.org:119/b58dme%24aia2%40ripley.netscape.com?header=print&part=1.2&type=image/jpeg&filename=Pole.jpg
    m_newsAction = nsINntpUrl::ActionFetchPart;
    return NS_OK;
  }

  if (PL_strcasestr(path.get(), "?cancel")) {
    // news://news.mozilla.org/3C06C0E8.5090107@sspitzer.org?cancel
    m_newsAction = nsINntpUrl::ActionCancelArticle;
    return NS_OK;
  }

  if (PL_strcasestr(path.get(), "?list-ids")) {
    // news://news.mozilla.org/netscape.test?list-ids
    // remove all cancelled articles from netscape.test
    m_newsAction = nsINntpUrl::ActionListIds;
    return NS_OK;
  }
   
  if (strchr(path.get(), '@') || strstr(path.get(),"%40")) {
    // news://news.mozilla.org/3B98D201.3020100@cs.com
    // news://news.mozilla.org/3B98D201.3020100%40cs.com
    m_newsAction = nsINntpUrl::ActionFetchArticle;
    return NS_OK;
  }

  // news://news.mozilla.org/netscape.test could be 
  // get new news for netscape.test (nsINntpUrl::ActionGetNewNews)
  // or subscribe to netscape.test (nsINntpUrl::AutoSubscribe)
  // set it as unknown (so we won't try to check the cache for it
  // we'll figure out the action later, or it will be set on the url by the caller.
  m_newsAction = nsINntpUrl::ActionUnknown;
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 323 of file nsNntpUrl.cpp.

{
   nsresult rv;

   if (mOriginalSpec.IsEmpty()) {
    // this could be a autosubscribe url (news://host/group)
    // or a message id url (news://host/message-id)
    // either way, we won't have a msgFolder for you
    return NS_ERROR_FAILURE;
   }

   nsCOMPtr <nsINntpService> nntpService = do_GetService(NS_NNTPSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);

   nsMsgKey msgKey;
   // XXX should we find the first "?" in the mOriginalSpec, cut there, and pass that in?
   rv = nntpService->DecomposeNewsURI(mOriginalSpec.get(), msgFolder, &msgKey);
   NS_ENSURE_SUCCESS(rv,rv);
   return NS_OK;
}

Here is the call graph for this function:

virtual const char* nsNntpUrl::GetUserName ( ) [inline, private, virtual]

Definition at line 70 of file nsNntpUrl.h.

{ return nsnull; }

Definition at line 290 of file nsNntpUrl.cpp.

{
       NS_ENSURE_ARG(isType);

       switch(type)
       {
              case nsIMsgMailNewsUrl::eDisplay:
                     *isType = (m_newsAction == nsINntpUrl::ActionFetchArticle);
                     break;
              default:
                     *isType = PR_FALSE;
       };                          

       return NS_OK;

}
NS_IMETHODIMP nsNntpUrl::SetSpec ( const nsACString &  aSpec)

Definition at line 97 of file nsNntpUrl.cpp.


Member Data Documentation

Definition at line 70 of file nsINntpUrl.idl.

Definition at line 64 of file nsINntpUrl.idl.

Definition at line 62 of file nsINntpUrl.idl.

Definition at line 69 of file nsINntpUrl.idl.

Definition at line 61 of file nsINntpUrl.idl.

Definition at line 68 of file nsINntpUrl.idl.

Definition at line 71 of file nsINntpUrl.idl.

Definition at line 65 of file nsINntpUrl.idl.

Definition at line 63 of file nsINntpUrl.idl.

Definition at line 66 of file nsINntpUrl.idl.

Definition at line 60 of file nsINntpUrl.idl.

Definition at line 67 of file nsINntpUrl.idl.

Definition at line 135 of file nsIMsgMailNewsUrl.idl.

Definition at line 136 of file nsIMsgMailNewsUrl.idl.

Definition at line 157 of file nsIMsgMailNewsUrl.idl.

Definition at line 153 of file nsIMsgMailNewsUrl.idl.

Definition at line 154 of file nsIMsgMailNewsUrl.idl.

Definition at line 58 of file nsINntpUrl.idl.

Definition at line 85 of file nsNntpUrl.h.

Definition at line 86 of file nsNntpUrl.h.

Definition at line 80 of file nsNntpUrl.h.

Definition at line 87 of file nsNntpUrl.h.

Definition at line 83 of file nsNntpUrl.h.

Definition at line 74 of file nsNntpUrl.h.

Definition at line 73 of file nsNntpUrl.h.

Definition at line 77 of file nsNntpUrl.h.

Definition at line 134 of file nsIMsgMailNewsUrl.idl.

Definition at line 139 of file nsIMsgMailNewsUrl.idl.

Definition at line 56 of file nsINntpUrl.idl.

Definition at line 79 of file nsNntpUrl.h.

Definition at line 76 of file nsNntpUrl.h.

Definition at line 57 of file nsINntpUrl.idl.

Definition at line 137 of file nsIMsgMailNewsUrl.idl.

Definition at line 132 of file nsIMsgMailNewsUrl.idl.


The documentation for this class was generated from the following files: