[sword-svn] r2217 - trunk/src/mgr

scribe at crosswire.org scribe at crosswire.org
Tue Dec 16 20:22:02 MST 2008


Author: scribe
Date: 2008-12-16 20:22:02 -0700 (Tue, 16 Dec 2008)
New Revision: 2217

Modified:
   trunk/src/mgr/installmgr.cpp
Log:
More master remote source list code


Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp	2008-12-16 20:50:54 UTC (rev 2216)
+++ trunk/src/mgr/installmgr.cpp	2008-12-17 03:22:02 UTC (rev 2217)
@@ -32,6 +32,7 @@
 #include <ftplibftpt.h>
 #endif
 
+#include <iostream>
 SWORD_NAMESPACE_START
 
 namespace {
@@ -43,7 +44,7 @@
 		buf.size(len-1);
 }
 
-const char *crosswireMasterRepoList = "http://crosswire.org/repos.conf";
+const char *masterRepoList = "masterRepoList.conf";
 
 };
 
@@ -563,7 +564,24 @@
 	// 	YYYYMMDDHHMMSSUU=FTPSource=...
 	// 	YYYYMMDDHHMMSSUU=delete
 	//
-	return 0;
+	SWBuf root = (SWBuf)privatePath+"/"+masterRepoList;
+	removeTrailingSlash(root);
+	InstallSource is("FTP");
+	is.source = "ftp.crosswire.org";
+	is.directory = "/pub/sword";
+	int errorCode = ftpCopy(&is, masterRepoList, root.c_str(), false);
+	if (!errorCode) { //sucessfully downloaded the repo list
+		SWConfig masterList(masterRepoList);
+		SectionMap::iterator sections = masterList.Sections.find("Repos");
+		if (sections != masterList.Sections.end()) {
+			for (ConfigEntMap::iterator actions = sections->second.begin(); actions != sections->second.end(); actions++) {
+				std::cout << "UID: " << actions->first << " ; data: " << actions->second << std::endl;
+			}
+			return 0;
+		}
+	}
+
+	return -1;
 }
 
 




More information about the sword-cvs mailing list