summaryrefslogtreecommitdiff
path: root/src/sysync/mimedirprofile.cpp
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2011-07-22 09:04:01 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2011-07-22 09:04:01 +0200
commite3fdd5ca811f24b2f80e598f9d00d2e134aa85e1 (patch)
treeb6afade0cb627e206d297ddc5ac739d5f3ccc7c4 /src/sysync/mimedirprofile.cpp
parentb69d0aecf612d0f009903179619a983706f3b8f7 (diff)
scripting: added READ() method
The READ(filename) method returns the content of the file identified with "filename". Relative paths are interpreted relative to the current directory. On failures, an error messages is logged and UNASSIGNED is returned. This method is useful for inlining the photo data referenced with local file:// URIs shortly before sending to a remote peer. SyncEvolution uses the method in its outgoing vcard script as follows: Field list: <!-- Photo --> <field name="PHOTO" type="blob" compare="never" merge="fillempty"/> <field name="PHOTO_TYPE" type="string" compare="never" merge="fillempty"/> <field name="PHOTO_VALUE" type="string" compare="never" merge="fillempty"/> Profile: <property name="PHOTO" filter="no"> <value field="PHOTO" conversion="BLOB_B64"/> <parameter name="TYPE" default="no" show="yes"> <value field="PHOTO_TYPE"/> </parameter> <parameter name="VALUE" default="no" show="yes"> <value field="PHOTO_VALUE"/> </parameter> </property> Script: if (PHOTO_VALUE == "uri" && SUBSTR(PHOTO, 0, 7) == "file://") { // inline the photo data string data; data = READ(SUBSTR(PHOTO, 7)); if (data != UNASSIGNED) { PHOTO = data; PHOTO_VALUE = "binary"; } } Test cases for inlining, not inlining because of non-file URI and failed inling (file not found) were added to SyncEvolution.
Diffstat (limited to 'src/sysync/mimedirprofile.cpp')
0 files changed, 0 insertions, 0 deletions