//-----------------------------------------------------------------------------
void USER_IMPL::SetLogin(const std::string & l)
{
//-----------------------------------------------------------------------------
void USER_IMPL::SetLogin(const std::string & l)
{
//-----------------------------------------------------------------------------
int USER_IMPL::ReadConf()
{
//-----------------------------------------------------------------------------
int USER_IMPL::ReadConf()
{
//-----------------------------------------------------------------------------
int USER_IMPL::ReadStat()
{
//-----------------------------------------------------------------------------
int USER_IMPL::ReadStat()
{
//-----------------------------------------------------------------------------
int USER_IMPL::WriteConf()
{
//-----------------------------------------------------------------------------
int USER_IMPL::WriteConf()
{
USER_CONF conf(property.GetConf());
printfd(__FILE__, "USER::WriteConf()\n");
USER_CONF conf(property.GetConf());
printfd(__FILE__, "USER::WriteConf()\n");
//-----------------------------------------------------------------------------
int USER_IMPL::WriteStat()
{
//-----------------------------------------------------------------------------
int USER_IMPL::WriteStat()
{
USER_STAT stat(property.GetStat());
if (store->SaveUserStat(stat, login))
USER_STAT stat(property.GetStat());
if (store->SaveUserStat(stat, login))
//-----------------------------------------------------------------------------
int USER_IMPL::WriteMonthStat()
{
//-----------------------------------------------------------------------------
int USER_IMPL::WriteMonthStat()
{
//-----------------------------------------------------------------------------
int USER_IMPL::Authorize(uint32_t ip, uint32_t dirs, const AUTH * auth)
{
//-----------------------------------------------------------------------------
int USER_IMPL::Authorize(uint32_t ip, uint32_t dirs, const AUTH * auth)
{
/*
* Authorize user. It only means that user will be authorized. Nothing more.
* User can be connected or disconnected while authorized.
/*
* Authorize user. It only means that user will be authorized. Nothing more.
* User can be connected or disconnected while authorized.
//-----------------------------------------------------------------------------
void USER_IMPL::Unauthorize(const AUTH * auth, const std::string & reason)
{
//-----------------------------------------------------------------------------
void USER_IMPL::Unauthorize(const AUTH * auth, const std::string & reason)
{
//-----------------------------------------------------------------------------
bool USER_IMPL::IsAuthorizedBy(const AUTH * auth) const
{
//-----------------------------------------------------------------------------
bool USER_IMPL::IsAuthorizedBy(const AUTH * auth) const
{
// Is this user authorized by specified authorizer?
return authorizedBy.find(auth) != authorizedBy.end();
}
// Is this user authorized by specified authorizer?
return authorizedBy.find(auth) != authorizedBy.end();
}
std::cout << "============================================================" << std::endl;
std::cout << "id=" << id << std::endl;
std::cout << "login=" << login << std::endl;
std::cout << "============================================================" << std::endl;
std::cout << "id=" << id << std::endl;
std::cout << "login=" << login << std::endl;
//-----------------------------------------------------------------------------
void USER_IMPL::UpdatePingTime(time_t t)
{
//-----------------------------------------------------------------------------
void USER_IMPL::UpdatePingTime(time_t t)
{
//printfd(__FILE__, "UpdatePingTime(%d) %s\n", t, login.c_str());
if (t)
pingTime = t;
//printfd(__FILE__, "UpdatePingTime(%d) %s\n", t, login.c_str());
if (t)
pingTime = t;
//-----------------------------------------------------------------------------
bool USER_IMPL::IsInetable()
{
//-----------------------------------------------------------------------------
bool USER_IMPL::IsInetable()
{
//-----------------------------------------------------------------------------
std::string USER_IMPL::GetEnabledDirs() const
{
//-----------------------------------------------------------------------------
std::string USER_IMPL::GetEnabledDirs() const
{
//-----------------------------------------------------------------------------
void USER_IMPL::AddCurrIPBeforeNotifier(CURR_IP_NOTIFIER * notifier)
{
//-----------------------------------------------------------------------------
void USER_IMPL::AddCurrIPBeforeNotifier(CURR_IP_NOTIFIER * notifier)
{
currIP.AddBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelCurrIPBeforeNotifier(const CURR_IP_NOTIFIER * notifier)
{
currIP.AddBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelCurrIPBeforeNotifier(const CURR_IP_NOTIFIER * notifier)
{
currIP.DelBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::AddCurrIPAfterNotifier(CURR_IP_NOTIFIER * notifier)
{
currIP.DelBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::AddCurrIPAfterNotifier(CURR_IP_NOTIFIER * notifier)
{
currIP.AddAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelCurrIPAfterNotifier(const CURR_IP_NOTIFIER * notifier)
{
currIP.AddAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelCurrIPAfterNotifier(const CURR_IP_NOTIFIER * notifier)
{
currIP.DelAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::AddConnectedBeforeNotifier(CONNECTED_NOTIFIER * notifier)
{
currIP.DelAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::AddConnectedBeforeNotifier(CONNECTED_NOTIFIER * notifier)
{
connected.AddBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelConnectedBeforeNotifier(const CONNECTED_NOTIFIER * notifier)
{
connected.AddBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelConnectedBeforeNotifier(const CONNECTED_NOTIFIER * notifier)
{
connected.DelBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::AddConnectedAfterNotifier(CONNECTED_NOTIFIER * notifier)
{
connected.DelBeforeNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::AddConnectedAfterNotifier(CONNECTED_NOTIFIER * notifier)
{
connected.AddAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelConnectedAfterNotifier(const CONNECTED_NOTIFIER * notifier)
{
connected.AddAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::DelConnectedAfterNotifier(const CONNECTED_NOTIFIER * notifier)
{
connected.DelAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::OnAdd()
{
connected.DelAfterNotifier(notifier);
}
//-----------------------------------------------------------------------------
void USER_IMPL::OnAdd()
{
//-----------------------------------------------------------------------------
void USER_IMPL::OnDelete()
{
//-----------------------------------------------------------------------------
void USER_IMPL::OnDelete()
{
//-----------------------------------------------------------------------------
double USER_IMPL::GetPassiveTimePart() const
{
//-----------------------------------------------------------------------------
double USER_IMPL::GetPassiveTimePart() const
{
static int daysInMonth[12] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static int daysInMonth[12] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//-----------------------------------------------------------------------------
void USER_IMPL::SetPassiveTimeAsNewUser()
{
//-----------------------------------------------------------------------------
void USER_IMPL::SetPassiveTimeAsNewUser()
{
//-----------------------------------------------------------------------------
void USER_IMPL::MidnightResetSessionStat()
{
//-----------------------------------------------------------------------------
void USER_IMPL::MidnightResetSessionStat()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessNewMonth()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessNewMonth()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessDayFeeSpread()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessDayFeeSpread()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessDayFee()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessDayFee()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessDailyFee()
{
//-----------------------------------------------------------------------------
void USER_IMPL::ProcessDailyFee()
{
//-----------------------------------------------------------------------------
int USER_IMPL::AddMessage(STG_MSG * msg)
{
//-----------------------------------------------------------------------------
int USER_IMPL::AddMessage(STG_MSG * msg)
{
//-----------------------------------------------------------------------------
std::string USER_IMPL::GetParamValue(const std::string & name) const
{
//-----------------------------------------------------------------------------
std::string USER_IMPL::GetParamValue(const std::string & name) const
{
- if (name == "login") return login;
- if (name == "currIP") return currIP.ToString();
- if (name == "enabledDirs") return GetEnabledDirs();
- if (property.Exists(name))
- return property.GetPropertyValue(name);
+ if (lowerName == "login") return login;
+ if (lowerName == "currip") return currIP.ToString();
+ if (lowerName == "enableddirs") return GetEnabledDirs();
+ if (lowerName == "tariff") return property.tariffName;
+ if (property.Exists(lowerName))
+ return property.GetPropertyValue(lowerName);