From 63d6e04f30e86f6d973dfe55ac6765c442ade026 Mon Sep 17 00:00:00 2001
From: Stefan Sayer <stefan.sayer@googlemail.com>
Date: Fri, 20 Feb 2015 21:36:49 +0100
Subject: [PATCH 6/7] dsm:mod_conference: flushMixInList action, loop for mix
 in list

---
 apps/dsm/mods/mod_conference/ModConference.cpp | 24 ++++++++++++++++++++----
 apps/dsm/mods/mod_conference/ModConference.h   |  4 ++--
 doc/dsm/mods/Readme.mod_conference.txt         |  5 ++++-
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/apps/dsm/mods/mod_conference/ModConference.cpp b/apps/dsm/mods/mod_conference/ModConference.cpp
index 236cdd2..0028a14 100644
--- a/apps/dsm/mods/mod_conference/ModConference.cpp
+++ b/apps/dsm/mods/mod_conference/ModConference.cpp
@@ -51,6 +51,7 @@ MOD_ACTIONEXPORT_BEGIN(MOD_CLS_NAME) {
   DEF_CMD("conference.setupMixIn", ConfSetupMixInAction);
   DEF_CMD("conference.playMixIn",  ConfPlayMixInAction);
   DEF_CMD("conference.playMixInList", ConfPlayMixInListAction);
+  DEF_CMD("conference.flushMixInList", ConfFlushMixInListAction);
 
 } MOD_ACTIONEXPORT_END;
 
@@ -402,9 +403,10 @@ EXEC_ACTION_START(ConfPlayMixInAction) {
 
 } EXEC_ACTION_END;
 
-
+CONST_ACTION_2P(ConfPlayMixInListAction, ',', true);
 EXEC_ACTION_START(ConfPlayMixInListAction) {
-  string filename = resolveVars(arg, sess, sc_sess, event_params);
+  string filename = resolveVars(par1, sess, sc_sess, event_params);
+  bool loop = resolveVars(par2, sess, sc_sess, event_params) == "true";
 
   bool has_playlist = true;
   // get playlist
@@ -434,9 +436,10 @@ EXEC_ACTION_START(ConfPlayMixInListAction) {
     throw DSMException("file", "path", filename);
   }
   sc_sess->transferOwnership(af);
+  af->loop.set(loop);
 
-    DBG("adding file '%s' to mixin playlist\n", filename.c_str());
-    l->addToPlaylist(new AmPlaylistItem(af, NULL));
+  DBG("adding file '%s' to mixin playlist\n", filename.c_str());
+  l->addToPlaylist(new AmPlaylistItem(af, NULL));
 
   if (!has_playlist) {
     // get mixin mixer
@@ -450,3 +453,16 @@ EXEC_ACTION_START(ConfPlayMixInListAction) {
     m->mixin(l);
   }
 } EXEC_ACTION_END;
+
+EXEC_ACTION_START(ConfFlushMixInListAction) {
+  // get playlist
+  DSMDisposableT<AmPlaylist >* l_obj = 
+    getDSMConfChannel<DSMDisposableT<AmPlaylist> >(sc_sess, CONF_AKEY_MIXLIST);
+  if (NULL == l_obj) {
+    DBG("no mix list present - not flushing list\n");
+    EXEC_ACTION_STOP;
+  }
+  AmPlaylist* l = l_obj->get();
+  l->flush();
+  DBG("flushed mixInList\n");
+} EXEC_ACTION_END;
diff --git a/apps/dsm/mods/mod_conference/ModConference.h b/apps/dsm/mods/mod_conference/ModConference.h
index 73c2f5b..c6cdc72 100644
--- a/apps/dsm/mods/mod_conference/ModConference.h
+++ b/apps/dsm/mods/mod_conference/ModConference.h
@@ -95,6 +95,6 @@ DEF_ACTION_1P(ConfTeeLeaveAction);
 
 DEF_ACTION_2P(ConfSetupMixInAction);
 DEF_ACTION_1P(ConfPlayMixInAction);
-DEF_ACTION_1P(ConfPlayMixInListAction);
-
+DEF_ACTION_2P(ConfPlayMixInListAction);
+DEF_ACTION_1P(ConfFlushMixInListAction);
 #endif
diff --git a/doc/dsm/mods/Readme.mod_conference.txt b/doc/dsm/mods/Readme.mod_conference.txt
index f4c0acc..a626c96 100644
--- a/doc/dsm/mods/Readme.mod_conference.txt
+++ b/doc/dsm/mods/Readme.mod_conference.txt
@@ -49,6 +49,9 @@ conference.setupMixIn(float level, unsigned int seconds)
 conference.playMixIn(string filename)
     - mix in a file
 
-conference.playMixInList(string filename)
+conference.playMixInList(string filename [, loop=true])
     - add a file to the mix-in playlist
     - the list is setup when this is called for the first time and set as mixin source 
+
+conference.flushMixInList()
+    - flush mix-in playlist
-- 
1.9.3 (Apple Git-50)

