summaryrefslogtreecommitdiffstats
path: root/src/IrcIngameChat.cpp
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2017-05-30 20:27:57 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2017-05-30 20:27:57 +0200
commit8bd7d77ba07d84b7829201befe30c07b12c5568a (patch)
tree5c0def8fc1e2a05d22891ec18c5e7ab173fb3401 /src/IrcIngameChat.cpp
parentc20ac02beb8520953d90d0d9114371fe36187ed0 (diff)
downloadmanager-8bd7d77ba07d84b7829201befe30c07b12c5568a.tar.gz
manager-8bd7d77ba07d84b7829201befe30c07b12c5568a.zip
Move IngameChat functionality into its own ClonkOutputInterface
Diffstat (limited to 'src/IrcIngameChat.cpp')
-rw-r--r--src/IrcIngameChat.cpp38
1 files changed, 38 insertions, 0 deletions
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;
+}