mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
chat code
This commit is contained in:
parent
8daa81e462
commit
5d32bb8bc4
14 changed files with 85 additions and 28 deletions
|
|
@ -1,8 +1,8 @@
|
|||
#include "chatchannel.h"
|
||||
#include "serversocket.h"
|
||||
|
||||
ChatChannel::ChatChannel(const QString &_name, const QString &_description)
|
||||
: name(_name), description(_description)
|
||||
ChatChannel::ChatChannel(const QString &_name, const QString &_description, bool _autoJoin, const QStringList &_joinMessage)
|
||||
: name(_name), description(_description), autoJoin(_autoJoin), joinMessage(_joinMessage)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -16,6 +16,8 @@ void ChatChannel::addPlayer(ServerSocket *player)
|
|||
|
||||
for (int i = 0; i < size(); ++i)
|
||||
player->msg(QString("chat|list_players|%1|%2").arg(name).arg(at(i)->getPlayerName()));
|
||||
for (int i = 0; i < joinMessage.size(); ++i)
|
||||
player->msg(QString("chat|server_message|%1|%2").arg(name).arg(joinMessage[i]));
|
||||
|
||||
emit channelInfoChanged();
|
||||
}
|
||||
|
|
@ -40,5 +42,5 @@ void ChatChannel::say(ServerSocket *player, const QString &s)
|
|||
|
||||
QString ChatChannel::getChannelListLine() const
|
||||
{
|
||||
return QString("chat|list_channels|%1|%2|%3").arg(name).arg(description).arg(size());
|
||||
}
|
||||
return QString("chat|list_channels|%1|%2|%3|%4").arg(name).arg(description).arg(size()).arg(autoJoin ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue