Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * modifications by Micael Estrazulas
- * @param pUrl
- * @param pParameters
- * @return responseText
- */
- var sendWithReturn = function(pUrl, pParameters)
- {
- Ti.API.debug('Sending a message to the service at [' + pUrl + '] with the following params: ' + JSON.stringify(pParameters));
- if (accessToken == null || accessTokenSecret == null)
- {
- Ti.API.debug('The send status cannot be processed as the client doesn\'t have an access token. The status update will be sent as soon as the client has an access token.');
- actionsQueue.push({
- url: pUrl,
- parameters: pParameters,
- title: pTitle,
- successMessage: pSuccessMessage,
- errorMessage: pErrorMessage
- });
- return;
- }
- accessor.tokenSecret = accessTokenSecret;
- var message = createMessage(pUrl);
- message.parameters.push(['oauth_token', accessToken]);
- for (p in pParameters) {
- message.parameters.push(pParameters[p]);
- }
- OAuth.setTimestampAndNonce(message);
- OAuth.SignatureMethod.sign(message, accessor);
- var parameterMap = OAuth.getParameterMap(message.parameters);
- var client = Ti.Network.createHTTPClient();
- var params = "?oauth_version=1";
- // var params = {};
- for (var p in parameterMap) {
- Ti.API.debug(p + ': ' + parameterMap[p]);
- // eval("params."+p+" = parameterMap[p]");
- params += "&"+p+"="+escape(parameterMap[p]);
- // client.setRequestHeader("OAuth",params)
- }
- Ti.API.info(params);
- client.open('GET', pUrl+params, false);
- // client.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- // client.send(params);
- client.onload = function() {
- Ti.API.info(client.responseText);
- if (client.status == 200) {
- return client.responseText;
- } else {
- return false;
- }
- };
- Ti.API.debug('*** sendStatus, Response: [' + client.status + '] ' + client.responseText);
- return client.responseText;
- };
Add Comment
Please, Sign In to add comment