Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
nsNntpIncomingServer Class Reference

#include <nsNntpIncomingServer.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSINNTPINCOMINGSERVER
NS_DECL_NSIURLLISTENER
NS_DECL_NSISUBSCRIBABLESERVER
NS_DECL_NSITREEVIEW 
nsNntpIncomingServer ()
virtual ~nsNntpIncomingServer ()
NS_IMETHOD GetLocalStoreType (char **type)
NS_IMETHOD CloseCachedConnections ()
NS_IMETHOD PerformBiff (nsIMsgWindow *aMsgWindow)
NS_IMETHOD PerformExpand (nsIMsgWindow *aMsgWindow)
NS_IMETHOD OnUserOrHostNameChanged (const char *oldName, const char *newName)
virtual PRInt32 HandleLine (char *line, PRUint32 line_size)
NS_IMETHODIMP ForgetPassword ()
NS_IMETHOD GetCanSearchMessages (PRBool *canSearchMessages)
NS_IMETHOD GetOfflineSupportLevel (PRInt32 *aSupportLevel)
NS_IMETHOD GetDefaultCopiesAndFoldersPrefsToServer (PRBool *aCopiesAndFoldersOnServer)
NS_IMETHOD GetCanCreateFoldersOnServer (PRBool *aCanCreateFoldersOnServer)
NS_IMETHOD GetCanFileMessagesOnServer (PRBool *aCanFileMessagesOnServer)
NS_IMETHOD GetFilterScope (nsMsgSearchScopeValue *filterScope)
NS_IMETHOD GetSearchScope (nsMsgSearchScopeValue *searchScope)
nsresult AppendIfSearchMatch (nsCString &newsgroupName)
void addNewsgroup (in AString name)
void removeNewsgroup (in AString name)
void writeNewsrcFile ()
void displaySubscribedGroup (in nsIMsgNewsFolder msgFolder, in long firstMessage, in long lastMessage, in long totalMessages)
void getNntpConnection (in nsIURI url, in nsIMsgWindow window, out nsINNTPProtocol aNntpConnection)
void removeConnection (in nsINNTPProtocol aNntpConnection)
boolean containsNewsgroup (in AUTF8String name)
void subscribeToNewsgroup (in AUTF8String name)
void addNewsgroupToList (in string name)
void addExtension (in string extension)
boolean queryExtension (in string extension)
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)
nsIMsgNewsFolder findGroup (in AUTF8String name)
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)
void OnStartRunningUrl (in nsIURI url)
void OnStopRunningUrl (in nsIURI url, in nsresult aExitCode)
void startPopulating (in nsIMsgWindow aMsgWindow, in boolean forceToServer)
void startPopulatingWithUri (in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string uri)
void stopPopulating (in nsIMsgWindow aMsgWindow)
boolean setState (in AUTF8String path, in boolean state)
void subscribeCleanup ()
void subscribe (in wstring name)
void unsubscribe (in wstring name)
void commitSubscribeChanges ()
void setIncomingServer (in nsIMsgIncomingServer server)
void addTo (in AUTF8String aName, in boolean addAsSubscribed, in boolean aSubscribable, in boolean aChangeIfExists)
void setAsSubscribed (in AUTF8String path)
void updateSubscribed ()
void setShowFullName (in boolean showFullName)
boolean hasChildren (in AUTF8String path)
boolean isSubscribed (in AUTF8String path)
boolean isSubscribable (in AUTF8String path)
AString getLeafName (in AUTF8String path)
void getChildren (in AUTF8String path, in nsISupportsArray array)
AUTF8String getFirstChildURI (in AUTF8String path)
void setSearchValue (in AString searchValue)
void getRowProperties (in long index, in nsISupportsArray properties)
 An atomized list of properties for a given row.
void getCellProperties (in long row, in nsITreeColumn col, in nsISupportsArray properties)
 An atomized list of properties for a given cell.
void getColumnProperties (in nsITreeColumn col, in nsISupportsArray properties)
 Called to get properties to paint a column background.
boolean isContainer (in long index)
 Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.
boolean isContainerOpen (in long index)
boolean isContainerEmpty (in long index)
boolean isSeparator (in long index)
 isSeparator is used to determine if the row at index is a separator.
boolean isSorted ()
 Specifies if there is currently a sort on any column.
boolean canDrop (in long index, in long orientation)
 Methods used by the drag feedback code to determine if a drag is allowable at the current location.
void drop (in long row, in long orientation)
 Called when the user drops something on this view.
long getParentIndex (in long rowIndex)
 Methods used by the tree to draw thread lines in the tree.
boolean hasNextSibling (in long rowIndex, in long afterIndex)
 hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.
long getLevel (in long index)
 The level is an integer value that represents the level of indentation.
AString getImageSrc (in long row, in nsITreeColumn col)
 The image path for a given cell.
long getProgressMode (in long row, in nsITreeColumn col)
AString getCellValue (in long row, in nsITreeColumn col)
 The value for a given cell.
AString getCellText (in long row, in nsITreeColumn col)
 The text for a given cell.
void setTree (in nsITreeBoxObject tree)
 Called during initialization to link the view to the front end box object.
void toggleOpenState (in long index)
 Called on the view when an item is opened or closed.
