Changeset 2421
- Timestamp:
- 08/06/07 16:00:03 (1 year ago)
- Files:
-
- plugins/irmc-sync (modified) (1 prop)
- plugins/irmc-sync/src/irmc_obex.c (modified) (2 diffs)
- plugins/irmc-sync/src/irmc_sync.c (modified) (10 diffs)
- plugins/irmc-sync/src/irmc_sync.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/irmc-sync
- Property svn:ignore changed from
config.log
.sconsign.dblite
irmc-sync.conf
.sconf_temp
to
config.log
.sconsign.dblite
irmc-sync.conf
.sconf_temp
tags
- Property svn:ignore changed from
plugins/irmc-sync/src/irmc_obex.c
r2415 r2421 549 549 550 550 gboolean irmc_obex_connect(obex_t* handle, char* target, OSyncError **error) { 551 osync_trace(TRACE_ENTRY, "%s(%p,%p,%p)", __func__, handle, target, error); 551 552 int ret = -1; 552 553 obex_object_t *object; … … 617 618 } 618 619 // Connected and serial number is OK! 620 osync_trace(TRACE_EXIT, "%s", __func__); 619 621 return TRUE; 620 622 } 621 623 osync_error_set(error, OSYNC_ERROR_GENERIC, "Cannot connect via OBEX."); 624 osync_trace(TRACE_EXIT_ERROR, "%s", __func__); 622 625 return FALSE; 623 626 } plugins/irmc-sync/src/irmc_sync.c
r2410 r2421 856 856 } 857 857 858 /** 859 * Establishes connection to the device. 860 */ 858 /* Establish connection to the device */ 861 859 static void irmcConnect(void *data, OSyncPluginInfo *info, OSyncContext *ctx) 862 860 { … … 891 889 osync_context_report_osyncerror(ctx, error); 892 890 osync_trace(TRACE_EXIT, "%s: %s", __func__, osync_error_print(&error)); 893 return;891 return; 894 892 } 895 893 … … 898 896 899 897 // check whether a slowsync is necessary 900 901 898 902 899 /* TODO: port sink engine stuff.. … … 1336 1333 osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, error); 1337 1334 1338 // TODO: do some discover voodoo 1339 1335 irmc_environment *env = (irmc_environment *)data; 1336 1337 GList *s = NULL; 1338 for (s = env->databases; s; s = s->next) { 1339 irmc_database *sinkenv = s->data; 1340 osync_objtype_sink_set_available(sinkenv->sink, TRUE); 1341 } 1342 1343 OSyncVersion *version = osync_version_new(error); 1344 osync_version_set_plugin(version, "irmc-sync"); 1345 //osync_version_set_modelversion(version, "version"); 1346 //osync_version_set_firmwareversion(version, "firmwareversion"); 1347 //osync_version_set_softwareversion(version, "softwareversion"); 1348 //osync_version_set_hardwareversion(version, "hardwareversion"); 1349 osync_plugin_info_set_version(info, version); 1350 osync_version_unref(version); 1340 1351 1341 1352 osync_trace(TRACE_EXIT, "%s", __func__); 1342 1353 return TRUE; 1343 1344 // TODO : do some disvoer voodoo 1345 //error: 1346 1347 osync_trace(TRACE_EXIT_ERROR, "%s: %s", osync_error_print(error)); 1348 return FALSE; 1349 } 1350 1351 static irmc_database *create_database(OSyncPluginInfo *info, const char *objtype, const char *format, OSyncSinkGetChangesFn getchanges, OSyncSinkCommitFn commit, OSyncError **error) { 1354 } 1355 1356 static irmc_database *create_database(OSyncPluginInfo *info, const char *objtype, const char *format, OSyncSinkGetChangesFn getchanges, OSyncSinkCommitFn commit, OSyncError **error) 1357 { 1352 1358 osync_trace(TRACE_ENTRY, "%s(%p, %s, %s, %p)", __func__, info, objtype, format, error); 1353 1359 … … 1356 1362 irmc_database *database = osync_try_malloc0(sizeof(irmc_database), error); 1357 1363 if (!database) 1358 goto error; 1359 1360 OSyncObjTypeSink *sink = osync_objtype_sink_new(objtype, error); 1361 if (!sink) 1362 goto error_free_db; 1363 1364 OSyncObjTypeSinkFunctions functions; 1365 memset(&functions, 0, sizeof(functions)); 1366 functions.connect = irmcConnect; 1367 functions.disconnect = irmcDisconnect; 1368 functions.sync_done = irmcSyncDone; 1369 1370 osync_objtype_sink_add_objformat(sink, format); 1371 functions.get_changes = getchanges; 1372 functions.commit = commit; 1373 1374 database->objformat = osync_format_env_find_objformat(formatenv, format); 1375 if (!database->objformat) { 1376 osync_error_set(error, OSYNC_ERROR_GENERIC, "Can't find object format \"%s\" for object type \"%s\"! " 1377 "Is the vformat plugin correctly installed?", format, objtype); 1378 goto error_free_db; 1379 } 1380 1381 osync_objtype_sink_set_functions(sink, functions, database); 1382 osync_plugin_info_add_objtype(info, sink); 1383 1384 osync_trace(TRACE_EXIT, "%s: %p", __func__, database); 1385 return database; 1386 1387 error_free_db: 1388 g_free(database); 1389 error: 1390 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 1391 return NULL; 1392 } 1393 1394 /** 1395 * Initialize the connection. 1396 */ 1364 goto error; 1365 1366 database->sink = osync_objtype_sink_new(objtype, error); 1367 if (!database->sink) 1368 goto error_free_db; 1369 1370 OSyncObjTypeSinkFunctions functions; 1371 memset(&functions, 0, sizeof(functions)); 1372 functions.connect = irmcConnect; 1373 functions.disconnect = irmcDisconnect; 1374 functions.sync_done = irmcSyncDone; 1375 functions.get_changes = getchanges; 1376 functions.commit = commit; 1377 1378 osync_objtype_sink_set_functions(database->sink, functions, database); 1379 1380 database->objformat = osync_format_env_find_objformat(formatenv, format); 1381 if (!database->objformat) { 1382 osync_error_set(error, OSYNC_ERROR_GENERIC, "Can't find object format \"%s\" for object type \"%s\"! " 1383 "Is the vformat plugin correctly installed?", format, objtype); 1384 goto error_free_db; 1385 } 1386 osync_objtype_sink_add_objformat(database->sink, format); 1387 1388 osync_plugin_info_add_objtype(info, database->sink); 1389 1390 osync_trace(TRACE_EXIT, "%s: %p", __func__, database); 1391 return database; 1392 1393 error_free_db: 1394 g_free(database); 1395 1396 error: 1397 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 1398 return NULL; 1399 } 1400 1401 /* Initialize connection */ 1397 1402 static void *irmcInitialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError **error) 1398 1403 { … … 1400 1405 const char *configdata = NULL; 1401 1406 1402 // create new environment, where all connection information are stored in1407 // create new environment, where all connection information are stored in 1403 1408 irmc_environment *env = osync_try_malloc0(sizeof(irmc_environment), error); 1404 1409 if (!env) 1405 goto error;1410 goto error; 1406 1411 1407 1412 // retrieve the config data … … 1421 1426 env->anchor_path = g_strdup_printf("%s/anchor.db", osync_plugin_info_get_configdir(info)); 1422 1427 1423 1424 1428 irmc_database *contactdb = create_database(info, "contact", "vcard21", irmcContactGetChangeinfo, irmcContactCommitChange, error); 1425 1429 irmc_database *eventdb = create_database(info, "event", "vevent10", irmcCalendarGetChangeinfo, irmcCalendarCommitChange, error); 1426 1427 // XXX: Is there a todo database in IrMC?!1428 1430 irmc_database *tododb = create_database(info, "todo", "vtodo10", irmcCalendarGetChangeinfo, irmcCalendarCommitChange, error); 1429 1431 irmc_database *notedb = create_database(info, "note", "vnote11", irmcNoteGetChangeinfo, irmcNoteCommitChange, error); … … 1437 1439 env->databases = g_list_append(env->databases, notedb); 1438 1440 1439 1440 1441 // return the environment 1441 1442 osync_trace(TRACE_EXIT, "%s: %p", __func__, env); … … 1443 1444 1444 1445 error_free_env: 1445 free(env); 1446 free(env); 1447 1446 1448 error: 1447 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 1448 return NULL; 1449 } 1450 1451 /** 1452 * Returns all information about this plugin. 1453 */ 1449 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 1450 return NULL; 1451 } 1452 1453 /* Return all plugin information */ 1454 1454 osync_bool get_sync_info(OSyncPluginEnv *env, OSyncError **error) 1455 1455 { 1456 1457 1456 OSyncPlugin *plugin = osync_plugin_new(error); 1458 1457 if (!plugin) 1459 goto error;1458 goto error; 1460 1459 1461 1460 osync_plugin_set_name(plugin, "irmc-sync"); … … 1470 1469 osync_plugin_unref(plugin); 1471 1470 1472 /*1473 osync_plugin_accept_objtype(info, "contact");1474 osync_plugin_accept_objformat(info, "contact", "vcard21", NULL);1475 osync_plugin_set_commit_objformat(info, "contact", "vcard21", irmcContactCommitChange);1476 1477 osync_plugin_accept_objtype(info, "event");1478 osync_plugin_accept_objformat(info, "event", "vevent10", NULL);1479 osync_plugin_set_commit_objformat(info, "event", "vevent10", irmcCalendarCommitChange);1480 1481 osync_plugin_accept_objtype(info, "todo");1482 osync_plugin_accept_objformat(info, "todo", "vtodo10", NULL);1483 osync_plugin_set_commit_objformat(info, "todo", "vtodo10", irmcCalendarCommitChange);1484 1485 osync_plugin_accept_objtype(info, "note");1486 osync_plugin_accept_objformat(info, "note", "vnote11", NULL);1487 osync_plugin_set_commit_objformat(info, "note", "vnote11", irmcNoteCommitChange);1488 */1489 1471 return TRUE; 1490 1472 plugins/irmc-sync/src/irmc_sync.h
r2410 r2421 66 66 typedef struct irmc_database { 67 67 OSyncObjFormat *objformat; // The configured objformat for this database 68 OSyncObjTypeSink *sink; 68 69 unsigned int changecounter; 69 70 char *dbid;
