|
|
|
@ -377,8 +377,6 @@ void IRC::onMsgPrivmsg(const IRCPrefix& sender, const std::string& target, const |
|
|
|
|
if (sender.nickname() == getNickname()) |
|
|
|
|
ptype = PrintType::OwnText; |
|
|
|
|
|
|
|
|
|
const std::string msg = fmt::format("<{}> {}", sender.toString(), message); |
|
|
|
|
|
|
|
|
|
auto highlightState = HL_Message; |
|
|
|
|
if (message.find(getNickname()) != std::string::npos) |
|
|
|
|
highlightState = HL_Attention; |
|
|
|
@ -386,6 +384,19 @@ void IRC::onMsgPrivmsg(const IRCPrefix& sender, const std::string& target, const |
|
|
|
|
/* Message to a channel */ |
|
|
|
|
if (chantypes.find_first_of(target[0]) != std::string::npos) { |
|
|
|
|
auto* window = MdiManager::instance().findWindow(&getStatus(), target.c_str()); |
|
|
|
|
auto& conf = ConfigMgr::instance(); |
|
|
|
|
std::string msg; |
|
|
|
|
if (conf.common("ShowModeInMessage").toInt()) { |
|
|
|
|
auto& member = getChannel(target)->getMember(sender.toString())->get(); |
|
|
|
|
if (member.modes().empty()) |
|
|
|
|
msg = fmt::format("<{}> {}", sender.toString(), message); |
|
|
|
|
else { |
|
|
|
|
std::string symbols = toMemberPrefix(member.modes()); |
|
|
|
|
msg = fmt::format("<{}{}> {}", symbols[0], sender.toString(), message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
msg = fmt::format("<{}> {}", sender.toString(), message); |
|
|
|
|
window->print(ptype, msg.c_str()); |
|
|
|
|
MdiManager::instance().highlight(window, highlightState); |
|
|
|
|
} |
|
|
|
@ -393,7 +404,8 @@ void IRC::onMsgPrivmsg(const IRCPrefix& sender, const std::string& target, const |
|
|
|
|
/* Private message */ |
|
|
|
|
else { |
|
|
|
|
auto* window = getStatus().createPrivateWindow(sender.toString().c_str(), false); |
|
|
|
|
window->print(ptype, msg.c_str()); |
|
|
|
|
const std::string msg = fmt::format("<{}> {}", sender.toString(), message); |
|
|
|
|
window->print(ptype, msg.c_str()); |
|
|
|
|
MdiManager::instance().highlight(window, highlightState); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|