|
|
|
@ -761,44 +761,59 @@ void IRC::onMsgCTCPRequest(const IRCPrefix& sender, const std::string& target, c |
|
|
|
|
win->print(PrintType::Action, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
else if (!ignoreVerbosity(Command::Internal::CTCP)) { |
|
|
|
|
std::string msg; |
|
|
|
|
|
|
|
|
|
std::string printmsg; |
|
|
|
|
std::string cmdMsg; |
|
|
|
|
if (!message.empty() && command != "PING") |
|
|
|
|
cmdMsg = fmt::format("{} {}", command, message); |
|
|
|
|
else |
|
|
|
|
cmdMsg = command; |
|
|
|
|
|
|
|
|
|
/* Sent private */ |
|
|
|
|
if (std::find(chantypes.begin(), chantypes.end(), target[0]) == chantypes.end()) { |
|
|
|
|
msg = fmt::format("[CTCP {}] from {}", command, sender.nickname()); |
|
|
|
|
printmsg = fmt::format("[CTCP {}] from {}", cmdMsg, sender.nickname()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Sent to channel */ |
|
|
|
|
else { |
|
|
|
|
msg = fmt::format("[CTCP {}]:{} from {}", command, target, sender.nickname()); |
|
|
|
|
printmsg = fmt::format("[CTCP {}]:{} from {}", cmdMsg, target, sender.nickname()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto* win = getStatus().getActiveWindow(); |
|
|
|
|
win->print(PrintType::CTCP, msg.c_str()); |
|
|
|
|
getStatus().print(PrintType::CTCP, printmsg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (command == "VERSION") { |
|
|
|
|
ctcpResponse(sender.nickname(), "VERSION", |
|
|
|
|
fmt::format("IdealIRC {} by Tomatix - http://www.idealirc.org/", VERSION_STRING)); |
|
|
|
|
} |
|
|
|
|
else if (command == "PING") { |
|
|
|
|
ctcpResponse(sender.toString(), command, message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
contextualScriptEvent(&m_status, ScriptEvent::CtcpRequest, sender.toString(), target, command, message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void IRC::onMsgCTCPResponse(const IRCPrefix& sender, const std::string& target, const std::string& command, const std::string& message) |
|
|
|
|
{ |
|
|
|
|
std::string msg = message; |
|
|
|
|
|
|
|
|
|
if (command == "PING") { |
|
|
|
|
const qint64 curr = QDateTime::currentMSecsSinceEpoch(); |
|
|
|
|
const qint64 prev = std::stoll(message); |
|
|
|
|
const qint64 diffMs = curr - prev; |
|
|
|
|
msg = fmt::format("{}ms", diffMs); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!ignoreVerbosity(Command::Internal::CTCP)) { |
|
|
|
|
std::string printmsg; |
|
|
|
|
if (message.empty()) |
|
|
|
|
printmsg = fmt::format("[CTCP {}] reply from {}", command, sender.nickname()); |
|
|
|
|
else |
|
|
|
|
printmsg = fmt::format("[CTCP {}] reply from {}: {}", command, sender.nickname(), message); |
|
|
|
|
printmsg = fmt::format("[CTCP {}] reply from {}: {}", command, sender.nickname(), msg); |
|
|
|
|
|
|
|
|
|
auto* win = getStatus().getActiveWindow(); |
|
|
|
|
win->print(PrintType::CTCP, printmsg.c_str()); |
|
|
|
|
} |
|
|
|
|
contextualScriptEvent(&m_status, ScriptEvent::CtcpReply, sender.toString(), target, command, message); |
|
|
|
|
contextualScriptEvent(&m_status, ScriptEvent::CtcpReply, sender.toString(), target, command, msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void IRC::onMsgDCCRequest(std::shared_ptr<DCC> dcc, const IRCPrefix& sender, const std::string& target, const std::string& type, const std::string& message) |
|
|
|
|