void cycleHeader (in nsITreeColumn col)
 Called on the view when a header is clicked.
void selectionChanged ()
 Should be called from a XUL onselect handler whenever the selection changes.
void cycleCell (in long row, in nsITreeColumn col)
 Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
boolean isEditable (in long row, in nsITreeColumn col)
 isEditable is called to ask the view if the cell contents are editable.
void setCellValue (in long row, in nsITreeColumn col, in AString value)
 setCellValue is called when the value of the cell has been set by the user.
void setCellText (in long row, in nsITreeColumn col, in AString value)
 setCellText is called when the contents of the cell have been edited by the user.
void performAction (in wstring action)
 A command API that can be used to invoke commands on the selection.
void performActionOnRow (in wstring action, in long row)
 A command API that can be used to invoke commands on a specific row.
void performActionOnCell (in wstring action, in long row, in nsITreeColumn col)
 A command API that can be used to invoke commands on a specific cell.

Public Attributes

attribute nsIFileSpec newsrcFilePath
attribute nsIFileSpec newsrcRootPath
attribute boolean notifyOn
attribute long maxArticles
attribute boolean markOldRead
attribute boolean abbreviate
attribute boolean singleSignon
attribute ACString charset
 the server charset and it may be needed to display newsgroup folder names correctly
attribute boolean newsrcHasChanged
attribute long maximumConnectionsNumber
readonly attribute long numGroupsNeedingCounts
readonly attribute nsISupports firstGroupNeedingCounts
attribute boolean supportsExtensions
attribute boolean postingAllowed
attribute boolean pushAuth
attribute unsigned long lastUpdatedTime
readonly attribute AUTF8String firstGroupNeedingExtraInfo
attribute boolean userAuthenticated
attribute nsISubscribeListener subscribeListener
attribute char delimiter
readonly attribute boolean supportsSubscribeSearch
readonly attribute long rowCount
 The total number of rows in the tree (including the offscreen rows).
attribute nsITreeSelection selection
 The selection for this view.
const short DROP_BEFORE = -1
const short DROP_ON = 0
const short DROP_AFTER = 1
const short PROGRESS_NORMAL = 1
 The progress mode for a given cell.
const short PROGRESS_UNDETERMINED = 2
const short PROGRESS_NONE = 3

Protected Member Functions

nsresult CreateProtocolInstance (nsINNTPProtocol **aNntpConnection, nsIURI *url, nsIMsgWindow *window)
PRBool ConnectionTimeOut (nsINNTPProtocol *aNntpConnection)
NS_IMETHOD GetServerRequiresPasswordForBiff (PRBool *aServerRequiresPasswordForBiff)
nsresult SetupNewsrcSaveTimer ()

Static Protected Member Functions

static void OnNewsrcSaveTimer (nsITimer *timer, void *voidIncomingServer)

Protected Attributes

nsCOMPtr< nsISupportsArraym_connectionCache
nsByteArray mHostInfoInputStream

Private Member Functions

nsresult WriteHostInfoFile ()
nsresult LoadHostInfoFile ()
nsresult AddGroupOnServer (const nsACString &name)
nsresult EnsureInner ()
nsresult ClearInner ()
nsresult IsValidRow (PRInt32 row)

Private Attributes

nsCStringArray mSubscribedNewsgroups
nsCStringArray mGroupsOnServer
nsCStringArray mSubscribeSearchResult
PRBool mSearchResultSortDescending
nsCStringArray mTempSubscribed
nsCOMPtr< nsIAtommSubscribedAtom
nsCOMPtr< nsIAtommNntpAtom
nsString mSearchValue
nsCOMPtr< nsITreeBoxObjectmTree
nsCOMPtr< nsITreeSelectionmTreeSelection
PRBool mHasSeenBeginGroups
PRBool mNewsrcHasChanged
nsAdapterEnumerator * mGroupsEnumerator
PRBool mHostInfoLoaded
PRBool mHostInfoHasChanged
nsCOMPtr< nsIFileSpecmHostInfoFile
PRUint32 mLastGroupDate
PRTime mFirstNewDate
PRInt32 mUniqueId
PRUint32 mLastUpdatedTime
PRInt32 mVersion
PRBool mPostingAllowed
PRBool m_userAuthenticated
nsCOMPtr< nsITimermNewsrcSaveTimer
nsCOMPtr< nsIMsgWindowmMsgWindow
nsCOMPtr< nsISubscribableServermInner
nsIOFileStreammHostInfoStream
nsCOMPtr< nsIFileSpecmNewsrcFilePath

Detailed Description

Definition at line 67 of file nsNntpIncomingServer.h.


Constructor & Destructor Documentation

Definition at line 106 of file nsNntpIncomingServer.cpp.

Here is the call graph for this function:

Definition at line 135 of file nsNntpIncomingServer.cpp.

Here is the call graph for this function:


Member Function Documentation

void nsINntpIncomingServer::addExtension ( in string  extension) [inherited]
nsresult nsNntpIncomingServer::AddGroupOnServer ( const nsACString &  name) [private]

Definition at line 1336 of file nsNntpIncomingServer.cpp.

