Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
nsNNTPProtocol.cpp File Reference
#include "msgCore.h"
#include "MailNewsTypes.h"
#include "nntpCore.h"
#include "nsNetUtil.h"
#include "nsIMsgHdr.h"
#include "nsNNTPProtocol.h"
#include "nsINNTPArticleList.h"
#include "nsIOutputStream.h"
#include "nsFileStream.h"
#include "nsIMemory.h"
#include "nsIPipe.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsMsgI18N.h"
#include "nsMsgBaseCID.h"
#include "nsMsgNewsCID.h"
#include "nsINntpUrl.h"
#include "nsCRT.h"
#include "prtime.h"
#include "prlog.h"
#include "prerror.h"
#include "nsEscape.h"
#include "nsString.h"
#include "prprf.h"
#include "nsIMsgHeaderParser.h"
#include "nsIMsgSearchSession.h"
#include "nsIMsgSearchAdapter.h"
#include "nsIMsgStatusFeedback.h"
#include "nsMsgKeySet.h"
#include "nsNewsUtils.h"
#include "nsMsgUtils.h"
#include "nsIMsgMailSession.h"
#include "nsIMsgIdentity.h"
#include "nsIMsgAccountManager.h"
#include "nsIPrompt.h"
#include "nsIMsgFolder.h"
#include "nsIMsgNewsFolder.h"
#include "nsIDocShell.h"
#include "nsICacheEntryDescriptor.h"
#include "nsICacheSession.h"
#include "nsIStreamListener.h"
#include "nsNetCID.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIMsgWindow.h"
#include "nsIWindowWatcher.h"
#include "nsINntpService.h"
#include "nsIStreamConverterService.h"
#include "nsIStreamListenerTee.h"
#include "nsISocketTransport.h"
#include <time.h>

Go to the source code of this file.

Classes

struct  _cancelInfoEntry
class  nsNntpCacheStreamListener

Defines

#define PREF_NEWS_CANCEL_CONFIRM   "news.cancel.confirm"
#define PREF_NEWS_CANCEL_ALERT_ON_SUCCESS   "news.cancel.alert_on_success"
#define READ_NEWS_LIST_COUNT_MAX   500 /* number of groups to process at a time when reading the list from the server */
#define READ_NEWS_LIST_TIMEOUT   50 /* uSec to wait until doing more */
#define RATE_STR_BUF_LEN   32
#define UPDATE_THRESHHOLD   25600 /* only update every 25 KB */
#define out   PR_LOG_ALWAYS
#define NNTP_LOG_READ(buf)
#define NNTP_LOG_WRITE(buf)
#define NNTP_LOG_NOTE(buf)
#define LIST_WANTED   0
#define ARTICLE_WANTED   1
#define CANCEL_WANTED   2
#define GROUP_WANTED   3
#define NEWS_POST   4
#define READ_NEWS_RC   5
#define NEW_GROUPS   6
#define SEARCH_WANTED   7
#define PRETTY_NAMES_WANTED   8
#define PROFILE_WANTED   9
#define IDS_WANTED   10
#define OUTPUT_BUFFER_SIZE   (4096*2)
#define NEWGROUPS_TIME_OFFSET   60L*60L*12L /* 12 hours */
#define NET_IS_SPACE(x)   ((x)==' ' || (x)=='\t')
#define RATE_CONSTANT   976.5625 /* PR_USEC_PER_SEC / 1024 bytes */
#define NEWS_GROUP_DISPLAY_FREQ   1

Typedefs

typedef struct _cancelInfoEntry cancelInfoEntry

Functions

static NS_DEFINE_CID (kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID)
char * MSG_UnEscapeSearchUrl (const char *commandSpecificData)
static void ComputeRate (PRInt32 bytes, PRTime startTime, float *rate)

Variables

PRLogModuleInfoNNTP = NULL
const char *const stateLabels []
static const char * XP_AppCodeName = "Mozilla"

Class Documentation

struct _cancelInfoEntry

Definition at line 142 of file nsNNTPProtocol.cpp.

Class Members
char * from
char * old_from

Define Documentation

Definition at line 255 of file nsNNTPProtocol.cpp.

Definition at line 256 of file nsNNTPProtocol.cpp.

Definition at line 257 of file nsNNTPProtocol.cpp.

#define IDS_WANTED   10

Definition at line 264 of file nsNNTPProtocol.cpp.

Definition at line 254 of file nsNNTPProtocol.cpp.

#define NET_IS_SPACE (   x)    ((x)==' ' || (x)=='\t')

