You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Mel Morrow <me...@gmail.com> on 2009/12/04 12:46:28 UTC

Implementing requestSendMessage for Partuza problem

Hey there.

I'm trying to implement requestSendMessage for partzua.
In the gadget I have this

<script type="text/javascript">
                function sendNotification() {
                        var params = [];
                        params[opensocial.Message.Field.TITLE] = "title";
                        params[opensocial.Message.Field.TYPE] =
opensocial.Message.Type.NOTIFICATION;

                        var message = opensocial.newMessage("body",
params);
                        var recipient = opensocial.IdSpec.PersonId.OWNER;

                        opensocial.requestSendMessage(recipient, message,
callback);

                };

                function callback(data) {

                  if (data.hadError()) {
                    alert("There was a problem:" + data.getErrorCode());
                  } else {
                    alert("Ok");
                  }
                };
</script>

and in my container.js I've added

init: function() {
                ...
                gadgets.rpc.register('requestSendMessage',
this.requestSendMessage);
        },

and now I need a little help to understand what should I do next, in
my method

requestSendMessage: function() {

}

and now I need a little help to understand what should I do next, in
my method

requestSendMessage: function() {

}

I'm debugging the entire code to have a notion of shindig -
partuza interaction flow,

and that is what I found..

gadgets.json.stringify function (..rps/wpm.transport.js) changes the
entire rpc object structure... I mean that some fields of that object
(i.e the array containing
title, body and message type) are getting changed ...hence in my
container.js (partuza's) in requestSendMessage function(that I should
implement) I can get only the recipient, but no message to proceed.

something is wrong with my code:( or I'm doing so..


Any help is appreciated.