Horde_SyncMl_Device_P800
extends Horde_SyncMl_Device
in package
P800/P900/P910: --------------- Charset: This device is able to handle UTF-8 and sends its XML packages in UTF8.
However even though the XML itself is UTF-8, it expects the enclosed vcard-data to be ISO-8859-1 unless explicitly stated otherwise (using the CHARSET option, which is deprecated for VCARD 3.0)
Encoding: String values are encoded "QUOTED-PRINTABLE"
Other: This devices handles tasks and events in one database.
As the P800 was the first device to work with package, most of the required conversions are in Device.php's default handling.
Copyright 2005-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
- $requestedContentType : string
- The original preferred content type of the client, if provided through DevInf.
- convertClient2Server() : array<string|int, mixed>
- Convert the content.
- convertServer2Client() : array<string|int, mixed>
- Converts the content from the backend to a format suitable for the client device.
- factory() : Horde_SyncMl_Device
- Attempts to return a concrete Horde_SyncMl_Device instance based on $driver.
- getPreferredContentType() : string
- Returns the guessed content type for a database URI.
- getPreferredContentTypeClient() : mixed
- Returns the preferrred MIME content type of the client for the given sync data type (contacts/tasks/notes/calendar).
- handleTasksInCalendar() : bool
- Some devices like the Sony Ericsson P800/P900/P910 handle vtodos (tasks) and vevents in the same "calendar" sync.
- omitIndividualSyncStatus() : bool
- Send individual status response for each Add,Delete,Replace.
- useCdataTag() : bool
- Returns whether the payload data should be enclosed in a [CDATA[ section when sending via XML.
- useLocalTime() : bool
- Returns whether the device accepts datetimes only in local time format (DTSTART:20061222T130000) instead of the more robust UTC time (DTSTART:20061222T110000Z).
- _convertUTC2LocalTime() : string
- Converts an UTC timestamp like "20061222T110000Z" into a local timestamp like "20061222T130000" using the server timezone.
Properties
$requestedContentType
The original preferred content type of the client, if provided through DevInf.
public
string
$requestedContentType
Methods
convertClient2Server()
Convert the content.
public
convertClient2Server(string $content, string $contentType) : array<string|int, mixed>
Parameters
- $content : string
-
The content to convert.
- $contentType : string
-
The contentType of the content.
Return values
array<string|int, mixed> —array($newcontent, $newcontentType): the converted content and the (possibly changed) new ContentType.
convertServer2Client()
Converts the content from the backend to a format suitable for the client device.
public
convertServer2Client(string $content, string $contentType, string $database) : array<string|int, mixed>
Strips the uid (primary key) information as client and server might use different ones.
Parameters
- $content : string
-
The content to convert
- $contentType : string
-
The content type of content as returned from the backend
- $database : string
-
The server database URI.
Return values
array<string|int, mixed> —Three-element array with the converted content, the (possibly changed) new content type, and encoding type (like b64 as used by Funambol).
factory()
Attempts to return a concrete Horde_SyncMl_Device instance based on $driver.
public
factory(string $driver) : Horde_SyncMl_Device
Parameters
- $driver : string
-
The type of concrete Horde_SyncMl_Device subclass to return.
Return values
Horde_SyncMl_Device —The newly created concrete Horde_SyncMl_Device instance, or false on error.
getPreferredContentType()
Returns the guessed content type for a database URI.
public
getPreferredContentType(string $database) : string
When a client sends data during a sync but does not provide information about the MIME content type with this individual item, this function returns the content type the item is supposed to be in.
Parameters
- $database : string
-
A database URI.
Return values
string —A MIME type that might match the database URI.
getPreferredContentTypeClient()
Returns the preferrred MIME content type of the client for the given sync data type (contacts/tasks/notes/calendar).
public
getPreferredContentTypeClient(string $serverSyncURI, string $sourceSyncURI) : mixed
The result is passed as an option to the backend export functions. This is not the content type ultimately passed to the client but rather the content type presented to the backend export functions.
After the data is retrieved from the backend, convertServer2Client() can do some post-processing and set the correct content type acceptable for the client if necessary.
The default implementation tries to extract the content type from the device info. If this does not work, some defaults are used.
If the client does not provice proper DevInf data, this public function may have to be overwritten to return the correct values.
Parameters
- $serverSyncURI : string
-
The URI for the server database: contacts, notes, calendar or tasks.
- $sourceSyncURI : string
-
The URI for the client database. This is needed as the DevInf is grouped by sourceSyncURIs.
Return values
mixed —handleTasksInCalendar()
Some devices like the Sony Ericsson P800/P900/P910 handle vtodos (tasks) and vevents in the same "calendar" sync.
public
handleTasksInCalendar() : bool
This requires special actions on our side as we store this in different databases (nag and kronolith). This public function could directly return true but tries to be a bit more generic so it might work for other phones as well.
Return values
bool —True if tasks and events are processed in a single request.
omitIndividualSyncStatus()
Send individual status response for each Add,Delete,Replace.
public
omitIndividualSyncStatus() : bool
The P800 class of devices seem to have trouble with too many status responses. So omit them for these (and only these),
Return values
bool —False if individual status responses should be send.
useCdataTag()
Returns whether the payload data should be enclosed in a [CDATA[ section when sending via XML.
public
useCdataTag() : bool
The synchronized data may contain XML special characters like &, < or >. Clients might choke when sending these embedded in XML. The data should be enclosed in [CDATA[ in these cases. This applies only to XML, not to WBXML devices.
Return values
bool —True if the data should be enclosed in [CDATA[.
useLocalTime()
Returns whether the device accepts datetimes only in local time format (DTSTART:20061222T130000) instead of the more robust UTC time (DTSTART:20061222T110000Z).
public
useLocalTime() : bool
Return values
bool —True if the client doesn't accept UTC datetimes.
_convertUTC2LocalTime()
Converts an UTC timestamp like "20061222T110000Z" into a local timestamp like "20061222T130000" using the server timezone.
protected
_convertUTC2LocalTime(array<string|int, mixed> $utc) : string
Parameters
- $utc : array<string|int, mixed>
-
Array with a datetime string in UTC.
Return values
string —The datetime string converted to the local timezone.