From 8bd7d77ba07d84b7829201befe30c07b12c5568a Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Tue, 30 May 2017 20:27:57 +0200 Subject: Move IngameChat functionality into its own ClonkOutputInterface --- src/IrcIngameChat.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/IrcIngameChat.cpp (limited to 'src/IrcIngameChat.cpp') diff --git a/src/IrcIngameChat.cpp b/src/IrcIngameChat.cpp new file mode 100644 index 0000000..30e2411 --- /dev/null +++ b/src/IrcIngameChat.cpp @@ -0,0 +1,38 @@ +#include "IrcIngameChat.hpp" +#include "crsm.hpp" + +IrcIngameChat::IrcIngameChat(const QString& channel, CRSM& crsm) : channel(channel), crsm(crsm) +{ + +} + +void IrcIngameChat::sendChannelMessage(const QString& message, bool action) +{ + crsm.sendIrcMessage(message, channel, action, false, false); +} + +bool IrcIngameChat::clientConnected(const ClientInfo& client) +{ + sendChannelMessage("[Clonk] " + client.toString() + " verbunden.", false); + return false; +} + +bool IrcIngameChat::clientMessage(ClientInfo& client, const QString& message, ClonkOutputInterface::MessageType type, const QTime& time) +{ + Q_UNUSED(time); + if(type == Action) + { + sendChannelMessage("[Clonk] " + client.nick + " " + message, true); + } + else if(type == Message) + { + sendChannelMessage("[Clonk]<" + client.nick+ "> " + message, false); + } + return false; +} + +bool IrcIngameChat::clientRemoved(const ClientInfo& client, const QString& reason) +{ + sendChannelMessage("[Clonk] " + client.toString() + " entfernt (" + reason + ").", false); + return false; +} -- cgit v1.2.3-54-g00ecf