Initialize an FTP host or account. This means setting up all the parameters for connecting to an FTP server
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzFtpHost::Init | (hzString&,hzString&,hzString&,hzString&,hzString&,hzString&,) |
Declared in file: hzFtpClient.h
Defined in file : hzFtpClient.cpp
Function Logic:
Function body:
hzEcode hzFtpHost::Init (hzString& host)hzString& user, hzString& pass, hzString& remDir, hzString& locDir, hzString& criteria,
{
// Initialize an FTP host or account. This means setting up all the parameters for connecting to an FTP server
//
// Arguments: 1) host The host name
// 2) user The username for the account
// 3) pass The password to the account
// 4) remDir The opening directory on the server (usually /)
// 5) locDir The opening directory on the local machine
// 6) criteria Opening search criteria for listing (if any)
//
// Returns: E_ARGUMENT If either the hostname, username, password or local directory is not supplied
// E_NOCREATE If the local directory does not exist and could not be created
// E_OK If the operation was successful
_hzfunc("hzFtpSite::Initialize") ;
hzEcode rc = E_OK ; // Return code
/*
** ** Check we have an action, that the action is associated with a publication and that it has an issue date
** */
m_Host = host ;
m_Username = user ;
m_Password = pass ;
m_Source = remDir ;
m_Repos = locDir ;
m_Criteria = criteria ;
if (!host || !user || !pass || !locDir)
{
if (!host) threadLog("No FTP host supplied\n") ;
if (!user) threadLog("No FTP username supplied\n") ;
if (!pass) threadLog("No FTP password supplied\n") ;
if (!locDir) threadLog("No FTP local directory supplied\n") ;
return E_ARGUMENT ;
}
/*
** ** Formulate directory to collect files from and assert that directory
** */
rc = AssertDir(*m_Repos, 0755);
if (rc != E_OK)
return hzwarn(rc, "Failed to assert local dir (%s)\n", *m_Repos) ;
m_bInit = true ;
return rc ;
}