[vdr] Feature request: suggestion for cPlugin

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Sun Aug 21 11:51:32 CEST 2005


Udo Richter wrote:
> Udo Richter wrote:
> 
>>New patch including docs etc. later this day.
> 
> 
> ... as promised. Custom plugin services, including PLUGINS.html and
> newplugin update. This version still mentions Data=NULL as supported query.
> ...
> +To send messages to, or request services from some plugin that offers the protocol, the 
> +plugin can call the function <tt>cPluginManager::CallFirstService</tt>. This function
> +will send the request to the first plugin that supports this service protocol. The 

Actually it sends the call to _every_ plugin and returns as soon as one
has processed it. Should this be rephrased, or should the implementation
be changed to

cPlugin *cPluginManager::CallFirstService(const char *Id, void *Data)
{
   if (pluginManager) {
      for (cDll *dll = pluginManager->dlls.First(); dll; dll = pluginManager->dlls.Next(dll)) {
          cPlugin *p = dll->Plugin();
          if (p && p->Service(Id, NULL) && p->Service(Id, Data))
             return p;
          }
      }
   return NULL;
}

> +function returns a pointer to the plugin that handled the request, or <tt>NULL</tt>
> +if no plugin handles the request.
> +<p>
> +To send a messages to all plugins, the plugin can call the function 
> +<tt>cPluginManager::CallAllServices</tt>. This function will send the request to 
> +all plugins that support this service protocol.

Actually it sends the request to _all_ plugins, because it doesn't explicitly
check whether a particular plugin supports it. In this case this doesn't make
much difference, but I think the description should reflect what actually happens.

Klaus



More information about the vdr mailing list