Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsNntpIncomingServer.cpp File Reference
#include "nsNntpIncomingServer.h"
#include "nsXPIDLString.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIMsgNewsFolder.h"
#include "nsIMsgFolder.h"
#include "nsIFileSpec.h"
#include "nsCOMPtr.h"
#include "nsINntpService.h"
#include "nsINNTPProtocol.h"
#include "nsMsgNewsCID.h"
#include "nsNNTPProtocol.h"
#include "nsIDirectoryService.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsInt64.h"
#include "nsMsgUtils.h"
#include "nsIPrompt.h"
#include "nsIStringBundle.h"
#include "nntpCore.h"
#include "nsIWindowWatcher.h"
#include "nsITreeColumns.h"
#include "nsIDOMElement.h"
#include "nsMsgFolderFlags.h"
#include "nsMsgI18N.h"
#include "nsUnicharUtils.h"
#include "nsEscape.h"
#include "nsISupportsObsolete.h"

Go to the source code of this file.

Defines

#define INVALID_VERSION   0
#define VALID_VERSION   1
#define NEW_NEWS_DIR_NAME   "News"
#define PREF_MAIL_NEWSRC_ROOT   "mail.newsrc_root"
#define PREF_MAIL_NEWSRC_ROOT_REL   "mail.newsrc_root-rel"
#define PREF_MAILNEWS_VIEW_DEFAULT_CHARSET   "mailnews.view_default_charset"
#define HOSTINFO_FILE_NAME   "hostinfo.dat"
#define NEWS_DELIMITER   '.'
#define NEWSRC_FILE_PREFIX   ""
#define NEWSRC_FILE_SUFFIX   ".rc"
#define HOSTINFO_FILE_BUFFER_SIZE   1024
#define kMaxConnectionsPerHost   2

Functions

static NS_DEFINE_CID (kSubscribableServerCID, NS_SUBSCRIBABLESERVER_CID)
 NS_IMPL_SERVERPREF_INT (nsNntpIncomingServer, MaximumConnectionsNumber,"max_cached_connections") PRBool nsNntpIncomingServer
PRBool checkIfSubscribedFunction (nsCString &aElement, void *aData)
PRBool writeGroupToHostInfoFile (nsCString &aElement, void *aData)
PRBool setAsSubscribedFunction (nsCString &aElement, void *aData)
PRBool buildSubscribeSearchResult (nsCString &aElement, void *aData)

Define Documentation

Definition at line 92 of file nsNntpIncomingServer.cpp.

#define HOSTINFO_FILE_NAME   "hostinfo.dat"

Definition at line 75 of file nsNntpIncomingServer.cpp.

Definition at line 69 of file nsNntpIncomingServer.cpp.

Definition at line 556 of file nsNntpIncomingServer.cpp.

#define NEW_NEWS_DIR_NAME   "News"

Definition at line 71 of file nsNntpIncomingServer.cpp.

Definition at line 77 of file nsNntpIncomingServer.cpp.

Definition at line 85 of file nsNntpIncomingServer.cpp.

Definition at line 86 of file nsNntpIncomingServer.cpp.

#define PREF_MAIL_NEWSRC_ROOT   "mail.newsrc_root"

Definition at line 72 of file nsNntpIncomingServer.cpp.

#define PREF_MAIL_NEWSRC_ROOT_REL   "mail.newsrc_root-rel"

Definition at line 73 of file nsNntpIncomingServer.cpp.

#define PREF_MAILNEWS_VIEW_DEFAULT_CHARSET   "mailnews.view_default_charset"

Definition at line 74 of file nsNntpIncomingServer.cpp.

Definition at line 70 of file nsNntpIncomingServer.cpp.


Function Documentation

PRBool buildSubscribeSearchResult ( nsCString aElement,
void aData 
)

Definition at line 1741 of file nsNntpIncomingServer.cpp.

{
    nsresult rv = NS_OK;
    nsNntpIncomingServer *server;
    server = (nsNntpIncomingServer *)aData;
    NS_ASSERTION(server, "no server");
    if (!server) {
        return PR_FALSE;
    }
 
    rv = server->AppendIfSearchMatch(aElement);
    NS_ASSERTION(NS_SUCCEEDED(rv),"AddSubscribeSearchResult failed");
    return PR_TRUE;
}

Here is the call graph for this function:

PRBool checkIfSubscribedFunction ( nsCString aElement,
void aData 
)

Definition at line 790 of file nsNntpIncomingServer.cpp.

{
    if (aElement.Equals(*NS_STATIC_CAST(nsACString *, aData))) {
        return PR_FALSE;
    }
    else {
        return PR_TRUE;
    }
}
static NS_DEFINE_CID ( kSubscribableServerCID  ,
NS_SUBSCRIBABLESERVER_CID   
) [static]
NS_IMPL_SERVERPREF_INT ( nsNntpIncomingServer  ,
MaximumConnectionsNumber  ,
"max_cached_connections"   
)

Definition at line 503 of file nsNntpIncomingServer.cpp.

{
    PRBool retVal = PR_FALSE;
    if (!aConnection) return retVal;
    nsresult rv;

    PRTime cacheTimeoutLimits;

    LL_I2L(cacheTimeoutLimits, 170 * 1000000); // 170 seconds in microseconds
    PRTime lastActiveTimeStamp;
    rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp);

    PRTime elapsedTime;
    LL_SUB(elapsedTime, PR_Now(), lastActiveTimeStamp);
    PRTime t;
    LL_SUB(t, elapsedTime, cacheTimeoutLimits);
    if (LL_GE_ZERO(t))
    {
#ifdef DEBUG_seth
      printf("XXX connection timed out, close it, and remove it from the connection cache\n");
#endif
      aConnection->CloseConnection();
            m_connectionCache->RemoveElement(aConnection);
            retVal = PR_TRUE;
    }
    return retVal;
}

Here is the call graph for this function:

PRBool setAsSubscribedFunction ( nsCString aElement,
void aData 
)

Definition at line 1154 of file nsNntpIncomingServer.cpp.

{
    nsresult rv = NS_OK;
    nsNntpIncomingServer *server;
    server = (nsNntpIncomingServer *)aData;
    NS_ASSERTION(server, "no server");
    if (!server) {
        return PR_FALSE;
    }
 
    rv = server->SetAsSubscribed(aElement);
    NS_ASSERTION(NS_SUCCEEDED(rv),"SetAsSubscribed failed");
    return PR_TRUE;
}
PRBool writeGroupToHostInfoFile ( nsCString aElement,
void aData 
)

Definition at line 834 of file nsNntpIncomingServer.cpp.

{
    nsIOFileStream *stream;
    stream = (nsIOFileStream *)aData;
    NS_ASSERTION(stream, "no stream");
    if (!stream) {
        // stop, something is bad.
        return PR_FALSE;
    }

    // XXX todo ",,1,0,0" is a temporary hack, fix it
    *stream << aElement.get() << ",,1,0,0" << MSG_LINEBREAK;
    return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function: