|
|
|
@ -492,6 +492,10 @@ void IRC::onMsgNumeric(const IRCPrefix& /*sender*/, const std::string& num, cons |
|
|
|
|
|
|
|
|
|
if (num == Numeric::RPL_ENDOFNAMES) { |
|
|
|
|
emit memberListReloaded(args[1].c_str()); |
|
|
|
|
if (!ignoreVerbosity(num)) { |
|
|
|
|
std::string msg = fmt::format("{}: {}", argmsg, message); |
|
|
|
|
getStatus().print(PrintType::Normal, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else if (num == Numeric::RPL_TOPIC) { |
|
|
|
@ -570,31 +574,80 @@ void IRC::onMsgNumeric(const IRCPrefix& /*sender*/, const std::string& num, cons |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else if (!ignoreVerbosity(num)) { |
|
|
|
|
IWin* window = nullptr; |
|
|
|
|
|
|
|
|
|
if (num == Numeric::RPL_WHOISUSER) { |
|
|
|
|
// This is always the first message received in /WHOIS response.
|
|
|
|
|
auto& conf = ConfigMgr::instance(); |
|
|
|
|
m_receiveWhoisToCurrentWindow = conf.common("ShowWhoisActiveWindow").toInt(); |
|
|
|
|
IWin* window = m_receiveWhoisToCurrentWindow ? getStatus().getActiveWindow() |
|
|
|
|
: &getStatus(); |
|
|
|
|
|
|
|
|
|
std::string msg = fmt::format("{}: {}@{}: {}", args[1], args[2], args[3], message); |
|
|
|
|
window->print(PrintType::Normal, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (m_receiveWhoisToCurrentWindow) { |
|
|
|
|
window = getStatus().getActiveWindow(); |
|
|
|
|
else if (num == Numeric::RPL_WHOISSERVER) { |
|
|
|
|
IWin* window = m_receiveWhoisToCurrentWindow ? getStatus().getActiveWindow() |
|
|
|
|
: &getStatus(); |
|
|
|
|
|
|
|
|
|
std::string msg = fmt::format("{}: {} ({})", args[1], args[2], message); |
|
|
|
|
window->print(PrintType::Normal, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
if (args.size() > 1) |
|
|
|
|
window = MdiManager::instance().findWindow(&getStatus(), QString::fromStdString(args[1])); |
|
|
|
|
if (!window) |
|
|
|
|
window = &getStatus(); |
|
|
|
|
|
|
|
|
|
else if (num == Numeric::RPL_WHOISIDLE) { |
|
|
|
|
IWin* window = m_receiveWhoisToCurrentWindow ? getStatus().getActiveWindow() |
|
|
|
|
: &getStatus(); |
|
|
|
|
auto list = QString::fromStdString(message).split(", "); |
|
|
|
|
std::string msg = fmt::format("{}:", args[1]); |
|
|
|
|
int i = 2; // Relevant information starts on the 2nd argument
|
|
|
|
|
for (const auto& il : list) { |
|
|
|
|
auto item = il.toLower(); |
|
|
|
|
auto arg = QString::fromStdString(args[i]); |
|
|
|
|
if (item == "seconds idle") { |
|
|
|
|
quint64 now = QDateTime::currentSecsSinceEpoch(); |
|
|
|
|
quint64 seconds = arg.toLongLong(); |
|
|
|
|
QString date = QDateTime::fromTime_t(now-seconds).toString(); |
|
|
|
|
msg.append(fmt::format(" Last active: {}", date.toStdString())); |
|
|
|
|
} |
|
|
|
|
else if (item == "signon time") { |
|
|
|
|
quint64 seconds = arg.toLongLong(); |
|
|
|
|
QString date = QDateTime::fromTime_t(seconds).toString(); |
|
|
|
|
msg.append(fmt::format(" Signed on: {}", date.toStdString())); |
|
|
|
|
} |
|
|
|
|
++i; |
|
|
|
|
} |
|
|
|
|
window->print(PrintType::Normal, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (message.empty()) |
|
|
|
|
window->print(PrintType::Normal, argmsg.c_str()); |
|
|
|
|
else if (argmsg.empty()) |
|
|
|
|
window->print(PrintType::Normal, message.c_str()); |
|
|
|
|
else { |
|
|
|
|
std::string msg = fmt::format("{}: {}", argmsg, message); |
|
|
|
|
else if (num == Numeric::RPL_WHOISLOGGEDIN) { |
|
|
|
|
IWin* window = m_receiveWhoisToCurrentWindow ? getStatus().getActiveWindow() |
|
|
|
|
: &getStatus(); |
|
|
|
|
|
|
|
|
|
std::string msg = fmt::format("{}: {} {}", args[1], message, args[2]); |
|
|
|
|
window->print(PrintType::Normal, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else { |
|
|
|
|
IWin* window = nullptr; |
|
|
|
|
|
|
|
|
|
if (m_receiveWhoisToCurrentWindow) { |
|
|
|
|
window = getStatus().getActiveWindow(); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
if (args.size() > 1) |
|
|
|
|
window = MdiManager::instance().findWindow(&getStatus(), QString::fromStdString(args[1])); |
|
|
|
|
if (!window) |
|
|
|
|
window = &getStatus(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (message.empty()) |
|
|
|
|
window->print(PrintType::Normal, argmsg.c_str()); |
|
|
|
|
else if (argmsg.empty()) |
|
|
|
|
window->print(PrintType::Normal, message.c_str()); |
|
|
|
|
else { |
|
|
|
|
std::string msg = fmt::format("{}: {}", argmsg, message); |
|
|
|
|
window->print(PrintType::Normal, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (num == Numeric::ERR_NICKNAMEINUSE && !isOnline()) { |
|
|
|
|