printfd(__FILE__, "FILES_STORE::RestoreUserStat - download stat read failed for user '%s'\n", login.c_str());
return -1;
}
- stat->down[i] = traff;
+ stat->monthDown[i] = traff;
snprintf(s, 22, "U%d", i);
if (cf.ReadULongLongInt(s, &traff, 0) != 0)
printfd(__FILE__, "FILES_STORE::RestoreUserStat - upload stat read failed for user '%s'\n", login.c_str());
return -1;
}
- stat->up[i] = traff;
+ stat->monthUp[i] = traff;
}
if (cf.ReadDouble("Cash", &stat->cash, 0) != 0)
for (int i = 0; i < DIR_NUM; i++)
{
snprintf(s, 22, "D%d", i);
- cfstat.WriteInt(s, stat.down[i]);
+ cfstat.WriteInt(s, stat.monthDown[i]);
snprintf(s, 22, "U%d", i);
- cfstat.WriteInt(s, stat.up[i]);
+ cfstat.WriteInt(s, stat.monthUp[i]);
}
cfstat.WriteDouble("Cash", stat.cash);
}
//-----------------------------------------------------------------------------
int FILES_STORE::WriteUserDisconnect(const std::string & login,
- const DIR_TRAFF & up,
- const DIR_TRAFF & down,
+ const DIR_TRAFF & monthUp,
+ const DIR_TRAFF & monthDown,
const DIR_TRAFF & sessionUp,
const DIR_TRAFF & sessionDown,
double cash,
<< "\' session download: \'"
<< sessionDown
<< "\' month upload: \'"
- << up
+ << monthUp
<< "\' month download: \'"
- << down
+ << monthDown
<< "\' cash: \'"
<< cash
<< "\'";
{
char dirName[3];
snprintf(dirName, 3, "U%llu", (unsigned long long)i);
- s.WriteInt(dirName, stat.up[i]); // Classic
- s2.WriteInt(dirName, stat.up[i]); // New
+ s.WriteInt(dirName, stat.monthUp[i]); // Classic
+ s2.WriteInt(dirName, stat.monthUp[i]); // New
snprintf(dirName, 3, "D%llu", (unsigned long long)i);
- s.WriteInt(dirName, stat.down[i]); // Classic
- s2.WriteInt(dirName, stat.down[i]); // New
+ s.WriteInt(dirName, stat.monthDown[i]); // Classic
+ s2.WriteInt(dirName, stat.monthDown[i]); // New
}
// Classic
printfd(__FILE__, "FILES_STORE::RestoreTariff - invalid trafftype for tariff '%s'\n", tariffName.c_str());
return -1;
}
+
+if (conf.ReadString("Period", &str, "month") < 0)
+ td->tariffConf.period = TARIFF::MONTH;
+else
+ td->tariffConf.period = TARIFF::StringToPeriod(str);
return 0;
}
//-----------------------------------------------------------------------------
cf.WriteString("TraffType", "max");
break;
}
+
+ cf.WriteString("Period", TARIFF::PeriodToString(td.tariffConf.period));
}
return 0;
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
errorStr = "Error moving dir from " + fileName + ".new to " + fileName;
- printfd(__FILE__, "FILES_STORE::SaveTariff - rename failed. Message: '%s'\n", strerror(errno));
+ printfd(__FILE__, "FILES_STORE::EditMessage - rename failed. Message: '%s'\n", strerror(errno));
return -1;
}