diff options
author | Frank Neumann <fnu@yavdr.org> | 2017-05-01 11:02:21 +0200 |
---|---|---|
committer | Frank Neumann <fnu@yavdr.org> | 2017-05-01 11:02:21 +0200 |
commit | a46c7161bddc00b5b11bda0f8a14066b5f837302 (patch) | |
tree | 48e50b78f0efb1120b39bfb07f3612aabb1541e6 /mail.c | |
parent | 0b09f90f361454d1d422cc750ee84359f11bd378 (diff) | |
download | vdr-plugin-epgsearch-a46c7161bddc00b5b11bda0f8a14066b5f837302.tar.gz vdr-plugin-epgsearch-a46c7161bddc00b5b11bda0f8a14066b5f837302.tar.bz2 |
Add compatibility for VDR 2.3.2+ (thx kamel5, mini73 & TomJoad)
Diffstat (limited to 'mail.c')
-rw-r--r-- | mail.c | 37 |
1 files changed, 30 insertions, 7 deletions
@@ -50,7 +50,13 @@ string cMailTimerNotification::Format(const string& templ) const if (!pEvent) return ""; eTimerMatch TimerMatch = tmNone; - cTimer* pTimer = Timers.GetMatch(pEvent, &TimerMatch); +#if VDRVERSNUM > 20300 + LOCK_TIMERS_READ; + const cTimers *vdrtimers = Timers; +#else + cTimers *vdrtimers = &Timers; +#endif + const cTimer* pTimer = vdrtimers->GetMatch(pEvent, &TimerMatch); if (!pTimer) return ""; string result = templ; @@ -70,8 +76,13 @@ string cMailTimerNotification::Format(const string& templ) const const cEvent* cMailTimerNotification::GetEvent() const { +#if VDRVERSNUM > 20300 + LOCK_SCHEDULES_READ; + const cSchedules *schedules = Schedules; +#else cSchedulesLock schedulesLock; const cSchedules *schedules = cSchedules::Schedules(schedulesLock); +#endif if (!schedules) return NULL; const cSchedule *schedule = schedules->GetSchedule(channelID); if (!schedule) return NULL; @@ -80,8 +91,14 @@ const cEvent* cMailTimerNotification::GetEvent() const bool cMailTimerNotification::operator< (const cMailTimerNotification &N) const { - const cChannel* channel = Channels.GetByChannelID(channelID,true,true); - const cChannel* channelOther = Channels.GetByChannelID(N.channelID,true,true); +#if VDRVERSNUM > 20300 + LOCK_CHANNELS_READ; + const cChannels *vdrchannels = Channels; +#else + cChannels *vdrchannels = &Channels; +#endif + const cChannel* channel = vdrchannels->GetByChannelID(channelID,true,true); + const cChannel* channelOther = vdrchannels->GetByChannelID(N.channelID,true,true); if (!channel || !channelOther) return false; const cEvent* event = GetEvent(); @@ -98,7 +115,7 @@ bool cMailTimerNotification::operator< (const cMailTimerNotification &N) const // ------------------------- // cMailDelTimerNotification -cMailDelTimerNotification::cMailDelTimerNotification(cTimer* pTimer, const cEvent* pEvent, const string& templ) +cMailDelTimerNotification::cMailDelTimerNotification(const cTimer* pTimer, const cEvent* pEvent, const string& templ) { if (!pTimer || !pTimer->Channel()) return; @@ -121,8 +138,14 @@ cMailDelTimerNotification::cMailDelTimerNotification(const string& Formatted, tC bool cMailDelTimerNotification::operator< (const cMailDelTimerNotification &N) const { - const cChannel* channel = Channels.GetByChannelID(channelID,true,true); - const cChannel* channelOther = Channels.GetByChannelID(N.channelID,true,true); +#if VDRVERSNUM > 20300 + LOCK_CHANNELS_READ; + const cChannels *vdrchannels = Channels; +#else + cChannels *vdrchannels = &Channels; +#endif + const cChannel* channel = vdrchannels->GetByChannelID(channelID,true,true); + const cChannel* channelOther = vdrchannels->GetByChannelID(N.channelID,true,true); if (!channel || !channelOther) return false; if (channel != channelOther) @@ -338,7 +361,7 @@ void cMailUpdateNotifier::AddModTimerNotification(tEventID EventID, tChannelID C modTimers.insert(N); } -void cMailUpdateNotifier::AddRemoveTimerNotification(cTimer* t, const cEvent* e) +void cMailUpdateNotifier::AddRemoveTimerNotification(const cTimer* t, const cEvent* e) { string templTimer = GetTemplValue(mailTemplate, "timer"); cMailDelTimerNotification N(t, e, templTimer); |