From: Greg Kroah-Hartman Date: Wed, 12 Jan 2011 19:01:39 +0000 (-0800) Subject: Merge https://github.com/leif81/bti into main tree X-Git-Url: https://git.toastfreeware.priv.at/gregoa/bti.git/commitdiff_plain/6614ae6e7e2aeda209654226e3d3cffde0d54a21?hp=a2ba3bbc5e121d61af36921f8477a9f5d81dcfe0 Merge https://github.com/leif81/bti into main tree This fixes an issue with twitter queries for non-oauth portions of the api. --- diff --git a/bti-bashcompletion b/bti-bashcompletion index 3dfdff0..e627ae2 100644 --- a/bti-bashcompletion +++ b/bti-bashcompletion @@ -8,7 +8,7 @@ _bti() COMPREPLY=( $(compgen -W "-a -A -p -P -H -b -d -v -s -n -g -h -r --account --action --password --proxy --host --bash \ --user --debug --dry-run --shrink-urls --page --version --verbose \ - --help --replyto" -- ${cur}) ) + --help --replyto --retweet" -- ${cur}) ) fi if [[ "${prev}" == "--host" ]] ; then diff --git a/bti-shrink-urls.xml b/bti-shrink-urls.xml index 491743b..9a7c770 100644 --- a/bti-shrink-urls.xml +++ b/bti-shrink-urls.xml @@ -37,7 +37,7 @@ bti-shrink-urls converts URLs to a shorter form using a web service. - Currently only http://2tu.us/ is supported. + Currently http://2tu.us/ (default) and http://bit.ly / http://j.mp are supported. @@ -72,6 +72,40 @@ + CONFIGURATION + + bti-shrink-urls is configured by setting some values in ~/.bti: + + + + + + + Possible values: 2tu.us (default), bit.ly, j.mp + + + + + + + + API login for bit.ly, j.mp, required if shrink_host is set to bit.ly or j.mp. + See https://code.google.com/p/bitly-api/wiki/ApiDocumentation + + + + + + + + API key for bit.ly, j.mp, required if shrink_host is set to bit.ly or j.mp. + See https://code.google.com/p/bitly-api/wiki/ApiDocumentation + + + + + + AUTHOR Written by Bart Trojanowski bart@jukie.net. diff --git a/bti.c b/bti.c index a7fa43c..4ad5b54 100644 --- a/bti.c +++ b/bti.c @@ -750,26 +750,29 @@ static int send_request(struct session *session) break; } - if (is_post) { - req_url = oauth_sign_url2(endpoint, &postarg, OA_HMAC, - NULL, session->consumer_key, - session->consumer_secret, - session->access_token_key, - session->access_token_secret); - reply = oauth_http_post(req_url, postarg); - } else { - req_url = oauth_sign_url2(endpoint, NULL, OA_HMAC, NULL, - session->consumer_key, - session->consumer_secret, - session->access_token_key, - session->access_token_secret); - reply = oauth_http_get(req_url, postarg); - } + dbg("%s\n", endpoint); + if (!session->dry_run) { + if (is_post) { + req_url = oauth_sign_url2(endpoint, &postarg, OA_HMAC, + NULL, session->consumer_key, + session->consumer_secret, + session->access_token_key, + session->access_token_secret); + reply = oauth_http_post(req_url, postarg); + } else { + req_url = oauth_sign_url2(endpoint, NULL, OA_HMAC, NULL, + session->consumer_key, + session->consumer_secret, + session->access_token_key, + session->access_token_secret); + reply = oauth_http_get(req_url, postarg); + } - dbg("%s\n", req_url); - dbg("%s\n", reply); - if (req_url) - free(req_url); + dbg("%s\n", req_url); + dbg("%s\n", reply); + if (req_url) + free(req_url); + } if ((session->action != ACTION_UPDATE) && (session->action != ACTION_RETWEET)) diff --git a/bti.example b/bti.example index e6ad489..615cc10 100644 --- a/bti.example +++ b/bti.example @@ -13,3 +13,7 @@ logfile=.bti.log #user=gregkh #proxy=http://localhost:8080 #shrink-urls=yes +# Example of using bit.ly in bti-shrink-urls +#shrink_host=bit.ly +#shrink_bitly_login=bitlyuser +#shrink_bitly_key=R_deadbeef diff --git a/bti.xml b/bti.xml index 0fba17f..ae08e4f 100644 --- a/bti.xml +++ b/bti.xml @@ -35,6 +35,7 @@ + @@ -159,6 +160,14 @@ + + + + + Status ID of a single post which you want to retweet. + + + @@ -169,7 +178,11 @@ more suitable for micro-blogging. - Currently, only http://2tu.us/ is used as a URL shrinking service. + The following URL shrinking services are available: + http://2tu.us/ (default) and http://bit.ly / http://j.mp + + + See the documentation for bti-shrink-urls for the configuration options.