From 12ecca76a37c2a0a7d72ca8f96975e4b1725645d Mon Sep 17 00:00:00 2001
From: Chris Tallon <chris@vomp.tv>
Date: Fri, 21 Apr 2006 16:36:24 +0000
Subject: [PATCH] Check timers before deleting a recording

---
 mvpclient.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/mvpclient.c b/mvpclient.c
index bedcd24..be0a8ef 100644
--- a/mvpclient.c
+++ b/mvpclient.c
@@ -20,6 +20,9 @@
 
 #include "mvpclient.h"
 
+// This is here else it causes compile errors with something in libdvbmpeg
+#include <vdr/menu.h>
+
 MVPClient::MVPClient(int tsocket)
  : tcp(tsocket)
 {
@@ -335,12 +338,27 @@ int MVPClient::processDeleteRecording(UCHAR* data, int length)
   if (recording)
   {
     log->log("Client", Log::DEBUG, "deleting recording: %s", recording->Name());
-    recording->Delete();
-    sendULONG(1);
+
+    cRecordControl *rc = cRecordControls::GetRecordControl(recording->FileName());
+    if (!rc)
+    {
+      if (recording->Delete())
+      {
+        sendULONG(1);
+      }
+      else
+      {
+        sendULONG(2);
+      }
+    }
+    else
+    {
+      sendULONG(3);
+    }
   }
   else
   {
-    sendULONG(0);
+    sendULONG(4);
   }
 
   return 1;
-- 
2.39.5