Data Tranformation functions
[Client DLL]

Collaboration diagram for Data Tranformation functions:

Modules

 Static SIF Fields tables
 VObject conversion functions

Functions

WinItemcreateWinItem (bool useSIF, const std::wstring itemType)
 Creates an empty WinItem object of the desired type (Client to Server).
WinItemcreateWinItem (bool useSIF, const std::wstring itemType, const std::wstring &data, const WCHAR **sifFields)
 Creates and fills a WinItem object of the desired type (Server to Client).
SyncItem * convertToSyncItem (ClientItem *cItem, const char *dataType, const std::wstring &defaultFolder)
 ClientItem object -> SyncItem object (client to server).
int fillClientItem (const std::wstring &sif, ClientItem *cItem, const std::wstring &itemType, const WCHAR *dataType)
 data string (SIF/VCard/.
WCHAR ** getProperSifArray (const std::wstring &type)
 Utility to return the right pointer to the static WCHAR** array of SIF fields, given the 'type' itemType.
int normalizeExceptions (ClientItem *cItem, itemKeyList &allItems, itemKeyList &allItemsPaths)
int deleteOccurrencesInInterval (const DATE startDate, const DATE originalDate, ClientRecurrence *cRec)
 Deletes all existing occurrences in the interval [startDate - originalDate[ , from ClientRecurrence object 'cRec'.
int setRecurrenceExceptions (ClientItem *cItem, std::list< std::wstring > &excludeDates, std::list< std::wstring > &includeDates)
 Sets the appointment exceptions for the item passed (server to client).
int checkIllegalXMLChars (char *data)
 Check for illegal XML chars inside 'data'.
std::wstring getVPropertyValue (const std::wstring &dataString, const std::wstring &propertyName)
 Get a property value from a string formatted vCard / vCalendar.
void replaceDefaultPath (std::wstring &path, const std::wstring &defaultFolder)
 Replaces the 'defaultFolder' string with "DEFAULT_FOLDER" inside 'path'.

Function Documentation

int checkIllegalXMLChars ( char *  data  ) 

Check for illegal XML chars inside 'data'.

Chars < 0x20 are converted to 0x20 (space) - preserved '' '
' ''.

Parameters:
data [IN/OUT] the buffer to analyze
Returns:
1 if some char is converted, 0 otherwise

Referenced by convertToSyncItem().

SyncItem* convertToSyncItem ( ClientItem cItem,
const char *  dataType,
const wstring &  defaultFolder 
)

ClientItem object -> SyncItem object (client to server).

SyncItem data is the string generated from all ClientItem properties. Data is converted into SIF or other mime types, based on 'dataType' parameter.

Parameters:
cItem [INPUT] pointer to ClientItem
dataType the mime type of data we want into the SyncItem (SIF/VCard/...)
defaultFolder the default folder path for this syncsource
Returns:
the (new allocated) SyncItem object. Returned pointer MUST be freed by the caller

References checkIllegalXMLChars(), createWinItem(), ClientAppException::formatOriginalDate(), ClientRecurrence::getException(), ClientRecurrence::getExceptionsCount(), WinEvent::getExcludeDates(), ClientItem::getID(), ClientApplication::getInstance(), ClientItem::getParentPath(), getProperSifArray(), ClientRecurrence::getProperty(), ClientItem::getProperty(), WinTask::getRecPattern(), ClientTask::getRecPattern(), WinEvent::getRecPattern(), ClientAppointment::getRecPattern(), ClientApplication::getTimezone(), ClientItem::getType(), ClientApplication::getVersion(), ClientAppointment::isAllDayEvent(), isSIF(), recurrenceFields, WinItem::removeElement(), replaceDefaultPath(), WinContact::setPhotoType(), WinItem::setProperty(), WinEvent::setTimezone(), and WinItem::toString().

Referenced by WindowsSyncSource::getFirstItem(), WindowsSyncSource::getFirstNewItem(), WindowsSyncSource::getFirstUpdatedItem(), WindowsSyncSource::getNextItem(), WindowsSyncSource::getNextNewItem(), and WindowsSyncSource::getNextUpdatedItem().

WinItem* createWinItem ( bool  useSIF,
const wstring  itemType,
const wstring &  data,
const WCHAR **  sifFields 
)

Creates and fills a WinItem object of the desired type (Server to Client).

Fills the WinItem map parsing the passed 'data' wstring.

Parameters:
useSIF true if we use SIF data
itemType the item type ("contact", "task", ...)
data the data input string to parse
sifFields pointer to the static array of SIF fields used
Returns:
a new allocated WinItem* of the desired type (WinContact, WinEvent,...)

References recurrenceFields.

WinItem* createWinItem ( bool  useSIF,
const wstring  itemType 
)

Creates an empty WinItem object of the desired type (Client to Server).

Parameters:
useSIF true if we use SIF data
itemType the item type ("contact", "task", ...)
Returns:
a new allocated WinItem* of the desired type (WinContact, WinEvent,...)

Referenced by convertToSyncItem(), WindowsSyncSource::extractFolder(), and fillClientItem().

int deleteOccurrencesInInterval ( const DATE  startDate,
const DATE  originalDate,
ClientRecurrence cRec 
)

Deletes all existing occurrences in the interval [startDate - originalDate[ , from ClientRecurrence object 'cRec'.

When an occurrence is found in the given interval, a proper exception is added to 'cRec' (a 'deleted occurrence' exception).

Parameters:
startDate : the start date (included in interval)
originalDate : the original date (excluded from interval)
cRec : the ClientRecurrence pointer to work on
Returns:
the number of occurrences deleted ( = number of exceptions created in cRec)

References ClientRecurrence::addException(), ClientRecurrence::getOccurrence(), ClientAppException::setDeleted(), and ClientAppException::setOriginalDate().

int fillClientItem ( const wstring &  data,
ClientItem cItem,
const wstring &  itemType,
const WCHAR *  dataType 
)

data string (SIF/VCard/.

..) -> ClientItem (server to client). Fill the passed ClientItem object with all properties from 'data' string. Data is parsed from SIF or other mime types, based on 'dataType' parameter.

Parameters:
data : the input string to read from
cItem : [IN-OUT] the ClientItem object to fill
itemType : the type of item (contact/task/...)
dataType : the mime type of data sent by server
Returns:
0 if no errors

References createWinItem(), WinEvent::getExcludeDates(), WinEvent::getIncludeDates(), getProperSifArray(), WinItem::getProperty(), WinTask::getRecPattern(), ClientTask::getRecPattern(), WinEvent::getRecPattern(), ClientAppointment::getRecPattern(), WinEvent::getTimezone(), WinEvent::hasTimezone(), isSIF(), recurrenceFields, ClientRecurrence::setHasTimezone(), ClientRecurrence::setProperty(), ClientItem::setProperty(), setRecurrenceExceptions(), ClientRecurrence::setRecurringTimezone(), and ClientAppointment::setRecurringTimezone().

Referenced by WindowsSyncSource::addItem(), and WindowsSyncSource::updateItem().

std::wstring getVPropertyValue ( const wstring &  dataString,
const wstring &  propertyName 
)

Get a property value from a string formatted vCard / vCalendar.

Parses the string, and returns the property value from the passed name.

Note:
Used if vObject is not available, to parse properties it's better to use the vConveter::parse() method.
Parameters:
dataString the input string (vCard/vCalendar)
propertyName the name of property to retrieve
Returns:
the property value (empty if not found)

void replaceDefaultPath ( wstring &  path,
const wstring &  defaultFolder 
)

Replaces the 'defaultFolder' string with "DEFAULT_FOLDER" inside 'path'.

We need to temporary add a "\" char at the end, to avoid replacing folders names such as "\\Personal Folder\Contacts2" into "DEFAULT_FOLDER2".

Parameters:
path the wstring to search (IN/OUT: it can be modified here)
defaultFolder the wstring to search for

Referenced by convertToSyncItem().

int setRecurrenceExceptions ( ClientItem cItem,
list< wstring > &  excludeDates,
list< wstring > &  includeDates 
)

Sets the appointment exceptions for the item passed (server to client).

Exceptions dates are passed with 2 lists 'escludeDates' and 'includeDates'. Each exception found is set into a ClientAppException object. Each ClientRecurrence object can have a list of ClientAppExceptions. All exceptions are finally saved to Outlook when calling the method 'save()' of the corrispondent ClientAppointment object.

  • Deleted occurrences are normally added to Client
  • Added occurrences are not supported by Outlook -> a new (unlinked event) is created -> the item is modified itself, must be added next sync to the MOD items list

Parameters:
cItem : the ClientItem object to modify (it's an appointment)
excludeDates : a list of exclude-dates (occurrences to delete)
includeDates : a list of include-dates (occurrences to add)
Returns:
0 if exceptions saved with no errors. 1 if not recurring (nothing done). -1 if errors.

References ClientRecurrence::addException(), ClientItem::copyItem(), ClientItem::getID(), ClientItem::getParentPath(), ClientItem::getProperty(), ClientAppointment::getRecPattern(), getSafeItemName(), readDataPath(), ClientRecurrence::resetExceptions(), ClientItem::saveItem(), ClientAppException::setDeleted(), ClientAppException::setOriginalDate(), ClientItem::setProperty(), systemTimeToDouble(), and writeToFile().

Referenced by fillClientItem().


Generated on Tue Apr 6 13:00:40 2010 for Funambol Outlook Plug-in Library by  doxygen 1.5.7.1