From 4ad7ab823cfeb2f140cdff1ad0c4f272b5997aac Mon Sep 17 00:00:00 2001 From: "rhp%netscape.com" Date: Fri, 28 Apr 2000 13:56:54 +0000 Subject: [PATCH] NOT PART OF THE BUILD...nothing to see here, just move along... --- mailnews/absync/build/nsAbSyncFactory.cpp | 5 +- .../absync/public/nsIAbSyncPostEngine.idl | 2 +- mailnews/absync/src/makefile.win | 2 + mailnews/absync/src/nsAbSync.cpp | 524 +++++++++++++----- mailnews/absync/src/nsAbSync.h | 47 +- mailnews/absync/src/nsAbSyncPostEngine.cpp | 55 +- mailnews/absync/src/nsAbSyncPostEngine.h | 5 +- mailnews/absync/src/nsSyncDecoderRing.cpp | 126 +++++ mailnews/absync/src/nsSyncDecoderRing.h | 130 +++++ 9 files changed, 717 insertions(+), 179 deletions(-) create mode 100644 mailnews/absync/src/nsSyncDecoderRing.cpp create mode 100644 mailnews/absync/src/nsSyncDecoderRing.h diff --git a/mailnews/absync/build/nsAbSyncFactory.cpp b/mailnews/absync/build/nsAbSyncFactory.cpp index a37614eabc8a..47c9326e79b6 100644 --- a/mailnews/absync/build/nsAbSyncFactory.cpp +++ b/mailnews/absync/build/nsAbSyncFactory.cpp @@ -37,7 +37,7 @@ #include "nsAbSyncPostEngine.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbSync); -NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbSyncPostEngine); +// NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbSyncPostEngine); //////////////////////////////////////////////////////////// // @@ -52,8 +52,7 @@ static nsModuleComponentInfo components[] = { "Addressbook Sync Post Engine", NS_ABSYNC_POST_ENGINE_CID, NS_ABSYNC_POST_ENGINE_PROGID, - nsAbSyncPostEngineConstructor } + nsAbSyncPostEngine::Create } }; - NS_IMPL_NSGETMODULE("nsAbSyncModule", components) diff --git a/mailnews/absync/public/nsIAbSyncPostEngine.idl b/mailnews/absync/public/nsIAbSyncPostEngine.idl index 76cffc708561..7261b927548f 100644 --- a/mailnews/absync/public/nsIAbSyncPostEngine.idl +++ b/mailnews/absync/public/nsIAbSyncPostEngine.idl @@ -47,5 +47,5 @@ interface nsIAbSyncPostEngine : nsISupports { * Send the protocol request and get a transaction ID in return that * will be sent along with all sync listener operations */ - void SendAbRequest(in string aSpec, in string aProtocolRequest, in PRInt32 aTransactionID); + void SendAbRequest(in string aSpec, in PRInt32 aPort, in string aProtocolRequest, in PRInt32 aTransactionID); }; diff --git a/mailnews/absync/src/makefile.win b/mailnews/absync/src/makefile.win index 783b538b221c..35ac08f7a21f 100644 --- a/mailnews/absync/src/makefile.win +++ b/mailnews/absync/src/makefile.win @@ -30,6 +30,7 @@ include <$(DEPTH)\config\config.mak> EXPORTS= nsAbSyncPostEngine.h \ nsAbSync.h \ nsAbSyncCRCModel.h \ + nsSyncDecoderRing.h \ $(NULL) ################################################################################ @@ -40,6 +41,7 @@ LIBRARY_NAME=absync_s CPP_OBJS= .\$(OBJDIR)\nsAbSyncPostEngine.obj \ .\$(OBJDIR)\nsAbSync.obj \ .\$(OBJDIR)\nsAbSyncCRCModel.obj \ + .\$(OBJDIR)\nsSyncDecoderRing.obj \ $(NULL) diff --git a/mailnews/absync/src/nsAbSync.cpp b/mailnews/absync/src/nsAbSync.cpp index fe2945c390c5..b375c9ea3431 100644 --- a/mailnews/absync/src/nsAbSync.cpp +++ b/mailnews/absync/src/nsAbSync.cpp @@ -33,6 +33,8 @@ #include "nsRDFCID.h" #include "nsIFileLocator.h" #include "nsFileLocations.h" +#include "nsEscape.h" +#include "nsSyncDecoderRing.h" static NS_DEFINE_CID(kCAbSyncPostEngineCID, NS_ABSYNC_POST_ENGINE_CID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -41,95 +43,6 @@ static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); -// Address book fields! -const char *kFirstNameColumn = "FirstName"; -const char *kLastNameColumn = "LastName"; -const char *kDisplayNameColumn = "DisplayName"; -const char *kNicknameColumn = "NickName"; -const char *kPriEmailColumn = "PrimaryEmail"; -const char *k2ndEmailColumn = "SecondEmail"; -const char *kPlainTextColumn = "SendPlainText"; -const char *kWorkPhoneColumn = "WorkPhone"; -const char *kHomePhoneColumn = "HomePhone"; -const char *kFaxColumn = "FaxNumber"; -const char *kPagerColumn = "PagerNumber"; -const char *kCellularColumn = "CellularNumber"; -const char *kHomeAddressColumn = "HomeAddress"; -const char *kHomeAddress2Column = "HomeAddress2"; -const char *kHomeCityColumn = "HomeCity"; -const char *kHomeStateColumn = "HomeState"; -const char *kHomeZipCodeColumn = "HomeZipCode"; -const char *kHomeCountryColumn = "HomeCountry"; -const char *kWorkAddressColumn = "WorkAddress"; -const char *kWorkAddress2Column = "WorkAddress2"; -const char *kWorkCityColumn = "WorkCity"; -const char *kWorkStateColumn = "WorkState"; -const char *kWorkZipCodeColumn = "WorkZipCode"; -const char *kWorkCountryColumn = "WorkCountry"; -const char *kJobTitleColumn = "JobTitle"; -const char *kDepartmentColumn = "Department"; -const char *kCompanyColumn = "Company"; -const char *kWebPage1Column = "WebPage1"; -const char *kWebPage2Column = "WebPage2"; -const char *kBirthYearColumn = "BirthYear"; -const char *kBirthMonthColumn = "BirthMonth"; -const char *kBirthDayColumn = "BirthDay"; -const char *kCustom1Column = "Custom1"; -const char *kCustom2Column = "Custom2"; -const char *kCustom3Column = "Custom3"; -const char *kCustom4Column = "Custom4"; -const char *kNotesColumn = "Notes"; -const char *kLastModifiedDateColumn = "LastModifiedDate"; - -// Server record fields! -const char *kServerFirstNameColumn = "fname"; -const char *kServerLastNameColumn = "lname"; -const char *kServerDisplayNameColumn = "screen_name"; -const char *kServerNicknameColumn = "NickName"; -const char *kServerPriEmailColumn = "email1"; -const char *kServer2ndEmailColumn = "email2"; -const char *kServerPlainTextColumn = "SendPlainText"; -const char *kServerWorkPhoneColumn = "work_phone"; -const char *kServerHomePhoneColumn = "home_phone"; -const char *kServerFaxColumn = "fax"; -const char *kServerPagerColumn = "pager"; -const char *kServerCellularColumn = "cell_phone"; -const char *kServerHomeAddressColumn = "home_add1"; -const char *kServerHomeAddress2Column = "home_add2"; -const char *kServerHomeCityColumn = "home_city"; -const char *kServerHomeStateColumn = "home_state"; -const char *kServerHomeZipCodeColumn = "home_zip"; -const char *kServerHomeCountryColumn = "home_country"; -const char *kServerWorkAddressColumn = "work_add1"; -const char *kServerWorkAddress2Column = "work_add2"; -const char *kServerWorkCityColumn = "work_city"; -const char *kServerWorkStateColumn = "work_state"; -const char *kServerWorkZipCodeColumn = "work_zip"; -const char *kServerWorkCountryColumn = "work_country"; -const char *kServerJobTitleColumn = "JobTitle"; -const char *kServerDepartmentColumn = "Department"; -const char *kServerCompanyColumn = "Company"; -const char *kServerWebPage1Column = "WebPage1"; -const char *kServerWebPage2Column = "WebPage2"; -const char *kServerBirthYearColumn = "BirthYear"; -const char *kServerBirthMonthColumn = "BirthMonth"; -const char *kServerBirthDayColumn = "BirthDay"; -const char *kServerCustom1Column = "Custom1"; -const char *kServerCustom2Column = "Custom2"; -const char *kServerCustom3Column = "Custom3"; -const char *kServerCustom4Column = "Custom4"; -const char *kServerNotesColumn = "Notes"; -const char *kServerLastModifiedDateColumn = "LastModifiedDate"; - -// So far, we aren't really doing anything with these! -const char *kAddressCharSetColumn = "AddrCharSet"; -const char *kMailListName = "ListName"; -const char *kMailListNickName = "ListNickName"; -const char *kMailListDescription = "ListDescription"; -const char *kMailListTotalAddresses = "ListTotalAddresses"; -// So far, we aren't really doing anything with these! - - /* Implementation file */ NS_IMPL_ISUPPORTS1(nsAbSync, nsIAbSync) @@ -151,6 +64,10 @@ nsAbSync::nsAbSync() mHistoryFile = nsnull; mOldSyncMapingTable = nsnull; mNewSyncMapingTable = nsnull; + mNewServerTable = nsnull; + + mLastChangeNum = 1; + mUserName = nsString("RHPizzarro").ToNewCString(); InitSchemaColumns(); } @@ -164,9 +81,16 @@ nsAbSync::InternalCleanup() PR_FREEIF(mAbSyncServer); PR_FREEIF(mAbSyncAddressBook); PR_FREEIF(mAbSyncAddressBookFileName); + + PR_FREEIF(mOldSyncMapingTable); + PR_FREEIF(mNewSyncMapingTable); + PR_FREEIF(mNewServerTable); + if (mHistoryFile) mHistoryFile->CloseStream(); + PR_FREEIF(mUserName); + return NS_OK; } @@ -407,6 +331,8 @@ NS_IMETHODIMP nsAbSync::OnStopOperation(PRInt32 aTransactionID, nsresult aStatus NotifyListenersOnStopSync(aTransactionID, aStatus, aMsg); InternalCleanup(); + + mCurrentState = nsIAbSyncState::nsIAbSyncIdle; return NS_OK; } @@ -429,6 +355,7 @@ NS_IMETHODIMP nsAbSync::PerformAbSync(PRInt32 *aTransactionID) nsresult rv; char *postSpec = nsnull; char *protocolRequest = nsnull; + char *prefixStr = nsnull; // If we are already running...don't let anything new start... if (mCurrentState != nsIAbSyncState::nsIAbSyncIdle) @@ -442,11 +369,11 @@ NS_IMETHODIMP nsAbSync::PerformAbSync(PRInt32 *aTransactionID) if (NS_FAILED(rv) || !prefs) return NS_ERROR_FAILURE; - mAbSyncPort = 5000; - - prefs->CopyCharPref("mail.absync.server", &mAbSyncServer); - prefs->GetIntPref ("mail.absync.port", &mAbSyncPort); - prefs->CopyCharPref("mail.absync.address_book", &mAbSyncAddressBook); + prefs->CopyCharPref("mail.absync.server", &mAbSyncServer); + prefs->CopyCharPref("mail.absync.address_book", &mAbSyncAddressBook); + prefs->GetIntPref ("mail.absync.last_change", &mLastChangeNum); + if (NS_FAILED(prefs->GetIntPref("mail.absync.port", &mAbSyncPort))) + mAbSyncPort = 5000; // Did we get sane values... if (!mAbSyncServer) @@ -455,7 +382,7 @@ NS_IMETHODIMP nsAbSync::PerformAbSync(PRInt32 *aTransactionID) goto EarlyExit; } - postSpec = PR_smprintf("http://%s:%d", mAbSyncServer, mAbSyncPort); + postSpec = PR_smprintf("http://%s", mAbSyncServer); if (!postSpec) { rv = NS_ERROR_OUT_OF_MEMORY; @@ -506,12 +433,24 @@ NS_IMETHODIMP nsAbSync::PerformAbSync(PRInt32 *aTransactionID) mPostEngine->AddPostListener((nsIAbSyncPostListener *)this); } + // Ok, add the header to this protocol string information... + prefixStr = PR_smprintf("last=%u&protocol=%d&client=2&ver=Demo&", mLastChangeNum, ABSYNC_PROTOCOL); + if (!prefixStr) + { + rv = NS_ERROR_OUT_OF_MEMORY; + OnStopOperation(mTransactionID, NS_OK, nsnull, nsnull); + goto EarlyExit; + } + + mPostString.Insert(prefixStr, 0); + nsCRT::free(prefixStr); + protocolRequest = mPostString.ToNewCString(); if (!protocolRequest) goto EarlyExit; // Ok, FIRE! - rv = mPostEngine->SendAbRequest(postSpec, protocolRequest, mTransactionID); + rv = mPostEngine->SendAbRequest(postSpec, mAbSyncPort, protocolRequest, mTransactionID); if (NS_SUCCEEDED(rv)) mCurrentState = nsIAbSyncState::nsIAbSyncRunning; @@ -556,32 +495,57 @@ nsAbSync::OpenAB(char *aAbName, nsIAddrDatabase **aDatabase) } NS_IMETHODIMP -nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRInt32 id, nsString &protLine) +nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &protLine) { PRUnichar *aName = nsnull; + nsString tProtLine = ""; + + if (aAddId) + { + PRUint32 aKey; + if (NS_FAILED(aCard->GetKey(&aKey))) + return NS_ERROR_FAILURE; + + char *tVal = PR_smprintf("%d", (aKey * -1)); + if (tVal) + { + tProtLine.Append("%26cid%3D"); + tProtLine.Append(tVal); + nsCRT::free(tVal); + } + } for (PRInt32 i=0; iGetCardValue(mSchemaMappingList[0].abField, &aName)) && (aName) && (*aName)) + if (NS_SUCCEEDED(aCard->GetCardValue(mSchemaMappingList[i].abField, &aName)) && (aName) && (*aName)) { - protLine.Append("&"); - protLine.Append(mSchemaMappingList[0].serverField); - - if (id >= 0) + if (nsCRT::strncasecmp(mSchemaMappingList[i].serverField, "OMIT:", 5)) { - char *tVal = PR_smprintf("%d", id); - if (tVal) - { - protLine.Append(tVal); - nsCRT::free(tVal); - } + tProtLine.Append("&"); + tProtLine.Append(mSchemaMappingList[i].serverField); + tProtLine.Append("="); + tProtLine.Append(aName); } - - protLine.Append("="); - protLine.Append(aName); } } + if (tProtLine != "") + { + char *tLine = tProtLine.ToNewCString(); + if (!tLine) + return NS_ERROR_OUT_OF_MEMORY; + + char *escData = nsEscape(tLine, url_Path); + if (escData) + { + tProtLine = escData; + } + + PR_FREEIF(tLine); + PR_FREEIF(escData); + protLine = tProtLine; + } + return NS_OK; } @@ -633,9 +597,9 @@ nsAbSync::ThisCardHasChanged(nsIAbCard *aCard, syncMappingRecord *newSyncRecord, { while (counter < mOldTableSize) { - if (mOldSyncMapingTable[counter]->localID == newSyncRecord->localID) + if (mOldSyncMapingTable[counter].localID == newSyncRecord->localID) { - historyRecord = mOldSyncMapingTable[counter]; + historyRecord = &(mOldSyncMapingTable[counter]); break; } @@ -646,7 +610,7 @@ nsAbSync::ThisCardHasChanged(nsIAbCard *aCard, syncMappingRecord *newSyncRecord, // // Now, build up the compare protocol line for this entry. // - if (NS_FAILED(GenerateProtocolForCard(aCard, -1, tempProtocolLine))) + if (NS_FAILED(GenerateProtocolForCard(aCard, PR_FALSE, tempProtocolLine))) return PR_FALSE; // Get the CRC for this temp entry line... @@ -667,7 +631,7 @@ nsAbSync::ThisCardHasChanged(nsIAbCard *aCard, syncMappingRecord *newSyncRecord, if (historyRecord) { newSyncRecord->serverID = historyRecord->serverID; - historyRecord->flags &= SYNC_PROCESSED; + historyRecord->flags |= SYNC_PROCESSED; } // If this is a record that has changed from comparing CRC's, then @@ -675,19 +639,29 @@ nsAbSync::ThisCardHasChanged(nsIAbCard *aCard, syncMappingRecord *newSyncRecord, // going up to the server // if ( (!historyRecord) || (historyRecord->CRC != newSyncRecord->CRC) ) - { - mCurrentPostRecord++; - if (NS_FAILED(GenerateProtocolForCard(aCard, mCurrentPostRecord, protLine))) + { + PRUint32 aKey; + if (NS_FAILED(aCard->GetKey(&aKey))) return PR_FALSE; - else + + // Needs to be negative, so make it so! + char *tVal = PR_smprintf("%d", (aKey * -1)); + if (tVal) { - if (!historyRecord) - newSyncRecord->flags &= SYNC_ADD; - else - newSyncRecord->flags &= SYNC_MODIFIED; - - return PR_TRUE; + protLine.Append("%26cid%3D"); + protLine.Append(tVal); + protLine.Append(tempProtocolLine); + nsCRT::free(tVal); } + else + return PR_FALSE; + + if (!historyRecord) + newSyncRecord->flags |= SYNC_ADD; + else + newSyncRecord->flags |= SYNC_MODIFIED; + + return PR_TRUE; } else // This is the same record as before. { @@ -712,9 +686,12 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director // Init size vars... mOldTableSize = 0; mNewTableSize = 0; + mNewServerTableSize = 0; PR_FREEIF(mOldSyncMapingTable); PR_FREEIF(mNewSyncMapingTable); + PR_FREEIF(mNewServerTable); mCurrentPostRecord = 1; + mNewServerTableSize = 0; // // First thing we need to do is open the absync.dat file @@ -726,7 +703,7 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director if (NS_FAILED(rv)) return rv; - rv = locator->GetFileLocation(nsSpecialFileSpec::App_MailDirectory50, getter_AddRefs(mHistoryFile)); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_UserProfileDirectory50, getter_AddRefs(mHistoryFile)); if (NS_FAILED(rv)) return rv; @@ -756,7 +733,7 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director goto GetOut; } - mOldSyncMapingTable = (syncMappingRecord **) PR_MALLOC(mOldTableSize); + mOldSyncMapingTable = (syncMappingRecord *) PR_MALLOC(mOldTableSize); if (!mOldSyncMapingTable) { rv = NS_ERROR_OUT_OF_MEMORY;; @@ -779,6 +756,8 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director rv = NS_ERROR_OUT_OF_MEMORY;; goto GetOut; } + + readCount++; } } } @@ -801,7 +780,7 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director mNewTableSize++; } while (NS_SUCCEEDED(cardEnum->Next())); - mNewSyncMapingTable = (syncMappingRecord **) PR_MALLOC(mNewTableSize * sizeof(syncMappingRecord)); + mNewSyncMapingTable = (syncMappingRecord *) PR_MALLOC(mNewTableSize * sizeof(syncMappingRecord)); if (!mNewSyncMapingTable) { rv = NS_ERROR_OUT_OF_MEMORY;; @@ -826,25 +805,46 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director // First, we need to fill out the localID for this entry. This should // be the ID from the local database for this card entry // - // RICHIE - Need access to the unique ID from Candice. - // mNewSyncMapingTable[workCounter] = card.??? - mNewSyncMapingTable[workCounter]->localID = workCounter; + PRUint32 aKey; + if (NS_FAILED(card->GetKey(&aKey))) + continue; - if (ThisCardHasChanged(card, mNewSyncMapingTable[workCounter], singleProtocolLine)) + mNewSyncMapingTable[workCounter].localID = aKey; + + if (ThisCardHasChanged(card, &(mNewSyncMapingTable[workCounter]), singleProtocolLine)) { // If we get here, we should look at the flags in the mNewSyncMapingTable to see // what we should add to the protocol header area and then tack on the singleProtcolLine // we got back from this call. // - if (mNewSyncMapingTable[workCounter]->flags && SYNC_ADD) + if (mNewSyncMapingTable[workCounter].flags && SYNC_ADD) { - mPostString.Append("add:"); + char *tVal3 = PR_smprintf("%d", mCurrentPostRecord); + if (tVal3) + { + mPostString.Append(tVal3); + mPostString.Append("="); + } + + mPostString.Append(SYNC_ESCAPE_ADDUSER); mPostString.Append(singleProtocolLine); + + PR_FREEIF(tVal3); + mCurrentPostRecord++; } - else if (mNewSyncMapingTable[workCounter]->flags && SYNC_MODIFIED) + else if (mNewSyncMapingTable[workCounter].flags && SYNC_MODIFIED) { - mPostString.Append("modify:"); + char *tVal4 = PR_smprintf("%d", mCurrentPostRecord); + if (tVal4) + { + mPostString.Append(tVal4); + mPostString.Append("="); + } + + mPostString.Append(SYNC_ESCAPE_MOD); mPostString.Append(singleProtocolLine); + PR_FREEIF(tVal4); + mCurrentPostRecord++; } } } @@ -863,15 +863,24 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director readCount = 0; while (readCount < mOldTableSize) { - if (!(mOldSyncMapingTable[readCount]->flags && SYNC_PROCESSED)) + if (!(mOldSyncMapingTable[readCount].flags && SYNC_PROCESSED)) { - char *tVal = PR_smprintf("%d", mOldSyncMapingTable[readCount]->serverID); + char *tVal = PR_smprintf("%d", mOldSyncMapingTable[readCount].serverID); if (tVal) { - mCurrentPostRecord++; - mPostString.Append("&op=del&id="); + char *tVal2 = PR_smprintf("%d", mCurrentPostRecord); + if (tVal2) + { + mPostString.Append(tVal2); + mPostString.Append("="); + } + + mPostString.Append(SYNC_ESCAPE_DEL); + mPostString.Append("%26id="); mPostString.Append(tVal); nsCRT::free(tVal); + nsCRT::free(tVal2); + mCurrentPostRecord++; } } @@ -882,8 +891,6 @@ GetOut: if (mHistoryFile) mHistoryFile->CloseStream(); - mHistoryFile = nsnull; - if (NS_FAILED(rv)) { mOldTableSize = 0; @@ -907,7 +914,7 @@ nsAbSync::AnalyzeTheLocalAddressBook() // Get the address book entry nsCOMPtr resource = nsnull; nsCOMPtr directory = nsnull; - nsIAbCard *urlArgCard; + nsIAbCard *urlArgCard = nsnull; PRUnichar *workEmail = nsnull; char *charEmail = nsnull; PRUnichar *workAb = nsnull; @@ -958,11 +965,242 @@ EarlyExit: return rv; } +/////////////////////////////////////////////// +// The following is for protocol parsing +/////////////////////////////////////////////// + +#define SERVER_OP_RETURN "~op_return" +#define SERVER_NEW_RECORDS "~new_records_section " +#define SERVER_DELETED_RECORDS "~deleted_records_section " +#define SERVER_LAST_CHANGED "~last_chg" + +// Return true if the server returned an error... +PRBool +nsAbSync::ErrorFromServer(char **errString) +{ + if (!nsCRT::strncasecmp(mProtocolOffset, "err ", 4)) + { + *errString = mProtocolOffset + 4; + return PR_TRUE; + } + else + return PR_FALSE; +} + +// If this returns true, we are done with the data... +PRBool +nsAbSync::DecoderDone() +{ + if ( (!*mProtocolOffset) ) + return PR_TRUE; + else + return PR_FALSE; +} + +nsresult +nsAbSync::ProcessOpReturn() +{ + return NS_OK; +} + +nsresult +nsAbSync::ProcessNewRecords() +{ + return NS_OK; +} + +nsresult +nsAbSync::ProcessDeletedRecords() +{ + return NS_OK; +} + +nsresult +nsAbSync::ProcessLastChange() +{ + char *aLine = nsnull; + + if (NS_FAILED(AdvanceToNextLine())) + return NS_ERROR_FAILURE; + + if (NS_SUCCEEDED(ExtractCurrentLine(&aLine))) + { + if (aLine) + { + mLastChangeNum = nsCRT::atoi(nsString(aLine).GetUnicode()); + PR_FREEIF(aLine); + } + return NS_OK; + } + else + return NS_ERROR_FAILURE; +} + +nsresult +nsAbSync::ExtractCurrentLine(char **aLine) +{ + nsString extractString = ""; + + *aLine = nsnull; + while (*mProtocolOffset) + { + while ( (*mProtocolOffset != CR) && (*mProtocolOffset == LF) ) + { + extractString.Append(*mProtocolOffset); + mProtocolOffset++; + } + } + + if (!*mProtocolOffset) + return NS_ERROR_FAILURE; + else + return NS_OK; +} + +nsresult +nsAbSync::AdvanceToNextLine() +{ + while (*mProtocolOffset) + { + while ( (*mProtocolOffset != CR) && (*mProtocolOffset != LF) ) + mProtocolOffset++; + } + + if (!*mProtocolOffset) + return NS_ERROR_FAILURE; + + while (*mProtocolOffset) + { + while ( (*mProtocolOffset == CR) || (*mProtocolOffset == LF) ) + mProtocolOffset++; + } + + if (!*mProtocolOffset) + return NS_ERROR_FAILURE; + else + return NS_OK; +} + +PRBool +nsAbSync::ParseNextSection() +{ + nsresult rv = NS_OK; + + while ( (*mProtocolOffset == CR) || (*mProtocolOffset == LF) ) + mProtocolOffset++; + + if (!nsCRT::strncasecmp(mProtocolOffset, SERVER_OP_RETURN, nsCRT::strlen(SERVER_OP_RETURN))) + rv = ProcessOpReturn(); + else if (!nsCRT::strncasecmp(mProtocolOffset, SERVER_NEW_RECORDS, nsCRT::strlen(SERVER_NEW_RECORDS))) + rv = ProcessNewRecords(); + else if (!nsCRT::strncasecmp(mProtocolOffset, SERVER_DELETED_RECORDS, nsCRT::strlen(SERVER_DELETED_RECORDS))) + rv = ProcessDeletedRecords(); + else if (!nsCRT::strncasecmp(mProtocolOffset, SERVER_LAST_CHANGED, nsCRT::strlen(SERVER_LAST_CHANGED))) + rv = ProcessLastChange(); + + return PR_TRUE; +} + // // This is the response side of getting things back from the server // nsresult nsAbSync::ProcessServerResponse(const char *aProtocolResponse) { + nsresult rv = NS_OK; + PRUint32 writeCount = 0; + PRInt32 writeSize = 0; + char *errorString; + PRBool parseOk = PR_TRUE; + + // If no response, then this is a problem... + if (!aProtocolResponse) + { + printf("\7RICHIE: Server returned invalid response!\n"); + return NS_ERROR_FAILURE; + } + + // Assign the vars... + mProtocolResponse = (char *)aProtocolResponse; + mProtocolOffset = (char *)aProtocolResponse; + + if (ErrorFromServer(&errorString)) + { + printf("\7RICHIE: Server error: %s\n", errorString); + return NS_ERROR_FAILURE; + } + + while ( (!DecoderDone()) && (parseOk) ) + { + parseOk = ParseNextSection(); + } + + // Now, write out the history file with the new information + // + if (!mHistoryFile) + { + rv = NS_ERROR_OUT_OF_MEMORY; + goto ExitEarly; + } + + /***********RICHIE + if (NS_FAILED(mHistoryFile->OpenStreamForWriting())) + { + rv = NS_ERROR_OUT_OF_MEMORY; + goto ExitEarly; + } + + // + // Now, when we get here, we should go through the old history and see if + // there are records we need to delete since we didn't touch them when comparing + // against the current address book + // + + // Ok, this handles the entries that we knew about before we started. + while (writeCount < mNewTableSize) + { + + if (NS_FAILED(mHistoryFile->Write((char *)&(mNewSyncMapingTable[writeCount]), + sizeof(syncMappingRecord), &writeSize)) + || (writeSize != sizeof(syncMappingRecord))) + { + rv = NS_ERROR_OUT_OF_MEMORY;; + goto ExitEarly; + } + + writeCount++; + } + + // These are entries that we got back from the server that are new + // to us! + writeCount = 0; + while (writeCount < mNewServerTableSize) + { + + if (NS_FAILED(mHistoryFile->Write((char *)&(mNewServerTable[writeCount]), + sizeof(syncMappingRecord), &writeSize)) + || (writeSize != sizeof(syncMappingRecord))) + { + rv = NS_ERROR_OUT_OF_MEMORY;; + goto ExitEarly; + } + + writeCount++; + } + + if (mHistoryFile) + mHistoryFile->CloseStream(); +*************** RICHIE */ + +ExitEarly: + if (mLastChangeNum > 1) + { + NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv); + if (NS_SUCCEEDED(rv) && prefs) + { + prefs->SetIntPref("mail.absync.last_change", mLastChangeNum); + } + } + return NS_OK; } diff --git a/mailnews/absync/src/nsAbSync.h b/mailnews/absync/src/nsAbSync.h index dfc1a2aee27c..6006441af6b1 100644 --- a/mailnews/absync/src/nsAbSync.h +++ b/mailnews/absync/src/nsAbSync.h @@ -79,6 +79,25 @@ typedef struct { #define SYNC_RENUMBER 0x0010 // Renumber on the server #define SYNC_PROCESSED 0x8000 // We processed the entry...nothing to do +#define SYNC_ALLTAGS 1000 +#define SYNC_EMAILS 2000 +#define ABSYNC_PROTOCOL 3 + +#define SYNC_ESCAPE_ADDUSER "op%3Dadd" +#define SYNC_ESCAPE_MOD "op%3Dmod" +#define SYNC_ESCAPE_DEL "op%3Ddel" + +//mailing list +#define SYNC_ESCAPE_MAIL_ADD "op%3DmaillistCreate" +#define SYNC_ESCAPE_MAIL_MOD "op%3DmaillistRen" +#define SYNC_ESCAPE_MAIL_DEL "op%3DmaillistDel" +#define SYNC_ESCAPE_MAIL_EMAIL_MOD "op%3DemailstringUpdate" +#define SYNC_ESCAPE_MAIL_CONTACT_ADD "op%3DmaillistAdd" +#define SYNC_ESCAPE_MAIL_CONTACT_DEL "op%3DmaillistMemberDel" + +// group +#define SYNC_ESCAPE_GROUP_DEL "op%3DgrpDel" + // // We need this structure for mapping our field names to the server // field names @@ -115,7 +134,7 @@ private: NS_IMETHOD OpenAB(char *aAbName, nsIAddrDatabase **aDatabase); NS_IMETHOD AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *directory); - NS_IMETHOD GenerateProtocolForCard(nsIAbCard *aCard, PRInt32 id, nsString &protLine); + NS_IMETHOD GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &protLine); PRBool ThisCardHasChanged(nsIAbCard *aCard, syncMappingRecord *syncRecord, nsString &protLine); nsresult InternalCleanup(); @@ -125,6 +144,9 @@ private: PRInt32 mListenerArrayCount; PRInt32 mCurrentState; + PRInt32 mLastChangeNum; + char *mUserName; + // Setting for ABSync operations... char *mAbSyncServer; PRInt32 mAbSyncPort; @@ -137,11 +159,30 @@ private: nsCOMPtr mHistoryFile; PRUint32 mOldTableSize; - syncMappingRecord **mOldSyncMapingTable; + syncMappingRecord *mOldSyncMapingTable; // Old history table... PRUint32 mNewTableSize; - syncMappingRecord **mNewSyncMapingTable; + syncMappingRecord *mNewSyncMapingTable; // New table after reading address book + PRUint32 mNewServerTableSize; + syncMappingRecord *mNewServerTable; // New entries from the server + + char *mProtocolResponse; // what the server said... + char *mProtocolOffset; // where in the buffer are we? schemaStruct mSchemaMappingList[kMaxColumns]; + + /////////////////////////////////////////////// + // The following is for protocol parsing + /////////////////////////////////////////////// + PRBool ErrorFromServer(char **errString); // Return true if the server returned an error... + PRBool DecoderDone(); // If this returns true, we are done with the data... + PRBool ParseNextSection(); // Deal with next section + nsresult AdvanceToNextLine(); + nsresult ExtractCurrentLine(char **aLine); + + nsresult ProcessOpReturn(); + nsresult ProcessNewRecords(); + nsresult ProcessDeletedRecords(); + nsresult ProcessLastChange(); }; #endif /* __nsIAbSync_h__ */ diff --git a/mailnews/absync/src/nsAbSyncPostEngine.cpp b/mailnews/absync/src/nsAbSyncPostEngine.cpp index 9115f974c6a8..19e0ac2c846c 100644 --- a/mailnews/absync/src/nsAbSyncPostEngine.cpp +++ b/mailnews/absync/src/nsAbSyncPostEngine.cpp @@ -45,22 +45,18 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); /* * This function will be used by the factory to generate an - * mime object class object.... + * object class object.... */ -nsresult NS_NewPostEngine(nsAbSyncPostEngine ** aInstancePtrResult) +NS_METHOD +nsAbSyncPostEngine::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { - //nsresult result = NS_OK; - NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr"); - if (nsnull != aInstancePtrResult) - { - nsAbSyncPostEngine *obj = new nsAbSyncPostEngine(); - if (obj) - return obj->QueryInterface(NS_GET_IID(nsIStreamListener), (void**) aInstancePtrResult); - else - return NS_ERROR_OUT_OF_MEMORY; // we couldn't allocate the object - } - else - return NS_ERROR_NULL_POINTER; // aInstancePtrResult was NULL.... + if (aOuter) + return NS_ERROR_NO_AGGREGATION; + + nsAbSyncPostEngine *ph = new nsAbSyncPostEngine(); + if (ph == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + return ph->QueryInterface(aIID, aResult); } NS_IMPL_ADDREF(nsAbSyncPostEngine) @@ -72,6 +68,7 @@ NS_INTERFACE_MAP_BEGIN(nsAbSyncPostEngine) NS_INTERFACE_MAP_ENTRY(nsIStreamObserver) NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) NS_INTERFACE_MAP_ENTRY(nsIURIContentListener) + NS_INTERFACE_MAP_ENTRY(nsIAbSyncPostEngine) NS_INTERFACE_MAP_END /* @@ -311,28 +308,27 @@ nsAbSyncPostEngine::FireURLRequest(nsIURI *aURL, nsPostCompletionCallback cb, if (!postData) return NS_ERROR_INVALID_ARG; - rv = NS_NewPostDataStream(&postStream, PR_FALSE, postData, 0); - if (NS_FAILED(rv)) - return rv; - nsCOMPtr channel; NS_ENSURE_SUCCESS(NS_OpenURI(getter_AddRefs(channel), aURL, nsnull), NS_ERROR_FAILURE); - // Tag the post stream onto the channel... +/** + // RICHIE + // Tag the post stream onto the channel...but never seemed to work...so putting it + // directly on the URL spec nsCOMPtr httpChannel = do_QueryInterface(channel); if (!httpChannel) return NS_ERROR_FAILURE; - mMessageSize = nsCRT::strlen(postData); httpChannel->SetRequestMethod(HM_POST); - httpChannel->SetPostDataStream(postStream); + httpChannel->SetUploadStream(postStream); +**/ // let's try uri dispatching... nsCOMPtr pURILoader (do_GetService(NS_URI_LOADER_PROGID)); NS_ENSURE_TRUE(pURILoader, NS_ERROR_FAILURE); nsCOMPtr openContext; nsCOMPtr cntListener (do_QueryInterface(NS_STATIC_CAST(nsIStreamListener *, this))); - rv = pURILoader->OpenURI(channel, nsIURILoader::viewNormal, nsnull /* window target */, cntListener); + rv = pURILoader->OpenURI(channel, nsIURILoader::viewNormal, nsnull, cntListener); mURL = dont_QueryInterface(aURL); mCallback = cb; @@ -452,7 +448,7 @@ nsAbSyncPostEngine::NotifyListenersOnStopSending(PRInt32 aTransactionID, nsresul // Utility to create a nsIURI object... extern "C" nsresult -nsMimeNewURI(nsIURI** aInstancePtrResult, const char *aSpec, nsIURI *aBase) +nsEngineNewURI(nsIURI** aInstancePtrResult, const char *aSpec, nsIURI *aBase) { nsresult res; @@ -496,8 +492,7 @@ NS_IMETHODIMP nsAbSyncPostEngine::GetCurrentState(PRInt32 *_retval) // //////////////////////////////////////////////////////////////////////////////////////// -/* void SendAbRequest (in string aProtocolRequest, out PRInt32 aTransactionID); */ -NS_IMETHODIMP nsAbSyncPostEngine::SendAbRequest(const char *aSpec, const char *aProtocolRequest, PRInt32 aTransactionID) +NS_IMETHODIMP nsAbSyncPostEngine::SendAbRequest(const char *aSpec, PRInt32 aPort, const char *aProtocolRequest, PRInt32 aTransactionID) { nsresult rv; nsIURI *workURI = nsnull; @@ -510,10 +505,18 @@ NS_IMETHODIMP nsAbSyncPostEngine::SendAbRequest(const char *aSpec, const char *a mProtocolResponse = ""; mTotalWritten = 0; - rv = nsMimeNewURI(&workURI, aSpec, nsnull); + char *tSpec = PR_smprintf("%s?%s", aSpec, aProtocolRequest); + if (!tSpec) + return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the string */ + + rv = nsEngineNewURI(&workURI, tSpec, nsnull); if (NS_FAILED(rv) || (!workURI)) return NS_ERROR_FAILURE; + PR_FREEIF(tSpec); + if (aPort > 0) + workURI->SetPort(aPort); + rv = FireURLRequest(workURI, PostDoneCallback, this, aProtocolRequest); mPostEngineState = nsIAbSyncPostEngineState::nsIAbSyncPostRunning; return rv; diff --git a/mailnews/absync/src/nsAbSyncPostEngine.h b/mailnews/absync/src/nsAbSyncPostEngine.h index 732657cab3a8..0585680d0fcd 100644 --- a/mailnews/absync/src/nsAbSyncPostEngine.h +++ b/mailnews/absync/src/nsAbSyncPostEngine.h @@ -65,6 +65,8 @@ public: nsPostCompletionCallback cb, void *tagData); + static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); + // Methods for nsIStreamListener NS_DECL_NSISTREAMLISTENER // Methods for nsIStreamObserver @@ -102,7 +104,4 @@ private: PRInt32 mListenerArrayCount; }; -/* this function will be used by the factory to generate an class access object....*/ -extern nsresult NS_NewPostEngine(nsAbSyncPostEngine **aInstancePtrResult); - #endif /* nsAbSyncPostEngine_h_ */ diff --git a/mailnews/absync/src/nsSyncDecoderRing.cpp b/mailnews/absync/src/nsSyncDecoderRing.cpp new file mode 100644 index 000000000000..49f7d0e18a5d --- /dev/null +++ b/mailnews/absync/src/nsSyncDecoderRing.cpp @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "nsAbSync.h" +#include "prmem.h" +#include "nsAbSyncCID.h" +#include "nsIPref.h" +#include "nsIServiceManager.h" +#include "nsEscape.h" +#include "nsSyncDecoderRing.h" + +// Address book fields! +char *kFirstNameColumn = "FirstName"; +char *kLastNameColumn = "LastName"; +char *kDisplayNameColumn = "DisplayName"; +char *kNicknameColumn = "NickName"; +char *kPriEmailColumn = "PrimaryEmail"; +char *k2ndEmailColumn = "SecondEmail"; +char *kPlainTextColumn = "SendPlainText"; +char *kWorkPhoneColumn = "WorkPhone"; +char *kHomePhoneColumn = "HomePhone"; +char *kFaxColumn = "FaxNumber"; +char *kPagerColumn = "PagerNumber"; +char *kCellularColumn = "CellularNumber"; +char *kHomeAddressColumn = "HomeAddress"; +char *kHomeAddress2Column = "HomeAddress2"; +char *kHomeCityColumn = "HomeCity"; +char *kHomeStateColumn = "HomeState"; +char *kHomeZipCodeColumn = "HomeZipCode"; +char *kHomeCountryColumn = "HomeCountry"; +char *kWorkAddressColumn = "WorkAddress"; +char *kWorkAddress2Column = "WorkAddress2"; +char *kWorkCityColumn = "WorkCity"; +char *kWorkStateColumn = "WorkState"; +char *kWorkZipCodeColumn = "WorkZipCode"; +char *kWorkCountryColumn = "WorkCountry"; +char *kJobTitleColumn = "JobTitle"; +char *kDepartmentColumn = "Department"; +char *kCompanyColumn = "Company"; +char *kWebPage1Column = "WebPage1"; +char *kWebPage2Column = "WebPage2"; +char *kBirthYearColumn = "BirthYear"; +char *kBirthMonthColumn = "BirthMonth"; +char *kBirthDayColumn = "BirthDay"; +char *kCustom1Column = "Custom1"; +char *kCustom2Column = "Custom2"; +char *kCustom3Column = "Custom3"; +char *kCustom4Column = "Custom4"; +char *kNotesColumn = "Notes"; +char *kLastModifiedDateColumn = "LastModifiedDate"; + +// Server record fields! +char *kServerFirstNameColumn = "fname"; +char *kServerLastNameColumn = "lname"; +char *kServerDisplayNameColumn = "screen_name"; +char *kServerNicknameColumn = "OMIT:NickName"; +char *kServerPriEmailColumn = "email1"; +char *kServer2ndEmailColumn = "email2"; +char *kServerPlainTextColumn = "OMIT:SendPlainText"; +char *kServerWorkPhoneColumn = "work_phone"; +char *kServerHomePhoneColumn = "home_phone"; +char *kServerFaxColumn = "fax"; +char *kServerPagerColumn = "pager"; +char *kServerCellularColumn = "cell_phone"; +char *kServerHomeAddressColumn = "home_add1"; +char *kServerHomeAddress2Column = "home_add2"; +char *kServerHomeCityColumn = "home_city"; +char *kServerHomeStateColumn = "home_state"; +char *kServerHomeZipCodeColumn = "home_zip"; +char *kServerHomeCountryColumn = "home_country"; +char *kServerWorkAddressColumn = "work_add1"; +char *kServerWorkAddress2Column = "work_add2"; +char *kServerWorkCityColumn = "work_city"; +char *kServerWorkStateColumn = "work_state"; +char *kServerWorkZipCodeColumn = "work_zip"; +char *kServerWorkCountryColumn = "work_country"; +char *kServerJobTitleColumn = "job_title"; +char *kServerDepartmentColumn = "OMIT:Department"; +char *kServerCompanyColumn = "OMIT:Company"; +char *kServerWebPage1Column = "web_page"; +char *kServerWebPage2Column = "OMIT:WebPage2"; +char *kServerBirthYearColumn = "OMIT:BirthYear"; +char *kServerBirthMonthColumn = "OMIT:BirthMonth"; +char *kServerBirthDayColumn = "OMIT:BirthDay"; +char *kServerCustom1Column = "OMIT:Custom1"; +char *kServerCustom2Column = "OMIT:Custom2"; +char *kServerCustom3Column = "OMIT:Custom3"; +char *kServerCustom4Column = "OMIT:Custom4"; +char *kServerNotesColumn = "addl_info"; +char *kServerLastModifiedDateColumn = "OMIT:LastModifiedDate"; + +// So far, we aren't really doing anything with these! +char *kAddressCharSetColumn = "AddrCharSet"; +char *kMailListName = "ListName"; +char *kMailListNickName = "ListNickName"; +char *kMailListDescription = "ListDescription"; +char *kMailListTotalAddresses = "ListTotalAddresses"; +// So far, we aren't really doing anything with these! + +nsSyncDecoderRing::nsSyncDecoderRing() +{ +} + +nsSyncDecoderRing::~nsSyncDecoderRing() +{ +} + + diff --git a/mailnews/absync/src/nsSyncDecoderRing.h b/mailnews/absync/src/nsSyncDecoderRing.h new file mode 100644 index 000000000000..64c0a20180a9 --- /dev/null +++ b/mailnews/absync/src/nsSyncDecoderRing.h @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#ifndef __nsSyncDecoderRing_h__ +#define __nsSyncDecoderRing_h__ + +#include "nsIAbSync.h" +#include "nsIAbSyncPostListener.h" +#include "nsIAbSyncPostEngine.h" +#include "nsCOMPtr.h" +#include "nsIAddrDatabase.h" +#include "nsIAbDirectory.h" +#include "nsAbSyncCRCModel.h" + +// Address book fields! +extern char *kFirstNameColumn; +extern char *kLastNameColumn; +extern char *kDisplayNameColumn; +extern char *kNicknameColumn; +extern char *kPriEmailColumn; +extern char *k2ndEmailColumn; +extern char *kPlainTextColumn; +extern char *kWorkPhoneColumn; +extern char *kHomePhoneColumn; +extern char *kFaxColumn; +extern char *kPagerColumn; +extern char *kCellularColumn; +extern char *kHomeAddressColumn; +extern char *kHomeAddress2Column; +extern char *kHomeCityColumn; +extern char *kHomeStateColumn; +extern char *kHomeZipCodeColumn; +extern char *kHomeCountryColumn; +extern char *kWorkAddressColumn; +extern char *kWorkAddress2Column; +extern char *kWorkCityColumn; +extern char *kWorkStateColumn; +extern char *kWorkZipCodeColumn; +extern char *kWorkCountryColumn; +extern char *kJobTitleColumn; +extern char *kDepartmentColumn; +extern char *kCompanyColumn; +extern char *kWebPage1Column; +extern char *kWebPage2Column; +extern char *kBirthYearColumn; +extern char *kBirthMonthColumn; +extern char *kBirthDayColumn; +extern char *kCustom1Column; +extern char *kCustom2Column; +extern char *kCustom3Column; +extern char *kCustom4Column; +extern char *kNotesColumn; +extern char *kLastModifiedDateColumn; + +// Server record fields! +extern char *kServerFirstNameColumn; +extern char *kServerLastNameColumn; +extern char *kServerDisplayNameColumn; +extern char *kServerNicknameColumn; +extern char *kServerPriEmailColumn; +extern char *kServer2ndEmailColumn; +extern char *kServerPlainTextColumn; +extern char *kServerWorkPhoneColumn; +extern char *kServerHomePhoneColumn; +extern char *kServerFaxColumn; +extern char *kServerPagerColumn; +extern char *kServerCellularColumn; +extern char *kServerHomeAddressColumn; +extern char *kServerHomeAddress2Column; +extern char *kServerHomeCityColumn; +extern char *kServerHomeStateColumn; +extern char *kServerHomeZipCodeColumn; +extern char *kServerHomeCountryColumn; +extern char *kServerWorkAddressColumn; +extern char *kServerWorkAddress2Column; +extern char *kServerWorkCityColumn; +extern char *kServerWorkStateColumn; +extern char *kServerWorkZipCodeColumn; +extern char *kServerWorkCountryColumn; +extern char *kServerJobTitleColumn; +extern char *kServerDepartmentColumn; +extern char *kServerCompanyColumn; +extern char *kServerWebPage1Column; +extern char *kServerWebPage2Column; +extern char *kServerBirthYearColumn; +extern char *kServerBirthMonthColumn; +extern char *kServerBirthDayColumn; +extern char *kServerCustom1Column; +extern char *kServerCustom2Column; +extern char *kServerCustom3Column; +extern char *kServerCustom4Column; +extern char *kServerNotesColumn; +extern char *kServerLastModifiedDateColumn; + +// So far, we aren't really doing anything with these! +extern char *kAddressCharSetColumn; +extern char *kMailListName; +extern char *kMailListNickName; +extern char *kMailListDescription; +extern char *kMailListTotalAddresses; +// So far, we aren't really doing anything with these! + +class nsSyncDecoderRing +{ +public: + + nsSyncDecoderRing(); + virtual ~nsSyncDecoderRing(); +}; + +#endif /* __nsSyncDecoderRing_h__ */