diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2011-01-25 16:18:44 +0100 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2011-01-25 16:18:44 +0100 |
commit | e8b3e088fdc894cade81472412817c01c7cef57f (patch) | |
tree | 71107ad445862be5f4a5817b2c7cafae0d87865d | |
parent | 758c5d62b5db02bebd4b1918a19bb7d22bfd9cb9 (diff) |
MAKE/PARSETEXTWITHPROFILE(): allow rule parameter to influence global conversion options
So far the optional rule parameter was only used to select properties
in the profile via their "rule" parameter. In contrast to a sync session,
it wasn't possible to enable <noemptyproperties>, for example.
This patch makes that possible by extending the
TMimeDirProfileHandler::setRemoteRule() semantic: now each rule and
its sub-rules are also check for relevant conversion settings. Because
there is no session where these settings could be stored, some code had
to be copied from TSyncSession::checkRemoteSpecifics(). For the sake of
completeness, all settings which do not apply are still in the patch
as lines that were commented out.
Because setRemoteRule() is not used outside of these two script macros
(clarified in a comment), this change has no negative effect on
syncing.
-rw-r--r-- | src/sysync/mimedirprofile.cpp | 37 | ||||
-rwxr-xr-x | src/sysync/mimedirprofile.h | 7 |
2 files changed, 42 insertions, 2 deletions
diff --git a/src/sysync/mimedirprofile.cpp b/src/sysync/mimedirprofile.cpp index b0b7a20..df5a0b6 100644 --- a/src/sysync/mimedirprofile.cpp +++ b/src/sysync/mimedirprofile.cpp @@ -5212,16 +5212,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 faf2b65..282b5e0 100755 --- a/src/sysync/mimedirprofile.h +++ b/src/sysync/mimedirprofile.h @@ -474,6 +474,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) @@ -669,6 +672,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 |