Clarify the display of the remaining ban duration to banned users

This commit is contained in:
Lari Nieminen 2016-10-03 14:19:31 +03:00 committed by ln-zookeeper
parent 213c19729f
commit a18843907b
2 changed files with 4 additions and 4 deletions

View file

@ -133,11 +133,11 @@ std::string get_timespan(const time_t& t) {
if(t <= 0) {
strncpy(buf, "expired", 100);
} else if(minutes == 0) {
snprintf(buf, 100, "00:00:%02ld", t);
snprintf(buf, 100, "%ld seconds", t);
} else if(days == 0) {
snprintf(buf, 100, "%02ld:%02ld", minutes / 60, minutes % 60);
snprintf(buf, 100, "%ld hours, %ld minutes", minutes / 60, minutes % 60);
} else {
snprintf(buf, 100, "%ld %02ld:%02ld", days, (minutes / 60) % 24, minutes % 60);
snprintf(buf, 100, "%ld days, %ld hours, %ld minutes", days, (minutes / 60) % 24, minutes % 60);
}
return buf;
}

View file

@ -664,7 +664,7 @@ static lg::log_domain log_server("server");
ban_set::const_iterator ban = std::find_if(bans_.begin(), bans_.end(), boost::bind(&banned::match_ip, boost::bind(&banned_ptr::get, _1), pair));
if (ban == bans_.end()) return "";
const std::string& nick = (*ban)->get_nick();
return (*ban)->get_reason() + (nick.empty() ? "" : " (" + nick + ")") + " (" + (*ban)->get_human_time_span() + ")";
return (*ban)->get_reason() + (nick.empty() ? "" : " (" + nick + ")") + " (Remaining ban duration: " + (*ban)->get_human_time_span() + ")";
}
void ban_manager::init_ban_help()