fixed posting plain messages

This commit is contained in:
Jeena Paradies 2012-10-29 23:45:47 +01:00
parent 5bf8ca3fb5
commit 3244f092a3
2 changed files with 37 additions and 5 deletions

40
Core.js
View file

@ -345,9 +345,41 @@ Core.prototype.getNewData = function(supress_new_with_timeout) {
);*/ );*/
} }
/*
Core.prototype.sendNewMessage = function(tweet, in_reply_to_status_id) { Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
var _this = this;
var url = URI(controller.stringForKey_("api_root") + "/posts");
var http_method = "POST";
var callback = function(data) { _this.getNewData(true); }
var data = JSON.stringify({
"type": "https://tent.io/types/post/status/v0.1.0",
"published_at": (new Date().getTime() / 1000),
"permissions": {
"public": true
},
"content": {
"text": content,
}
});
getURL(
url.toString(),
http_method,
callback,
data,
makeAuthHeader(
url.toString(),
http_method,
controller.stringForKey_("user_mac_key"),
controller.stringForKey_("user_access_token")
)
); // FIXME: error callback
/*
var url = API_PATH + "statuses/update.json"; var url = API_PATH + "statuses/update.json";
var data = "source=tentia&status=" + OAuth.percentEncode(tweet); var data = "source=tentia&status=" + OAuth.percentEncode(tweet);
if(in_reply_to_status_id != '') data += "&in_reply_to_status_id=" + in_reply_to_status_id if(in_reply_to_status_id != '') data += "&in_reply_to_status_id=" + in_reply_to_status_id
@ -381,9 +413,9 @@ Core.prototype.sendNewMessage = function(tweet, in_reply_to_status_id) {
alert(xhr.status); alert(xhr.status);
alert(thrownError); alert(thrownError);
} }
}); });*/
} }
/*
Core.prototype.retweet = function(status_id, item) { Core.prototype.retweet = function(status_id, item) {
var url = API_PATH + "statuses/retweet/" + status_id + ".json"; var url = API_PATH + "statuses/retweet/" + status_id + ".json";

View file

@ -88,7 +88,7 @@
} }
-(void)controlTextDidChange:(NSNotification *)aNotification { -(void)controlTextDidChange:(NSNotification *)aNotification {
NSInteger c = 140 - [[textField stringValue] length]; NSInteger c = MESSAGE_MAX_LENGTH - [[textField stringValue] length];
[counter setIntValue:c]; [counter setIntValue:c];
if(c < 0) { if(c < 0) {
[counter setTextColor:[NSColor redColor]]; [counter setTextColor:[NSColor redColor]];