/SyncML

SyncML JavaScript implementation as webOs Synergy connector

Primary LanguageJavaScriptMIT LicenseMIT

SyncML on webOs 2.x

This is an implementation of a SyncML client in JavaScript together with an iCal parser to allow webOs to sync a calendar with a SyncML server. Currently this is tested with some SyncML servers, including syncevolution, libsynthesis based stuff, horde/eGroupware, funambol/myFunambol/oneMediahub, Syncfriend.com. Reported to be basically working are O3SIS Server (used by O2 Germany) and Oracle OCS. 

This is also released into the webos-nation feeds and can be installed OTA with Preware. A submission into the app catalog is unlikely at the current time. Maybe in a distant future that might be possibel.

Be sure to have a decent backup for your data! I am not responsible for any data loss or messup of data! The data on your phone "should" be save, a new calendar & addressbook is created, everything else can not be touched by this app. The data on the server can be messed up, if there are misunderstanding between the app and the server. Especially timezone issues might arise. If that happens, please report back!
After the first sync, that puts everything from the server into the device, be sure to check the presentation of the data on the device. If something is awkward, better *NOT* sync back, but report back with a log. 

The sync of contacts is to be added later. Maybe also more datastore types (I'd like notes or todos). You could theoretically use SyncML to sync any type of data, also possibly just in one direction. This could be used for a synergy integrated multimedia sync.

The synergy integration is quite done. The JavaScript SyncML Client and iCal parser work. 

My list of Todo's
- Optimize old eventCallback structure to be more database optimized and collect all adds, updates and deletes to do them in one batch.
- Look into Todo or Note sync that will sync with the onboard tasks / memos apps.
- Abuse multiple calendars as replacement for category support in the calendar app (maybe not necessary if a newer, more fancy calendar app of Open webOS will support categories? ;))
- make error messages more readable (especially: 404 on alert => wrong datastore path, no connection => might be internal server error (funambol likes to do that!),...)

Pull requests are welcome! :)
Released under MIT license.

