[sword-cvs] sword/apps/windoze/CBuilder5/InstallMgr MainFrm.cpp,1.18,1.19 MainFrm.h,1.7,1.8 RemoteMntFrm.cpp,1.5,1.6 StatusFrm.cpp,1.15,1.16 StatusFrm.h,1.9,1.10 cipherfrm.cpp,1.4,1.5 cipherfrm.h,1.3,1.4

sword@www.crosswire.org sword@www.crosswire.org
Thu, 26 Jun 2003 18:41:08 -0700


Update of /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr
In directory www:/tmp/cvs-serv19920/apps/windoze/CBuilder5/InstallMgr

Modified Files:
	MainFrm.cpp MainFrm.h RemoteMntFrm.cpp StatusFrm.cpp 
	StatusFrm.h cipherfrm.cpp cipherfrm.h 
Log Message:
no message

Index: MainFrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr/MainFrm.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** MainFrm.cpp	26 Jun 2003 20:05:52 -0000	1.18
--- MainFrm.cpp	27 Jun 2003 01:41:06 -0000	1.19
***************
*** 26,84 ****
  #include <FileCtrl.hpp>
  #include <installmgr.h>
  
  TMainForm *MainForm;
  
- 	
- VersionInfo::VersionInfo(const char *version) {
- 	char *buf = new char[ strlen(version) + 1 ];
- 	char *tok;
- 	major = minor = minor2 = minor3 = 0;
- 		
- 	strcpy(buf, version);
- 	tok = strtok(buf, ".");
- 	if (tok)
- 		major = atoi(tok);
- 	tok = strtok(0, ".");
- 	if (tok)
- 		minor = atoi(tok);
- 	tok = strtok(0, ".");
- 	if (tok)
- 		minor2 = atoi(tok);
- 	tok = strtok(0, ".");
- 	if (tok)
- 		minor3 = atoi(tok);
- 	delete [] buf;
- }
- 
  
! int VersionInfo::compare(const VersionInfo &vi) const {
! 	if (major == vi.major)
! 		if (minor == vi.minor)
! 			if (minor2 == vi.minor2)
! 				if (minor3 == vi.minor3)
! 					return 0;
! 				else return minor3 - vi.minor3;
! 			else	return minor2 - vi.minor2;
! 		else	return minor - vi.minor;
! 	else	return major - vi.major;
! }
! 
! 
! __fastcall InstallSourceTab::InstallSourceTab(TComponent *Owner, const char *confEnt, const char *type) : TControl(Owner) {
! 	char *buf = new char [ strlen(confEnt) + 1 ];
! 	
! 	strcpy(buf, confEnt);
! 
! 	Caption = strtok(buf, "|");
! 	Source = strtok(0, "|");
! 	Directory = strtok(0, "|");
! 	delete [] buf;
! 	Type = type;
! 	mgr = 0;
  }
  
  __fastcall InstallSourceTab::~InstallSourceTab() {
- 	if (mgr)
- 		delete mgr;
  }
  	
--- 26,38 ----
  #include <FileCtrl.hpp>
  #include <installmgr.h>
+ #include <filemgr.h>
  
  TMainForm *MainForm;
  
  
! __fastcall InstallSourceTab::InstallSourceTab(TComponent *Owner, const char *confEnt, const char *type) : TControl(Owner), is(confEnt, type) {
  }
  
  __fastcall InstallSourceTab::~InstallSourceTab() {
  }
  	
***************
*** 90,94 ****
       }
       catch (...) {
!            createPathAndFile("./mods.d/globals.conf");           
             manager = new SWMgr();
       }
--- 44,48 ----
       }
       catch (...) {
!            FileMgr::createPathAndFile("./mods.d/globals.conf");           
             manager = new SWMgr();
       }
***************
*** 156,161 ****
  	SectionMap::iterator sit;
  	
! 	newtab->Caption = ist->Caption.c_str();
! 	newtab->Hint = ist->Source.c_str();
  	newtab->ShowHint = true;
  	newtab->PageControl = PageControl1;
--- 110,115 ----
  	SectionMap::iterator sit;
  	
! 	newtab->Caption = ist->is.caption.c_str();
! 	newtab->Hint = ist->is.source.c_str();
  	newtab->ShowHint = true;
  	newtab->PageControl = PageControl1;
***************
*** 179,185 ****
  	newtree->Images = ImageList1;
  	newtree->StateImages = ImageList2;
! 	string parent = "./sources/" + ist->Source + "/file";
! 	createParent(parent.c_str());
! 	parent = "./sources/" + ist->Source;
  	fillSourceTree(parent.c_str(), newtree);
  }
--- 133,139 ----
  	newtree->Images = ImageList1;
  	newtree->StateImages = ImageList2;
! 	SWBuf parent = (SWBuf)"./sources/" + ist->is.source + "/file";
! 	FileMgr::createParent(parent.c_str());
! 	parent = (SWBuf)"./sources/" + ist->is.source;
  	fillSourceTree(parent.c_str(), newtree);
  }
