/* bouquets are numbered starting at 0 */
void CZapitClient::getBouquets(BouquetList& bouquets, const bool emptyBouquetsToo, const bool utf_encoded, const channelsMode mode)
{
	CZapitMessages::commandGetBouquets msg;

	msg.emptyBouquetsToo = emptyBouquetsToo;
	msg.mode = mode;

	send(CZapitMessages::CMD_GET_BOUQUETS, (char*)&msg, sizeof(msg));

	responseGetBouquets response;
	while (CBasicClient::receive_data((char*)&response, sizeof(responseGetBouquets)))
	{
		if (response.bouquet_nr == RESPONSE_GET_BOUQUETS_END_MARKER)
			break;

		if (!utf_encoded)
		{
			strncpy(response.name, ZapitTools::UTF8_to_Latin1(response.name).c_str(), 30);
			response.name[29] = '\0';
		}
		bouquets.push_back(response);
	}

	close_connection();
}
/* bouquets are numbered starting at 0 */
void CZapitClient::getBouquets(BouquetList& bouquets, const bool emptyBouquetsToo, const bool utf_encoded, channelsMode mode)
{
	char buffer[30 + 1];

	CZapitMessages::commandGetBouquets msg;
	VALGRIND_PARANOIA;

	msg.emptyBouquetsToo = emptyBouquetsToo;
	msg.mode = mode;

	OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
	send(CZapitMessages::CMD_GET_BOUQUETS, (char*)&msg, sizeof(msg));

	responseGetBouquets response;
	while (CBasicClient::receive_data((char*)&response, sizeof(responseGetBouquets)))
	{
		if (response.bouquet_nr == RESPONSE_GET_BOUQUETS_END_MARKER)
			break;

		if (!utf_encoded)
		{
			cstrncpy(buffer, response.name, sizeof(buffer));
			cstrncpy(response.name, ZapitTools::UTF8_to_Latin1(buffer).c_str(), sizeof(buffer));
		}
		bouquets.push_back(response);
	}

	close_connection();
}
void CBouquetManager::deletePosition(t_satellite_position satellitePosition)
{
	BouquetList tmplist;
	for (unsigned int i =0; i < Bouquets.size(); i++) {
		if (satellitePosition == Bouquets[i]->satellitePosition) {
			printf("CBouquetManager::deletePosition: delete [%s]\n", Bouquets[i]->Name.c_str());
			delete Bouquets[i];
		} else
			tmplist.push_back(Bouquets[i]);
	}
	Bouquets = tmplist;
}
void CBouquetManager::clearAll(bool user)
{
	BouquetList tmplist;
	for (unsigned int i =0; i < Bouquets.size(); i++) {
		if (user || !Bouquets[i]->bUser)
			delete Bouquets[i];
		else
			tmplist.push_back(Bouquets[i]);
	}

	Bouquets.clear();
	if (!user)
		Bouquets = tmplist;
	remainChannels = NULL;
}
Beispiel #5
0
/* bouquets are numbered starting at 0 */
void CZapitClient::getBouquets(BouquetList& bouquets, const bool emptyBouquetsToo, const bool utf_encoded)
{
	char buffer[30 + 1];

	CZapitMessages::commandGetBouquets msg;

	msg.emptyBouquetsToo = emptyBouquetsToo;

	send(CZapitMessages::CMD_GET_BOUQUETS, (char*)&msg, sizeof(msg));

	responseGetBouquets response;
	while (CBasicClient::receive_data((char*)&response, sizeof(responseGetBouquets)))
	{
		if (!utf_encoded)
		{
			buffer[30] = (char) 0x00;
			strncpy(buffer, response.name, 30);
			strncpy(response.name, Utf8_to_Latin1(std::string(buffer)).c_str(), 30);
		}
		bouquets.push_back(response);
	}

	close_connection();
}