--- remote.c	2006/01/29 14:43:07	1.49
+++ remote.c	2006/04/17 08:58:28
@@ -145,10 +145,23 @@
   return false;
 }
 
-void cRemote::CallPlugin(const char *Plugin)
+bool cRemote::CallPlugin(const char *Plugin)
 {
-  plugin = Plugin;
-  Put(k_Plugin);
+  cMutexLock MutexLock(&mutex);
+  if (!plugin) {
+     plugin = Plugin;
+     Put(k_Plugin);
+     return true;
+     }
+  return false;
+}
+
+const char *cRemote::GetPlugin(void)
+{
+  cMutexLock MutexLock(&mutex);
+  const char *p = plugin;
+  plugin = NULL;
+  return p;
 }
 
 bool cRemote::HasKeys(void)
--- remote.h	2006/03/31 14:18:44	1.34
+++ remote.h	2006/04/17 08:59:48
@@ -46,11 +46,18 @@
   static void Clear(void);
   static bool Put(eKeys Key, bool AtFront = false);
   static bool PutMacro(eKeys Key);
-  static void CallPlugin(const char *Plugin);
+  static bool CallPlugin(const char *Plugin);
       ///< Initiates calling the given plugin's main menu function.
       ///< The Plugin parameter is the name of the plugin, and must be
-      ///< a static string.
-  static const char *GetPlugin(void) { return plugin; }
+      ///< a static string. Returns true if the plugin call was successfully
+      ///< initiated (the actual call to the plugin's main menu function
+      ///< will take place some time later, during the next execution
+      ///< of VDR's main loop). If there is already a plugin call pending
+      ///< false will be returned and the caller should try again later.
+  static const char *GetPlugin(void);
+      ///< Returns the name of the plugin that was set with a previous
+      ///< call to CallPlugin(). The internally stored pointer to the
+      ///< plugin name will be reset to NULL by this call.
   static bool HasKeys(void);
   static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL);
   };
--- svdrp.c	2006/03/26 09:14:13	1.94
+++ svdrp.c	2006/04/17 09:02:23
@@ -1351,8 +1351,10 @@
               }
            }
         else if (strcasecmp(cmd, "MAIN") == 0) {
-           cRemote::CallPlugin(plugin->Name());
-           Reply(250, "Initiated call to main menu function of plugin \"%s\"", plugin->Name());
+           if (cRemote::CallPlugin(plugin->Name()))
+              Reply(250, "Initiated call to main menu function of plugin \"%s\"", plugin->Name());
+           else
+              Reply(550, "A plugin call is already pending - please try again later");
            }
         else {
            int ReplyCode = 900;
