Author: lindner
Date: Fri Jun  5 23:58:21 2009
New Revision: 782173

URL: http://svn.apache.org/viewvc?rev=782173&view=rev
Log:
SHINDIG-1049 | requestSendMessage should use the RPC mechanism as similar 
features do | Patch from Jordon Zimmerman

Modified:
    
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
    
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
    incubator/shindig/trunk/javascript/container/gadgets.js

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js?rev=782173&r1=782172&r2=782173&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
 Fri Jun  5 23:58:21 2009
@@ -98,12 +98,7 @@
  */
 opensocial.Container.prototype.requestSendMessage = function(recipients,
     message, opt_callback, opt_params) {
-  if (opt_callback) {
-    window.setTimeout(function() {
-      opt_callback(new opensocial.ResponseItem(
-          null, null, opensocial.ResponseItem.Error.NOT_IMPLEMENTED, null));
-    }, 0);
-  }
+    return opensocial.requestSendMessage(recipients, message, opt_callback, 
opt_params);
 };
 
 

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js?rev=782173&r1=782172&r2=782173&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
 Fri Jun  5 23:58:21 2009
@@ -76,8 +76,8 @@
  */
 opensocial.requestSendMessage = function(recipients, message, opt_callback,
     opt_params) {
-  opensocial.Container.get().requestSendMessage(recipients, message,
-      opt_callback, opt_params);
+    gadgets.rpc.call(null, "requestSendMessage", opt_callback, recipients, 
message, opt_callback,
+        opt_params);
 };
 
 

Modified: incubator/shindig/trunk/javascript/container/gadgets.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/gadgets.js?rev=782173&r1=782172&r2=782173&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/container/gadgets.js (original)
+++ incubator/shindig/trunk/javascript/container/gadgets.js Fri Jun  5 23:58:21 
2009
@@ -183,6 +183,7 @@
   gadgets.rpc.register('set_pref', this.setUserPref);
   gadgets.rpc.register('set_title', this.setTitle);
   gadgets.rpc.register('requestNavigateTo', this.requestNavigateTo);
+  gadgets.rpc.register('requestSendMessage', this.requestSendMessage);
 };
 
 gadgets.IfrGadgetService.inherits(gadgets.GadgetService);
@@ -224,6 +225,29 @@
 };
 
 /**
+ * Requests the container to send a specific message to the specified users.
+ * @param {Array.<String>, String} An ID, array of IDs, or a group reference;
+ * the supported keys are VIEWER, OWNER, VIEWER_FRIENDS, OWNER_FRIENDS, or a
+ * single ID within one of those groups
+ * @param {opensocial.Message} message The message to send to the specified 
users
+ * @param {Function} opt_callback The function to call once the request has 
been
+ * processed; either this callback will be called or the gadget will be 
reloaded
+ * from scratch
+ * @param {opensocial.NavigationParameters} opt_params The optional parameters
+ * indicating where to send a user when a request is made, or when a request
+ * is accepted; options are of type  NavigationParameters.DestinationType
+ */
+gadgets.IfrGadgetService.prototype.requestSendMessage = function(recipients,
+    message, opt_callback, opt_params) {
+    if (opt_callback) {
+      window.setTimeout(function() {
+        opt_callback(new opensocial.ResponseItem(
+            null, null, opensocial.ResponseItem.Error.NOT_IMPLEMENTED, null));
+      }, 0);
+    }
+};
+
+/**
  * Navigates the page to a new url based on a gadgets requested view and
  * parameters.
  */


Reply via email to