Definition at line 290 of file nsNNTPProtocol.cpp.

#define NEW_GROUPS   6

Definition at line 260 of file nsNNTPProtocol.cpp.

#define NEWGROUPS_TIME_OFFSET   60L*60L*12L /* 12 hours */

Definition at line 280 of file nsNNTPProtocol.cpp.

Definition at line 3791 of file nsNNTPProtocol.cpp.

#define NEWS_POST   4

Definition at line 258 of file nsNNTPProtocol.cpp.

Value:
if (NNTP==NULL) \
    NNTP = PR_NewLogModule("NNTP"); \
PR_LOG(NNTP, out, ("(%p) %s",this, buf)) ;

Definition at line 165 of file nsNNTPProtocol.cpp.

Value:
if (NNTP==NULL) \
    NNTP = PR_NewLogModule("NNTP"); \
PR_LOG(NNTP, out, ("(%p) Receiving: %s", this, buf)) ;

Definition at line 155 of file nsNNTPProtocol.cpp.

Value:
if (NNTP==NULL) \
    NNTP = PR_NewLogModule("NNTP"); \
PR_LOG(NNTP, out, ("(%p) Sending: %s", this, buf)) ;

Definition at line 160 of file nsNNTPProtocol.cpp.

Definition at line 153 of file nsNNTPProtocol.cpp.

#define OUTPUT_BUFFER_SIZE   (4096*2)

Definition at line 275 of file nsNNTPProtocol.cpp.

#define PREF_NEWS_CANCEL_ALERT_ON_SUCCESS   "news.cancel.alert_on_success"

Definition at line 127 of file nsNNTPProtocol.cpp.

#define PREF_NEWS_CANCEL_CONFIRM   "news.cancel.confirm"

Definition at line 126 of file nsNNTPProtocol.cpp.

Definition at line 262 of file nsNNTPProtocol.cpp.

Definition at line 263 of file nsNNTPProtocol.cpp.

#define RATE_CONSTANT   976.5625 /* PR_USEC_PER_SEC / 1024 bytes */

Definition at line 3026 of file nsNNTPProtocol.cpp.

Definition at line 130 of file nsNNTPProtocol.cpp.

#define READ_NEWS_LIST_COUNT_MAX   500 /* number of groups to process at a time when reading the list from the server */

Definition at line 128 of file nsNNTPProtocol.cpp.

#define READ_NEWS_LIST_TIMEOUT   50 /* uSec to wait until doing more */

Definition at line 129 of file nsNNTPProtocol.cpp.

Definition at line 259 of file nsNNTPProtocol.cpp.

Definition at line 261 of file nsNNTPProtocol.cpp.

#define UPDATE_THRESHHOLD   25600 /* only update every 25 KB */

Definition at line 131 of file nsNNTPProtocol.cpp.


Typedef Documentation


Function Documentation

static void ComputeRate ( PRInt32  bytes,
PRTime  startTime,
float *  rate 
) [static]

Definition at line 3028 of file nsNNTPProtocol.cpp.

{
  // rate = (bytes / USECS since start) * RATE_CONSTANT

  // compute usecs since we started.
  PRTime timeSinceStart;
  PRTime now = PR_Now();
  LL_SUB(timeSinceStart, now, startTime);

  // convert PRTime to PRInt32
  PRInt32 delta;
  LL_L2I(delta, timeSinceStart);

  // compute rate
  if (delta > 0) {
    *rate = (float) ((bytes * RATE_CONSTANT) / delta);
  }
  else {
    *rate = 0.0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

char * MSG_UnEscapeSearchUrl ( const char *  commandSpecificData)

Definition at line 293 of file nsNNTPProtocol.cpp.

{
  nsCAutoString result(commandSpecificData);
  PRInt32 slashpos = 0;
  while (slashpos = result.FindChar('\\', slashpos),
         slashpos != kNotFound)
  {
    nsCAutoString hex;
    hex.Assign(Substring(result, slashpos + 1, 2));
    PRInt32 err, ch;
    ch = hex.ToInteger(&err, 16);
    result.Replace(slashpos, 3, err == NS_OK && ch != 0 ? (char) ch : 'X');
    slashpos++;
  }
  return ToNewCString(result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kStreamListenerTeeCID  ,
NS_STREAMLISTENERTEE_CID   
) [static]

Variable Documentation

Definition at line 152 of file nsNNTPProtocol.cpp.

Definition at line 170 of file nsNNTPProtocol.cpp.

const char* XP_AppCodeName = "Mozilla" [static]

Definition at line 288 of file nsNNTPProtocol.cpp.