[sync] Only mobile numbers syncing from Synthesis

Deryk Piper deryk-lists at mod-soft.com
Fri Jul 25 10:55:45 UTC 2008


Looks like this was resolved in bug 7011.

I didn't want to touch turba/lib/driver.php as I wasn't sure if the elseif
conditions were there for a good reason.

However... if there are multiple numbers - say, multiple work numbers, as in my
example below - Turba will still only import the last work number.  This is
often the secondary or tertiary number of that type, as Synthesis seems to put
the primary number first (but certainly adds the X-Synthesis-Ref1 tag to it).

Because of that, my approach was to add the following to convertClient2Server()
in lib/syncml/device/synthesis.php:

// ... delete X-Synthesis-Ref1 tag
$content = preg_replace('/;X-Synthesis-Ref1(:|;)/',
                        '\1', $content);
// ... and remove any other *values* containing X-Synthesis-Ref*
$content =
preg_replace('/(\r\n|\r|\n).*;X-Synthesis-Ref\d+(:|;).*(\r\n|\r|\n)/',
                        '\1', $content);
// ... and finally delete all X-Synthesis-* tags
$content = preg_replace('/;X-Synthesis-.*(:|;)(.*)/',
                        '\1', $content);

It's not pretty - again I'm not a PHP programmer - but the gist is that only the
Ref1 tag is kept and all others are removed.  There's probably a
cleaner/better/safer way to do this, and it should be changed to work on TEL
fields only since apparently Turba can handle multiple email addresses using
allow_multi (I haven't tested this though).

DP


Quoting Deryk Piper <deryk-lists at mod-soft.com>:

> Running the following:
>
> - Horde 3.2.1
> - Turba 2.2.1
> - Kronolith 2.2
> - Nag 2.2
> - Synthesis SyncML Client STD for Windows Mobile v3.0.2.22 (demo)
>
> It seems that only the mobile phone number is being uploaded from the
> device.  The problem appears to be the " X-Synthesis-Ref" in the following,
> from data.txt:
>
> TEL;HOME;VOICE;X-Synthesis-Ref1:(123) 456-7890
> TEL;WORK;VOICE;X-Synthesis-Ref1:(234) 567-8901
> TEL;WORK;VOICE;X-Synthesis-Ref2:(345) 678-9012
> TEL;CELL;VOICE;X-Synthesis-Ref1:(456) 789-0123
>
> This fails the elseif() block on line 1584 in turba/lib/driver.php:
>
>                 } elseif (count($item['params']) <= 1 ||
>                           (count($item['params']) <= 2 &&
>                            isset($item['params']['VOICE']))) {
>
> I would think the right answer is to strip out "X-Synthesis-Ref", perhaps in
> convertClient2Server() in lib/syncml/device/synthesis.php ???
>
> This is an educated guess - I'll attempt it later and see what happens (I'm
> not well-versed in PHP or Horde's inner workings).
>
> Thanks,
>
> DP
>
>
>
> --
> sync mailing list - Join the hunt: http://horde.org/bounties/#sync
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: sync-unsubscribe at lists.horde.org







More information about the sync mailing list