void Client::handleMessage(protocol::MessagePtr msg) { // Handle control messages here // (these are sent only by the server and are not stored in the session) if(msg->isControl()) { switch(msg->type()) { using namespace protocol; case MSG_COMMAND: handleServerCommand(msg.cast<Command>()); break; case MSG_DISCONNECT: handleDisconnectMessage(msg.cast<Disconnect>()); break; default: qWarning("Received unhandled control message %d", msg->type()); } return; } // Rest of the messages are part of the session emit messageReceived(msg); }
void Client::sendDirectMessage(protocol::MessagePtr msg) { if(!d->isAwaitingReset || msg->isControl()) d->msgqueue->send(msg); }