From 6d725535f9eb21413a91a92f1d12a54b30afa26b Mon Sep 17 00:00:00 2001 From: gardners Date: Fri, 7 Sep 2012 22:53:16 +0930 Subject: [PATCH] starting work on the actual synchronisation code for rhizome direct. --- commandline.c | 6 ++++++ rhizome_direct.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/commandline.c b/commandline.c index 7caefbee..d9bff2d7 100644 --- a/commandline.c +++ b/commandline.c @@ -1786,6 +1786,12 @@ command_line_option command_line_options[]={ {app_rhizome_direct_sync,{"rhizome","direct","sync","",NULL}, CLIFLAG_STANDALONE, "Synchronise with the specified Rhizome Direct server. Return when done."}, + {app_rhizome_direct_sync,{"rhizome","direct","push","",NULL}, + CLIFLAG_STANDALONE, + "Deliver all new content to the specified Rhizome Direct server. Return when done."}, + {app_rhizome_direct_sync,{"rhizome","direct","pull","",NULL}, + CLIFLAG_STANDALONE, + "Fetch all new content from the specified Rhizome Direct server. Return when done."}, {app_keyring_create,{"keyring","create",NULL},0, "Create a new keyring file."}, {app_keyring_list,{"keyring","list","[]",NULL},CLIFLAG_STANDALONE, diff --git a/rhizome_direct.c b/rhizome_direct.c index 982a5dac..17efd895 100644 --- a/rhizome_direct.c +++ b/rhizome_direct.c @@ -569,6 +569,12 @@ int app_rhizome_direct_sync(int argc, const char *const *argv, { /* Attempt to connect with a remote Rhizome Direct instance, and negotiate which BARs to synchronise. */ + char *modeName = (argc >= 3 ? argv[2] : "sync"); + int mode=3; /* two-way sync */ + if (!strcasecmp(modeName,"push")) mode=1; /* push only */ + if (!strcasecmp(modeName,"pull")) mode=2; /* pull only */ + + DEBUGF("sync direction = %d",mode); return -1; }