Re: sync with Motorola A780
"Alexandre d'Alton" <multisync-jojFES6RfZNxtahE/[email protected]>
| Newsgroups | gmane.comp.gnome.apps.multisync.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, I've managed to make sync work with my phone, not over GPRS, but with USB by modifying multisync a bit. I've attached the patch against version 0.82, if you want to try, I'd be interrested if you tell me if it worked with GPRS, Thanks, Alex. > Hi, > > I'm trying to get multisync work with Motorola A780 (over GPRS). I'm > using latest daily snapshot with syncml and Evolution 2.2. > > It seems that the phone makes the request, but multisync does not answer > and eventually the phone gives "Unable to connect to sync server" error. > > Any help will be much appretiated. A780 is a Linux-based > phone and it would be a shame if I cannot make it work ;) >
multisync.patch
(application/octet-stream, 6.4 KB)
diff -urN multisync-0.82/plugins/syncml_plugin/src/gui.c multisync-0.82-a780/plugins/syncml_plugin/src/gui.c
--- multisync-0.82/plugins/syncml_plugin/src/gui.c 2004-04-12 23:03:23.000000000 +0200
+++ multisync-0.82-a780/plugins/syncml_plugin/src/gui.c 2005-03-29 17:07:29.000000000 +0200
@@ -26,13 +26,13 @@
"devinfobutton")), FALSE);
gtk_entry_set_text(GTK_ENTRY(lookup_widget(syncmlwindow, "calendarentry")),
- "calendar");
+ "events");
gtk_entry_set_editable(GTK_ENTRY(lookup_widget(syncmlwindow,
"calendarentry")), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(syncmlwindow,
"calendarentry")), FALSE);
gtk_entry_set_text(GTK_ENTRY(lookup_widget(syncmlwindow, "phonebookentry")),
- "addressbook");
+ "contacts");
gtk_entry_set_editable(GTK_ENTRY(lookup_widget(syncmlwindow,
"phonebookentry")), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(syncmlwindow,
diff -urN multisync-0.82/plugins/syncml_plugin/src/syncml_cmd.c multisync-0.82-a780/plugins/syncml_plugin/src/syncml_cmd.c
--- multisync-0.82/plugins/syncml_plugin/src/syncml_cmd.c 2004-04-12 23:03:23.000000000 +0200
+++ multisync-0.82-a780/plugins/syncml_plugin/src/syncml_cmd.c 2005-03-31 11:13:56.000000000 +0200
@@ -194,7 +194,7 @@
return(len);
}
-// Receive all data on a stream until EOF. Return as g_malloc'ed block.
+// Receive all data on a stream until EOF. Return as g_malloc'ed block
int syncml_conn_recv_all(syncml_state *state, char **data) {
int len = 0;
*data = NULL;
@@ -362,18 +362,30 @@
char *syncml_xml_out_convert(syncml_state *state, char *in, int *outlen) {
char *ret = NULL;
#if USE_LIBWBXML
+ char doctype[] = "-//SYNCML//DTD SyncML 1.0//EN";
if (in && state->wbxml) {
WB_UTINY *wbxml = NULL, *xml;
WB_LONG wbxml_len = 0;
WBXMLError res = 0;
- WBXMLConvXML2WBXMLParams params = {WBXML_VERSION_11, TRUE, TRUE};
+ WBXMLConvXML2WBXMLParams params = {WBXML_VERSION_12, TRUE, TRUE};
xml = in;
if ((res = wbxml_conv_xml2wbxml(xml, &wbxml, &wbxml_len, ¶ms)) ==
WBXML_OK) {
- ret = g_malloc(wbxml_len);
+ int strtablen;
+ ret = g_malloc(wbxml_len + strlen(doctype) + 1);
+ /*
+ ret[0] = 0x2;
+ ret[1] = 0;
+ strtablen = ret[2] = ret[4];
+ ret[3] = wbxml[3];
+ ret[4] += strlen(doctype) + 1;
+ memcpy(ret+5, wbxml+5, strtablen);
+ memcpy(ret+5+strtablen, doctype, strlen(doctype)+1);
+ memcpy(ret+5+strtablen+strlen(doctype)+1, wbxml+5+strtablen, wbxml_len-5-strtablen);
+ */
memcpy(ret, wbxml, wbxml_len);
if (outlen)
- *outlen = wbxml_len;
+ *outlen = wbxml_len /*+ strlen(doctype) + 1*/;
wbxml_free(wbxml);
g_free(in);
return(ret);
@@ -808,7 +820,7 @@
state->connfd = -1;
state->syncmlversion = SYNCML_VER_11;
state->wbxml = FALSE;
- state->usedauth = state->defaultauth = SYNCML_AUTH_MD5;
+ state->usedauth = state->defaultauth = SYNCML_AUTH_BASIC;
state->userdata = userdata;
state->statefilename = g_strdup(statefilename);
syncml_reset_state(state); // Reset the sync engine state
diff -urN multisync-0.82/plugins/syncml_plugin/src/syncml_engine.c multisync-0.82-a780/plugins/syncml_plugin/src/syncml_engine.c
--- multisync-0.82/plugins/syncml_plugin/src/syncml_engine.c 2004-04-12 23:03:23.000000000 +0200
+++ multisync-0.82-a780/plugins/syncml_plugin/src/syncml_engine.c 2005-03-31 14:16:42.000000000 +0200
@@ -191,13 +191,24 @@
node = xmlNewChild(hdr, NULL, "Target", NULL);
xmlNewChild(node, NULL, "LocURI", state->otherURI);
+ xmlNewChild(node, NULL, "LocName", "moto");
node = xmlNewChild(hdr, NULL, "Source", NULL);
- xmlNewChild(node, NULL, "LocURI", state->myURI);
+ xmlNewChild(node, NULL, "LocURI", "BVRP SyncML Server"/*state->myURI*/);
// For debugging
- //node = xmlNewChild(hdr, NULL, "Meta", NULL);
- //node = xmlNewChildInt(node, NULL, "MaxMsgSize", 2000);
+ node = xmlNewChild(hdr, NULL, "Meta", NULL);
+ xmlNewChildInt(node, NULL, "MaxMsgSize", 10000);
+ xmlNewProp(node, "xmlns", "syncml:metinf");
+ {
+ xmlNodePtr cred = xmlNewChild(hdr, NULL, "Cred", NULL);
+ xmlNodePtr meta = xmlNewChild(cred, NULL, "Meta", NULL);
+ node = xmlNewChild(meta, NULL, "Type", "syncml:auth-basic");
+ xmlNewProp(node, "xmlns", "syncml:metinf");
+ node = xmlNewChild(meta, NULL, "Format", "b64");
+ xmlNewProp(node, "xmlns", "syncml:metinf");
+ xmlNewChild(cred, NULL, "Data", "Og==");
+ }
if (!state->myauthok && state->user && state->passwd) {
if (state->chal == SYNCML_AUTH_BASIC && !state->isserver) {
state->credsent++;
@@ -1227,7 +1238,7 @@
}
if (authenticated)
- cmdstatus = SYNCML_STATUS_AUTHFORSESSION;
+ cmdstatus = /*SYNCML_STATUS_AUTHFORSESSION*/ SYNCML_STATUS_OK;
else if (state->authok)
cmdstatus = SYNCML_STATUS_OK;
else {
@@ -2390,7 +2401,7 @@
if (result->result >= 0) {
if (cmd->cmd == SYNCML_CMD_REPLACE ||
cmd->cmd == SYNCML_CMD_ADD)
- status = syncml_build_status(state, cmd, SYNCML_STATUS_ADDED);
+ status = syncml_build_status(state, cmd, SYNCML_STATUS_ADDED);
else
status =
syncml_build_status(state, cmd,
diff -urN multisync-0.82/plugins/syncml_plugin/src/syncml_plugin.c multisync-0.82-a780/plugins/syncml_plugin/src/syncml_plugin.c
--- multisync-0.82/plugins/syncml_plugin/src/syncml_plugin.c 2004-04-12 23:03:23.000000000 +0200
+++ multisync-0.82-a780/plugins/syncml_plugin/src/syncml_plugin.c 2005-03-30 16:47:44.000000000 +0200
@@ -507,16 +507,16 @@
conn->commondata.is_feedthrough = TRUE;
syncml_set_login(conn->state, conn->login, conn->passwd);
if (conn->commondata.object_types & SYNC_OBJECT_TYPE_PHONEBOOK) {
- syncml_add_db(conn->state, "addressbook", SYNC_OBJECT_TYPE_PHONEBOOK);
+ syncml_add_db(conn->state, "contacts", SYNC_OBJECT_TYPE_PHONEBOOK);
if (!conn->isserver)
- syncml_add_remote_db(conn->state, "addressbook", conn->otherphonebookdb);
+ syncml_add_remote_db(conn->state, "contacts", conn->otherphonebookdb);
}
if (conn->commondata.object_types &
(SYNC_OBJECT_TYPE_CALENDAR|SYNC_OBJECT_TYPE_TODO)) {
- syncml_add_db(conn->state, "calendar",
+ syncml_add_db(conn->state, "events",
SYNC_OBJECT_TYPE_CALENDAR|SYNC_OBJECT_TYPE_TODO);
if (!conn->isserver)
- syncml_add_remote_db(conn->state, "calendar", conn->othercalendardb);
+ syncml_add_remote_db(conn->state, "events", conn->othercalendardb);
}
return(TRUE);