@@ -54,11 +50,9 @@
* Returns an array of GUIDs for all notes that the current user is
* authorized to see.
*
- * @param string $filter The filter expression the client provided.
- *
* @return array An array of GUIDs for all notes the user can access.
*/
-function _egwcontactssync_list($filter='')
+function _egwcontactssync_list()
{
$guids = array();
@@ -68,7 +62,8 @@
$criteria = array();
$filter = array();
- if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) {
+ if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'])
+ {
$filter['account_id'] = null;
}
@@ -85,7 +80,7 @@
#Horde::logMessage("SymcML: egwcontactssync list generate id for: ". print_r($contact, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
$guids[] = "contacts-".$contact['id'];
-
+
}
#Horde::logMessage("SymcML: egwcontactssync list found ids: ". print_r($guids, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
@@ -99,22 +94,20 @@
*
* @param string $action The action to check for - add, modify, or delete.
* @param integer $timestamp The time to start the search.
- * @param string $type The type of the content.
- * @param string $filter The filter expression the client provided.
*
* @return array An array of GUIDs matching the action and time criteria.
*/
-function &_egwcontactssync_listBy($action, $timestamp, $type, $filter='') {
+function &_egwcontactssync_listBy($action, $timestamp) {
$allChangedItems = (array)$state->getHistory('contacts', $action, $timestamp);
- #Horde::logMessage('SymcML: egwcontactssync listBy $allChangedItems: '. count($allChangedItems), __FILE__, __LINE__, PEAR_LOG_DEBUG);
+ #Horde::logMessage('SymcML: egwcontactssync listBy $allChangedItems: '. print_r($allChangedItems,true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
$allReadAbleItems = (array)_egwcontactssync_list();
- #Horde::logMessage('SymcML: egwcontactssync listBy $allReadAbleItems: '. count($allReadAbleItems), __FILE__, __LINE__, PEAR_LOG_DEBUG);
- $allClientItems = (array)$state->getClientItems();
- #Horde::logMessage('SymcML: egwcontactssync listBy $allClientItems: '. count($allClientItems), __FILE__, __LINE__, PEAR_LOG_DEBUG);
+ #Horde::logMessage('SymcML: egwcontactssync listBy $allReadAbleItems: '. print_r($allReadAbleItems,true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
+ $allClientItems = (array)$state->_getClientItems($state->_currentTargetURI);
+ #Horde::logMessage('SymcML: egwcontactssync listBy $allClientItems: '. print_r($allClientItems,true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
switch ($action) {
case 'delete' :
// filters may have changed, so we need to calculate which
@@ -145,56 +138,27 @@
* @param string $contentType What format is the data in? Currently supports:
* text/plain
* text/x-vnote
- * @param string $guid (optional) The guid of a collision entry.
+ * @param string $notepad (optional) The notepad to save the memo on.
*
* @return string The new GUID, or false on failure.
*/
-function _egwcontactssync_import($content, $contentType, $guid = null)
+function _egwcontactssync_import($content, $contentType, $notepad = null)
{
//error_log("_egwcontactssync_import");
#error_log("SymcML: egwcontactssync import content: ".base64_decode($ccontent)." contentType: $contentType");
- #Horde::logMessage("SymcML: egwcontactssync import content: $content contenttype:\n" . print_r($contentType,true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
-
- if (is_array($contentType)) {
- $contentType = $contentType['ContentType'];
- }
-
- $contactId = null; //default for new entry
-
- if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['addressbook_conflict_category'])) {
- if (!$guid) {
- $guid = _egwcontactssync_search($content, $contentType, null, true);
- }
- if (preg_match('/contacts-(\d+)/', $guid, $matches)) {
- Horde::logMessage("SymcML: egwcontactssync import conflict found for " . $matches[1], __FILE__, __LINE__, PEAR_LOG_DEBUG);
- // We found a conflicting entry on the server, let's make it a duplicate
- if ($conflict = ExecMethod2('addressbook.addressbook_bo.read', $matches[1])) {
- $cat_ids = explode(",", $conflict['cat_id']); //existing categories
- $conflict_cat = $GLOBALS['egw_info']['user']['preferences']['syncml']['addressbook_conflict_category'];
- if (!in_array($conflict_cat, $cat_ids)) {
- $cat_ids[] = $conflict_cat;
- $conflict['cat_id'] = implode(",", $cat_ids);
- }
- if (!empty($conflict['uid'])) {
- $conflict['uid'] = 'DUP-' . $conflict['uid'];
- }
- ExecMethod2('addressbook.addressbook_bo.save', $conflict);
- }
- }
- }
-
- $state = &$_SESSION['SyncML.state'];
+ Horde::logMessage("SymcML: egwcontactssync import content: $content contenttype: $contentType", __FILE__, __LINE__, PEAR_LOG_DEBUG);
+
+ $state = $_SESSION['SyncML.state'];
$deviceInfo = $state->getClientDeviceInfo();
#error_log(print_r($deviceInfo, true));
switch ($contentType) {
case 'text/x-vcard':
- case 'text/vcard':
$vcaladdressbook = new addressbook_vcal();
$vcaladdressbook->setSupportedFields($deviceInfo['manufacturer'],$deviceInfo['model']);
case 'text/x-s4j-sife':
@@ -203,7 +167,7 @@
error_log("[_egwcontactssync_import] Treating bad contact content-type '".$contentType."' as if is was 'text/x-s4j-sifc'");
case 'text/x-s4j-sifc':
$sifaddressbook = new addressbook_sif();
- $contactId = $sifaddressbook->addSIF($content, $contactId);
+ $contactId = $sifaddressbook->addSIF($content);
break;
/**
* Search a memo represented in the specified contentType,
* used for SlowSync to check / rebuild content_map.
*
- * @param string $content The content of the memo.
- * @param string $contentType What format is the data in? Currently supports:
- * text/plain
- * text/x-vnote
- * @param string $contentid the contentid read from contentmap we are expecting the content to be
- * @param boolean $relax=false relaxed matching (lesser fields)
+ * @param string $content The content of the memo.
+ * @param string $contentType What format is the data in? Currently supports:
+ * text/plain
+ * text/x-vnote
+ * @param string $contentid the contentid read from contentmap we are expecting the content to be
*
*
* @return string The new GUID, or false on failure.
*/
-function _egwcontactssync_search($content, $contentType, $contentid, $relax=false)
-{
- #Horde::logMessage("SymcML: egwcontactssync search content: $content contentid: $contentid contenttype:\n" . print_r($contentType, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
-
- $state = &$_SESSION['SyncML.state'];
+function _egwcontactssync_search($content, $contentType, $contentid)
+{
+ Horde::logMessage("SymcML: egwcontactssync search content: $content contenttype: $contentType contentid: $contentid", __FILE__, __LINE__, PEAR_LOG_DEBUG);
+
+ $state = $_SESSION['SyncML.state'];
$deviceInfo = $state->getClientDeviceInfo();
- if (is_array($contentType)) {
- $contentType = $contentType['ContentType'];
- }
switch ($contentType) {
case 'text/x-vcard':
- case 'text/vcard':
$vcaladdressbook = new addressbook_vcal();
$vcaladdressbook->setSupportedFields($deviceInfo['manufacturer'],$deviceInfo['model']);
case 'text/x-s4j-sife':
@@ -264,7 +222,7 @@
#Horde::logMessage("SymcML: egwcontactssync search content: Treating bad contact content-type '$contentType' as if it was 'text/x-s4j-sifc'", __FILE__, __LINE__, PEAR_LOG_DEBUG);
case 'text/x-s4j-sifc':
$sifaddressbook = new addressbook_sif();
- $contactId = $sifaddressbook->search($content, $state->get_egwID($contentid), $relax);
+ $contactId = $sifaddressbook->search($content,$state->get_egwID($contentid));
break;
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge _______________________________________________
eGroupWare-cvs mailing list
eGroupWare-cvs@... https://lists.sourceforge.net/lists/listinfo/egroupware-cvs