zapit/src/bouquets.cpp: fix scan bouquets saving, ignore user bouquets while copy

This commit is contained in:
[CST] Focus
2013-09-19 17:11:05 +04:00
parent 32ca9b848c
commit e655e94c8a
2 changed files with 6 additions and 7 deletions

View File

@@ -112,7 +112,7 @@ class CBouquetManager
CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false);
void deleteBouquet(const unsigned int id);
void deleteBouquet(const CZapitBouquet* bouquet);
int existsBouquet(char const * const name);
int existsBouquet(char const * const name, bool ignore_user = false);
int existsUBouquet(char const * const name, bool myfav = false);
void moveBouquet(const unsigned int oldId, const unsigned int newId);
bool existsChannelInBouquet(unsigned int bq_id, const t_channel_id channel_id);

View File

@@ -304,11 +304,11 @@ void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode,
if ((bouquetMode == CZapitClient::BM_UPDATEBOUQUETS) || (bouquetMode == CZapitClient::BM_DELETEBOUQUETS)) {
while (!(Bouquets.empty())) {
CZapitBouquet* bouquet;
int dest = g_bouquetManager->existsBouquet(Bouquets[0]->Name.c_str());
int dest = g_bouquetManager->existsBouquet(Bouquets[0]->Name.c_str(), true);
DBG("save Bouquets: dest %d for name %s\n", dest, Bouquets[0]->Name.c_str());
if(dest == -1) {
bouquet = g_bouquetManager->addBouquet(Bouquets[0]->Name.c_str(), false);
dest = g_bouquetManager->existsBouquet(Bouquets[0]->Name.c_str());
dest = g_bouquetManager->existsBouquet(Bouquets[0]->Name.c_str(), true);
}
else
bouquet = g_bouquetManager->Bouquets[dest];
@@ -552,11 +552,10 @@ int str_compare_withoutspace(char const *s1, char const *s2)
// -- Find Bouquet-Name, if BQ exists (2002-04-02 rasc)
// -- Return: Bouqet-ID (found: 0..n) or -1 (Bouquet does not exist)
int CBouquetManager::existsBouquet(char const * const name)
int CBouquetManager::existsBouquet(char const * const name, bool ignore_user)
{
unsigned int i;
for (i = 0; i < Bouquets.size(); i++) {
if (Bouquets[i]->Name == name)
for (unsigned int i = 0; i < Bouquets.size(); i++) {
if ((!ignore_user || !Bouquets[i]->bUser) && (Bouquets[i]->Name == name))
{
return (int)i;
}