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

added identi.ca support (uses twitter api); spare a json enc/dec when surfing locally

This commit is contained in:
Gabor Adam Toth 2010-02-23 23:42:54 +01:00
parent bcbf2785d8
commit 9421149ffd
9 changed files with 88 additions and 18 deletions

View file

@ -92,6 +92,11 @@ void connect() {
::connect(thehost, port);
}
// some people think these are case sensitive.. let's fix it for them (only works for most cases)
string http_header_capitalize(string name) {
return regreplace(name, "(^.|-.)", (: return upper_case($1); :), 1);
}
varargs int real_logon(int failure) {
string scheme;
@ -115,7 +120,7 @@ varargs int real_logon(int failure) {
buffer = "";
foreach (string key, string value : rheaders) {
buffer += key + ": " + value + "\r\n";
buffer += http_header_capitalize(key) + ": " + value + "\r\n";
}
// we won't need connection: close w/ http/1.0

View file

@ -59,6 +59,7 @@ void parse_request_token(string body, mapping headers, int http_status) {
url_parse_query(request_params, body);
if (strlen(request_params["oauth_token"]) && strlen(request_params["oauth_token_secret"])) {
shared_memory("oauth_request_tokens")[request_params["oauth_token"]] = ME;
//P3((">>> adding token: %O to shm: %O\n", request_params["oauth_token"], shared_memory("oauth_request_tokens")))
sendmsg(user, "_notice_oauth_authorize_url", "Open [_url] to perform authorization.",
(["_url": authorize_url + "?oauth_token=" + request_params["oauth_token"]]));
return;

View file

@ -179,8 +179,8 @@ case "/static/":
case "/oauth":
object oauth;
http_ok(version);
//PT((">>> shm: %O\n", shared_memory("oauth_request_tokens")))
if (query["oauth_verifier"] && (oauth = shared_memory("oauth_request_tokens")[query["oauth_token"]])) {
//PT((">>> looking up token %O in shm: %O\n", query["oauth_token"], shared_memory("oauth_request_tokens")))
if (oauth = shared_memory("oauth_request_tokens")[query["oauth_token"]]) {
//PT((">>> oauth: %O\n", oauth))
oauth->verified(query["oauth_verifier"]);
m_delete(shared_memory("oauth_request_tokens"), query["oauth_token"]);