hi. this patch adds two new commandline switches usefull for using multisync in a script:
-p syncpair (--syncpair) to load only the given syncpair. if the syncpair does not exist, multisync will report an error and exit. -f (--force) to force synchronization (same as clicking "Sync") and exit after the synchronization finishes. Best regards, Armin Bauer
--- multisync/src/syncengine.c 2003-09-26 18:30:48.000000000 +0200 +++ /multisync/multisync/src/syncengine.c 2003-10-03 20:11:48.000000000 +0200 @@ -73,6 +73,8 @@ GList *pluginlist = NULL; GList *syncpairlist = NULL; char *datadir; +char *plugin = NULL; +gboolean synconce = FALSE; gboolean multisync_debug = FALSE; #define dd(x) (multisync_debug?(x):0) @@ -473,7 +475,7 @@ async_set_pairlist_status(thissync, "Plugin missing.", 0); cmd = SYNC_MSG_QUIT; - } + } sync_init(thissync); @@ -520,7 +522,8 @@ lastsyncmissed = thissync->syncmissed; thissync->syncmissed = 0; - if (((cmd == SYNC_MSG_OBJECTCHANGE && !thissync->manualonly) || + if (((cmd == SYNC_MSG_OBJECTCHANGE && !thissync->manualonly) || + synconce == TRUE || cmd == SYNC_MSG_FORCESYNC || cmd == SYNC_MSG_FORCERESYNC) && (localfeedthrough || remotefeedthrough)) { @@ -540,8 +543,9 @@ // Don't sync if syncinterval is set to manual // unless we do it manually :) - if ((cmd == SYNC_MSG_OBJECTCHANGE && !thissync->manualonly) - || cmd == SYNC_MSG_FORCESYNC || + if ((cmd == SYNC_MSG_OBJECTCHANGE && !thissync->manualonly) + || synconce == TRUE || + cmd == SYNC_MSG_FORCESYNC || cmd == SYNC_MSG_FORCERESYNC) { if (!remotealwaysconn) { async_set_pairlist_status(thissync, "Connecting to remote client...", 1); @@ -769,6 +773,7 @@ } } + if (synconce == FALSE) { if (!thissync->manualonly) { if (thissync->syncmissed) { async_set_pairlist_status(thissync, "Searching for client...",0); @@ -810,8 +815,11 @@ } if (!cmd) cmd = SYNC_MSG_OBJECTCHANGE; + } else { + exit(0); } - + } + dd(printf("Syncthread: Exiting.\n")); if (localconn) { CALL_PLUGIN_ASYNC(thissync->localclient, "sync_disconnect", (localconn)); @@ -1948,7 +1956,8 @@ } } dd(printf("Found pair: %s - %s\n", pair->localname, pair->remotename)); - syncpairlist = g_list_append(syncpairlist, pair); + if (!plugin || !strcmp(pair->displayname, plugin)) + syncpairlist = g_list_append(syncpairlist, pair); fclose(f); } g_free(filename); @@ -1957,6 +1966,10 @@ } closedir(dir); } + if (plugin && g_list_length(syncpairlist) != 1) { + printf("Requested sync pair not found.\n"); + exit(1); + } } char* sync_objtype_as_string(sync_object_type objtype) { @@ -1980,9 +1993,17 @@ struct poptOption popts[] = { { "nogui", 'q', POPT_ARG_NONE, &nogui, 1, "Do not show the GUI. Useful for starting " "MultiSync in a script.", NULL }, - { "resync", 'r', POPT_ARG_NONE, &resyncbutton, + { "resync", 'r', POPT_ARG_NONE, &resyncbutton, + 1, + "Do show an experimental 'Resync' button.", + NULL }, + { "force", 'f', POPT_ARG_NONE, &synconce, + 1, + "Force synchronization and quit after it finishes. " "Use it only with -p syncpairname!", + NULL }, + { "syncpair", 'p', POPT_ARG_STRING, &plugin, 1, - "Do show an experimental 'Resync' button.", + "Only load this sync pair.", NULL }, { "datadir", 'd', POPT_ARG_STRING, &optdatadir, 1,