***************
*** 243,247 ****
  	ModMap::iterator mods;
  	TTreeNode *node;
! 	string nodeName;
  	
  	installTree->Items->Clear();
--- 197,201 ----
  	ModMap::iterator mods;
  	TTreeNode *node;
! 	SWBuf nodeName;
  	
  	installTree->Items->Clear();
***************
*** 281,289 ****
  	SectionMap::iterator sections, targetSection;
  	ConfigEntMap::iterator entry;
! 	string secName;
  	const char * modDesc;
! 	string nodeName;
! 	string targetVersion;
! 	string sourceVersion;
  	bool cipher;
  	bool showLocked = LockedModules1->Checked;
--- 235,243 ----
  	SectionMap::iterator sections, targetSection;
  	ConfigEntMap::iterator entry;
! 	SWBuf secName;
  	const char * modDesc;
! 	SWBuf nodeName;
! 	SWBuf targetVersion;
! 	SWBuf sourceVersion;
  	bool cipher;
  	bool showLocked = LockedModules1->Checked;
***************
*** 297,305 ****
  	}
  	else {
-      	
  		InstallSourceTab *ist = (InstallSourceTab *) tree->Parent->Controls[0];
! 		if (ist->mgr)
! 			delete ist->mgr;
! 		mgr = ist->mgr = new SWMgr(sourceConf);
  	}
  	
--- 251,258 ----
  	}
  	else {
  		InstallSourceTab *ist = (InstallSourceTab *) tree->Parent->Controls[0];
! 		if (ist->is.mgr)
! 			delete ist->is.mgr;
! 		mgr = ist->is.mgr = new SWMgr(sourceConf);
  	}
  	
***************
*** 330,334 ****
  		}
  
! 		string misc1 = ((entry = sections->second.find("Category")) != sections->second.end()) ? (*entry).second : (string)"";
            if (misc1.length() > 0)
               secName = misc1;
--- 283,287 ----
  		}
  
! 		SWBuf misc1 = ((entry = sections->second.find("Category")) != sections->second.end()) ? (SWBuf)(*entry).second.c_str() : (SWBuf)"";
            if (misc1.length() > 0)
               secName = misc1;
***************
*** 355,359 ****
  		}
  
