#114 Added tray messages

master
Tomatix 4 years ago
parent 101e18429e
commit b13547646a
  1. 10
      IdealIRC/IRC.cpp
  2. 2
      IdealIRC/IRC.h

@ -390,6 +390,7 @@ void IRC::onMsgInvite(const IRCPrefix& sender, const std::string& target)
auto* win = getStatus().getActiveWindow();
win->print(PrintType::Invite, msg.c_str());
MdiManager::instance().highlight(win, HL_Attention);
emit showTrayMessage(tr("Invited to channel"), QString::fromStdString(msg));
}
contextualScriptEvent(&m_status, ScriptEvent::Invite, sender.toString(), target);
@ -402,6 +403,7 @@ void IRC::onMsgKick(const IRCPrefix& sender, const std::string& target, const st
/* We were kicked */
if (who == getNickname()) {
msg = fmt::format("You were kicked out by {} ({})", sender.toString(), reason);
emit showTrayMessage(tr("Kicked from channel"), QString::fromStdString(msg));
emit memberListReset(target.c_str());
}
@ -463,6 +465,9 @@ void IRC::onMsgPrivmsg(const IRCPrefix& sender, const std::string& target, const
msg = fmt::format("<{}> {}", sender.toString(), message);
window->print(ptype, msg.c_str());
MdiManager::instance().highlight(window, hl);
if (messageHasMyNick)
emit showTrayMessage(QString::fromStdString(target), QString::fromStdString(msg));
}
/* Private message */
@ -471,6 +476,7 @@ void IRC::onMsgPrivmsg(const IRCPrefix& sender, const std::string& target, const
const std::string msg = fmt::format("<{}> {}", sender.toString(), message);
window->print(ptype, msg.c_str());
MdiManager::instance().highlight(window, hl);
emit showTrayMessage(tr("Private message"), QString::fromStdString(msg));
}
}
@ -492,6 +498,7 @@ void IRC::onMsgNotice(const IRCPrefix& sender, const std::string& target, const
}
window->print(PrintType::Notice, msg.c_str());
MdiManager::instance().highlight(window, HL_Attention);
emit showTrayMessage(tr("Notice"), QString::fromStdString(msg));
}
contextualScriptEvent(&m_status, ScriptEvent::Notice, sender.toString(), target, message);
@ -511,6 +518,7 @@ void IRC::onMsgKill(const IRCPrefix& sender, const std::string& reason)
getStatus().print(PrintType::ServerInfo, msg.c_str());
MdiManager::instance().highlight(&getStatus(), HL_Attention);
emit showTrayMessage(tr("Disconnected"), QString::fromStdString(msg));
}
contextualScriptEvent(&m_status, ScriptEvent::Kill, sender.toString(), reason);
@ -531,6 +539,7 @@ void IRC::onMsgError(const std::string& message)
if (!ignoreVerbosity(Command::IRC::ERROR_)) {
getStatus().print(PrintType::ServerInfo, message.c_str());
MdiManager::instance().highlight(&getStatus(), HL_Attention);
emit showTrayMessage(tr("Disconnected"), QString::fromStdString(message));
}
contextualScriptEvent(&m_status, ScriptEvent::Error, message);
@ -542,6 +551,7 @@ void IRC::onMsgWallops(const IRCPrefix& sender, const std::string& message)
const std::string msg = fmt::format("!{}! {}", sender.toString(), message);
getStatus().print(PrintType::Wallops, msg.c_str());
MdiManager::instance().highlight(&getStatus(), HL_Attention);
emit showTrayMessage(tr("Wallops"), QString::fromStdString(msg));
}
contextualScriptEvent(&m_status, ScriptEvent::Wallops, sender.toString(), message);

@ -51,6 +51,8 @@ signals:
void memberChanged(const QString& nickname, const IRCMemberEntry& entry);
void memberRemoved(const QString& channel, const IRCMemberEntry& entry);
void showTrayMessage(const QString& title, const QString message);
private:
struct ReconnectDetails {
bool ssl;

Loading…
Cancel
Save