summaryrefslogtreecommitdiffstats
path: root/src/IrcIngameChat.cpp
blob: 30e24119e64cd0bc6174089b4c52a282333a150a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
}