State of the software:
Known Issues:
- x-vcalendar implementation does not yet support b64ecoding/decoding.
- O3SIS Server (like O2 Germany operates for its customers) does not understand our device info and therefore will not send more complicated recurring events to me.
- Can't interpret "DAYLIGHT" string, yet. Need to extract TZID from that.
- Still some errors won't return from service to caller...
- 500 internal server error for onemediahub.com during check credentials. Hm. How to resolve that? 
- shiftAllday won't work if server and client are in different timezones, causes issues with alarms having wrong offsets.. hm. Need to evaluate again.
- Create account from the account app won't work on TouchPad.
- Issue with funambol server: they don't seem to support the "COUNT" keyword => for server id "funambol" modify "COUNT" RRULES into UNTIL.
- contacts don't show up on touchpad. => do I extend something wrong?
- service dies if a sync with too many items from the device (i.e. a slow sync with a huge database) is started. :(

Changelog:
2013-06-19 => 0.1.32
- fixed statistics that are saved in db.
- fixed possible issue that immediate refresh (on slow sync hack) would not happen. Now immediate refresh flag is saved in db.
- fixed possible issue that service won't finish
- fixed retry mechanism. It could keep on trying, even if the message was received or it should stop after 5 retries...
- fixed timeout while calling idle assistant
- fixed wrong message about failed syncs when no changes did happen at all.
2013-06-18 => 0.1.31
- service could get killed before sync did finish. Hope to have a fix for that now.
- service periodically prints out its memory usage to the log, now.
- slow sync hack now outputs item statistics for first sync, too.
2013-06-15 => 0.1.30
- changed disable slow sync hack, so that sync is now visible in app again.
2013-06-14 => 0.1.29
- fixed rev for delete all. Will not send all delete commands to server, if no update did happen.
- hack to disable slow sync. Now only sends recent changes to server and then does a refresh from server.
- readded add, needed for contacts on eGroupware
2013-06-14 => 0.1.28
- syncml account now stores server manufactor for hacks
- server next is now again saved in db directly when it is recieved. Should prevent some slow syncs.
- fixed x-vcard and vcard version confusion
- added hacks for eGroupware
2013-06-11 => 0.1.27
- switched to vCard (3.0)
- fixed issues with contact sync and notes (from server)
- implemented foto sync for contacts (one way from server)
- switched back to internet confidence "fair".
- fixed an issue with contact sync, won't work if synced for the very first time.
- disabled "add" again. Now also for new items "replace" is used. Never encountered a server that will not just fallback to "add". But explicit "add" did produce many double entries, sometimes.
2012-12-06 => 0.1.26
- quick-fix for an issue with contact sync, won't work if directory for temporary vCards is not present. Sorry, broke that.
2012-11-12 => 0.1.25
- fixed an issue with account creation that would hang the service on first sync, if account was created from the app. Sorry for that.
- fixed some more crashes during account creation and initial sync... not sure why they happend, though. :( No initial sync is performed now, you need to do that manually.
- fixed issue with allday events and alarms that would shift one hour (again? :()
- fixed issue with contact encoding stuff, should be fine now.
2012-10-08 => 0.1.24
- fixed issue that app would forget "one-way-from-server" or "one-way-from-client" on server requested slow syncs.
- fixed all time stats for failed syncs.
- changed required confidence level to "excellent"... even on fair syncs seem to fail quite often. Please see if syncs are happening at all, now.
2012-10-07 => 0.1.23
- fixed issue with sync of multiple data sources.
- fixed check credentials issue for funambol servers (like privat ones or onemediahub.com)
- results of last 10 syncs are now saved in db (i.e. if sync was ok, method of sync, how many objects were changed)
- implemented first *experimental* version of contact sync
2012-08-22 => 0.1.22
- fixed timeout mechanism
- fixed issue with two-way-sync if there was no data transmitted at all.
2012-08-15 => 0.1.21
- changed watch activity so that it delays for 1 minute, so the user has enough time to complete his changes. Every new change during that 1 minute will delay the sync further.
- changed requirement of activities to "internetConfidence: fair" so the syncs should have a higher probability to complete, now.
- changed behaviour, service now tries to "add" events on the server, until now only "replace" was called, no matter if they were new or not.
2012-08-01 => 0.1.20
- fixed app to work after profil restore, username + password cannot be decrypted and need to be configured again. Also a refresh-from-server sync is triggered.
- added additional timeout guard for network connections, so they (hopefully) don't hang forever on bad reception.
- now lastRev is reset on a slow-sync or refresh. This will also help after profile restore.
2012-07-10 => 0.1.19
- fixed activities, they don't need to be deleted anymore.
- fixed issue where for one account there could be multiple calendars.
- fixed issue that prevented service from shutting down after sync if the app was still open.
2012-07-05 => 0.1.18
- "Sync Now" in calendar app works
- a back from sync did overwrite data in the accounts after a successful sync. This could trigger unecessary slow syncs and duplication on the server.
- fixed that app pops up during configuration of a new account in account manager
- now shows what sources are synced with what method in the app/log.
- fixed push device info (check for refreshs did not work), also changed that we now also request the device info on refreshs/slow sync.
2012-07-04 => 0.1.17
- Implemented automatic sync. There is a periodic sync and a db watch. Both can be enabled/disabled in the config scene for each account. db watch is pretty experimental.
- Changed device info behaviour: Own device info is only send if no device info from server is present or if we are doing a refresh or slow sync.
2012-06-11 => 0.1.16
- fixed possible service crash during delete on server.
2012-06-02 => 0.1.15
- enabled b64 encoding of iCal data. Helps with not confusing XML parsers.
- added X-AlldayEvent cue for syncfriend.com.
- no VALARM for x-vcalendar.
- tried to fix allday for x-vcalendar.
2012-06-01 => 0.1.14
- again doing UTC behaviour. TZID=... seems to be ignored if VTIMEZONE is not there. This should be perfectly fine for all normal events with start/endtime. Issues might arise with allday events, though. Need to test more servers with our shift allDay behaviour (eGroupware works ;)).
- implemented support for X-FUNAMBOL-ALLDAY and X-MICROSOFT-CDO-ALLDAYEVENT allday cues.
- fixed bug that prevented slow sync from working at all :(
- fixed retry send message mechanism
2012-05-31 => 0.1.13
- reverted the UTC behaviour. Now sending TZID=... parameter. Issue: ical rfc requests VTIMEZONE for that also. I'm not sure if we can create that one... issue with UTC is allday events. Always the same trouble. :(
2012-05-31 => 0.1.12
- fixed tz issue, now transfering everything as UTC.
- changed behaviour of old log files to not truncate but move them.
2012-05-28 => 0.1.11
- fixed reset service
- added some hacks to support Syncfriend.com
- added some fixes to support alarm parsing from OCS server.
2012-05-27 => 0.1.10
- fixed possible failure if put device info is not supported.
- set delete event not to purge db to prevent alarms from sticking.
- cleaned up MimeTypes in device info (thanks to Matthias)
2012-05-26 => 0.1.9
- fixed issues with account creation and deletion on webOS 2.1.1.
- hotifx: fixed issue with account management if no account was present, yet.
- hotfix: fixed issue with keymanager if no key was present, yet.
2012-05-26 => 0.1.8
- hopefully solved deadlock during account creation.
- locks for the service calls are now much less restrictive
- app can even reattach to a running sync. :)
- solved issue where all controls in configScene would be disabled if service was still running after create account from account app.
- solved another issue with syncEvolution
- improved account deletion, possible associated webOS accounts will be deleted again.
2012-05-23 => 0.1.7
- changed behaviour to not send last anchor, if not present.
- fixed account creation / modification / deletion from app.
2012-05-22 => 0.1.4
- implemented "local" fix of AjaxCall to work with non standard http ports.
- added "Delete this account" - Button to config scene to delete accounts. Deletes accounts only from the apps db. If there exists a webOS account, delete it from the accounts app (should also delete app's account object).
- tried to add some more error messages to log files.
- fixed issue with attached E-Mail log (thanks to Matthias)
2012-05-21 => 0.1.3
- fixed possible issue during parsing of device data from server
- fixed locking up of modifyAccount calls during storeAccount. Race condition with onCredentialsChanged call. We don't really use onCredentialsChanged, anyway.
- fixed issues were the app lost connection to the service and would hang forever in the sync scene. (Now this only happens if the service itself crashes)
- fixed account icons 
2012-05-20 => 0.1.2
- Ignoring 406 errors = optional feature not supported. Maybe that helps with oracle server.
- Added menu entry to reset the service. Only use this if you are sure that the service hangs and you don't want for it to timeout ( one minute without action ). 
2012-05-20 => 0.1.1
- added repairDBPermission.sh script into app folder to repair db permissions. Issues might arise, if the app was installed before submitted to webos nation. Careful: Script might delete all data.
2012-05-20 => 0.1.0
- Major change: Implemented node.js service. 
- App only calls service functions
- Cleaned up log in the app itself considerably!
- Writing exhaustive log to /media/internal/.info.mobo.syncml.log (accessible in usb-mode)
- Not logging passwords (hopefully)
- Passwords and usernames stored only encrypted
- Integration into account app, delete and disable / enable of calendar/contacts works
- Create from account manager works partially (need to find out how to prevent it from spawning the welcome scene and popping it to front)
- E-Mail log improved, adds log-file as attachment
- log is truncated at 2MB, that means many sync processes can be kept in log and logs can be send way after the sync process that failed.
2012-05-17 => 0.0.16
- added a status description above log output. Should help with outside errors, like wrong credentials or connection aborts.
- changed behavior, app won't suggest slow sync (happened too often). On broken sync the server should request a slow sync anyway.
2012-05-14
- fixed some issues with account creation. Should now work again.
- now 0.0.15 is sending capability description to the server. This might help in some cases where synchronization is not working. Hopefully this does not break anything.
- app now is using the full screen on a Pre3. 
2012-05-01
- fixed a bug that prevented events with recurrence on a first Sunday of a month to be handled correctly.
- fixed a bug that prevented aalarms to be interpreted correctly. 
2012-04-25
- fixed bug that prevent any action if no account was specified.
2012-04-24
- improved the app to force initialization to happen before sync can be started. As a side effect sync is now started automatically in the sync scene.
- changed the app icon.
2012-04-22
- service can now load the complete syncml library. Great step towards real synergy integration and background sync.
2012-04-20
- app now selects first account automatically
2012-02-07
- fixed a bug that changed the msgId for repeated msg tries.
- repaired service configuration, service can now be started, but does not have functionalities.
2012-02-02
- fixed a bug that sended deletes to the server until a change (other than a delete) on the client device happened.
- fixed a bug with restored profiles that prevented changes from the device to be send to the server during a fast sync
2012-01-29
- fixed bug that prevented iCal->webOs time conversion to fail for UTC times denoted by a "Z" in the time string and no TZID field.
- first steps in implementing the service, but is still crashing during startup.
2012-01-21
- implemented x-vcalendar support for recurring events. Now older server should work properly.
2012-01-19
- implemented x-vcalendar support for servers like O2. Missing: Support for recurring events. 
- implemented quoted_printable and utf-8 support for x-vcalendar
- fixed a bug that prevented events without timezone information from completing iCal => webOs conversion.
- fixed a bug that prevented incoming, not repeating events, to show up in the device calendar
2012-01-18
- Supplied most funcitions with try/catch blocks to make system more robust and ease debugging
- implemented retry mechanism if empty response is received (how to systematically test that??)
- fixed a bug that prevented server updates from deleting fields in webOs.
- fixed some bugs that prevented updates from client to server.
- O2 currently really broken. Need to add support for x-vcalendar = iCal 1.0. :(
2012-01-17
- Added abilty to repair missformated XML if &,< or > characters are in unencoded item data.
- Fixed timezone issue. Now using Timezone Manager from frameworks/calendar. Might be forbidden for app catalog. But precentral is also fine for distribution...
2012-01-12
- Tried to fix some issues I had with O3SIS SyncML Server (used by O2 Germany):
  - allDay issue fixed. 
  - Alarm partly fixed (sometimes alarm does not appear on server, need to investigate further).
  - Detected new character encoding problem.
  - Still the server does not accept my device info, don't know why.
older:
- Modified app to allow to send logs per E-Mail

.