diff options
Diffstat (limited to 'plugin.c')
-rw-r--r-- | plugin.c | 50 |
1 files changed, 45 insertions, 5 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: plugin.c 1.18 2006/04/09 14:16:17 kls Exp $ + * $Id: plugin.c 1.22 2006/04/17 09:20:05 kls Exp $ */ #include "plugin.h" @@ -14,6 +14,7 @@ #include <stdlib.h> #include <time.h> #include "config.h" +#include "interface.h" #define LIBVDR_PREFIX "libvdr-" #define SO_INDICATOR ".so." @@ -69,6 +70,15 @@ void cPlugin::Housekeeping(void) { } +void cPlugin::MainThreadHook(void) +{ +} + +cString cPlugin::Active(void) +{ + return NULL; +} + const char *cPlugin::MainMenuEntry(void) { return NULL; @@ -284,7 +294,7 @@ void cPluginManager::AddPlugin(const char *Args) if (p) { *p = 0; p += strlen(SO_INDICATOR); - if (strcmp(p, VDRVERSION) == 0) { + if (strcmp(p, APIVERSION) == 0) { char *name = e->d_name + strlen(LIBVDR_PREFIX); if (strcmp(name, "*") != 0) { // let's not get into a loop! AddPlugin(e->d_name + strlen(LIBVDR_PREFIX)); @@ -300,7 +310,7 @@ void cPluginManager::AddPlugin(const char *Args) if (p) *p = 0; char *buffer = NULL; - asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION); + asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION); dlls.Add(new cDll(buffer, Args)); free(buffer); free(s); @@ -364,6 +374,32 @@ void cPluginManager::Housekeeping(void) } } +void cPluginManager::MainThreadHook(void) +{ + for (cDll *dll = pluginManager->dlls.First(); dll; dll = pluginManager->dlls.Next(dll)) { + cPlugin *p = dll->Plugin(); + if (p) + p->MainThreadHook(); + } +} + +bool cPluginManager::Active(const char *Prompt) +{ + if (pluginManager) { + for (cDll *dll = pluginManager->dlls.First(); dll; dll = pluginManager->dlls.Next(dll)) { + cPlugin *p = dll->Plugin(); + if (p) { + cString s = p->Active(); + if (!isempty(*s)) { + if (!Prompt || !Interface->Confirm(cString::sprintf("%s - %s", *s, Prompt))) + return true; + } + } + } + } + return false; +} + bool cPluginManager::HasPlugins(void) { return pluginManager && pluginManager->dlls.Count(); @@ -424,9 +460,13 @@ void cPluginManager::StopPlugins(void) } } -void cPluginManager::Shutdown(void) +void cPluginManager::Shutdown(bool Log) { cDll *dll; - while ((dll = dlls.Last()) != NULL) + while ((dll = dlls.Last()) != NULL) { + cPlugin *p = dll->Plugin(); + if (p && Log) + isyslog("deleting plugin: %s", p->Name()); dlls.Del(dll); + } } |