From: Eduardo P. H. <eha...@co...> - 2005-04-25 18:37:32
|
On Mon, Apr 25, 2005 at 06:53:22PM +0100, Matthew Kay wrote: > Hi all, Hi, Matthew, >=20 > I've written some Python code to help me back up my addressbook from my > phone, using gnokii. I'd love to help Opensync by augmenting this into > an Opensync plugin. However, there are a few preliminary things I wanted > to raise. Do you know which protocol does gnokii implement, to access your phone? >=20 > Firstly, the best thing is presumably to convert the information from > gnokii into your XML format. However, I haven't been able to find the > documentation on this format - could you direct me to it? Not necessarily. You tell opensync on which format the data you reported is. You can use the existing formats (e.g. "vcard"), or write a plugin for your own format. The xml format is mostly used internally, as it isn't even reported as plain xml, but a libxml2 xmlDoc object on memory. If you plan to write your plugin in python (and test our brand new [untested] python plugin support code :), the better option would be just report the data as vcard, because it wouldn't be possible to report the xml format, as it is expected to be a C struct. I don't know if the xml format is documented, somewhere. I am used to look at the sources to check which fields should be set. Armin may give you more information. So, you have two choices: - Convert the data to vcard or the xml format before reporting it to opensync. This is the "quick" way, as you just need to write your plugin and not care about making a format-plugin - Report the data in the format that is reported by your device, or by gnokii, and write a format-plugin to handle this format and and provide functions convert it from/to an already supported format. Then the gnokii-plugin would report the data on this format, and the conversion code on opensync will convert it to the right format when writing it to other devices. This is the preferred way of handling data on other formats, but has the additional work of writing the format plugin, and then write your gnokii plugin. But it shouldn't be so complex, as for the previous approach, you'll need to write a conversion function from gnokii to a know format, anyway Again, if you plan to write your plugin in python, you'll need to choose the first approach, because format-plugins in python aren't supported, currently. >=20 > Also, the information you get from gnokii is much less rich than the > information you get from evolution, for instance. For example, there's > no birthday field from gnokii. How does that sort of consideration > affect a plugin? It should work. But currently, the only problem is: if you change the data on your phone, additional fields on the other device (i.e. on evolution), will be dropped and your item on evolution will be replaced by the "less rich" version from your phone. To avoid this, we need to implement a feature called "merging", that is not supported by opensync, yet. >=20 > Typically, you get this sort of info from a gnokii plugin: >=20 > 159. Name: Kay Matt > Number: +44xxxxxxxxxxx > Group id: 5 > Preferred number: +44xxxxxxxxxxx > Cellular number: +44xxxxxxxxxxx > Email address: m_...@fa... > Business number: +44xxxxxxxxxxxx > Home number: +44xxxxxxxxxxxx > Notes: blabla >=20 > The number at the top (here, 159) is the memory location in the phone > where the entry is stored. This is needed when you want to overwrite an > entry in the phone - you can't just direct it by name. The group ID is > something specific to the phone and wouldn't need to be synchronised - > it's the friends/family thing. The number at the top would be the UID your plugin would report. The group id could be translated to a category, when converting the data to a known format. >=20 > Do you think it's feasible to do this? I might need a bit of helpful > advice with writing the plugin, but would be happy to give it a go. I think it is really feasible. But I guess it would be better to write a plugin for the protocol your phone uses. But I am not sure what would be better, as I don't know how gnokii works, and which protocols it supports. >=20 > Best wishes, > Matt >=20 --=20 Eduardo |