Пример #1
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);

        }
    }


}
Пример #2
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;
}
Пример #3
0
void MumbleClient::joinChannel(int id)
{
    MumbleProto::UserState us;
    us.set_session(_session_id);
    us.set_self_deaf(false);
    us.set_self_mute(false);
    us.set_channel_id(id);
    int size = us.ByteSize();
    quint8 data[size];
    us.SerializeToArray(data,size);
    this->sendMessage(data,9,size);
    _channel_id = id;

}
Пример #4
0
void MumbleClient::disconnectFromCall()
{
    if(_channel_id < 2)
    {
        qDebug() << "something went wrong";
        return;
    }
    _temp_channel_name = "";
    MumbleProto::UserState us;
    us.set_channel_id(1);
    us.set_session(_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);
}
Пример #5
0
void MumbleClient::SetChannel(const std::string& channelName)
{
	if (!m_connectionInfo.isConnected)
	{
		return;
	}

	if (channelName == m_curManualChannel)
	{
		return;
	}

	m_curManualChannel = channelName;

	// check if the channel already exists
	std::wstring wname = ToWide(channelName);

	for (const auto& channel : m_state.GetChannels())
	{
		if (channel.second.GetName() == wname)
		{
			// join the channel
			MumbleProto::UserState state;
			state.set_session(m_state.GetSession());
			state.set_channel_id(channel.first);

			Send(MumbleMessageType::UserState, state);
			return;
		}
	}

	// it does not, create the channel
	{
		MumbleProto::ChannelState chan;
		chan.set_parent(0);
		chan.set_name(channelName);
		chan.set_temporary(true);

		Send(MumbleMessageType::ChannelState, chan);
	}
}