Initialize a POP3 Account that our application will access as client.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzPop3Acc::Init | (hzString,hzString,hzString,hzString,) |
Declared in file: hzMailer.h
Defined in file : hzPop3.cpp
Function Logic:
Function body:
hzEcode hzPop3Acc::Init (hzString Server)hzString Username, hzString Password, hzString Repos,
{
// Initialize a POP3 Account that our application will access as client.
//
// Arguments: 1) Server Server/Hostname to connect to.
// 2) Username Username for the account.
// 3) Password Password for the account.
// 4) Repos Pathname for the email repository (of downloaded messages and headers)
//
// Returns: E_INITDUP If this POP3 account manager has already been initialized
// E_ARGUMENT If the server, username, password or the email repository pathname are not supplied
// E_OK If this POP3 account manager is now initialized
hzVect <hzString> dirs ; // Vector of directories populated by ListDir()
hzVect <hzString> files ; // Vector of files populated by ListDir()
hzString S ; // Temp string (filename)
uint32_t nIndex ; // Files iterator
hzEcode rc ; // Return code
m_Error.Clear() ;
m_Server = Server ;
m_Username = Username ;
m_Password = Password ;
m_Repos = Repos ;
if (m_Repos)
{
m_Error.Printf("hzPop3Acc::Init - Duplicate call\n") ;
return E_INITDUP ;
}
if (!m_Server || !m_Username || !m_Password || !m_Repos)
{
m_Error.Printf("hzPop3Acc::Init\n") ;
if (!m_Server) m_Error.Printf(" - No POP3 server specified\n") ;
if (!m_Username) m_Error.Printf(" - No POP3 Username\n") ;
if (!m_Password) m_Error.Printf(" - No POP3 Password\n") ;
if (!m_Repos) m_Error.Printf(" - No POP3 Repository specified\n") ;
return E_ARGUMENT ;
}
rc = AssertDir(Repos, 0777);
if (rc != E_OK)
return rc ;
// Read the repository and populate the m_Already map
rc = ListDir(dirs, files, *Repos, 0);
for (nIndex = 0; nIndex < files.Count() ; nIndex++)
{
S = files[nIndex] ;
m_Already.Insert(S) ;
}
return E_OK ;
}