{
       mGroupsOnServer.AppendCString(aName); 
       return NS_OK;
}
void nsINntpIncomingServer::addNewsgroup ( in AString  name) [inherited]
void nsINntpIncomingServer::addPropertyForGet ( in string  name,
in string  value 
) [inherited]
void nsINntpIncomingServer::addSearchableGroup ( in AString  name) [inherited]
void nsISubscribableServer::addTo ( in AUTF8String  aName,
in boolean  addAsSubscribed,
in boolean  aSubscribable,
in boolean  aChangeIfExists 
) [inherited]

Definition at line 1757 of file nsNntpIncomingServer.cpp.

{
    NS_ConvertUTF8toUTF16 groupName(newsgroupName);
    nsAString::const_iterator start, end;
    groupName.BeginReading(start);
    groupName.EndReading(end);
    if (FindInReadable(mSearchValue, start, end, 
                       nsCaseInsensitiveStringComparator())) 
        mSubscribeSearchResult.AppendCString(newsgroupName);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsITreeView::canDrop ( in long  index,
in long  orientation 
) [inherited]

Methods used by the drag feedback code to determine if a drag is allowable at the current location.

To get the behavior where drops are only allowed on items, such as the mailNews folder pane, always return false when the orientation is not DROP_ON.

Definition at line 1094 of file nsNntpIncomingServer.cpp.

{
    nsresult rv = NS_OK;

    if (mInner) {
        rv = mInner->SetSubscribeListener(nsnull);
        NS_ENSURE_SUCCESS(rv,rv);

        rv = mInner->SetIncomingServer(nsnull);
        NS_ENSURE_SUCCESS(rv,rv);

        mInner = nsnull;
    }
    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 473 of file nsNntpIncomingServer.cpp.

{
  nsresult rv;
  PRUint32 cnt;
  nsCOMPtr<nsINNTPProtocol> connection;

  // iterate through the connection cache and close the connections.
  if (m_connectionCache)
  {
    rv = m_connectionCache->Count(&cnt);
    if (NS_FAILED(rv)) return rv;
    for (PRUint32 i = 0; i < cnt; i++) 
         {
      connection = do_QueryElementAt(m_connectionCache, 0);
                if (connection)
      {
         rv = connection->CloseConnection();
        RemoveConnection(connection);
      }
         }
  }
  rv = WriteNewsrcFile();
  if (NS_FAILED(rv)) return rv;

  rv = WriteHostInfoFile(); 
  if (NS_FAILED(rv)) return rv;
       
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsINntpIncomingServer::containsNewsgroup ( in AUTF8String  name) [inherited]
nsresult nsNntpIncomingServer::CreateProtocolInstance ( nsINNTPProtocol **  aNntpConnection,
nsIURI url,
nsIMsgWindow window 
) [protected]

Definition at line 537 of file nsNntpIncomingServer.cpp.

{
  // create a new connection and add it to the connection cache
  // we may need to flag the protocol connection as busy so we don't get
  // a race 
  // condition where someone else goes through this code 
  nsNNTPProtocol * protocolInstance = new nsNNTPProtocol(url, aMsgWindow);
  if (!protocolInstance)
    return NS_ERROR_OUT_OF_MEMORY;

  nsresult rv = protocolInstance->QueryInterface(NS_GET_IID(nsINNTPProtocol), (void **) aNntpConnection);
  // take the protocol instance and add it to the connectionCache
  if (NS_SUCCEEDED(rv) && *aNntpConnection)
    m_connectionCache->AppendElement(*aNntpConnection);
  return rv;
}
void nsITreeView::cycleCell ( in long  row,
in nsITreeColumn  col 
) [inherited]

Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.

Called on the view when a header is clicked.

void nsINntpIncomingServer::displaySubscribedGroup ( in nsIMsgNewsFolder  msgFolder,
in long  firstMessage,
in long  lastMessage,
in long  totalMessages 
) [inherited]
void nsITreeView::drop ( in long  row,
in long  orientation 
) [inherited]

Called when the user drops something on this view.

The |orientation| param specifies before/on/after the given |row|.

Definition at line 1111 of file nsNntpIncomingServer.cpp.

{
    nsresult rv = NS_OK;

    if (mInner) return NS_OK;

    mInner = do_CreateInstance(kSubscribableServerCID,&rv);
    NS_ENSURE_SUCCESS(rv,rv);
    if (!mInner) return NS_ERROR_FAILURE;

    rv = SetIncomingServer(this);
    NS_ENSURE_SUCCESS(rv,rv);

    return NS_OK;
}

Here is the call graph for this function:

nsIMsgNewsFolder nsINntpIncomingServer::findGroup ( in AUTF8String  name) [inherited]

Definition at line 1439 of file nsNntpIncomingServer.cpp.

{
    nsresult rv;

    // clear password of root folder (for the news account)
    nsCOMPtr<nsIMsgFolder> rootFolder;
    rv = GetRootFolder(getter_AddRefs(rootFolder));
    NS_ENSURE_SUCCESS(rv,rv);
    if (!rootFolder) return NS_ERROR_FAILURE;

    nsCOMPtr <nsIMsgNewsFolder> newsFolder = do_QueryInterface(rootFolder, &rv);
    NS_ENSURE_SUCCESS(rv,rv);
    if (!newsFolder) return NS_ERROR_FAILURE;

    rv = newsFolder->ForgetGroupUsername();
    NS_ENSURE_SUCCESS(rv,rv);
    rv = newsFolder->ForgetGroupPassword();
    NS_ENSURE_SUCCESS(rv,rv);

    // clear password of all child folders
    nsCOMPtr<nsIEnumerator> subFolders;

    rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
    NS_ENSURE_SUCCESS(rv,rv);

    nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
    if (!simpleEnumerator) return NS_ERROR_OUT_OF_MEMORY;

    PRBool moreFolders = PR_FALSE;
        
    nsresult return_rv = NS_OK;

    while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders) {
        nsCOMPtr<nsISupports> child;
        rv = simpleEnumerator->GetNext(getter_AddRefs(child));
        if (NS_SUCCEEDED(rv) && child) {
            newsFolder = do_QueryInterface(child, &rv);
            if (NS_SUCCEEDED(rv) && newsFolder) {
                rv = newsFolder->ForgetGroupUsername();
                if (NS_FAILED(rv)) return_rv = rv;
                rv = newsFolder->ForgetGroupPassword();
                if (NS_FAILED(rv)) return_rv = rv;
            }
            else {
                return_rv = NS_ERROR_FAILURE;
            }
        }
    }
    delete simpleEnumerator;

    return return_rv;
}

Here is the call graph for this function:

Definition at line 1731 of file nsNntpIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aCanCreateFoldersOnServer);

    // No folder creation on news servers. Return false.
    *aCanCreateFoldersOnServer = PR_FALSE;
    return NS_OK;
}

