From b0e4588fd90ca5211e8de93e39f0af08808cfed7 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 26 Feb 2006 01:40:16 +0000 Subject: [PATCH] Client can now set timers --- mvpclient.c | 29 +++++++++++++++++++++++++++++ mvpclient.h | 1 + 2 files changed, 30 insertions(+) diff --git a/mvpclient.c b/mvpclient.c index 9ac9e93..dba85ac 100644 --- a/mvpclient.c +++ b/mvpclient.c @@ -224,6 +224,9 @@ void MVPClient::run2() case 14: result = processGetTimers(data, packetLength); break; + case 15: + result = processSetTimer(data, packetLength); + break; } free(buffer); @@ -1250,3 +1253,29 @@ int MVPClient::processGetTimers(UCHAR* buffer, int length) return 1; } + +int MVPClient::processSetTimer(UCHAR* buffer, int length) +{ + cTimer *timer = new cTimer; + if (timer->Parse((char*)buffer)) + { + cTimer *t = Timers.GetTimer(timer); + if (!t) + { + Timers.Add(timer); + Timers.SetModified(); + sendULONG(0); + return 1; + } + else + { + sendULONG(1); + } + } + else + { + sendULONG(2); + } + delete timer; + return 1; +} diff --git a/mvpclient.h b/mvpclient.h index 55d6835..6444cd7 100644 --- a/mvpclient.h +++ b/mvpclient.h @@ -77,6 +77,7 @@ class MVPClient int processConfigSave(UCHAR* data, int length); int processConfigLoad(UCHAR* data, int length); int processGetTimers(UCHAR* data, int length); + int processSetTimer(UCHAR* data, int length); cChannel* channelFromNumber(ULONG channelNumber); void writeResumeData(); -- 2.39.5