Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsAbLDAPProcessChangeLogData Class Reference

#include <nsAbLDAPChangeLogData.h>

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

List of all members.

Public Member Functions

 nsAbLDAPProcessChangeLogData ()
 ~nsAbLDAPProcessChangeLogData ()
NS_IMETHOD Init (nsIAbLDAPReplicationQuery *query, nsIWebProgressListener *progressListener)
void init (in nsIAbLDAPReplicationQuery query, in nsIWebProgressListener progressListener)
 this method initializes the implementation
void abort ()
 this method a aborts the ongoing processing
void populateAuthData ()
 this utility method populates authentication data from Dir Server
void onLDAPMessage (in nsILDAPMessage aMessage)
 Messages received are passed back via this function.
void onLDAPInit (in nsILDAPConnection aConn, in nsresult aStatus)
 Notify the listener that the Init has completed, passing in the results from the connection initialization.

Public Attributes

readonly attribute PRInt32 replicationState
 readonly attribute giving the current replication state
const long kIdle = 0
 replication states
const long kAnonymousBinding = 1
const long kAuthenticatedBinding = 2
const long kSyncServerBinding = 3
const long kSearchingAuthDN = 4
const long kDecidingProtocol = 5
const long kAuthenticating = 6
const long kReplicatingAll = 7
const long kSearchingRootDSE = 8
const long kFindingChanges = 9
const long kReplicatingChanges = 10
const long kReplicationDone = 11
readonly attribute PRInt32 protocolUsed
 readonly attribute giving the current protocol used
const long kDefaultDownloadAll = 0
 replication protocols
const long kChangeLogProtocol = 1
const long kLCUPProtocol = 2
const long kLastUpdatedTimeStampMethod = 3

Protected Member Functions

nsresult OnLDAPBind (nsILDAPMessage *aMessage)
nsresult OnLDAPSearchEntry (nsILDAPMessage *aMessage)
nsresult OnLDAPSearchResult (nsILDAPMessage *aMessage)
nsresult ParseChangeLogEntries (nsILDAPMessage *aMessage)
nsresult ParseRootDSEEntry (nsILDAPMessage *aMessage)
nsresult GetAuthData ()
nsresult OnSearchAuthDNDone ()
nsresult OnSearchRootDSEDone ()
nsresult OnFindingChangesDone ()
nsresult OnReplicatingChangeDone ()
nsresult OpenABForReplicatedDir (PRBool bCreate)
nsresult DeleteCard (nsString &aDn)
void Done (PRBool aSuccess)

Protected Attributes

nsCOMPtr< nsIAbLDAPChangeLogQuerymChangeLogQuery
nsCString mAuthUserID
RootDSEChangeLogEntry mRootDSEEntry
PRBool mUseChangeLog
PRInt32 mChangeLogEntriesCount
PRInt32 mEntriesAddedQueryCount
nsStringArray mEntriesToAdd
nsCOMPtr
< nsIAbLDAPReplicationQuery
mQuery
nsCOMPtr< nsIWebProgressListenermListener
nsCOMPtr< nsIAddrDatabasemReplicationDB
nsCOMPtr< nsILocalFilemReplicationFile
nsCOMPtr< nsILocalFilemBackupReplicationFile
PRInt32 mState
PRInt32 mProtocol
PRInt32 mCount
PRBool mDBOpen
PRBool mInitialized
DIR_ServermDirServerInfo
nsCString mAuthDN
nsCString mAuthPswd
nsCOMPtr< nsIAbLDAPAttributeMapmAttrMap

Detailed Description

Definition at line 53 of file nsAbLDAPChangeLogData.h.


Constructor & Destructor Documentation

Definition at line 74 of file nsAbLDAPChangeLogData.cpp.

{

}

Member Function Documentation

this method a aborts the ongoing processing

Definition at line 611 of file nsAbLDAPReplicationData.cpp.

