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
120193fb0b
commit
e6a419aa3d
9 changed files with 51 additions and 9 deletions
|
|
@ -39,6 +39,9 @@ Server::Server(QObject *parent)
|
|||
|
||||
chatChannelList << new ChatChannel("channel1", "testchannel 1");
|
||||
chatChannelList << new ChatChannel("channel2", "testchannel 2");
|
||||
|
||||
for (int i = 0; i < chatChannelList.size(); ++i)
|
||||
connect(chatChannelList[i], SIGNAL(channelInfoChanged()), this, SLOT(broadcastChannelUpdate()));
|
||||
}
|
||||
|
||||
Server::~Server()
|
||||
|
|
@ -163,6 +166,14 @@ void Server::broadcastGameListUpdate(ServerGame *game)
|
|||
players[i]->msg(line);
|
||||
}
|
||||
|
||||
void Server::broadcastChannelUpdate()
|
||||
{
|
||||
QString line = qobject_cast<ChatChannel *>(sender())->getChannelListLine();
|
||||
for (int i = 0; i < players.size(); ++i)
|
||||
if (players[i]->getAcceptsChatChannelListChanges())
|
||||
players[i]->msg(line);
|
||||
}
|
||||
|
||||
void Server::addClientToGame(int gameId, ServerSocket *client)
|
||||
{
|
||||
ServerGame *game = getGame(gameId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue