Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > by-pkgid > fdddaca718fdaac56c6bff726f3554dd > files > 12

vdr-1.4.7-9mdv2007.1.src.rpm

diff -Nurp -x '*.orig' vdr-1.4.3-no/exthooks.c vdr-1.4.3/exthooks.c
--- vdr-1.4.3-no/exthooks.c	1970-01-01 02:00:00.000000000 +0200
+++ vdr-1.4.3/exthooks.c	2006-10-29 16:13:26.000000000 +0200
@@ -0,0 +1,10 @@
+/*
+ * exthooks.c: Additional hooks for 3rd party plugins
+ *
+ * Licensed under same license as VDR itself
+ */
+
+#include "exthooks.h"
+
+bool cExtHooks::pastTimers = false;
+
diff -Nurp -x '*.orig' vdr-1.4.3-no/exthooks.h vdr-1.4.3/exthooks.h
--- vdr-1.4.3-no/exthooks.h	1970-01-01 02:00:00.000000000 +0200
+++ vdr-1.4.3/exthooks.h	2006-10-29 16:13:49.000000000 +0200
@@ -0,0 +1,22 @@
+/*
+ * exthooks.h: Additional hooks for 3rd party plugins
+ *
+ * Licensed under same license as VDR itself
+ */
+#ifndef __EXTHOOKS_H
+#define __EXTHOOKS_H
+
+#define VDR_HAS_EXTHOOKS 101
+
+class cExtHooks
+{
+private:
+	static bool pastTimers;
+
+public:
+	static bool PastTimers() { return pastTimers; }
+	static void SetPastTimers(bool PastTimers) { pastTimers = PastTimers; }
+};
+
+#endif
+
diff -Nurp -x '*.orig' vdr-1.4.3-no/Makefile vdr-1.4.3/Makefile
--- vdr-1.4.3-no/Makefile	2006-10-29 16:11:34.000000000 +0200
+++ vdr-1.4.3/Makefile	2006-10-29 16:12:06.000000000 +0200
@@ -41,6 +41,8 @@ OBJS = audio.o channels.o ci.o config.o 
 
 OBJS += osdcontroller.o rcontroller.o dvbsub.o vdrttxtsubshooks.o
 
+OBJS += exthooks.o
+
 FIXFONT_ISO8859_1 = -adobe-courier-bold-r-normal--25-*-100-100-m-*-iso8859-1
 OSDFONT_ISO8859_1 = -adobe-helvetica-medium-r-normal--23-*-100-100-p-*-iso8859-1
 SMLFONT_ISO8859_1 = -adobe-helvetica-medium-r-normal--18-*-100-100-p-*-iso8859-1
diff -Nurp -x '*.orig' vdr-1.4.3-no/menuitems.c vdr-1.4.3/menuitems.c
--- vdr-1.4.3-no/menuitems.c	2006-10-29 16:11:34.000000000 +0200
+++ vdr-1.4.3/menuitems.c	2006-10-29 16:12:06.000000000 +0200
@@ -14,6 +14,7 @@
 #include "remote.h"
 #include "skins.h"
 #include "status.h"
+#include "exthooks.h"
 
 #define AUTO_ADVANCE_TIMEOUT  1500 // ms before auto advance when entering characters via numeric keys
 
@@ -855,6 +856,32 @@ eOSState cMenuEditDateItem::ProcessKey(e
   if (state == osUnknown) {
      time_t now = time(NULL);
      if (NORMALKEY(Key) == kLeft) { // TODO might want to increase the delta if repeated quickly?
+      if (cExtHooks::PastTimers()) { // use the implementation that allows past timers
+        if (!weekdays || !*weekdays) {
+           // Decrement single day:
+           if ((*value <= now) && (now < *value + SECSINDAY)) { // this is today, so enter weekdays mode
+              if (weekdays) {
+                 *value = 0;
+                 dayindex = sizeof(days) / sizeof(int) - 2;
+                 *weekdays = days[dayindex];
+                 }
+              else
+                 *value -= SECSINDAY;
+              }
+           else
+              *value -= SECSINDAY;
+           }
+        else {
+           // Decrement weekday index:
+           if (dayindex > 0)
+              *weekdays = days[--dayindex];
+           else { // was first weekday entry, so switch to yesterday
+              *value = cTimer::SetTime(now, 0) - SECSINDAY;  // yesterday
+              *weekdays = 0;
+              dayindex = 0;
+              }
+           }
+      } else {
         if (!weekdays || !*weekdays) {
            // Decrement single day:
            time_t v = *value;
@@ -880,12 +907,20 @@ eOSState cMenuEditDateItem::ProcessKey(e
               *weekdays = days[--dayindex];
            }
         }
+     }
      else if (NORMALKEY(Key) == kRight) {
         if (!weekdays || !*weekdays) {
            // Increment single day:
            if (!*value)
               *value = cTimer::SetTime(now, 0);
            *value += SECSINDAY;
+           if (cExtHooks::PastTimers() && (*value <= now) && (now < *value + SECSINDAY)) { // this is today, so enter weekdays mode
+              if (weekdays) {
+                 *value = 0;
+                 dayindex = 0;
+                 *weekdays = days[dayindex];
+                 }
+              }
            }
         else {
            // Increment weekday index:
diff -Nurp -x '*.orig' vdr-1.4.3-no/timers.c vdr-1.4.3/timers.c
--- vdr-1.4.3-no/timers.c	2006-09-15 17:15:53.000000000 +0300
+++ vdr-1.4.3/timers.c	2006-10-29 16:12:06.000000000 +0200
@@ -14,6 +14,7 @@
  */
 
 #include "timers.h"
+#include "exthooks.h"
 #include <ctype.h>
 #include "channels.h"
 #include "device.h"
@@ -665,7 +666,7 @@ cTimer *cTimers::GetNextActiveTimer(void
   cTimer *t0 = NULL;
   for (cTimer *ti = First(); ti; ti = Next(ti)) {
       ti->Matches();
-      if ((ti->HasFlags(tfActive)) && (!t0 || ti->StopTime() > time(NULL) && ti->Compare(*t0) < 0))
+	  if ((ti->HasFlags(tfActive)) && (!t0 || ti->StopTime() > time(NULL) && ti->Compare(*t0) < 0) && (!cExtHooks::PastTimers() || !ti->Expired()))
          t0 = ti;
       }
   return t0;
diff -Nurp -x '*.orig' vdr-1.4.3-no/vdr.c vdr-1.4.3/vdr.c
--- vdr-1.4.3-no/vdr.c	2006-10-29 16:11:35.000000000 +0200
+++ vdr-1.4.3/vdr.c	2006-10-29 16:12:06.000000000 +0200
@@ -62,6 +62,7 @@
 #include "tools.h"
 #include "transfer.h"
 #include "videodir.h"
+#include "exthooks.h"
 
 #define MINCHANNELWAIT     10 // seconds to wait between failed channel switchings
 #define ACTIVITYTIMEOUT    60 // seconds before starting housekeeping
@@ -844,7 +845,8 @@ int main(int argc, char *argv[])
               LastTimerCheck = time(NULL);
               }
            // Delete expired timers:
-           Timers.DeleteExpired();
+	      if (!cExtHooks::PastTimers())
+           	Timers.DeleteExpired();
            }
         if (!Menu && Recordings.NeedsUpdate()) {
            Recordings.Update();