diff options
-rwxr-xr-x | src/sysync/binfileimplclient.cpp | 8 | ||||
-rw-r--r-- | src/sysync/mimedirprofile.cpp | 67 | ||||
-rwxr-xr-x | src/sysync/mimedirprofile.h | 7 |
3 files changed, 65 insertions, 17 deletions
diff --git a/src/sysync/binfileimplclient.cpp b/src/sysync/binfileimplclient.cpp index 3b694be..16bad84 100755 --- a/src/sysync/binfileimplclient.cpp +++ b/src/sysync/binfileimplclient.cpp @@ -2922,8 +2922,12 @@ localstatus TBinfileImplClient::SelectProfile(uInt32 aProfileSelector, bool aAut } // if target belongs to this profile } // if we can read the target record } // for all target records - // ok if at least one datastore enabled - return fLocalDataStores.size()>0 && fRemoteURI.size()>0 ? LOCERR_OK : LOCERR_NOCFG; + // ok if at least one datastore enabled; + // this also used to check fRemoteURI, but that setting is + // not needed if the app on top of libsynthesis knows how + // to contact the server (for example, via some transport + // which doesn't need a parameter) + return fLocalDataStores.size()>0 ? LOCERR_OK : LOCERR_NOCFG; } // active defaultprofile: return inherited::SelectProfile(aProfileSelector, aAutoSyncSession); diff --git a/src/sysync/mimedirprofile.cpp b/src/sysync/mimedirprofile.cpp index 84dc424..617294d 100644 --- a/src/sysync/mimedirprofile.cpp +++ b/src/sysync/mimedirprofile.cpp @@ -4684,20 +4684,24 @@ bool TMimeDirProfileHandler::parseLevels( void TMimeDirProfileHandler::getOptionsFromDatastore(void) { - // get options datastore if one is related - if (fRelatedDatastoreP) { - fReceiverCanHandleUTC = fRelatedDatastoreP->getSession()->fRemoteCanHandleUTC; - fVCal10EnddatesSameDay = fRelatedDatastoreP->getSession()->fVCal10EnddatesSameDay; - fReceiverTimeContext = fRelatedDatastoreP->getSession()->fUserTimeContext; // default to user context - fDontSendEmptyProperties = fRelatedDatastoreP->getSession()->fDontSendEmptyProperties; - fDefaultOutCharset = fRelatedDatastoreP->getSession()->fDefaultOutCharset; - fDefaultInCharset = fRelatedDatastoreP->getSession()->fDefaultInCharset; - fDoQuote8BitContent = fRelatedDatastoreP->getSession()->fDoQuote8BitContent; - fDoNotFoldContent = fRelatedDatastoreP->getSession()->fDoNotFoldContent; - fTreatRemoteTimeAsLocal = fRelatedDatastoreP->getSession()->fTreatRemoteTimeAsLocal; - fTreatRemoteTimeAsUTC = fRelatedDatastoreP->getSession()->fTreatRemoteTimeAsUTC; + // get options datastore if one is related; + // ignore the session from getSession() here because we need + // to distinguish between script context and normal sync context + // (the former has no datastore, the latter has) + TSyncSession *sessionP = fRelatedDatastoreP ? fRelatedDatastoreP->getSession() : NULL; + if (sessionP) { + fReceiverCanHandleUTC = sessionP->fRemoteCanHandleUTC; + fVCal10EnddatesSameDay = sessionP->fVCal10EnddatesSameDay; + fReceiverTimeContext = sessionP->fUserTimeContext; // default to user context + fDontSendEmptyProperties = sessionP->fDontSendEmptyProperties; + fDefaultOutCharset = sessionP->fDefaultOutCharset; + fDefaultInCharset = sessionP->fDefaultInCharset; + fDoQuote8BitContent = sessionP->fDoQuote8BitContent; + fDoNotFoldContent = sessionP->fDoNotFoldContent; + fTreatRemoteTimeAsLocal = sessionP->fTreatRemoteTimeAsLocal; + fTreatRemoteTimeAsUTC = sessionP->fTreatRemoteTimeAsUTC; #ifndef NO_REMOTE_RULES - fActiveRemoteRules = fRelatedDatastoreP->getSession()->fActiveRemoteRules; // copy the list + fActiveRemoteRules = sessionP->fActiveRemoteRules; // copy the list #endif } } @@ -5376,16 +5380,49 @@ void TMimeDirProfileHandler::setRemoteRule(const string &aRemoteRuleName) if((*pos)->fElementName == aRemoteRuleName) { // only this rule and all rules included by it rule must be active fActiveRemoteRules.clear(); - fActiveRemoteRules.push_back(*pos); + activateRemoteRule(*pos); TRemoteRulesList::iterator spos; for(spos=(*pos)->fSubRulesList.begin();spos!=(*pos)->fSubRulesList.end();spos++) { - fActiveRemoteRules.push_back(*spos); + activateRemoteRule(*spos); } break; } } } // TMimeDirProfileHandler::setRemoteRule +void TMimeDirProfileHandler::activateRemoteRule(TRemoteRuleConfig *aRuleP) +{ + // activate this rule (similar code as in TSyncSession::checkRemoteSpecifics() + fActiveRemoteRules.push_back(aRuleP); + // - apply options that have a value + //if (aRuleP->fLegacyMode>=0) fLegacyMode = aRuleP->fLegacyMode; + //if (aRuleP->fLenientMode>=0) fLenientMode = aRuleP->fLenientMode; + //if (aRuleP->fLimitedFieldLengths>=0) fLimitedRemoteFieldLengths = aRuleP->fLimitedFieldLengths; + if (aRuleP->fDontSendEmptyProperties>=0) fDontSendEmptyProperties = aRuleP->fDontSendEmptyProperties; + if (aRuleP->fDoQuote8BitContent>=0) fDoQuote8BitContent = aRuleP->fDoQuote8BitContent; + if (aRuleP->fDoNotFoldContent>=0) fDoNotFoldContent = aRuleP->fDoNotFoldContent; + //if (aRuleP->fNoReplaceInSlowsync>=0) fNoReplaceInSlowsync = aRuleP->fNoReplaceInSlowsync; + if (aRuleP->fTreatRemoteTimeAsLocal>=0) fTreatRemoteTimeAsLocal = aRuleP->fTreatRemoteTimeAsLocal; + if (aRuleP->fTreatRemoteTimeAsUTC>=0) fTreatRemoteTimeAsUTC = aRuleP->fTreatRemoteTimeAsUTC; + if (aRuleP->fVCal10EnddatesSameDay>=0) fVCal10EnddatesSameDay = aRuleP->fVCal10EnddatesSameDay; + //if (aRuleP->fIgnoreDevInfMaxSize>=0) fIgnoreDevInfMaxSize = aRuleP->fIgnoreDevInfMaxSize; + //if (aRuleP->fIgnoreCTCap>=0) fIgnoreCTCap = aRuleP->fIgnoreCTCap; + //if (aRuleP->fDSPathInDevInf>=0) fDSPathInDevInf = aRuleP->fDSPathInDevInf; + //if (aRuleP->fDSCgiInDevInf>=0) fDSCgiInDevInf = aRuleP->fDSCgiInDevInf; + //if (aRuleP->fUpdateClientDuringSlowsync>=0) fUpdateClientDuringSlowsync = aRuleP->fUpdateClientDuringSlowsync; + //if (aRuleP->fUpdateServerDuringSlowsync>=0) fUpdateServerDuringSlowsync = aRuleP->fUpdateServerDuringSlowsync; + //if (aRuleP->fAllowMessageRetries>=0) fAllowMessageRetries = aRuleP->fAllowMessageRetries; + //if (aRuleP->fStrictExecOrdering>=0) fStrictExecOrdering = aRuleP->fStrictExecOrdering; + //if (aRuleP->fTreatCopyAsAdd>=0) fTreatCopyAsAdd = aRuleP->fTreatCopyAsAdd; + //if (aRuleP->fCompleteFromClientOnly>=0) fCompleteFromClientOnly = aRuleP->fCompleteFromClientOnly; + //if (aRuleP->fRequestMaxTime>=0) fRequestMaxTime = aRuleP->fRequestMaxTime; + if (aRuleP->fDefaultOutCharset!=chs_unknown) fDefaultOutCharset = aRuleP->fDefaultOutCharset; + if (aRuleP->fDefaultInCharset!=chs_unknown) fDefaultInCharset = aRuleP->fDefaultInCharset; + // - possibly override decisions that are otherwise made by session + // Note: this is not a single option because we had this before rule options were tristates. + //if (aRuleP->fForceUTC>0) fRemoteCanHandleUTC=true; + //if (aRuleP->fForceLocaltime>0) fRemoteCanHandleUTC=false; +} // check if given rule (by name, or if aRuleName=NULL by rule pointer) is active bool TMimeDirProfileHandler::isActiveRule(TRemoteRuleConfig *aRuleP) diff --git a/src/sysync/mimedirprofile.h b/src/sysync/mimedirprofile.h index e0982af..4db8bdf 100755 --- a/src/sysync/mimedirprofile.h +++ b/src/sysync/mimedirprofile.h @@ -484,6 +484,9 @@ public: // - mode (for those profiles that have more than one, like MIME-DIR's old/standard) virtual void setProfileMode(sInt32 aMode); #ifndef NO_REMOTE_RULES + // set specific remote rule and activate the behavior defined by it; + // to be used only in script context, inside a session the session + // properties are used instead virtual void setRemoteRule(const string &aRemoteRuleName); #endif // generate Text Data (includes header and footer) @@ -683,6 +686,10 @@ private: const TProfileDefinition *aProfileP, bool aRootLevel ); +#ifndef NO_REMOTE_RULES + // helper for setRemoteRule(): add one specific remote rule and activate the behavior defined by it + void activateRemoteRule(TRemoteRuleConfig *aRuleP); +#endif }; // TMimeDirProfileHandler |