Back to index

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

#include <nsImapFlagAndUidState.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS nsImapFlagAndUidState (int numberOfMessages, PRUint16 flags=0)
 nsImapFlagAndUidState (const nsImapFlagAndUidState &state, PRUint16 flags=0)
virtual ~nsImapFlagAndUidState ()
NS_DECL_NSIIMAPFLAGANDUIDSTATE
PRInt32 
GetNumberOfDeletedMessages ()
imapMessageFlagsType GetMessageFlagsFromUID (PRUint32 uid, PRBool *foundIt, PRInt32 *ndx)
PRBool IsLastMessageUnseen (void)
PRUint32 GetHighestNonDeletedUID ()
PRUint16 GetSupportedUserFlags ()
void getUidOfMessage (in long zeroBasedIndex, out unsigned long result)
void getMessageFlags (in long zeroBasedIndex, out unsigned short result)
void setMessageFlags (in long zeroBasedIndex, in unsigned short flags)
void expungeByIndex (in unsigned long zeroBasedIndex)
void addUidFlagPair (in unsigned long uid, in unsigned short flags, in unsigned long zeroBasedIndex)
void addUidCustomFlagPair (in unsigned long uid, in string customFlag)
string getCustomFlags (in unsigned long uid)
void reset (in unsigned long howManyLeft)
void setSupportedUserFlags (in unsigned short flags)
void clearCustomFlags (in unsigned long uid)

Public Attributes

readonly attribute long numberOfMessages
readonly attribute long numberOfRecentMessages

Static Private Member Functions

static PRBool PR_CALLBACK FreeCustomFlags (nsHashKey *aKey, void *aData, void *closure)

Private Attributes

PRInt32 fNumberOfMessagesAdded
PRInt32 fNumberOfMessageSlotsAllocated
PRInt32 fNumberDeleted
nsMsgKeyArray fUids
imapMessageFlagsTypefFlags
nsHashtable * m_customFlagsHash
PRUint16 fSupportedUserFlags

Detailed Description

Definition at line 48 of file nsImapFlagAndUidState.h.


Constructor & Destructor Documentation

nsImapFlagAndUidState::nsImapFlagAndUidState ( int  numberOfMessages,
PRUint16  flags = 0 
)

Definition at line 130 of file nsImapFlagAndUidState.cpp.

Here is the call graph for this function:

Definition at line 152 of file nsImapFlagAndUidState.cpp.

Here is the call graph for this function:


Member Function Documentation

void nsIImapFlagAndUidState::addUidCustomFlagPair ( in unsigned long  uid,
in string  customFlag 
) [inherited]
void nsIImapFlagAndUidState::addUidFlagPair ( in unsigned long  uid,
in unsigned short  flags,
in unsigned long  zeroBasedIndex 
) [inherited]
void nsIImapFlagAndUidState::clearCustomFlags ( in unsigned long  uid) [inherited]
void nsIImapFlagAndUidState::expungeByIndex ( in unsigned long  zeroBasedIndex) [inherited]
PRBool PR_CALLBACK nsImapFlagAndUidState::FreeCustomFlags ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 145 of file nsImapFlagAndUidState.cpp.

{
  PR_Free(aData);
  return PR_TRUE;
}

Here is the caller graph for this function:

string nsIImapFlagAndUidState::getCustomFlags ( in unsigned long  uid) [inherited]

Definition at line 251 of file nsImapFlagAndUidState.cpp.

{
  PRUint32 msgIndex = fNumberOfMessagesAdded;
  do 
  {
    if (msgIndex <= 0)
      return(0);
    msgIndex--;
    if (fUids[msgIndex] && !(fFlags[msgIndex] & kImapMsgDeletedFlag))
      return fUids[msgIndex];
  }
  while (msgIndex > 0);
  return 0;
}

Here is the caller graph for this function:

void nsIImapFlagAndUidState::getMessageFlags ( in long  zeroBasedIndex,
out unsigned short  result 
) [inherited]

Definition at line 289 of file nsImapFlagAndUidState.cpp.

{
  PR_CEnterMonitor(this);
  
  PRInt32 msgIndex = 0;
  PRInt32 hi = fNumberOfMessagesAdded - 1;
  PRInt32 lo = 0;
  
  *foundIt = PR_FALSE;
  *ndx = -1;
  while (lo <= hi)
  {
    msgIndex = (lo + hi) / 2;
    if (fUids[msgIndex] == (PRUint32) uid)
    {
      PRInt32 returnFlags = fFlags[msgIndex];
      
      *foundIt = PR_TRUE;
      *ndx = msgIndex;
      PR_CExitMonitor(this);
      return returnFlags;
    }
    if (fUids[msgIndex] > (PRUint32) uid)
      hi = msgIndex -1;
    else if (fUids[msgIndex] < (PRUint32) uid)
      lo = msgIndex + 1;
  }
  msgIndex = lo;
  // leave msgIndex pointing to the first slot with a value > uid
  // first, move it before any ids that are > (shouldn't happen).
  while ((msgIndex > 0) && (fUids[msgIndex - 1] > (PRUint32) uid))
    msgIndex--;
  
  // next, move msgIndex up to the first slot > than uid.
  while ((PRUint32) uid < fUids[msgIndex])
    msgIndex++;
  
  if (msgIndex < 0)
    msgIndex = 0;
  *ndx = msgIndex;
  PR_CExitMonitor(this);
  return 0;
}

Here is the caller graph for this function:

Definition at line 244 of file nsImapFlagAndUidState.cpp.

{
  return fNumberDeleted;
}

Here is the caller graph for this function:

Definition at line 65 of file nsImapFlagAndUidState.h.

{ return fSupportedUserFlags; };
void nsIImapFlagAndUidState::getUidOfMessage ( in long  zeroBasedIndex,
out unsigned long  result 
) [inherited]

Definition at line 270 of file nsImapFlagAndUidState.cpp.

{
  PRUint32 msgIndex = fNumberOfMessagesAdded;
  
  if (msgIndex <= 0)
    return PR_FALSE;
  msgIndex--;
  // if last message is deleted, it was probably filtered the last time around
  if (fUids[msgIndex] && (fFlags[msgIndex] & (kImapMsgSeenFlag | kImapMsgDeletedFlag)))
    return PR_FALSE;
  return PR_TRUE; 
}

Here is the caller graph for this function:

void nsIImapFlagAndUidState::reset ( in unsigned long  howManyLeft) [inherited]
void nsIImapFlagAndUidState::setMessageFlags ( in long  zeroBasedIndex,
in unsigned short  flags 
) [inherited]
void nsIImapFlagAndUidState::setSupportedUserFlags ( in unsigned short  flags) [inherited]

Member Data Documentation

Definition at line 74 of file nsImapFlagAndUidState.h.

Definition at line 72 of file nsImapFlagAndUidState.h.

Definition at line 70 of file nsImapFlagAndUidState.h.

Definition at line 71 of file nsImapFlagAndUidState.h.

Definition at line 76 of file nsImapFlagAndUidState.h.

nsMsgKeyArray nsImapFlagAndUidState::fUids [private]

Definition at line 73 of file nsImapFlagAndUidState.h.

Definition at line 75 of file nsImapFlagAndUidState.h.

Definition at line 43 of file nsIImapFlagAndUidState.idl.

Definition at line 44 of file nsIImapFlagAndUidState.idl.


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