|
|
|
@ -5,7 +5,6 @@ |
|
|
|
|
#include "IRCClient/IRCChannel.h" |
|
|
|
|
#include "IWin/IWinStatus.h" |
|
|
|
|
#include "IWin/IWinChannel.h" |
|
|
|
|
#include "MdiManager.h" |
|
|
|
|
#include "ConfigMgr.h" |
|
|
|
|
#include "ICommand/Commands.h" |
|
|
|
|
#include "Numeric.h" |
|
|
|
@ -14,7 +13,6 @@ |
|
|
|
|
#include "Script/Builtin/ListUtils.h" // Needed for LIST_END_MAGIC |
|
|
|
|
#include "config.h" |
|
|
|
|
#include <fmt/format.h> |
|
|
|
|
#include <QDebug> |
|
|
|
|
|
|
|
|
|
IRC::IRC(IWinStatus& status) |
|
|
|
|
: m_status(status) |
|
|
|
@ -99,7 +97,7 @@ void IRC::onMsgNick(const IRCPrefix& sender, const std::string& newNickname, con |
|
|
|
|
|
|
|
|
|
if (!ignoreVerbosity(Command::IRC::NICK)) { |
|
|
|
|
const std::string msg = fmt::format("{} is now known as {}", sender.nickname(), newNickname); |
|
|
|
|
m_status.printTo(channelName.c_str(), PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
m_status.printTo(channelName.c_str(), PrintType::Nick, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const auto& member = memberOpt->get(); |
|
|
|
@ -124,7 +122,7 @@ void IRC::onMsgMode(const IRCPrefix& sender, const std::string& target, const st |
|
|
|
|
if (chantypes.find_first_of(target[0]) != std::string::npos) { |
|
|
|
|
if (!ignoreVerbosity(Command::IRC::MODE)) { |
|
|
|
|
const std::string msg = fmt::format("{} changed mode: {}", sender.toString(), modemsg); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::Mode, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto channel = getChannel(target); |
|
|
|
@ -152,13 +150,13 @@ void IRC::onMsgMode(const IRCPrefix& sender, const std::string& target, const st |
|
|
|
|
/* We changed our own usermode */ |
|
|
|
|
if (sender.toString() == target && target == getNickname()) { |
|
|
|
|
const std::string msg = fmt::format("Your usermode changed: {}", modemsg); |
|
|
|
|
getStatus().print(PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().print(PrintType::Mode, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Probably not possible, but someone set someone elses usermode and we got the message about it */ |
|
|
|
|
else { |
|
|
|
|
const std::string msg = fmt::format("{} changed usermode for {}: {}", sender.toString(), target, modemsg); |
|
|
|
|
getStatus().print(PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().print(PrintType::Mode, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -181,7 +179,7 @@ void IRC::onMsgQuit(const IRCPrefix& sender, const std::string& message, const s |
|
|
|
|
else |
|
|
|
|
msg = fmt::format("Quit: {} ({}@{})", sender.nickname(), sender.user(), sender.host()); |
|
|
|
|
|
|
|
|
|
m_status.printTo(channelName.c_str(), PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
m_status.printTo(channelName.c_str(), PrintType::Quit, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const auto& member = memberOpt->get(); |
|
|
|
@ -207,7 +205,7 @@ void IRC::onMsgJoin(const IRCPrefix& sender, const std::string& target) |
|
|
|
|
else { |
|
|
|
|
if (!ignoreVerbosity(Command::IRC::JOIN)) { |
|
|
|
|
const std::string msg = fmt::format("Join: {} ({}@{})", sender.nickname(), sender.user(), sender.host()); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::Join, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto channel = getChannel(target); |
|
|
|
@ -227,7 +225,7 @@ void IRC::onMsgPart(const IRCPrefix& sender, const std::string& target, const st |
|
|
|
|
msg = fmt::format("Part: {} ({}@{})", sender.nickname(), sender.user(), sender.host()); |
|
|
|
|
else |
|
|
|
|
msg = fmt::format("Part: {} ({}@{}) ({})", sender.nickname(), sender.user(), sender.host(), message); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::Part, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* We left a channel */ |
|
|
|
@ -253,7 +251,7 @@ void IRC::onMsgTopic(const IRCPrefix& sender, const std::string& target, const s |
|
|
|
|
msg = fmt::format("{} set the topic to: {}", sender.toString(), topic); |
|
|
|
|
else |
|
|
|
|
msg = fmt::format("{} removed the topic", sender.toString()); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::Topic, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
contextualScriptEvent(&m_status, ScriptEvent::Topic, sender.toString(), target, topic); |
|
|
|
@ -263,7 +261,7 @@ void IRC::onMsgInvite(const IRCPrefix& sender, const std::string& target) |
|
|
|
|
{ |
|
|
|
|
if (!ignoreVerbosity(Command::IRC::INVITE)) { |
|
|
|
|
const std::string msg = fmt::format("{} invited you to join {}", sender.toString(), target); |
|
|
|
|
getStatus().printToActive(PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().printToActive(PrintType::Invite, msg.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
contextualScriptEvent(&m_status, ScriptEvent::Invite, sender.toString(), target); |
|
|
|
@ -290,7 +288,7 @@ void IRC::onMsgKick(const IRCPrefix& sender, const std::string& target, const st |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!ignoreVerbosity(Command::IRC::KICK)) |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::ServerInfo, msg.c_str()); |
|
|
|
|
getStatus().printTo(target.c_str(), PrintType::Kick, msg.c_str()); |
|
|
|
|
|
|
|
|
|
contextualScriptEvent(&m_status, ScriptEvent::Kick, sender.toString(), who, target, reason); |
|
|
|
|
} |
|
|
|
|