diff --git a/core/AmPromptCollection.cpp b/core/AmPromptCollection.cpp index 52710212..a6bdfa28 100644 --- a/core/AmPromptCollection.cpp +++ b/core/AmPromptCollection.cpp @@ -105,6 +105,19 @@ AmCachedAudioFile* AudioFileEntry::getAudio(){ return new AmCachedAudioFile(&cache); } +bool AmPromptCollection::hasPrompt(const string& name) { + string s = name; + std::map::iterator it=store.begin(); + + while (it != store.end()) { + if (!strcmp(it->first.c_str(), s.c_str())) + break; + it++; + } + return it != store.end(); + +} + int AmPromptCollection::addToPlaylist(const std::string& name, long sess_id, AmPlaylist& list, bool front, bool loop) { diff --git a/core/AmPromptCollection.h b/core/AmPromptCollection.h index 27c1d6ef..2e03dc7f 100644 --- a/core/AmPromptCollection.h +++ b/core/AmPromptCollection.h @@ -92,6 +92,12 @@ class AmPromptCollection { int setPrompt(const string& name, const string& filename, const char* mod_name); + + /** + * check whether prompt exists + */ + bool hasPrompt(const string& name); + /** * add the announcement identified with @param name * to the playlist @list