Definition at line 2071 of file nsNntpIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aCanFileMessagesOnServer);

    // No folder creation on news servers. Return false.
    *aCanFileMessagesOnServer = PR_FALSE;
    return NS_OK;
}

Definition at line 1693 of file nsNntpIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(canSearchMessages);
    *canSearchMessages = PR_TRUE;
    return NS_OK;
}
void nsITreeView::getCellProperties ( in long  row,
in nsITreeColumn  col,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given cell.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-cell-x to be matched on the ::moz-tree-cell pseudoelement.

AString nsITreeView::getCellText ( in long  row,
in nsITreeColumn  col 
) [inherited]

The text for a given cell.

If a column consists only of an image, then the empty string is returned.

AString nsITreeView::getCellValue ( in long  row,
in nsITreeColumn  col 
) [inherited]

The value for a given cell.

This method is only called for columns of type other than |text|.

void nsISubscribableServer::getChildren ( in AUTF8String  path,
in nsISupportsArray  array 
) [inherited]

Called to get properties to paint a column background.

For shading the sort column, etc.

When a news account is created, the copies and folder prefs for the associated identity don't point to folders on the server. This makes sense, since there is no "Drafts" folder on a news server. They'll point to the ones on "Local Folders"

Definition at line 1715 of file nsNntpIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aCopiesAndFoldersOnServer);

    *aCopiesAndFoldersOnServer = PR_FALSE;
    return NS_OK;
}

Definition at line 2081 of file nsNntpIncomingServer.cpp.

{
   NS_ENSURE_ARG_POINTER(filterScope);

   *filterScope = nsMsgSearchScope::newsFilter;
   return NS_OK;
}
AUTF8String nsISubscribableServer::getFirstChildURI ( in AUTF8String  path) [inherited]
AString nsITreeView::getImageSrc ( in long  row,
in nsITreeColumn  col 
) [inherited]

The image path for a given cell.

For defining an icon for a cell. If the empty string is returned, the :moz-tree-image pseudoelement will be used.

AString nsISubscribableServer::getLeafName ( in AUTF8String  path) [inherited]
long nsITreeView::getLevel ( in long  index) [inherited]

The level is an integer value that represents the level of indentation.

It is multiplied by the width specified in the :moz-tree-indentation pseudoelement to compute the exact indendation.

Definition at line 231 of file nsNntpIncomingServer.cpp.

void nsINntpIncomingServer::getNntpConnection ( in nsIURI  url,
in nsIMsgWindow  window,
out nsINNTPProtocol  aNntpConnection 
) [inherited]

Definition at line 1701 of file nsNntpIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aSupportLevel);
    nsresult rv;
    
    rv = GetIntValue("offline_support_level", aSupportLevel);
    if (*aSupportLevel != OFFLINE_SUPPORT_LEVEL_UNDEFINED) return rv;
    
    // set default value
    *aSupportLevel = OFFLINE_SUPPORT_LEVEL_EXTENDED;
    return NS_OK;
}

Here is the call graph for this function:

long nsITreeView::getParentIndex ( in long  rowIndex) [inherited]

Methods used by the tree to draw thread lines in the tree.

getParentIndex is used to obtain the index of a parent row. If there is no parent row, getParentIndex returns -1.

