std::string::size_type start = comment.find("{"), end = std::string::npos;
if(start != std::string::npos)
end = comment.find("}", start + 1);
time_t length[3] = {0, 0, 0};
if(end != std::string::npos)
{
int32_t i = 0;
StringVec vec = explodeString(comment.substr(start + 1, end - start - 1), ",");
for(StringVec::iterator it = vec.begin(); it != vec.end() && i < 4; ++it, ++i)
{
if((*it) == "delete")
{
i--;
action = ACTION_DELETION;
continue;
}
time_t banTime = time(NULL);
StringVec tec = explodeString((*it), "+");
for(StringVec::iterator tit = tec.begin(); tit != tec.end(); ++tit)
{
std::string tmp = (*tit);
uint32_t count = 1;
if(tmp.size() > 1)
{
std::string str;
uint32_t textLength = tmp.length();
for(uint32_t size = 0; size < textLength; ++size)
{
if(isNumber(tmp.at(size)))
str += tmp.at(size);
}
count = atoi(str.c_str());
if(!count)
count = 1;
else
tmp = tmp.substr(str.length(), 1);
}
toLowerCaseString(tmp);
if(tmp[0] != 's' && tmp[0] != 'm' && tmp[0] != 'h' && tmp[0] != 'd'
&& tmp[0] != 'w' && tmp[0] != 'o' && tmp[0] != 'y')
continue;
if(tmp[0] == 's')
banTime += count;
if(tmp[0] == 'm')
banTime += count * 60;
if(tmp[0] == 'h')
banTime += count * 3600;
if(tmp[0] == 'd')
banTime += count * 86400;
if(tmp[0] == 'w')
banTime += count * 604800;
if(tmp[0] == 'o')
banTime += count * 2592000;
if(tmp[0] == 'y')
banTime += count * 31536000;
length[i] = banTime;
}
}
comment = comment.substr(0, start);
}