Use own lobby chat instead of IRC. First steps, still incomplete.

This commit is contained in:
lotodore
2009-08-15 10:25:13 +00:00
parent 94db67bbd5
commit 4c340d5bdc
18 changed files with 104 additions and 93 deletions
+22 -2
View File
@@ -172,18 +172,38 @@ ClientThread::SendPlayerAction()
}
void
ClientThread::SendChatMessage(const std::string &msg)
ClientThread::SendGameChatMessage(const std::string &msg)
{
// Warning: This function is called in the context of the GUI thread.
// Create a network packet containing the chat message.
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
packet->GetMsg()->present = PokerTHMessage_PR_chatRequestMessage;
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
netChat->gameId = GetGameId();
OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(),
msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeGame;
netChat->chatRequestType.choice.chatRequestTypeGame.gameId = GetGameId();
// Just dump the packet.
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
}
void
ClientThread::SendLobbyChatMessage(const std::string &msg)
{
// Warning: This function is called in the context of the GUI thread.
// Create a network packet containing the chat message.
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
packet->GetMsg()->present = PokerTHMessage_PR_chatRequestMessage;
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(),
msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeLobby;
// Just dump the packet.
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
}