[sync] Patches for BlackBerry etc.

Brent J. Nordquist bjn at horde.org
Fri May 27 09:09:52 PDT 2005


Trying to get SyncML working with Sync4j, my BlackBerry 7250, and a Horde
tree checked out from CVS this morning. First off, thanks Karsten for
writing Sync4j.php and SIF support! Sync4j is the only SyncML client I
can find for the BlackBerry at present.

Right now the sync code recognizes device ID "sc-pim-outlook" as needing
Sync4j (SIF) support... however, the BlackBerry Sync4j client sends
"sc-pim-blackberry" (I imagine the others do similar?). The following
patch fixes this for me, and I think would be a good idea for others.

Index: framework/SyncML/SyncML/Device.php
===================================================================
RCS file: /repository/framework/SyncML/SyncML/Device.php,v
retrieving revision 1.3
diff -u -r1.3 Device.php
--- framework/SyncML/SyncML/Device.php	28 Apr 2005 08:24:04 -0000	1.3
+++ framework/SyncML/SyncML/Device.php	27 May 2005 15:44:54 -0000
@@ -57,7 +57,7 @@
         $di = SyncML_Device::deviceInfo();
         
         if (stristr($si, 'sync4j') !== false 
-            || stristr($si, 'sc-pim-outlook') !== false) {
+            || stristr($si, 'sc-pim-') !== false) {
 
             include_once 'Horde/SyncML/Device/Sync4j.php';
             $cmd = &new SyncML_Device_sync4j();
Index: framework/SyncML/SyncML/Device/Sync4j.php
===================================================================
RCS file: /repository/framework/SyncML/SyncML/Device/Sync4j.php,v
retrieving revision 1.3
diff -u -r1.3 Sync4j.php
--- framework/SyncML/SyncML/Device/Sync4j.php	28 Apr 2005 08:24:04 -0000	1.3
+++ framework/SyncML/SyncML/Device/Sync4j.php	27 May 2005 15:44:54 -0000
@@ -29,7 +29,7 @@
  * Conversion to text/vcalendar etc. is done by SifConverter.php
  * The connector seems not support DevInf information, so SyncML_Device can
  * only detect it by the decice ID: so in the connector configuration the
- * device ID must be set to 'sc-pim-outlook' which should be the default 
+ * device ID must be set to 'sc-pim-<type>' which should be the default 
  * anyhow. 
  */
  
Next, I was failing with "Call to a member function on a non-object
in /usr/share/pear/Horde/SyncML.php on line 160". The use of
$GLOBALS['backend'] vs. $backend in that function looks inconsistent
to me. The following patch fixes this error for me, and the logMessage
at line 160 (line 161 after the patch) now prints out... not sure if
this is the "right" fix though.

Index: framework/SyncML/SyncML.php
===================================================================
RCS file: /repository/framework/SyncML/SyncML.php,v
retrieving revision 1.31
diff -u -r1.31 SyncML.php
--- framework/SyncML/SyncML.php	21 May 2005 15:48:18 -0000	1.31
+++ framework/SyncML/SyncML.php	27 May 2005 15:51:20 -0000
@@ -155,6 +155,7 @@
         session_id('syncml' . preg_replace('/[^a-zA-Z0-9]/', '', $sourceURI . $sessionID));
         @session_start();
 
+        global $backend;
         if (!isset($_SESSION['SyncML.state'])) {
             // Create a new state if one does not already exist.
             $backend->logMessage('New session created: '

With this patch, I get farther, but am still failing at other locations
where $backend is properly defined as global, but is not an object
(has been freed by then, or something). I'll post more when I have
better diagnosis.

-- 
Brent J. Nordquist <bjn at horde.org> N0BJN
Other contact information: http://www.nordist.net/contact.html


More information about the sync mailing list