Renamed some stuff

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@217 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-05-01 02:15:48 +00:00
parent 324cb165b2
commit 2d359f53d5
3 changed files with 14 additions and 13 deletions

View File

@@ -18,7 +18,7 @@ static struct option g_LongOpts[] =
void GenerateHelp( const char *appname )
{
CUtils::PrintMessage("USAGE: " + string(appname) + " [options] [znc.conf]");
CUtils::PrintMessage("USAGE: " + string(appname) + " [options] [config]");
CUtils::PrintMessage("Options are:");
CUtils::PrintMessage("\t--help");
CUtils::PrintMessage("\t--makepass Generates a password for use in config");

21
znc.cpp
View File

@@ -235,7 +235,7 @@ string CZNC::GetConfigPath(const string& sConfigFile) {
return sRetPath;
}
bool CZNC::WriteNewConfig(const string& sConfigFile) {
bool CZNC::WriteNewConfig(const string& sConfig) {
string sAnswer;
vector<string> vsLines;
bool bAnswer = false;
@@ -339,6 +339,7 @@ bool CZNC::WriteNewConfig(const string& sConfigFile) {
} while (CUtils::GetBoolInput("Would you like to setup another user?", false));
// !User
string sConfigFile = GetConfigPath(sConfig);
CUtils::PrintAction("Writing config [" + sConfigFile + "]");
CFile File(sConfigFile);
@@ -356,33 +357,33 @@ bool CZNC::WriteNewConfig(const string& sConfigFile) {
return true;
}
bool CZNC::ParseConfig(const string& sConfigFile) {
bool CZNC::ParseConfig(const string& sConfig) {
string sStatusPrefix;
string sFilePath = GetConfigPath(sConfigFile);
string sConfigFile = GetConfigPath(sConfig);
CUtils::PrintAction("Opening Config [" + sFilePath + "]");
CUtils::PrintAction("Opening Config [" + sConfigFile + "]");
if (!CFile::Exists(sFilePath)) {
if (!CFile::Exists(sConfigFile)) {
CUtils::PrintStatus(false, "No such file");
if (!CUtils::GetBoolInput("Would you like to create this config now?", true)) {
return false;
}
WriteNewConfig(sFilePath);
CUtils::PrintAction("Opening Config [" + sFilePath + "]");
WriteNewConfig(sConfigFile);
CUtils::PrintAction("Opening Config [" + sConfigFile + "]");
}
if (!CFile::IsReg(sFilePath)) {
if (!CFile::IsReg(sConfigFile)) {
CUtils::PrintStatus(false, "Not a file");
return false;
}
if (!m_LockFile.TryExLock(sFilePath, 50)) {
if (!m_LockFile.TryExLock(sConfigFile, 50)) {
CUtils::PrintStatus(false, "ZNC is already running on this config.");
return false;
}
CFile File(sFilePath);
CFile File(sConfigFile);
if (!File.Open(O_RDONLY)) {
CUtils::PrintStatus(false);

4
znc.h
View File

@@ -20,12 +20,12 @@ public:
CUser* GetUser(const string& sUser);
Csock* FindSockByName(const string& sSockName);
bool Listen();
bool ParseConfig(const string& sConfigFile);
bool ParseConfig(const string& sConfig);
bool IsHostAllowed(const string& sHostMask);
void InitDirs(const string& sArgvPath);
bool OnBoot();
string GetConfigPath(const string& sConfigFile);
bool WriteNewConfig(const string& sConfigFile);
bool WriteNewConfig(const string& sConfig);
// Getters
TSocketManager<Csock>& GetManager() { return m_Manager; }