Skip to content
This repository
Browse code

Merge pull request #3230 from spudwebb/master

Added JSONRPC.NotifyAll as a built-in function
  • Loading branch information...
commit 147d0105599740c88a1533b9d3ac028d0d9b8804 2 parents eefb50d + 9ab4925
authored October 06, 2013

Showing 1 changed file with 16 additions and 0 deletions. Show diff stats Hide diff stats

  1. 16  xbmc/interfaces/Builtins.cpp
16  xbmc/interfaces/Builtins.cpp
@@ -45,10 +45,12 @@
45 45
 #include "addons/AddonManager.h"
46 46
 #include "addons/PluginSource.h"
47 47
 #include "interfaces/generic/ScriptInvocationManager.h"
  48
+#include "interfaces/AnnouncementManager.h"
48 49
 #include "network/NetworkServices.h"
49 50
 #include "utils/log.h"
50 51
 #include "storage/MediaManager.h"
51 52
 #include "utils/RssManager.h"
  53
+#include "utils/JSONVariantParser.h"
52 54
 #include "PartyModeManager.h"
53 55
 #include "profiles/ProfilesManager.h"
54 56
 #include "settings/DisplaySettings.h"
@@ -138,6 +140,7 @@ const BUILT_IN commands[] = {
138 140
 #endif
139 141
   { "RunPlugin",                  true,   "Run the specified plugin" },
140 142
   { "RunAddon",                   true,   "Run the specified plugin/script" },
  143
+  { "NotifyAll",                  true,   "Notify all connected clients" },
141 144
   { "Extract",                    true,   "Extracts the specified archive" },
142 145
   { "PlayMedia",                  true,   "Play the specified media file (or playlist)" },
143 146
   { "SlideShow",                  true,   "Run a slideshow from the specified directory" },
@@ -587,6 +590,19 @@ int CBuiltins::Execute(const CStdString& execString)
587 590
       CLog::Log(LOGERROR, "XBMC.RunAddon called with no arguments.");
588 591
     }
589 592
   }
  593
+  else if (execute.Equals("notifyall"))
  594
+  {
  595
+    if (params.size() > 1)
  596
+    {
  597
+      CVariant data;
  598
+      if (params.size() > 2)
  599
+        data = CJSONVariantParser::Parse((const unsigned char *)params[2].c_str(), params[2].size());
  600
+
  601
+      ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::Other, params[0], params[1], data);
  602
+    }
  603
+    else
  604
+      CLog::Log(LOGERROR, "XBMC.NotifyAll needs two parameters");
  605
+  }
590 606
   else if (execute.Equals("playmedia"))
591 607
   {
592 608
     if (!params.size())

0 notes on commit 147d010

Please sign in to comment.
Something went wrong with that request. Please try again.