http/server: success/failure message for /oauth

This commit is contained in:
Gabor Adam Toth 2010-02-23 13:32:23 +01:00
parent a5164da136
commit b29f98f64f
2 changed files with 10 additions and 0 deletions

View File

@ -178,12 +178,17 @@ case "/static/":
break; break;
case "/oauth": case "/oauth":
object oauth; object oauth;
http_ok(version);
//PT((">>> shm: %O\n", shared_memory("oauth_request_tokens"))) //PT((">>> shm: %O\n", shared_memory("oauth_request_tokens")))
if (query["oauth_verifier"] && (oauth = shared_memory("oauth_request_tokens")[query["oauth_token"]])) { if (query["oauth_verifier"] && (oauth = shared_memory("oauth_request_tokens")[query["oauth_token"]])) {
//PT((">>> oauth: %O\n", oauth)) //PT((">>> oauth: %O\n", oauth))
oauth->verified(query["oauth_verifier"]); oauth->verified(query["oauth_verifier"]);
m_delete(shared_memory("oauth_request_tokens"), query["oauth_token"]); m_delete(shared_memory("oauth_request_tokens"), query["oauth_token"]);
write("OAuth succeeded");
} else {
write("OAuth failed: token not found");
} }
quit();
return 1; return 1;
} }
switch (file[1]) { switch (file[1]) {

View File

@ -1,3 +1,8 @@
/* twitter client
*
* - register @ http://twitter.com/apps
* - then in local.h #define TWITTER_KEY & TWITTER_SECRET
*/
#include <net.h> #include <net.h>
inherit NET_PATH "http/oauth"; inherit NET_PATH "http/oauth";