Пример #1
0
void RoomSelector::joinFinished(const Response &r, const CommandContainer & /*commandContainer*/, const QVariant &extraData)
{
    if (r.response_code() != Response::RespOk)
        return;
    const Response_JoinRoom &resp = r.GetExtension(Response_JoinRoom::ext);

    emit roomJoined(resp.room_info(), extraData.toBool());
}
Пример #2
0
void TabServer::joinRoomFinished(const Response &r, const CommandContainer & /*commandContainer*/, const QVariant &extraData)
{
    switch (r.response_code()) {
        case Response::RespOk:
            break;
        case Response::RespNameNotFound:
            QMessageBox::critical(this, tr("Error"), tr("Failed to join the room: it doesn't exists on the server."));
            return;
        case Response::RespContextError:
            QMessageBox::critical(this, tr("Error"), tr("The server thinks you are in the room but Cockatrice is unable to display it. Try restarting Cockatrice."));
            return;
        case Response::RespUserLevelTooLow:
            QMessageBox::critical(this, tr("Error"), tr("You do not have the required permission to join this room."));
            return;
        default:
            QMessageBox::critical(this, tr("Error"), tr("Failed to join the room due to an unknown error: %1.").arg(r.response_code()));
            return;
    }

    const Response_JoinRoom &resp = r.GetExtension(Response_JoinRoom::ext);
    emit roomJoined(resp.room_info(), extraData.toBool());
}