long nsITreeView::getProgressMode ( in long  row,
in nsITreeColumn  col 
) [inherited]
void nsITreeView::getRowProperties ( in long  index,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given row.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-row-x to be matched on the pseudoelement ::moz-tree-row.

Definition at line 2090 of file nsNntpIncomingServer.cpp.

{
   NS_ENSURE_ARG_POINTER(searchScope);

   if (WeAreOffline()) {
     *searchScope = nsMsgSearchScope::localNews;
   }
   else {
     *searchScope = nsMsgSearchScope::news;
   }
   return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsNntpIncomingServer::GetServerRequiresPasswordForBiff ( PRBool aServerRequiresPasswordForBiff) [protected]

Definition at line 762 of file nsNntpIncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aServerRequiresPasswordForBiff);
       *aServerRequiresPasswordForBiff = PR_FALSE;  // for news, biff is getting the unread counts
       return NS_OK;
}
void nsINntpIncomingServer::groupNotFound ( in nsIMsgWindow  window,
in AString  group,
in boolean  opening 
) [inherited]
PRInt32 nsNntpIncomingServer::HandleLine ( char *  line,
PRUint32  line_size 
) [virtual]

Definition at line 1286 of file nsNntpIncomingServer.cpp.

{
  NS_ASSERTION(line, "line is null");
  if (!line) return 0;

  // skip blank lines and comments
  if (line[0] == '#' || line[0] == '\0') return 0;
       
  line[line_size] = 0;

  if (mHasSeenBeginGroups) {
    char *commaPos = PL_strchr(line,',');
    if (commaPos) *commaPos = 0;

        // newsrc entries are all in UTF-8
#ifdef DEBUG_jungshik
    NS_ASSERTION(IsUTF8(nsDependentCString(line)), "newsrc line is not utf-8");
#endif
    nsresult rv = AddTo(nsDependentCString(line), PR_FALSE, PR_TRUE, PR_TRUE);
    NS_ASSERTION(NS_SUCCEEDED(rv),"failed to add line");
    if (NS_SUCCEEDED(rv)) {
      // since we've seen one group, we can claim we've loaded the
      // hostinfo file
      mHostInfoLoaded = PR_TRUE;
    }
  }
  else {
              if (nsCRT::strncmp(line,"begingroups", 11) == 0) {
                     mHasSeenBeginGroups = PR_TRUE;
              }
              char*equalPos = PL_strchr(line, '=');     
              if (equalPos) {
                     *equalPos++ = '\0';
                     if (PL_strcmp(line, "lastgroupdate") == 0) {
                            mLastGroupDate = strtol(equalPos, nsnull, 16);
                     } else if (PL_strcmp(line, "firstnewdate") == 0) {
                            PRInt32 firstnewdate = strtol(equalPos, nsnull, 16);
                            LL_I2L(mFirstNewDate, firstnewdate);
                     } else if (PL_strcmp(line, "uniqueid") == 0) {
                            mUniqueId = strtol(equalPos, nsnull, 16);
                     } else if (PL_strcmp(line, "version") == 0) {
                            mVersion = strtol(equalPos, nsnull, 16);
                     }
              }      
       }

       return 0;
}

Here is the call graph for this function:

boolean nsISubscribableServer::hasChildren ( in AUTF8String  path) [inherited]
boolean nsITreeView::hasNextSibling ( in long  rowIndex,
in long  afterIndex 
) [inherited]

hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.

Code that is forced to march down the view looking at levels can optimize the march by starting at afterIndex+1.

boolean nsITreeView::isContainer ( in long  index) [inherited]

Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.

Here is the caller graph for this function:

boolean nsITreeView::isContainerEmpty ( in long  index) [inherited]
boolean nsITreeView::isContainerOpen ( in long  index) [inherited]
boolean nsITreeView::isEditable ( in long  row,
in nsITreeColumn  col 
) [inherited]

isEditable is called to ask the view if the cell contents are editable.

A value of true will result in the tree popping up a text field when the user tries to inline edit the cell.

boolean nsITreeView::isSeparator ( in long  index) [inherited]

isSeparator is used to determine if the row at index is a separator.

A value of true will result in the tree drawing a horizontal separator. The tree uses the ::moz-tree-separator pseudoclass to draw the separator.

boolean nsITreeView::isSorted ( ) [inherited]

Specifies if there is currently a sort on any column.

Used mostly by dragdrop to affect drop feedback.

boolean nsISubscribableServer::isSubscribable ( in AUTF8String  path) [inherited]
boolean nsISubscribableServer::isSubscribed ( in AUTF8String  path) [inherited]

Definition at line 1925 of file nsNntpIncomingServer.cpp.

{
    return ((row >= 0) && (row < mSubscribeSearchResult.Count()));
}

Definition at line 909 of file nsNntpIncomingServer.cpp.

{
       nsresult rv;
       
    // we haven't loaded it yet
    mHostInfoLoaded = PR_FALSE;

       rv = GetLocalPath(getter_AddRefs(mHostInfoFile));
       if (NS_FAILED(rv)) return rv;
       if (!mHostInfoFile) return NS_ERROR_FAILURE;

       rv = mHostInfoFile->AppendRelativeUnixPath(HOSTINFO_FILE_NAME);
       if (NS_FAILED(rv)) return rv;

       PRBool exists;
       rv = mHostInfoFile->Exists(&exists);
       if (NS_FAILED(rv)) return rv;

       // it is ok if the hostinfo.dat file does not exist.
       if (!exists) return NS_OK;

    char *buffer = nsnull;
    rv = mHostInfoFile->OpenStreamForReading();
    NS_ENSURE_SUCCESS(rv,rv);

    PRInt32 numread = 0;

    if (NS_FAILED(mHostInfoInputStream.GrowBuffer(HOSTINFO_FILE_BUFFER_SIZE))) {
       return NS_ERROR_FAILURE;
    }
       
       mHasSeenBeginGroups = PR_FALSE;

    while (1) {
        buffer = mHostInfoInputStream.GetBuffer();
        rv = mHostInfoFile->Read(&buffer, HOSTINFO_FILE_BUFFER_SIZE, &numread);
        NS_ENSURE_SUCCESS(rv,rv);
        if (numread == 0) {
              break;
       }
       else {
              rv = BufferInput(mHostInfoInputStream.GetBuffer(), numread);
              if (NS_FAILED(rv)) {
                     break;
              }
       }
       }

    mHostInfoFile->CloseStream();
     
       rv = UpdateSubscribed();
       if (NS_FAILED(rv)) return rv;

       return NS_OK;
}