! 		if (VersionInfo(sourceVersion.c_str()) > VersionInfo(targetVersion.c_str())) {
  			for (node = tree->Items->GetFirstNode(); node; node = node->getNextSibling()) {
  				if (!strcmp(node->Text.c_str(), secName.c_str())) {
--- 308,312 ----
  		}
  
! 		if (SWVersion(sourceVersion.c_str()) > SWVersion(targetVersion.c_str())) {
  			for (node = tree->Items->GetFirstNode(); node; node = node->getNextSibling()) {
  				if (!strcmp(node->Text.c_str(), secName.c_str())) {
***************
*** 368,374 ****
  				node->ImageIndex = 0;
  			}
! 			nodeName = "[" + sections->first + "] " + modDesc;
  			node = tree->Items->AddChildObject(node, nodeName.c_str(), (void *) sections->first.c_str());
! 			if (VersionInfo(targetVersion.c_str()) < VersionInfo("1.0")) {
  				node->ImageIndex = 1;
  				node->SelectedIndex = 1;
--- 321,327 ----
  				node->ImageIndex = 0;
  			}
! 			nodeName = (SWBuf)"[" + sections->first + "] " + modDesc;
  			node = tree->Items->AddChildObject(node, nodeName.c_str(), (void *) sections->first.c_str());
! 			if (SWVersion(targetVersion.c_str()) < SWVersion("1.0")) {
  				node->ImageIndex = 1;
  				node->SelectedIndex = 1;
***************
*** 474,716 ****
  
  
- int TMainForm::createParent(const char *pName)
- {
- 	char *buf = new char [ strlen(pName) + 1 ];
- 	int retCode = 0;
- 	
- 	strcpy(buf, pName);
- 	int end = strlen(buf) - 1;
- 	while (end) {
- 		if (buf[end] == '/')
- 			break;
- 		end--;
- 	}
- 	buf[end] = 0;
- 	if (strlen(buf)>0) {
-           if (access(buf, 02)) {  // not exists with write access?
-           	if ((retCode = mkdir(buf))) {
- 		         	createParent(buf);
-                     retCode = mkdir(buf);
-                }
- 		}
-      }
-      else retCode = -1;
- 	delete [] buf;
- 	return retCode;
- }
- 	
- 
- int TMainForm::createPathAndFile(const char *fName)
- {
- 	int fd;
- 	
- 	fd = open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
- 	if (fd < 1) {
- 		createParent(fName);
- 		fd = open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
- 	}
- 	return fd;
- }
- 
- 
- int TMainForm::copyFileToCWD(const char *sourceDir, const char *fName)
- {
- 	string sourcePath = sourceDir;
- 	sourcePath += fName;
- 
-      string dest;
-      dest = manager->prefixPath;
-      if ((manager->prefixPath[strlen(manager->prefixPath)-1] != '\\') && ( manager->prefixPath[strlen(manager->prefixPath)-1] != '/'))
-         dest += "/";
-        dest += fName;
- 
- 	return copyFile(sourcePath.c_str(), dest.c_str());
- }
- 
- 
- int TMainForm::copyFile(const char *sourceFile, const char *targetFile)
- {
- 	int sfd, dfd, len;
- 	char buf[4096];
- 
- 	if ((sfd = open(sourceFile, O_RDONLY|O_BINARY)) < 1)
- 		return -1;
- 	if ((dfd = createPathAndFile(targetFile)) < 1)
- 		return -1;
- 
- 	do {
- 		len = read(sfd, buf, 4096);
- 		write(dfd, buf, len);
- 	}
- 	while(len == 4096);	
- 	close(dfd);
- 	close(sfd);
- 	
- 	return 0;
- }
- 
- 
- int TMainForm::installModule(const char *modName, InstallSourceTab *ist)
- {
- 	SectionMap::iterator module, section;
- 	ConfigEntMap::iterator fileBegin;
- 	ConfigEntMap::iterator fileEnd;
- 	ConfigEntMap::iterator entry;
- 	string sourceDir;
- 	string buffer;
- 	bool aborted = false;
- 	bool cipher = false;
- 
- 	if (ist)
- 		sourceDir = "./sources/" + ist->Source;
- 	else	sourceDir = getLocalDir();
- 	
- 	SWMgr mgr(sourceDir.c_str());
- 	
- 	module = mgr.config->Sections.find(modName);
- 
- 	if (module != mgr.config->Sections.end()) {
- 	
- 		entry = module->second.find("CipherKey");
- 		if (entry != module->second.end())
- 			cipher = true;
- 		
- 		fileEnd = module->second.upper_bound("File");
- 		fileBegin = module->second.lower_bound("File");
- 
- 		if (fileBegin != fileEnd) {	// copy each file
- 			if (ist) {
- 				while (fileBegin != fileEnd) {	// ftp each file first
- 					buffer = sourceDir + "/" + fileBegin->second;
- 					if (FTPCopy(ist, fileBegin->second.c_str(), buffer.c_str())) {
- 						aborted = true;
- 						break;	// user aborted
- 					}
- 					fileBegin++;
- 				}
- 				fileBegin = module->second.lower_bound("File");
- 			}
- 
- 			if (!aborted) {
- 				// DO THE INSTALL
- 				while (fileBegin != fileEnd) {
- 					copyFileToCWD(sourceDir.c_str(), fileBegin->second.c_str());
- 					fileBegin++;
- 				}
- 			}
- 			//---------------
- 
- 			if (ist) {
- 				fileBegin = module->second.lower_bound("File");
- 				while (fileBegin != fileEnd) {	// delete each tmp ftp file
- 					buffer = sourceDir + "/" + fileBegin->second;
- 					remove(buffer.c_str());
- 					fileBegin++;
- 				}
- 			}
- 		}
- 		else {	//copy all files in DataPath directory
- 			DIR *dir;
- 			struct dirent *ent;
- 			ConfigEntMap::iterator entry;
- 			string modDir;
- 			string modFile;
- 			string sourceOrig = sourceDir;
- 
- 			entry = module->second.find("DataPath");
- 			if (entry != module->second.end()) {
- 				modDir = entry->second.c_str();
- 				entry = module->second.find("ModDrv");
- 				if (entry != module->second.end()) {
- 					if (!strcmp(entry->second.c_str(), "RawLD") || !strcmp(entry->second.c_str(), "RawLD4") || !strcmp(entry->second.c_str(), "zLD") || !strcmp(entry->second.c_str(), "RawGenBook") || !strcmp(entry->second.c_str(), "zGenBook")) {
- 						char *buf = new char [ strlen(modDir.c_str()) + 1 ];
- 	
- 						strcpy(buf, modDir.c_str());
- 						int end = strlen(buf) - 1;
- 						while (end) {
- 							if (buf[end] == '/')
- 								break;
- 							end--;
- 						}
- 						buf[end] = 0;
- 						modDir = buf;
- 						delete [] buf;
- 					}
- 				}
- 
- 				if (ist) {
- 					buffer = sourceDir + "/" + modDir;
- 					if (FTPCopy(ist, modDir.c_str(), buffer.c_str(), true)) {
- 						aborted = true;	// user aborted
- 					}
- 				}
- 				sourceDir += "/";
- 				sourceDir += modDir;
- 				if (!aborted) {
- 					if (dir = opendir(sourceDir.c_str())) {
- 						rewinddir(dir);
- 						while ((ent = readdir(dir))) {
- 							if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- 								modFile = modDir;
- 								modFile += "/";
- 								modFile += ent->d_name;
- 								copyFileToCWD(sourceOrig.c_str(), modFile.c_str());
- 							}
- 						}
- 						closedir(dir);
- 					}
- 				}
- 				if (ist) {		// delete tmp ftp files
- 					if (dir = opendir(sourceDir.c_str())) {
- 						rewinddir(dir);
- 						while ((ent = readdir(dir))) {
- 							if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- 								modFile = sourceOrig + "/" + modDir;
- 								modFile += "/";
- 								modFile += ent->d_name;
- 								remove(modFile.c_str());
- 							}
- 						}
- 						closedir(dir);
- 					}
- 				}
- 				sourceDir = sourceOrig;
- 				sourceDir += "/mods.d/";
- 				if (!aborted) {
- 					if (dir = opendir(sourceDir.c_str())) {	// find and copy .conf file
- 						rewinddir(dir);
- 						while ((ent = readdir(dir))) {
- 							if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- 								modFile = sourceDir;
- 								modFile += ent->d_name;
- 								SWConfig *config = new SWConfig(modFile.c_str());
- 								if (config->Sections.find(modName) != config->Sections.end()) {
- 									delete config;
- 									string targetFile = manager->configPath; //"./mods.d/";
-                                              targetFile += "/";
- 									targetFile += ent->d_name;
- 									copyFile(modFile.c_str(), targetFile.c_str());
- 									if (cipher) {
- 										CipherForm->modName = modName;
- 										CipherForm->confFile = targetFile;
- 										if (CipherForm->ShowModal() == mrCancel) {
- 											removeModule(modName);
- 											aborted = true;
- 										}
- 									}
- 								}
- 								else	delete config;
- 							}
- 						}
- 						closedir(dir);
- 					}
- 				}
- 			}
- 		}
- 		return (aborted) ? -1 : 0;
- 	}
- 	return 1;
- }
- 
  
  void	TMainForm::fillAllSourceTrees()
--- 427,430 ----
***************
*** 719,723 ****
  	for (int i = 1; i < PageControl1->PageCount; i++) {
  		InstallSourceTab *ist = (InstallSourceTab *) MainForm->PageControl1->Pages[i]->Controls[0];
! 		string parent = "./sources/" + ist->Source;
  		fillSourceTree(parent.c_str(), ist->tree);
  	}
--- 433,437 ----
  	for (int i = 1; i < PageControl1->PageCount; i++) {
  		InstallSourceTab *ist = (InstallSourceTab *) MainForm->PageControl1->Pages[i]->Controls[0];
! 		SWBuf parent = (SWBuf)"./sources/" + ist->is.source;
  		fillSourceTree(parent.c_str(), ist->tree);
  	}
***************
*** 822,830 ****
  	struct dirent *ent;
  	ConfigEntMap::iterator entry;
! 	string modDir;
! 	string modFile;
! 	string root = "./sources/";
! 	root += ist->Source.c_str();
! 	string target = root + "/mods.d";
  
  	if (dir = opendir(target.c_str())) {
--- 536,544 ----
  	struct dirent *ent;
  	ConfigEntMap::iterator entry;
! 	SWBuf modDir;
! 	SWBuf modFile;
! 	SWBuf root = "./sources/";
! 	root += ist->is.source.c_str();
! 	SWBuf target = root + "/mods.d";
  
  	if (dir = opendir(target.c_str())) {
***************
*** 842,846 ****
  
  
!     	string archive = root + "/mods.d.tar.gz";
  	if (!FTPCopy(ist, "mods.d.tar.gz", archive.c_str(), false)) {
       	int fd = open(archive.c_str(), O_RDONLY|O_BINARY);
--- 556,560 ----
  
  
!     	SWBuf archive = root + "/mods.d.tar.gz";
  	if (!FTPCopy(ist, "mods.d.tar.gz", archive.c_str(), false)) {
       	int fd = open(archive.c_str(), O_RDONLY|O_BINARY);
***************
*** 851,855 ****
  
  	target = "./sources/";
! 	target += ist->Source.c_str();
  
  	fillSourceTree(target.c_str(), ist->tree);	
--- 565,569 ----
  
  	target = "./sources/";
! 	target += ist->is.source.c_str();
  
  	fillSourceTree(target.c_str(), ist->tree);	
***************
*** 879,883 ****
  	SectionMap::iterator module;
  	ConfigEntMap::iterator entry, entryEnd;
! 	string sourceDir;
  
  	if (PageControl1->ActivePage != PageControl1->Pages[0]) {
--- 593,597 ----
  	SectionMap::iterator module;
  	ConfigEntMap::iterator entry, entryEnd;
! 	SWBuf sourceDir;
  
  	if (PageControl1->ActivePage != PageControl1->Pages[0]) {
***************
*** 891,895 ****
  		if (node->Parent) {
  			if (ist)
! 				sourceDir = "./sources/" + ist->Source;
  			else	sourceDir = getLocalDir();
  			SWMgr *mgr = new SWMgr(sourceDir.c_str());
--- 605,609 ----
  		if (node->Parent) {
  			if (ist)
! 				sourceDir = (SWBuf)"./sources/" + ist->is.source;
  			else	sourceDir = getLocalDir();
  			SWMgr *mgr = new SWMgr(sourceDir.c_str());
***************
*** 898,903 ****
  
  			if (module != mgr->config->Sections.end()) {
! 				string targetVersion = "0.0";
! 				string sourceVersion = "1.0";
  				SectionMap::iterator targetSection;
  					
--- 612,617 ----
  
  			if (module != mgr->config->Sections.end()) {
! 				SWBuf targetVersion = "0.0";
! 				SWBuf sourceVersion = "1.0";
  				SectionMap::iterator targetSection;
  					
***************
*** 913,925 ****
  						targetVersion = entry->second;
  				}
! 				if (VersionInfo(targetVersion.c_str()) < VersionInfo("1.0")) {
  					InfoForm->info = "\\pard{\\b * Additional Module Available for Install. } \\par ";
  				}
  				else {
! 					InfoForm->info = "\\pard{\\b + Upgraded Module Available for Install.}\\par\\tab Current Version:  \\tab " + targetVersion + " \\par\\tab Upgrade Version:\\tab " + sourceVersion + " \\par ";
  					bool changes = false;
  					for (entry = module->second.begin(); entry != module->second.end(); entry++) {
  						if (!strncmp(entry->first.c_str(), "History_", 8)) {
! 							if (VersionInfo(&entry->first.c_str()[8]) > VersionInfo(targetVersion.c_str())) {
  								if (!changes) {
  									changes = true;
--- 627,639 ----
  						targetVersion = entry->second;
  				}
! 				if (SWVersion(targetVersion.c_str()) < SWVersion("1.0")) {
  					InfoForm->info = "\\pard{\\b * Additional Module Available for Install. } \\par ";
  				}
  				else {
! 					InfoForm->info = (SWBuf)"\\pard{\\b + Upgraded Module Available for Install.}\\par\\tab Current Version:  \\tab " + targetVersion + " \\par\\tab Upgrade Version:\\tab " + sourceVersion + " \\par ";
  					bool changes = false;
  					for (entry = module->second.begin(); entry != module->second.end(); entry++) {
  						if (!strncmp(entry->first.c_str(), "History_", 8)) {
! 							if (SWVersion(&entry->first.c_str()[8]) > SWVersion(targetVersion.c_str())) {
  								if (!changes) {
  									changes = true;
***************
*** 971,975 ****
  	ModMap::iterator it;
  	for (it = mgr->Modules.begin(); it != mgr->Modules.end(); it++) {
! 		string label = "Uninstalling: [";
  		label += it->second->Name();
  		label += "] ";
--- 685,689 ----
  	ModMap::iterator it;
  	for (it = mgr->Modules.begin(); it != mgr->Modules.end(); it++) {
! 		SWBuf label = "Uninstalling: [";
  		label += it->second->Name();
  		label += "] ";
***************
*** 1016,1020 ****
  {
  	SWConfig optionsconf("options.conf");
! 	string helpDir;
  	ConfigEntMap::iterator it = optionsconf.Sections["Help"].find("Directory");
  	if (it != optionsconf.Sections["Help"].end())
--- 730,734 ----
  {
  	SWConfig optionsconf("options.conf");
! 	SWBuf helpDir;
  	ConfigEntMap::iterator it = optionsconf.Sections["Help"].find("Directory");
  	if (it != optionsconf.Sections["Help"].end())
***************
*** 1022,1026 ****
  	else helpDir = ".\\help";
  
! 	string helpExe = helpDir + "\\Sword.chm::modulesh.html#instmgr";
  	ShellExecute(this->Handle, "open", "hh", helpExe.c_str(), NULL, SW_SHOWNORMAL);
  }
--- 736,740 ----
  	else helpDir = ".\\help";
  
! 	SWBuf helpExe = helpDir + "\\Sword.chm::modulesh.html#instmgr";
  	ShellExecute(this->Handle, "open", "hh", helpExe.c_str(), NULL, SW_SHOWNORMAL);
  }

Index: MainFrm.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr/MainFrm.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MainFrm.h	4 Oct 2002 22:25:36 -0000	1.7
--- MainFrm.h	27 Jun 2003 01:41:06 -0000	1.8
***************
*** 19,37 ****
  #include <NMHttp.hpp>
  #include <Psock.hpp>
  
  using namespace std;
  using namespace sword;
  
- class VersionInfo {
- 	public:
- 	int major, minor, minor2, minor3;
- 	
- 	VersionInfo(const char *version);
- 	int compare(const VersionInfo &vi) const;
- 	bool operator>(const VersionInfo &vi) const {return (compare(vi) > 0);}
- 	bool operator<(const VersionInfo &vi) const {return (compare(vi) < 0);}
- 	bool operator==(const VersionInfo &vi) const {return (compare(vi) == 0);}
- };
- 		
  
  class InstallSourceTab : public TControl {
--- 19,28 ----
  #include <NMHttp.hpp>
  #include <Psock.hpp>
+ #include <swversion.h>
+ #include <installmgr.h>
  
  using namespace std;
  using namespace sword;
  
  
  class InstallSourceTab : public TControl {
***************
*** 39,48 ****
  	__fastcall InstallSourceTab(TComponent *Owner, const char *confEnt, const char *type);
  	__fastcall ~InstallSourceTab();
! 	string Type;
! 	string Source;
! 	string Directory;
! 	string Caption;
  	TTreeView *tree;
- 	SWMgr *mgr;
  };
  
--- 30,35 ----
  	__fastcall InstallSourceTab(TComponent *Owner, const char *confEnt, const char *type);
  	__fastcall ~InstallSourceTab();
! 	InstallSource is;
  	TTreeView *tree;
  };
  
***************
*** 128,137 ****
  	void __fastcall RefreshRemoteSource(TObject *Sender);
  	int selectAll(TTreeView *tree, bool sel);
- 	int removeModule(const char *modName);
- 	int installModule(const char *modName, InstallSourceTab *ist = 0);
- 	static int createParent(const char *pName);
- 	int createPathAndFile(const char *fName);
- 	int copyFile(const char *sourceFile, const char *targetFile);
- 	int copyFileToCWD(const char *sourceDir, const char *fName);
  	int FTPCopy(InstallSourceTab *ist, const char *src, const char *dest, bool dirTransfer = false, const char *suffix = "");
  	SWMgr *localMgr;
--- 115,118 ----

Index: RemoteMntFrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr/RemoteMntFrm.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RemoteMntFrm.cpp	4 Oct 2002 22:25:36 -0000	1.5
--- RemoteMntFrm.cpp	27 Jun 2003 01:41:06 -0000	1.6
***************
*** 4,7 ****
--- 4,8 ----
  
  #include "RemoteMntFrm.h"
+ #include <installmgr.h>
  
  using namespace std;
***************
*** 16,34 ****
  class TRemoteSource : public TObject {
  public:
! 	string name;
! 	string machine;
! 	string dir;
! 	TRemoteSource(const char *confEnt) {
! 		char *buf = new char [ strlen(confEnt) + 1 ];
! 	
! 		strcpy(buf, confEnt);
! 
! 		name = strtok(buf, "|");
! 		machine = strtok(0, "|");
! 		dir = strtok(0, "|");
! 		delete [] buf;
! 	}
! 	string getConfEnt() {
! 		return name +"|" + machine + "|" + dir;
  	}
  };
--- 17,22 ----
  class TRemoteSource : public TObject {
  public:
! 	InstallSource is;
! 	TRemoteSource(const char *confEnt) : is(confEnt, "FTP") {
  	}
  };
***************
*** 50,54 ****
  	while (loop != end) {
  		TRemoteSource *rs = new TRemoteSource(loop->second.c_str());
! 		ListBox1->Items->AddObject(rs->name.c_str(), rs);
  		loop++;
  	}
--- 38,42 ----
  	while (loop != end) {
  		TRemoteSource *rs = new TRemoteSource(loop->second.c_str());
! 		ListBox1->Items->AddObject(rs->is.caption.c_str(), rs);
  		loop++;
  	}
***************
*** 87,93 ****
  		TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
  
! 		NameEdit->Text = rs->name.c_str();
! 		MachineEdit->Text = rs->machine.c_str();
! 		DirEdit->Text = rs->dir.c_str();
  	}
  	else {
--- 75,81 ----
  		TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
  
! 		NameEdit->Text = rs->is.caption.c_str();
! 		MachineEdit->Text = rs->is.source.c_str();
! 		DirEdit->Text = rs->is.directory.c_str();
  	}
  	else {
***************
*** 104,109 ****
  		return;
  	TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
! 	rs->name = NameEdit->Text.c_str();
! 	ListBox1->Items->Strings[ListBox1->ItemIndex] = rs->name.c_str();
  }
  
--- 92,97 ----
  		return;
  	TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
! 	rs->is.caption = NameEdit->Text.c_str();
! 	ListBox1->Items->Strings[ListBox1->ItemIndex] = rs->is.caption.c_str();
  }
  
***************
*** 114,118 ****
  		return;
  	TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
! 	rs->machine = MachineEdit->Text.c_str();
  }
  
--- 102,106 ----
  		return;
  	TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
! 	rs->is.source = MachineEdit->Text.c_str();
  }
  
***************
*** 123,127 ****
  		return;
  	TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
! 	rs->dir = DirEdit->Text.c_str();
  }
  
--- 111,115 ----
  		return;
  	TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex];
! 	rs->is.directory = DirEdit->Text.c_str();
  }
  
***************
*** 141,145 ****
  {
  	TRemoteSource *rs = new TRemoteSource("[New Remote Site]|ftp.domain.org|/pub/sword/raw/");
! 	ListBox1->ItemIndex = ListBox1->Items->AddObject(rs->name.c_str(), rs);
  		
  	checkDisabled();
--- 129,133 ----
  {
  	TRemoteSource *rs = new TRemoteSource("[New Remote Site]|ftp.domain.org|/pub/sword/raw/");
! 	ListBox1->ItemIndex = ListBox1->Items->AddObject(rs->is.caption.c_str(), rs);
  		
  	checkDisabled();
***************
*** 154,158 ****
  	for (int i = 0; i < ListBox1->Items->Count; i++) {
  		rs = (TRemoteSource *)ListBox1->Items->Objects[i];
! 		config->Sections["Sources"].insert(ConfigEntMap::value_type("FTPSource", rs->getConfEnt().c_str()));
  	}
  	(*config)["General"]["PassiveFTP"] = (CheckBox1->Checked) ? "true" : "false";
--- 142,146 ----
  	for (int i = 0; i < ListBox1->Items->Count; i++) {
  		rs = (TRemoteSource *)ListBox1->Items->Objects[i];
! 		config->Sections["Sources"].insert(ConfigEntMap::value_type("FTPSource", rs->is.getConfEnt().c_str()));
  	}
  	(*config)["General"]["PassiveFTP"] = (CheckBox1->Checked) ? "true" : "false";

Index: StatusFrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** StatusFrm.cpp	24 Sep 2002 21:08:15 -0000	1.15
--- StatusFrm.cpp	27 Jun 2003 01:41:06 -0000	1.16
***************
*** 6,9 ****
--- 6,10 ----
  #include "MainFrm.h"
  #include <installmgr.h>
+ #include <filemgr.h>
  #include <vector>
  
***************
*** 79,83 ****
  
  	Synchronize((TThreadMethod)&PreConnect);
! 	StatusForm->ftpCon->Host = ist->Source.c_str();
  	StatusForm->ftpCon->Username = "ftp";
  	StatusForm->ftpCon->Password = "installmgr@user.com";
--- 80,84 ----
  
  	Synchronize((TThreadMethod)&PreConnect);
! 	StatusForm->ftpCon->Host = ist->is.source.c_str();
  	StatusForm->ftpCon->Username = "ftp";
  	StatusForm->ftpCon->Password = "installmgr@user.com";
***************
*** 96,100 ****
  	}
  */
! 	string url = "ftp://" + ist->Source + ist->Directory.c_str() + "/"; //dont forget the final slash
  	if (FTPURLGetFile(session, "dirlist", url.c_str())) {
  		MessageBox(0, "Can't connect.  Please check your configuration.", "Connection Error", MB_OK);
--- 97,101 ----
  	}
  */
! 	SWBuf url = (SWBuf)"ftp://" + ist->is.source + ist->is.directory.c_str() + "/"; //dont forget the final slash
  	if (FTPURLGetFile(session, "dirlist", url.c_str())) {
  		MessageBox(0, "Can't connect.  Please check your configuration.", "Connection Error", MB_OK);
***************
*** 106,110 ****
  
  
! 	string url = "ftp://" + ist->Source + ist->Directory.c_str() + "/" + src + "/"; //dont forget the final slash
  	vector<struct ftpparse> dirList = FTPURLGetDir(session, url.c_str(), passive);
  
--- 107,111 ----
  
  
! 	SWBuf url = (SWBuf)"ftp://" + ist->is.source + ist->is.directory.c_str() + "/" + src + "/"; //dont forget the final slash
  	vector<struct ftpparse> dirList = FTPURLGetDir(session, url.c_str(), passive);
  
***************
*** 132,141 ****
  						buffer2 += (dirList[i].name);
  		//				SWLog::systemlog->LogInformation("%s", buffer.c_str());
! 						TMainForm::createParent(buffer.c_str());	// make sure parent directory exists
  						Synchronize((TThreadMethod)&PreDownload1);
  						try {
  //							StatusForm->ftpCon->Get(dirList->Items[i]->FileName.c_str(), buffer.c_str(), true, false);
  
! 							string url = "ftp://" + ist->Source + ist->Directory.c_str() + "/" + src + "/" + dirList[i].name; //dont forget the final slash
  
  							if (FTPURLGetFile(session, buffer.c_str(), url.c_str(), passive, status_callback)) {
--- 133,142 ----
  						buffer2 += (dirList[i].name);
  		//				SWLog::systemlog->LogInformation("%s", buffer.c_str());
! 						FileMgr::createParent(buffer.c_str());	// make sure parent directory exists
  						Synchronize((TThreadMethod)&PreDownload1);
  						try {
  //							StatusForm->ftpCon->Get(dirList->Items[i]->FileName.c_str(), buffer.c_str(), true, false);
  
! 							SWBuf url = (SWBuf)"ftp://" + ist->is.source + ist->is.directory.c_str() + "/" + src + "/" + dirList[i].name; //dont forget the final slash
  
  							if (FTPURLGetFile(session, buffer.c_str(), url.c_str(), passive, status_callback)) {
***************
*** 156,160 ****
  			try {
  //				StatusForm->ftpCon->Get(src.c_str(), dest.c_str(), true, false);
! 				string url = "ftp://" + ist->Source + ist->Directory.c_str() + "/" + src.c_str(); //dont forget the final slash
  				if (FTPURLGetFile(session, dest.c_str(), url.c_str(), status_callback)) {
  					MessageBox(0, "Can't connect.  Please check your configuration.", "Connection Error", MB_OK);
--- 157,161 ----
  			try {
  //				StatusForm->ftpCon->Get(src.c_str(), dest.c_str(), true, false);
! 				SWBuf url = (SWBuf)"ftp://" + ist->is.source + ist->is.directory.c_str() + "/" + src.c_str(); //dont forget the final slash
  				if (FTPURLGetFile(session, dest.c_str(), url.c_str(), status_callback)) {
  					MessageBox(0, "Can't connect.  Please check your configuration.", "Connection Error", MB_OK);
***************
*** 193,197 ****
  {
  	buffer = "Connecting to server at ";
! 	buffer += ist->Source.c_str();
  	buffer += "...";
  	StatusForm->actionBar->Caption = buffer.c_str();
--- 194,198 ----
  {
  	buffer = "Connecting to server at ";
! 	buffer += ist->is.source.c_str();
  	buffer += "...";
  	StatusForm->actionBar->Caption = buffer.c_str();
***************
*** 218,222 ****
  	StatusForm->statusBar->Caption = "";
  	StatusForm->Repaint();
! 	MainForm->createParent(dest.c_str());	// make sure parent directory exists
  }
  
--- 219,223 ----
  	StatusForm->statusBar->Caption = "";
  	StatusForm->Repaint();
! 	FileMgr::createParent(dest.c_str());	// make sure parent directory exists
  }
  

Index: StatusFrm.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr/StatusFrm.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** StatusFrm.h	24 Sep 2002 21:08:15 -0000	1.9
--- StatusFrm.h	27 Jun 2003 01:41:06 -0000	1.10
***************
*** 20,28 ****
  class TFTPCon {
  public:
! 	string Host;
! 	string Username;
! 	string Password;
  	bool Passive;
! 	string cwd;
  	
  };
--- 20,28 ----
  class TFTPCon {
  public:
! 	SWBuf Host;
! 	SWBuf Username;
! 	SWBuf Password;
  	bool Passive;
! 	SWBuf cwd;
  	
  };
***************
*** 51,59 ****
  		bool abort;
  		InstallSourceTab *ist;
! 		string src;
! 		string dest;
! 		string buffer;
! 		string buffer2;
! 		string suffix;
  		bool dirTransfer;
  		bool passive;
--- 51,59 ----
  		bool abort;
  		InstallSourceTab *ist;
! 		SWBuf src;
! 		SWBuf dest;
! 		SWBuf buffer;
! 		SWBuf buffer2;
! 		SWBuf suffix;
  		bool dirTransfer;
  		bool passive;
***************
*** 76,82 ****
  	long totalBytes;
  	InstallSourceTab *ist;
! 	string src;
! 	string dest;
! 	string suffix;
  	bool dirTransfer;
  	bool passive;
--- 76,82 ----
  	long totalBytes;
  	InstallSourceTab *ist;
! 	SWBuf src;
! 	SWBuf dest;
! 	SWBuf suffix;
  	bool dirTransfer;
  	bool passive;

Index: cipherfrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr/cipherfrm.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** cipherfrm.cpp	4 Oct 2002 22:25:36 -0000	1.4
--- cipherfrm.cpp	27 Jun 2003 01:41:06 -0000	1.5
***************
*** 25,29 ****
  	ConfigEntMap::iterator entry;
  	SWConfig *modconf = new SWConfig(confFile.c_str());
! 	string tmpBuf;
  	
  	section = modconf->Sections.find(modName);
--- 25,29 ----
  	ConfigEntMap::iterator entry;
  	SWConfig *modconf = new SWConfig(confFile.c_str());
! 	SWBuf tmpBuf;
  	
  	section = modconf->Sections.find(modName);
***************
*** 54,58 ****
  void __fastcall TCipherForm::FormShow(TObject *Sender)
  {
! 	string tmpCaption;
  	tmpCaption = "Cipher Key: [";
  	tmpCaption += modName;
--- 54,58 ----
  void __fastcall TCipherForm::FormShow(TObject *Sender)
  {
! 	SWBuf tmpCaption;
  	tmpCaption = "Cipher Key: [";
  	tmpCaption += modName;

Index: cipherfrm.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/InstallMgr/cipherfrm.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** cipherfrm.h	1 Nov 2000 03:04:33 -0000	1.3
--- cipherfrm.h	27 Jun 2003 01:41:06 -0000	1.4
***************
*** 8,12 ****
  #include <Forms.hpp>
  #include <ExtCtrls.hpp>
! #include <string>
  //---------------------------------------------------------------------------
  class TCipherForm : public TForm
--- 8,14 ----
  #include <Forms.hpp>
  #include <ExtCtrls.hpp>
! #include <swbuf.h>
! 
! using namespace sword;
  //---------------------------------------------------------------------------
  class TCipherForm : public TForm
***************
*** 28,33 ****
  private:	// User declarations
  public:		// User declarations
! 	std::string confFile;
! 	std::string modName;
  	__fastcall TCipherForm(TComponent* Owner);
  };
--- 30,35 ----
  private:	// User declarations
  public:		// User declarations
! 	SWBuf confFile;
! 	SWBuf modName;
  	__fastcall TCipherForm(TComponent* Owner);
  };