Initial
This commit is contained in:
142
pop/HOLD/SRVRREG.HPP
Normal file
142
pop/HOLD/SRVRREG.HPP
Normal file
@@ -0,0 +1,142 @@
|
||||
#ifndef _POP_SERVERREG_HPP_
|
||||
#define _POP_SERVERREG_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_REGKEY_HPP_
|
||||
#include <common/regkey.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_DISKINFO_HPP_
|
||||
#include <common/diskinfo.hpp>
|
||||
#endif
|
||||
#ifndef _POP_POP_HPP_
|
||||
#include <pop/pop.hpp>
|
||||
#endif
|
||||
|
||||
class ServerReg
|
||||
{
|
||||
public:
|
||||
ServerReg(void);
|
||||
ServerReg(const ServerReg &someServerReg);
|
||||
virtual ~ServerReg();
|
||||
ServerReg &operator=(const ServerReg &someServerReg);
|
||||
const String &serverName(void)const;
|
||||
void serverName(const String &hostName);
|
||||
const String &userName(void)const;
|
||||
void userName(const String &userName);
|
||||
const String &password(void)const;
|
||||
void password(const String &password);
|
||||
const String &mailDir(void)const;
|
||||
void mailDir(const String &mailDirectory);
|
||||
private:
|
||||
RegKey mRegKey;
|
||||
|
||||
String mServerName;
|
||||
String mMailDir;
|
||||
String mUserName;
|
||||
String mPassword;
|
||||
String mRegEntryKey;
|
||||
String mServerNameKey;
|
||||
String mMailDirKey;
|
||||
String mUserNameKey;
|
||||
String mPasswordKey;
|
||||
};
|
||||
|
||||
inline
|
||||
ServerReg::ServerReg(void)
|
||||
: mRegKey(RegKey::CurrentUser), mRegEntryKey(STRING_REGENTRYKEY),
|
||||
mServerNameKey(STRING_SERVERNAMEKEY), mMailDirKey(STRING_MAILDIRKEY),
|
||||
mUserNameKey(STRING_USERNAMEKEY), mPasswordKey(STRING_PASSWORDKEY)
|
||||
{
|
||||
if(!mRegKey.openKey(mRegEntryKey))
|
||||
{
|
||||
mRegKey.createKey(mRegEntryKey,"");
|
||||
mRegKey.openKey(mRegEntryKey);
|
||||
}
|
||||
mRegKey.queryValue(mMailDirKey,mMailDir);
|
||||
if(mMailDir.isNull())
|
||||
{
|
||||
DiskInfo diskInfo;
|
||||
diskInfo.getCurrentDirectory(mMailDir);
|
||||
mRegKey.setValue(mMailDirKey,mMailDir);
|
||||
}
|
||||
mRegKey.queryValue(mServerNameKey,mServerName);
|
||||
mRegKey.queryValue(mUserNameKey,mUserName);
|
||||
mRegKey.queryValue(mPasswordKey,mPassword);
|
||||
}
|
||||
|
||||
inline
|
||||
ServerReg::ServerReg(const ServerReg &someServerReg)
|
||||
: mRegKey(RegKey::CurrentUser), mRegEntryKey(STRING_REGENTRYKEY),
|
||||
mServerNameKey(STRING_SERVERNAMEKEY), mMailDirKey(STRING_MAILDIRKEY),
|
||||
mUserNameKey(STRING_USERNAMEKEY), mPasswordKey(STRING_PASSWORDKEY)
|
||||
{
|
||||
*this=someServerReg;
|
||||
}
|
||||
|
||||
inline
|
||||
ServerReg::~ServerReg()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ServerReg &ServerReg::operator=(const ServerReg &someServerReg)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
const String &ServerReg::serverName(void)const
|
||||
{
|
||||
return mServerName;
|
||||
}
|
||||
|
||||
inline
|
||||
void ServerReg::serverName(const String &serverName)
|
||||
{
|
||||
mServerName=serverName;
|
||||
mRegKey.setValue(mServerNameKey,mServerName);
|
||||
}
|
||||
|
||||
inline
|
||||
const String &ServerReg::mailDir(void)const
|
||||
{
|
||||
return mMailDir;
|
||||
}
|
||||
|
||||
inline
|
||||
void ServerReg::mailDir(const String &mailDir)
|
||||
{
|
||||
mMailDir=mailDir;
|
||||
mRegKey.setValue(mMailDirKey,mMailDir);
|
||||
}
|
||||
|
||||
inline
|
||||
const String &ServerReg::userName(void)const
|
||||
{
|
||||
return mUserName;
|
||||
}
|
||||
|
||||
inline
|
||||
void ServerReg::userName(const String &userName)
|
||||
{
|
||||
mUserName=userName;
|
||||
mRegKey.setValue(mUserNameKey,mUserName);
|
||||
}
|
||||
|
||||
inline
|
||||
const String &ServerReg::password(void)const
|
||||
{
|
||||
return mPassword;
|
||||
}
|
||||
|
||||
inline
|
||||
void ServerReg::password(const String &password)
|
||||
{
|
||||
mPassword=password;
|
||||
mRegKey.setValue(mPasswordKey,mPassword);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user