changed so new tweets are send via JavaScript

This commit is contained in:
Jeena Paradies 2011-06-07 10:54:44 +02:00
parent 1f506c5778
commit 89af06d7e0
2 changed files with 9 additions and 8 deletions

View file

@ -155,8 +155,6 @@
NSRange range = [aString rangeOfString:@"oauth_token"]; NSRange range = [aString rangeOfString:@"oauth_token"];
if (range.length > 0) { if (range.length > 0) {
NSLog(@"test 3 %@", oauth);
[oauth requestAccessToken]; [oauth requestAccessToken];
} else { } else {
MyDocument *newTweet = (MyDocument *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil]; MyDocument *newTweet = (MyDocument *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
@ -172,7 +170,9 @@
- (IBAction)sendTweet:(id)sender { - (IBAction)sendTweet:(id)sender {
TweetModel *tweet = (TweetModel *)[sender object]; TweetModel *tweet = (TweetModel *)[sender object];
[oauth updateTweet:tweet.text inReplaToStatus:tweet.inReplyTostatusId]; //[oauth updateTweet:tweet.text inReplaToStatus:tweet.inReplyTostatusId];
NSString *func = [NSString stringWithFormat:@"twittia_instance.sendNewTweet(\"%@\", \"%@\")", [tweet.text stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], tweet.inReplyTostatusId];
[timelineView stringByEvaluatingJavaScriptFromString:func];
} }
- (NSString *)pluginURL { - (NSString *)pluginURL {

View file

@ -7,6 +7,7 @@
// //
API_PATH = "http://api.twitter.com/1/"; API_PATH = "http://api.twitter.com/1/";
WEBSITE_PATH = "http://twitter.com/";
//API_PATH = "http://identi.ca/api/"; //API_PATH = "http://identi.ca/api/";
function Twittia(action) { function Twittia(action) {
@ -90,7 +91,7 @@ Twittia.prototype.getItem = function(status) {
if(status.in_reply_to_status_id != null) template.in_reply.innerText = status.in_reply_to_screen_name; if(status.in_reply_to_status_id != null) template.in_reply.innerText = status.in_reply_to_screen_name;
else template.in_reply.parentNode.className = "hidden"; else template.in_reply.parentNode.className = "hidden";
template.in_reply.href = API_PATH + status.in_reply_to_screen_name + "/status/" + status.in_reply_to_status_id; template.in_reply.href = WEBSITE_PATH + status.in_reply_to_screen_name + "/status/" + status.in_reply_to_status_id;
template.message.innerHTML = replaceTwitterLinks(replaceURLWithHTMLLinks(status.text)); template.message.innerHTML = replaceTwitterLinks(replaceURLWithHTMLLinks(status.text));
@ -100,7 +101,7 @@ Twittia.prototype.getItem = function(status) {
time.className = "timeago"; time.className = "timeago";
$(time).timeago(); $(time).timeago();
template.ago.appendChild(time); template.ago.appendChild(time);
template.ago.href = API_PATH + status.user.screen_name + "/status/" + status.id_str; template.ago.href = WEBSITE_PATH + status.user.screen_name + "/status/" + status.id_str;
// {"type":"Point","coordinates":[57.10803113,12.25854746]} // {"type":"Point","coordinates":[57.10803113,12.25854746]}
if (status.geo && status.geo.type == "Point") { if (status.geo && status.geo.type == "Point") {
@ -249,10 +250,10 @@ Twittia.prototype.getNewData = function(supress_new_with_timeout) {
); );
} }
/*
Twittia.prototype.sendNewTweet = function(tweet, in_reply_to_status_id) { Twittia.prototype.sendNewTweet = function(tweet, in_reply_to_status_id) {
var url = "http://api.twitter.com/1/statuses/update.json"; var url = API_PATH + "statuses/update.json";
var data = "source=twittia&status=" + OAuth.percentEncode(tweet); var data = "source=twittia&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
@ -287,7 +288,7 @@ Twittia.prototype.sendNewTweet = function(tweet, in_reply_to_status_id) {
} }
}); });
} }
*/
Twittia.prototype.retweet = function(status_id, item) { Twittia.prototype.retweet = function(status_id, item) {
var url = API_PATH + "statuses/retweet/" + status_id + ".json"; var url = API_PATH + "statuses/retweet/" + status_id + ".json";