Here is the call graph for this function:

void nsNntpIncomingServer::OnNewsrcSaveTimer ( nsITimer timer,
void voidIncomingServer 
) [static, protected]

Definition at line 291 of file nsNntpIncomingServer.cpp.

{
       nsNntpIncomingServer *incomingServer = (nsNntpIncomingServer*)voidIncomingServer;
       incomingServer->WriteNewsrcFile();        
}

Here is the caller graph for this function:

Here is the caller graph for this function:

void nsIUrlListener::OnStopRunningUrl ( in nsIURI  url,
in nsresult  aExitCode 
) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP nsNntpIncomingServer::OnUserOrHostNameChanged ( const char *  oldName,
const char *  newName 
)

Definition at line 2104 of file nsNntpIncomingServer.cpp.

{
  nsresult rv;
  // 1. Do common things in the base class.
  rv = nsMsgIncomingServer::OnUserOrHostNameChanged(oldName, newName);
  NS_ENSURE_SUCCESS(rv,rv);

  // 2. Remove file hostinfo.dat so that the new subscribe 
  //    list will be reloaded from the new server.
  nsCOMPtr <nsIFileSpec> hostInfoFile;
  rv = GetLocalPath(getter_AddRefs(hostInfoFile));
  NS_ENSURE_SUCCESS(rv, rv);
  rv = hostInfoFile->AppendRelativeUnixPath(HOSTINFO_FILE_NAME);
  NS_ENSURE_SUCCESS(rv, rv);
  hostInfoFile->Delete(PR_FALSE);

  // 3.Unsubscribe and then subscribe the existing groups to clean up the article numbers
  //   in the rc file (this is because the old and new servers may maintain different 
  //   numbers for the same articles if both servers handle the same groups).
  nsCOMPtr<nsIEnumerator> subFolders;

  nsCOMPtr <nsIMsgFolder> serverFolder;
  rv = GetRootMsgFolder(getter_AddRefs(serverFolder));
  NS_ENSURE_SUCCESS(rv,rv);

  rv = serverFolder->GetSubFolders(getter_AddRefs(subFolders));
  NS_ENSURE_SUCCESS(rv,rv);

  nsStringArray groupList;
  nsXPIDLString folderName;
  nsCOMPtr<nsISupports> aItem;
  nsCOMPtr <nsIMsgFolder> newsgroupFolder;

  // Prepare the group list
  while (subFolders->IsDone() != NS_OK)
  {
    rv = subFolders->CurrentItem(getter_AddRefs(aItem));
    NS_ENSURE_SUCCESS(rv,rv);
    newsgroupFolder = do_QueryInterface(aItem, &rv);
    NS_ENSURE_SUCCESS(rv,rv);
    rv = newsgroupFolder->GetName(getter_Copies(folderName));
    NS_ENSURE_SUCCESS(rv,rv);
    groupList.AppendString(folderName);
    if (! NS_SUCCEEDED(subFolders->Next()))
      break;
  }

  // If nothing subscribed then we're done.
  if (groupList.Count() == 0)
    return NS_OK;

  // Now unsubscribe & subscribe.
  int i, cnt=groupList.Count();
  nsAutoString groupStr;
  nsCAutoString cname;
  for (i=0; i<cnt; i++)
  {
    // unsubscribe.
    groupList.StringAt(i, groupStr);
    rv = Unsubscribe(groupStr.get());
    NS_ENSURE_SUCCESS(rv,rv);
  }

  for (i=0; i<cnt; i++)
  {
    // subscribe.
    groupList.StringAt(i, groupStr);
    rv = SubscribeToNewsgroup(NS_ConvertUTF16toUTF8(groupStr));
    NS_ENSURE_SUCCESS(rv,rv);
  }

  groupList.Clear();
  
  // Force updating the rc file.
  rv = CommitSubscribeChanges();
  return rv;
}

Here is the call graph for this function:

void nsITreeView::performAction ( in wstring  action) [inherited]

A command API that can be used to invoke commands on the selection.

The tree will automatically invoke this method when certain keys are pressed. For example, when the DEL key is pressed, performAction will be called with the "delete" string.

void nsITreeView::performActionOnCell ( in wstring  action,
in long  row,
in nsITreeColumn  col 
) [inherited]

A command API that can be used to invoke commands on a specific cell.

void nsITreeView::performActionOnRow ( in wstring  action,
in long  row 
) [inherited]

A command API that can be used to invoke commands on a specific row.

Definition at line 754 of file nsNntpIncomingServer.cpp.

