1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

http/oauth fixes, http/fetch POST support, place/threads signatures, place/userthreads: twitter submit

This commit is contained in:
Gabor Adam Toth 2010-02-23 18:46:50 +01:00
parent b48557c67a
commit 2ecaf00c24
8 changed files with 237 additions and 183 deletions

View file

@ -2,9 +2,10 @@
*
* - register @ http://twitter.com/apps
* - settings:
* - name: e.g. psyc://your.host/
* - app name: e.g. psyc://your.host/
* - app type: browser
* - callback url: http://your.host/oauth
* (actually the url psyced sends will be used but you have to type in something)
* - access type: read/write
* - then in local.h #define TWITTER_KEY & TWITTER_SECRET
*/
@ -22,12 +23,26 @@ object load(object usr, string key, string secret, string request, string access
return ::load(usr, key, secret, request, access, authorize);
}
void parse_home(string body, string headers) {
P3(("twitter/client:parse_home(%O, %O)\n", body, headers))
void parse_status_update(string body, string headers) {
P3(("twitter/client:parse_status_update(%O, %O)\n", body, headers))
}
void home() {
void status_update(string text) {
P3(("twitter/client:status_update()\n"))
if (strlen(text) > 140) text = text[0..136] + "...";
object ua = clone_object(NET_PATH "http/fetch");
ua->content(#'parse_home, 1, 1); //');
ua->content(#'parse_status_update, 1, 1); //');
fetch(ua, "http://api.twitter.com/1/statuses/update.json", "POST", 0, (["status": text]));
}
void parse_home_timeline(string body, string headers) {
P3(("twitter/client:parse_home_timeline(%O, %O)\n", body, headers))
}
void home_timeline() {
P3(("twitter/client:home_timeline()\n"))
object ua = clone_object(NET_PATH "http/fetch");
ua->content(#'parse_home_timeline, 1, 1); //');
fetch(ua, "http://api.twitter.com/1/statuses/home_timeline.json");
}