{
    nsCOMPtr<nsIAbCard> cardToDelete;
    mReplicationDB->GetCardFromAttribute(nsnull, "_DN", NS_ConvertUCS2toUTF8(aDn).get(),
                                         PR_FALSE, getter_AddRefs(cardToDelete));
    return mReplicationDB->DeleteCard(cardToDelete, PR_FALSE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAbLDAPProcessReplicationData::Done ( PRBool  aSuccess) [protected, inherited]

Definition at line 594 of file nsAbLDAPReplicationData.cpp.

{
   if(!mInitialized) 
       return;

   mState = kReplicationDone;

   mQuery->Done(aSuccess);

   if(mListener)
       mListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, aSuccess);

   // since this is called when all is done here, either on success, failure or abort
   // releas the query now.
   mQuery = nsnull;
}

Here is the caller graph for this function:

Definition at line 255 of file nsAbLDAPChangeLogData.cpp.

{
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
    if (!wwatch)
        return NS_ERROR_FAILURE;
    
    nsCOMPtr<nsIAuthPrompt> dialog;
    nsresult rv = wwatch->GetNewAuthPrompter(0, getter_AddRefs(dialog));
    if (NS_FAILED(rv))
        return rv;
    if (!dialog) 
        return NS_ERROR_FAILURE;

    nsCOMPtr<nsILDAPURL> url;
    rv = mQuery->GetReplicationURL(getter_AddRefs(url));
    if (NS_FAILED(rv))
        return rv;

    nsCAutoString serverUri;
    rv = url->GetSpec(serverUri);
    if (NS_FAILED(rv)) 
        return rv;

    nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
    if (NS_FAILED (rv)) 
        return rv ;
    nsCOMPtr<nsIStringBundle> bundle;
    rv = bundleService->CreateBundle("chrome://messenger/locale/addressbook/addressBook.properties", getter_AddRefs(bundle));
    if (NS_FAILED (rv)) 
        return rv ;

    nsXPIDLString title;
    rv = bundle->GetStringFromName(NS_LITERAL_STRING("AuthDlgTitle").get(), getter_Copies(title));
    if (NS_FAILED (rv)) 
        return rv ;

    nsXPIDLString desc;
    rv = bundle->GetStringFromName(NS_LITERAL_STRING("AuthDlgDesc").get(), getter_Copies(desc));
    if (NS_FAILED (rv)) 
        return rv ;

    nsXPIDLString username;
    nsXPIDLString password;
    PRBool btnResult = PR_FALSE;
       rv = dialog->PromptUsernameAndPassword(title, desc, 
                                            NS_ConvertUTF8toUCS2(serverUri).get(), 
                                            nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
                                            getter_Copies(username), getter_Copies(password), 
                                            &btnResult);
    if(NS_SUCCEEDED(rv) && btnResult) {
        CopyUTF16toUTF8(username, mAuthUserID);
        CopyUTF16toUTF8(password, mAuthPswd);
        mDirServerInfo->enableAuth=PR_TRUE;
        mDirServerInfo->savePassword=PR_TRUE;
    }
    else
        rv = NS_ERROR_FAILURE;

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 79 of file nsAbLDAPChangeLogData.cpp.

{
   NS_ENSURE_ARG_POINTER(query);

   // here we are assuming that the caller will pass a nsAbLDAPChangeLogQuery object,
   // an implementation derived from the implementation of nsIAbLDAPReplicationQuery.
   nsresult rv = NS_OK;
   mChangeLogQuery = do_QueryInterface(query, &rv);
   if(NS_FAILED(rv))
       return rv;
   
   // call the parent's Init now
   return nsAbLDAPProcessReplicationData::Init(query, progressListener);
}

Here is the call graph for this function:

this method initializes the implementation

Definition at line 492 of file nsAbLDAPChangeLogData.cpp.

{
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

#ifdef DEBUG_rdayal
    printf ("ChangeLog Replication : Finding Changes Done \n");
#endif

    nsresult rv = NS_OK;

    // no entries to add/update (for updates too we delete and add) entries,
    // we took care of deletes in ParseChangeLogEntries, all Done!
    mEntriesAddedQueryCount = mEntriesToAdd.Count();
    if(mEntriesAddedQueryCount <= 0) {
        if(mReplicationDB && mDBOpen) {
            // close the DB, no need to commit since we have not made
            // any changes yet to the DB.
            rv = mReplicationDB->Close(PR_FALSE);
            NS_ASSERTION(NS_SUCCEEDED(rv), "Replication DB Close(no commit) on Success failed");
            mDBOpen = PR_FALSE;
            // once are done with the replication file, delete the backup file
            if(mBackupReplicationFile) {
                rv = mBackupReplicationFile->Remove(PR_FALSE);
                NS_ASSERTION(NS_SUCCEEDED(rv), "Replication BackupFile Remove on Success failed");
            }
        }
        Done(PR_TRUE);
        return NS_OK;
    }

    // decrement the count first to get the correct array element
    mEntriesAddedQueryCount--;
    rv = mChangeLogQuery->QueryChangedEntries(NS_ConvertUCS2toUTF8(*(mEntriesToAdd[mEntriesAddedQueryCount])));
    if (NS_FAILED(rv))
        return rv;

    if(mListener && NS_SUCCEEDED(rv))
        mListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_START, PR_TRUE);

    mState = kReplicatingChanges;
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from nsAbLDAPProcessReplicationData.

Definition at line 94 of file nsAbLDAPChangeLogData.cpp.

{
    NS_ENSURE_ARG_POINTER(aMessage);
       if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    PRInt32 errCode;

    nsresult rv = aMessage->GetErrorCode(&errCode);
    if(NS_FAILED(rv)) {
        Done(PR_FALSE);
        return rv;
    }

    if(errCode != nsILDAPErrors::SUCCESS) {
        Done(PR_FALSE);
        return NS_ERROR_FAILURE;
    }

    switch(mState) {
    case kAnonymousBinding :
        rv = GetAuthData();
        if(NS_SUCCEEDED(rv)) 
            rv = mChangeLogQuery->QueryAuthDN(mAuthUserID);
        if(NS_SUCCEEDED(rv)) 
            mState = kSearchingAuthDN;
        break;
    case kAuthenticatedBinding :
        rv = mChangeLogQuery->QueryRootDSE();
        if(NS_SUCCEEDED(rv)) 
            mState = kSearchingRootDSE;
        break;
    } //end of switch

    if(NS_FAILED(rv))
        Abort();

    return rv;
}

Here is the call graph for this function:

Notify the listener that the Init has completed, passing in the results from the connection initialization.

The Reason for this is to allow us to do asynchronous DNS lookups, preresolving hostnames.

  • aConn The LDAP connection in question
  • aStatus The result from the LDAP connection init

Messages received are passed back via this function.

  • aMessage The message that was returned, NULL if none was.

XXX semantics of NULL?

Reimplemented from nsAbLDAPProcessReplicationData.

Definition at line 134 of file nsAbLDAPChangeLogData.cpp.

{
    NS_ENSURE_ARG_POINTER(aMessage);
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    nsresult rv = NS_OK;       

    switch(mState)
    {
    case kSearchingAuthDN :
        {
            nsCAutoString authDN;
            rv = aMessage->GetDn(authDN);
            if(NS_SUCCEEDED(rv) && !authDN.IsEmpty())
                mAuthDN = authDN.get();
        }
        break;
    case kSearchingRootDSE:
        rv = ParseRootDSEEntry(aMessage);
        break;
    case kFindingChanges:
        rv = ParseChangeLogEntries(aMessage);
        break;
    // fall through since we only add (for updates we delete and add)
    case kReplicatingChanges:
    case kReplicatingAll :
        return nsAbLDAPProcessReplicationData::OnLDAPSearchEntry(aMessage);
    }

    if(NS_FAILED(rv))
        Abort();

    return rv;
}

Here is the call graph for this function:

Reimplemented from nsAbLDAPProcessReplicationData.

Definition at line 170 of file nsAbLDAPChangeLogData.cpp.

{
    NS_ENSURE_ARG_POINTER(aMessage);
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    PRInt32 errorCode;
    
    nsresult rv = aMessage->GetErrorCode(&errorCode);

    if(NS_SUCCEEDED(rv))
    {
        if(errorCode == nsILDAPErrors::SUCCESS || errorCode == nsILDAPErrors::SIZELIMIT_EXCEEDED) {
            switch(mState) {
            case kSearchingAuthDN :
                rv = OnSearchAuthDNDone();
                break;
            case kSearchingRootDSE:
             {
                // before starting the changeLog check the DB file, if its not there or bogus
                // we need to create a new one and set to all.
                nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
                if(NS_FAILED(rv)) 
                    break;
                nsCOMPtr<nsILocalFile> dbPath;
                rv = abSession->GetUserProfileDirectory(getter_AddRefs(dbPath));
                if(NS_FAILED(rv)) 
                    break;

                rv = dbPath->AppendNative(nsDependentCString(mDirServerInfo->replInfo->fileName));
                if(NS_FAILED(rv)) 
                    break;

                PRBool fileExists;
                rv = dbPath->Exists(&fileExists);
                if(NS_FAILED(rv)) 
                    break;

                PRInt64 fileSize;
                rv = dbPath->GetFileSize(&fileSize);
                if(NS_FAILED(rv)) 
                    break;

                if (!fileExists || !fileSize)
                    mUseChangeLog = PR_FALSE;

                // open / create the AB here since it calls Done,
                // just return from here. 
                if (mUseChangeLog)
                   rv = OpenABForReplicatedDir(PR_FALSE);
                else
                   rv = OpenABForReplicatedDir(PR_TRUE);
                if (NS_FAILED(rv))
                   return rv;
                
                // now start the appropriate query
                rv = OnSearchRootDSEDone();
                break;
             }
            case kFindingChanges:
                rv = OnFindingChangesDone();
                // if success we return from here since
                // this changes state to kReplicatingChanges
                // and it falls thru into the if clause below.
                if (NS_SUCCEEDED(rv))
                    return rv;
                break;
            case kReplicatingAll :
                return nsAbLDAPProcessReplicationData::OnLDAPSearchResult(aMessage);
            } // end of switch
        }
        else
            rv = NS_ERROR_FAILURE;
        // if one of the changed entry in changelog is not found, 
        // continue with replicating the next one.
        if(mState == kReplicatingChanges)
            rv = OnReplicatingChangeDone();
    } // end of outer if

    if(NS_FAILED(rv))
        Abort();

    return rv;
}

Here is the call graph for this function:

Definition at line 536 of file nsAbLDAPChangeLogData.cpp.

{
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    nsresult rv = NS_OK;

    if(!mEntriesAddedQueryCount)
    {
        if(mReplicationDB && mDBOpen) {
            rv = mReplicationDB->Close(PR_TRUE); // commit and close the DB
            NS_ASSERTION(NS_SUCCEEDED(rv), "Replication DB Close (commit) on Success failed");
            mDBOpen = PR_FALSE;
        }
        // once we done with the replication file, delete the backup file
        if(mBackupReplicationFile) {
            rv = mBackupReplicationFile->Remove(PR_FALSE);
            NS_ASSERTION(NS_SUCCEEDED(rv), "Replication BackupFile Remove on Success failed");
        }
        Done(PR_TRUE);  // all data is recieved
        return NS_OK;
    }

    // remove the entry already added from the list and query the next one
    if(mEntriesAddedQueryCount < mEntriesToAdd.Count() && mEntriesAddedQueryCount >= 0)
        mEntriesToAdd.RemoveStringAt(mEntriesAddedQueryCount);
    mEntriesAddedQueryCount--;
    rv = mChangeLogQuery->QueryChangedEntries(NS_ConvertUCS2toUTF8(*(mEntriesToAdd[mEntriesAddedQueryCount])));

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 319 of file nsAbLDAPChangeLogData.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 475 of file nsAbLDAPReplicationData.cpp.

{
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    nsresult rv = NS_OK;

    nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
    if(NS_FAILED(rv)) {
        Done(PR_FALSE);
        return rv;
    }

    if(!mDirServerInfo->replInfo->fileName) {
        Done(PR_FALSE);
        return NS_ERROR_FAILURE;
    }

    rv = abSession->GetUserProfileDirectory(getter_AddRefs(mReplicationFile));
    if(NS_FAILED(rv)) {
        Done(PR_FALSE);
        return rv;
    }

    rv = mReplicationFile->AppendNative(nsDependentCString(mDirServerInfo->replInfo->fileName));
    if(NS_FAILED(rv)) {
        Done(PR_FALSE);
        return rv;
    }

    // if the AB DB already exists backup existing one, 
    // in case if the user cancels or Abort put back the backed up file
    PRBool fileExists;
    rv = mReplicationFile->Exists(&fileExists);
    if(NS_SUCCEEDED(rv) && fileExists) {
        // create the backup file object same as the Replication file object.
        // we create a backup file here since we need to cleanup the existing file
        // for create and then commit so instead of deleting existing cards we just
        // clone the existing one for a much better performance - for Download All.
        // And also important in case if replication fails we donot lose user's existing 
        // replicated data for both Download all and Changelog.
        nsCOMPtr<nsIFile> clone;
        rv = mReplicationFile->Clone(getter_AddRefs(clone));
        if(NS_FAILED(rv))  {
            Done(PR_FALSE);
            return rv;
        }
        mBackupReplicationFile = do_QueryInterface(clone, &rv);
        if(NS_FAILED(rv))  {
            Done(PR_FALSE);
            return rv;
        }
        rv = mBackupReplicationFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0777);
        if(NS_FAILED(rv))  {
            Done(PR_FALSE);
            return rv;
        }
        nsAutoString backupFileLeafName;
        rv = mBackupReplicationFile->GetLeafName(backupFileLeafName);
        if(NS_FAILED(rv))  {
            Done(PR_FALSE);
            return rv;
        }
        // remove the newly created unique backup file so that move and copy succeeds.
        rv = mBackupReplicationFile->Remove(PR_FALSE);
        if(NS_FAILED(rv))  {
            Done(PR_FALSE);
            return rv;
        }

        if(aCreate) {
            // set backup file to existing replication file for move
            mBackupReplicationFile->SetNativeLeafName(nsDependentCString(mDirServerInfo->replInfo->fileName));
            rv = mBackupReplicationFile->MoveTo(nsnull, backupFileLeafName);
            // set the backup file leaf name now
            if (NS_SUCCEEDED(rv))
                mBackupReplicationFile->SetLeafName(backupFileLeafName);
        }
        else {
            // set backup file to existing replication file for copy
            mBackupReplicationFile->SetNativeLeafName(nsDependentCString(mDirServerInfo->replInfo->fileName));
            // specify the parent here specifically, 
            // passing nsnull to copy to the same dir actually renames existing file
            // instead of making another copy of the existing file.
            nsCOMPtr<nsIFile> parent;
            rv = mBackupReplicationFile->GetParent(getter_AddRefs(parent));
            if (NS_SUCCEEDED(rv))
                rv = mBackupReplicationFile->CopyTo(parent, backupFileLeafName);
            // set the backup file leaf name now
            if (NS_SUCCEEDED(rv))
                mBackupReplicationFile->SetLeafName(backupFileLeafName);
        }
        if(NS_FAILED(rv))  {
            Done(PR_FALSE);
            return rv;
        }
    }

    nsCOMPtr<nsIAddrDatabase> addrDBFactory = 
             do_GetService(NS_ADDRDATABASE_CONTRACTID, &rv);
    if(NS_FAILED(rv)) {
        if (mBackupReplicationFile)
            mBackupReplicationFile->Remove(PR_FALSE);
        Done(PR_FALSE);
        return rv;
    }
    
    rv = addrDBFactory->Open(mReplicationFile, aCreate, PR_TRUE, getter_AddRefs(mReplicationDB));
    if(NS_FAILED(rv)) {
        Done(PR_FALSE);
        if (mBackupReplicationFile)
            mBackupReplicationFile->Remove(PR_FALSE);
        return rv;
    }

    mDBOpen = PR_TRUE;  // replication DB is now Open
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 412 of file nsAbLDAPChangeLogData.cpp.

{
    NS_ENSURE_ARG_POINTER(aMessage);
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    // populate the RootDSEChangeLogEntry
    CharPtrArrayGuard attrs;
    nsresult rv = aMessage->GetAttributes(attrs.GetSizeAddr(), attrs.GetArrayAddr());
    // no attributes
    if(NS_FAILED(rv)) 
        return rv;

    nsAutoString targetDN;
    UpdateOp operation = NO_OP;
    for(PRInt32 i = attrs.GetSize()-1; i >= 0; i--) {
        PRUnicharPtrArrayGuard vals;
        rv = aMessage->GetValues(attrs.GetArray()[i], vals.GetSizeAddr(), vals.GetArrayAddr());
        if(NS_FAILED(rv))
            continue;
        if(vals.GetSize()) {
            if (!PL_strcasecmp(attrs[i], "targetdn"))
                targetDN = vals[0];
            if (!PL_strcasecmp(attrs[i], "changetype")) {
                if (!Compare(nsDependentString(vals[0]), NS_LITERAL_STRING("add"), nsCaseInsensitiveStringComparator()))
                    operation = ENTRY_ADD;
                if (!Compare(nsDependentString(vals[0]), NS_LITERAL_STRING("modify"), nsCaseInsensitiveStringComparator()))
                    operation = ENTRY_MODIFY;
                if (!Compare(nsDependentString(vals[0]), NS_LITERAL_STRING("delete"), nsCaseInsensitiveStringComparator()))
                    operation = ENTRY_DELETE;
            }
        }
    }

    mChangeLogEntriesCount++;
    if(!(mChangeLogEntriesCount % 10)) { // inform the listener every 10 entries
        mListener->OnProgressChange(nsnull,nsnull,mChangeLogEntriesCount, -1, mChangeLogEntriesCount, -1);
        // in case if the LDAP Connection thread is starved and causes problem
        // uncomment this one and try.
        // PR_Sleep(PR_INTERVAL_NO_WAIT); // give others a chance
    }

#ifdef DEBUG_rdayal
    printf ("ChangeLog Replication : Updated Entry : %s for OpType : %u\n", 
                                    NS_ConvertUCS2toUTF8(targetDN).get(), operation);
#endif

    switch(operation) {
    case ENTRY_ADD:
        // add the DN to the add list if not already in the list
        if(!(mEntriesToAdd.IndexOf(targetDN) >= 0))
            mEntriesToAdd.AppendString(targetDN);
        break;
    case ENTRY_DELETE:
        // donot check the return here since delete may fail if 
        // entry deleted in changelog doesnot exist in DB 
        // for e.g if the user specifies a filter, so go next entry
        DeleteCard(targetDN);
        break;
    case ENTRY_MODIFY:
        // for modify, delte the entry from DB and add updated entry
        // we do this since we cannot access the changes attribs of changelog
        rv = DeleteCard(targetDN);
        if (NS_SUCCEEDED(rv)) 
            if(!(mEntriesToAdd.IndexOf(targetDN) >= 0))
                mEntriesToAdd.AppendString(targetDN);
        break;
    default:
        // should not come here, would come here only
        // if the entry is not a changeLog entry
        NS_WARNING("nsAbLDAPProcessChangeLogData::ParseChangeLogEntries"
           "Not an changelog entry");
    }

    // go ahead processing the next entry,  a modify or delete DB operation 
    // can 'correctly' fail if the entry is not present in the DB. 
    // eg : in case a filter is specified.
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 337 of file nsAbLDAPChangeLogData.cpp.

{
    NS_ENSURE_ARG_POINTER(aMessage);
    if(!mInitialized) 
        return NS_ERROR_NOT_INITIALIZED;

    // populate the RootDSEChangeLogEntry
    CharPtrArrayGuard attrs;
    nsresult rv = aMessage->GetAttributes(attrs.GetSizeAddr(), attrs.GetArrayAddr());
    // no attributes !!!
    if(NS_FAILED(rv)) 
        return rv;

    for(PRInt32 i=attrs.GetSize()-1; i >= 0; i--) {
        PRUnicharPtrArrayGuard vals;
        rv = aMessage->GetValues(attrs.GetArray()[i], vals.GetSizeAddr(), vals.GetArrayAddr());
        if(NS_FAILED(rv))
            continue;
        if(vals.GetSize()) {
            if (!PL_strcasecmp(attrs[i], "changelog"))
                CopyUTF16toUTF8(vals[0], mRootDSEEntry.changeLogDN);
            if (!PL_strcasecmp(attrs[i], "firstChangeNumber"))
                mRootDSEEntry.firstChangeNumber = atol(NS_LossyConvertUCS2toASCII(vals[0]).get());
            if (!PL_strcasecmp(attrs[i], "lastChangeNumber"))
                mRootDSEEntry.lastChangeNumber = atol(NS_LossyConvertUCS2toASCII(vals[0]).get());
            if (!PL_strcasecmp(attrs[i], "dataVersion"))
                CopyUTF16toUTF8(vals[0], mRootDSEEntry.dataVersion);
        }
    }

    if((mRootDSEEntry.lastChangeNumber > 0) 
        && (mDirServerInfo->replInfo->lastChangeNumber < mRootDSEEntry.lastChangeNumber)
        && (mDirServerInfo->replInfo->lastChangeNumber > mRootDSEEntry.firstChangeNumber) 
      )
        mUseChangeLog = PR_TRUE;

    if(mRootDSEEntry.lastChangeNumber && (mDirServerInfo->replInfo->lastChangeNumber == mRootDSEEntry.lastChangeNumber)) {
        Done(PR_TRUE); // we are up to date no need to replicate, db not open yet so call Done
        return NS_OK;
    }

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

this utility method populates authentication data from Dir Server


Member Data Documentation

Definition at line 58 of file nsIAbLDAPReplicationData.idl.

Definition at line 59 of file nsIAbLDAPReplicationData.idl.

Definition at line 63 of file nsIAbLDAPReplicationData.idl.

Definition at line 79 of file nsIAbLDAPReplicationData.idl.

Definition at line 62 of file nsIAbLDAPReplicationData.idl.

replication protocols

Definition at line 78 of file nsIAbLDAPReplicationData.idl.

Definition at line 66 of file nsIAbLDAPReplicationData.idl.

replication states

Definition at line 57 of file nsIAbLDAPReplicationData.idl.

Definition at line 81 of file nsIAbLDAPReplicationData.idl.

Definition at line 80 of file nsIAbLDAPReplicationData.idl.

Definition at line 64 of file nsIAbLDAPReplicationData.idl.

Definition at line 67 of file nsIAbLDAPReplicationData.idl.

Definition at line 68 of file nsIAbLDAPReplicationData.idl.

Definition at line 61 of file nsIAbLDAPReplicationData.idl.

Definition at line 65 of file nsIAbLDAPReplicationData.idl.

Definition at line 60 of file nsIAbLDAPReplicationData.idl.

Definition at line 80 of file nsAbLDAPReplicationData.h.

Definition at line 78 of file nsAbLDAPReplicationData.h.

Definition at line 79 of file nsAbLDAPReplicationData.h.

Definition at line 74 of file nsAbLDAPChangeLogData.h.

Definition at line 68 of file nsAbLDAPReplicationData.h.

Definition at line 83 of file nsAbLDAPChangeLogData.h.

Definition at line 64 of file nsAbLDAPChangeLogData.h.

Definition at line 73 of file nsAbLDAPReplicationData.h.

Definition at line 74 of file nsAbLDAPReplicationData.h.

Definition at line 77 of file nsAbLDAPReplicationData.h.

Definition at line 85 of file nsAbLDAPChangeLogData.h.

Definition at line 86 of file nsAbLDAPChangeLogData.h.

Definition at line 75 of file nsAbLDAPReplicationData.h.

Definition at line 64 of file nsAbLDAPReplicationData.h.

Definition at line 72 of file nsAbLDAPReplicationData.h.

Definition at line 61 of file nsAbLDAPReplicationData.h.

Definition at line 66 of file nsAbLDAPReplicationData.h.

Definition at line 67 of file nsAbLDAPReplicationData.h.

Definition at line 81 of file nsAbLDAPChangeLogData.h.

Definition at line 71 of file nsAbLDAPReplicationData.h.

Definition at line 82 of file nsAbLDAPChangeLogData.h.

readonly attribute giving the current protocol used

Definition at line 73 of file nsIAbLDAPReplicationData.idl.

readonly attribute giving the current replication state

Definition at line 52 of file nsIAbLDAPReplicationData.idl.


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