{
#ifdef DEBUG_NEWS
       printf("PerformBiff for nntp\n");
#endif
       return PerformExpand(nsnull);
}

Here is the call graph for this function:

Definition at line 635 of file nsNntpIncomingServer.cpp.

{
  // Get news.update_unread_on_expand pref
  nsresult rv; 
  PRBool updateUnreadOnExpand = PR_TRUE;
  nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
  if NS_SUCCEEDED(rv)
    prefBranch->GetBoolPref("news.update_unread_on_expand", &updateUnreadOnExpand);
  
  // Only if news.update_unread_on_expand is true do we update the unread counts
  if (updateUnreadOnExpand) 
  {
    // a user might have a new server without any groups.
    // if so, bail out.  no need to establish a connection to the server
    PRInt32 numGroups = 0;
    rv = GetNumGroupsNeedingCounts(&numGroups);
    NS_ENSURE_SUCCESS(rv,rv);
    
    if (!numGroups)
      return NS_OK;
    
    nsCOMPtr<nsINntpService> nntpService = do_GetService(NS_NNTPSERVICE_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv,rv);
  
    rv = nntpService->UpdateCounts(this, aMsgWindow);
    NS_ENSURE_SUCCESS(rv,rv);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsINntpIncomingServer::removeNewsgroup ( in AString  name) [inherited]

Should be called from a XUL onselect handler whenever the selection changes.

void nsISubscribableServer::setAsSubscribed ( in AUTF8String  path) [inherited]
void nsITreeView::setCellText ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellText is called when the contents of the cell have been edited by the user.

void nsITreeView::setCellValue ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellValue is called when the value of the cell has been set by the user.

This method is only called for columns of type other than |text|.

void nsINntpIncomingServer::setGroupNeedsExtraInfo ( in AUTF8String  name,
in boolean  needsExtraInfo 
) [inherited]
void nsINntpIncomingServer::setPrettyNameForGroup ( in AString  name,
in AString  prettyName 
) [inherited]
void nsISubscribableServer::setSearchValue ( in AString  searchValue) [inherited]
void nsISubscribableServer::setShowFullName ( in boolean  showFullName) [inherited]
boolean nsISubscribableServer::setState ( in AUTF8String  path,
in boolean  state 
) [inherited]

Called during initialization to link the view to the front end box object.

Definition at line 298 of file nsNntpIncomingServer.cpp.

{
       nsInt64 ms(300000);   // hard code, 5 minutes.
       //Convert biffDelay into milliseconds
       PRUint32 timeInMSUint32 = (PRUint32)ms;
       //Can't currently reset a timer when it's in the process of
       //calling Notify. So, just release the timer here and create a new one.
       if(mNewsrcSaveTimer)
       {
              mNewsrcSaveTimer->Cancel();
       }
    mNewsrcSaveTimer = do_CreateInstance("@mozilla.org/timer;1");
       mNewsrcSaveTimer->InitWithFuncCallback(OnNewsrcSaveTimer, (void*)this, timeInMSUint32, 
                                           nsITimer::TYPE_REPEATING_SLACK);

    return NS_OK;
}

Here is the call graph for this function:

void nsISubscribableServer::startPopulating ( in nsIMsgWindow  aMsgWindow,
in boolean  forceToServer 
) [inherited]
void nsISubscribableServer::startPopulatingWithUri ( in nsIMsgWindow  aMsgWindow,
in boolean  forceToServer,
in string  uri 
) [inherited]
void nsISubscribableServer::subscribe ( in wstring  name) [inherited]
void nsINntpIncomingServer::subscribeToNewsgroup ( in AUTF8String  name) [inherited]
void nsITreeView::toggleOpenState ( in long  index) [inherited]

Called on the view when an item is opened or closed.

void nsISubscribableServer::unsubscribe ( in wstring  name) [inherited]

Definition at line 850 of file nsNntpIncomingServer.cpp.

{
    nsresult rv = NS_OK;

    if (!mHostInfoHasChanged) {
        return NS_OK;
    }

    PRInt32 firstnewdate;

    LL_L2I(firstnewdate, mFirstNewDate);

    nsXPIDLCString hostname;
    rv = GetHostName(getter_Copies(hostname));
    NS_ENSURE_SUCCESS(rv,rv);
    
    nsFileSpec hostinfoFileSpec;

    if (!mHostInfoFile) 
        return NS_ERROR_UNEXPECTED;

    rv = mHostInfoFile->GetFileSpec(&hostinfoFileSpec);
    NS_ENSURE_SUCCESS(rv,rv);

    if (mHostInfoStream) {
        mHostInfoStream->close();
        delete mHostInfoStream;
    }

    mHostInfoStream = new nsIOFileStream(hostinfoFileSpec, (PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE));
    if (!mHostInfoStream)
        return NS_ERROR_OUT_OF_MEMORY;

    // todo, missing some formatting, see the 4.x code
    *mHostInfoStream
         << "# News host information file." << MSG_LINEBREAK
         << "# This is a generated file!  Do not edit." << MSG_LINEBREAK
         << "" << MSG_LINEBREAK
         << "version=" << VALID_VERSION << MSG_LINEBREAK
         << "newsrcname=" << (const char*)hostname << MSG_LINEBREAK
         << "lastgroupdate=" << mLastGroupDate << MSG_LINEBREAK
         << "firstnewdate=" << firstnewdate << MSG_LINEBREAK
         << "uniqueid=" << mUniqueId << MSG_LINEBREAK
         << "" << MSG_LINEBREAK
         << "begingroups" << MSG_LINEBREAK;

    // XXX todo, sort groups first?

    mGroupsOnServer.EnumerateForwards((nsCStringArrayEnumFunc)writeGroupToHostInfoFile, (void *)mHostInfoStream);

    mHostInfoStream->close();
    delete mHostInfoStream;
    mHostInfoStream = nsnull;

    mHostInfoHasChanged = PR_FALSE;
    return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 64 of file nsINntpIncomingServer.idl.

the server charset and it may be needed to display newsgroup folder names correctly

Definition at line 72 of file nsINntpIncomingServer.idl.

Definition at line 61 of file nsISubscribableServer.idl.

const short nsITreeView::DROP_AFTER = 1 [inherited]

Definition at line 103 of file nsITreeView.idl.

const short nsITreeView::DROP_BEFORE = -1 [inherited]

Definition at line 101 of file nsITreeView.idl.

const short nsITreeView::DROP_ON = 0 [inherited]

Definition at line 102 of file nsITreeView.idl.

Definition at line 85 of file nsINntpIncomingServer.idl.

Definition at line 123 of file nsINntpIncomingServer.idl.

Definition at line 110 of file nsINntpIncomingServer.idl.

Definition at line 110 of file nsNntpIncomingServer.h.

Definition at line 150 of file nsNntpIncomingServer.h.

Definition at line 61 of file nsINntpIncomingServer.idl.

Definition at line 58 of file nsINntpIncomingServer.idl.

Definition at line 82 of file nsINntpIncomingServer.idl.

Definition at line 145 of file nsNntpIncomingServer.h.

nsAdapterEnumerator* nsNntpIncomingServer::mGroupsEnumerator [private]

Definition at line 139 of file nsNntpIncomingServer.h.

nsCStringArray nsNntpIncomingServer::mGroupsOnServer [private]

Definition at line 118 of file nsNntpIncomingServer.h.

Definition at line 133 of file nsNntpIncomingServer.h.

Definition at line 142 of file nsNntpIncomingServer.h.

Definition at line 141 of file nsNntpIncomingServer.h.

Definition at line 112 of file nsNntpIncomingServer.h.

Definition at line 140 of file nsNntpIncomingServer.h.

Definition at line 160 of file nsNntpIncomingServer.h.

Definition at line 155 of file nsNntpIncomingServer.h.

Definition at line 144 of file nsNntpIncomingServer.h.

Definition at line 147 of file nsNntpIncomingServer.h.

Definition at line 153 of file nsNntpIncomingServer.h.

Definition at line 161 of file nsNntpIncomingServer.h.

Definition at line 138 of file nsNntpIncomingServer.h.

Definition at line 152 of file nsNntpIncomingServer.h.

Definition at line 127 of file nsNntpIncomingServer.h.

Definition at line 149 of file nsNntpIncomingServer.h.

Definition at line 120 of file nsNntpIncomingServer.h.

Definition at line 129 of file nsNntpIncomingServer.h.

Definition at line 126 of file nsNntpIncomingServer.h.

Definition at line 117 of file nsNntpIncomingServer.h.

Definition at line 119 of file nsNntpIncomingServer.h.

nsCStringArray nsNntpIncomingServer::mTempSubscribed [private]

Definition at line 125 of file nsNntpIncomingServer.h.

Definition at line 130 of file nsNntpIncomingServer.h.

Definition at line 131 of file nsNntpIncomingServer.h.

Definition at line 146 of file nsNntpIncomingServer.h.

Definition at line 148 of file nsNntpIncomingServer.h.

Definition at line 49 of file nsINntpIncomingServer.idl.

Definition at line 80 of file nsINntpIncomingServer.idl.

Definition at line 52 of file nsINntpIncomingServer.idl.

Definition at line 55 of file nsINntpIncomingServer.idl.

Definition at line 84 of file nsINntpIncomingServer.idl.

Definition at line 108 of file nsINntpIncomingServer.idl.

const short nsITreeView::PROGRESS_NONE = 3 [inherited]

Definition at line 153 of file nsITreeView.idl.

const short nsITreeView::PROGRESS_NORMAL = 1 [inherited]

The progress mode for a given cell.

This method is only called for columns of type |progressmeter|.

Definition at line 151 of file nsITreeView.idl.

Definition at line 152 of file nsITreeView.idl.

Definition at line 109 of file nsINntpIncomingServer.idl.

readonly attribute long nsITreeView::rowCount [inherited]

The total number of rows in the tree (including the offscreen rows).

Definition at line 53 of file nsITreeView.idl.

The selection for this view.

Definition at line 58 of file nsITreeView.idl.

Definition at line 67 of file nsINntpIncomingServer.idl.

Definition at line 60 of file nsISubscribableServer.idl.

Definition at line 104 of file nsINntpIncomingServer.idl.

Definition at line 100 of file nsISubscribableServer.idl.

Definition at line 133 of file nsINntpIncomingServer.idl.


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