Пример #1
0
int MumbleClient::disconnectStation(QString radio_id)
{
    int sessid = 0;
    for(int i =0; i<_stations.size(); i++)
    {
        Station *s = _stations.at(i);
        if(s->_radio_id == radio_id)
        {
            sessid = s->_id;
            if(s->_conference_id != _channel_id)
                return -2;
            if(s->_called_by != _session_id)
                return -3;
            s->_called_by = 0;
            s->_in_call = 0;
            s->_conference_id = -1;
        }
    }
    if(sessid ==0)
        return -1;
    MumbleProto::UserState us;
    us.set_channel_id(1);
    us.set_session(sessid);
    us.set_actor(_session_id);
    us.set_self_mute(true);
    us.set_self_deaf(true);
    int size = us.ByteSize();
    quint8 data[size];
    us.SerializeToArray(data,size);
    this->sendMessage(data,9,size);
    return 0;
}
Пример #2
0
void MumbleClient::disconnectAllStations()
{

    for(int i =0; i<_stations.size(); i++)
    {
        Station *s = _stations.at(i);
        if((s->_called_by == _session_id) &&
                (s->_in_call == 1) &&
                (s->_conference_id == _channel_id))
        {
            s->_called_by = 0;
            s->_in_call = 0;
            s->_conference_id = -1;

            MumbleProto::UserState us;
            us.set_channel_id(1);
            us.set_session(s->_id);
            us.set_actor(_session_id);
            us.set_self_mute(true);
            us.set_self_deaf(true);
            int size = us.ByteSize();
            quint8 data[size];
            us.SerializeToArray(data,size);
            this->sendMessage(data,9,size);

        }
    }


}
Пример #3
0
void MumbleClient::processServerSync(quint8 *message, quint64 size)
{
    MumbleProto::ServerSync sync;
    sync.ParseFromArray(message,size);
    _session_id = sync.session();
    _max_bandwidth = sync.max_bandwidth();
    std::string welcome = sync.welcome_text();
    _synchronized = true;
    qDebug() << QString::fromStdString(welcome)
             << " max bandwidth: " << _max_bandwidth
             << " session: " << QString::number(_session_id);
#ifndef NO_CRYPT
    createChannel();
#endif
    MumbleProto::UserState us;
    us.set_session(_session_id);
    us.set_actor(_session_id);
    us.set_self_deaf(true);
    us.set_self_mute(true);
    us.set_comment(_settings->_callsign.toStdString().c_str());
    int msize = us.ByteSize();
    quint8 data[msize];
    us.SerializeToArray(data,msize);
    this->sendMessage(data,9,msize);
}
Пример #4
0
void MumbleClient::setMute(bool mute)
{
    while(!_synchronized)
    {
        usleep(10000);
        QCoreApplication::processEvents();
    }
    MumbleProto::UserState us;
    us.set_self_deaf(mute);
    us.set_self_mute(mute);
    us.set_session(_session_id);
    us.set_actor(_session_id);
    int msize = us.ByteSize();
    quint8 mdata[msize];
    us.SerializeToArray(mdata,msize);
    this->sendMessage(mdata,9,msize);
}
Пример #5
0
QString MumbleClient::createChannel(QString channel_name)
{
    QString name;
    if(channel_name == "")
    {
        int rand_len = 8;
        char rand[9];
        genRandomStr(rand,rand_len);
        name = QString::fromLocal8Bit(rand);
    }
    else
    {
        name = channel_name;
    }
    _temp_channel_name = name;
    MumbleProto::ChannelState channel;
    channel.set_parent(0);
    channel.set_name(name.toStdString());
    channel.set_temporary(true);
    int size = channel.ByteSize();
    quint8 data[size];
    channel.SerializeToArray(data,size);
    quint16 type = 7;
    this->sendMessage(data,type,size);
    emit channelName(_temp_channel_name);
    MumbleProto::UserState us;
    us.set_self_deaf(false);
    us.set_self_mute(false);
    us.set_session(_session_id);
    us.set_actor(_session_id);
    int msize = us.ByteSize();
    quint8 mdata[msize];
    us.SerializeToArray(mdata,msize);
    this->sendMessage(mdata,9,msize);
    return name;
}