]> ToastFreeware Gitweb - gregoa/bti.git/commitdiff
Merge https://github.com/leif81/bti into main tree
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 12 Jan 2011 19:01:39 +0000 (11:01 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 12 Jan 2011 19:02:39 +0000 (11:02 -0800)
This fixes an issue with twitter queries for non-oauth portions
of the api.

bti-bashcompletion
bti-shrink-urls.xml
bti.c
bti.example
bti.xml

index 3dfdff050986f4beb22b918c8f9833f1a48d3dec..e627ae21c19195aa04b563a196b797d0476a74e8 100644 (file)
@@ -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
index 491743bec4f1831c09aceafa0b2e81c0b363aae3..9a7c77042483478a270db1473d8627c32a92a4e3 100644 (file)
@@ -37,7 +37,7 @@
          bti-shrink-urls converts URLs to a shorter form using a web service.
         </para>
         <para>
-          Currently only http://2tu.us/ is supported.
+          Currently http://2tu.us/ (default) and http://bit.ly / http://j.mp are supported.
         </para>
       </refsect1>
 
         </variablelist>
       </refsect1>
 
+      <refsect1><title>CONFIGURATION</title>
+        <para>
+         bti-shrink-urls is configured by setting some values in ~/.bti:
+        </para>
+        <variablelist>
+          <varlistentry>
+            <term><option>shrink_host</option></term>
+            <listitem>
+              <para>
+               Possible values: 2tu.us (default), bit.ly, j.mp
+             </para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term><option>shrink_bitly_login</option></term>
+            <listitem>
+              <para>
+               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
+              </para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term><option>shrink_bitly_key</option></term>
+            <listitem>
+              <para>
+               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
+              </para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+      </refsect1>
+
        <refsect1><title>AUTHOR</title>
          <para>Written by Bart Trojanowski <email>bart@jukie.net</email>.</para>
        </refsect1>
diff --git a/bti.c b/bti.c
index a7fa43c5ef3057d5c285bc099fcd62c8d9804e2f..4ad5b541052a2ce7115a1255fca341e98404e194 100644 (file)
--- 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))
index e6ad4899d8d81924e9702ce33bba262f6eb4aecc..615cc1081027981790ad3e5882e842cc1c0f4924 100644 (file)
@@ -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 0fba17ff5b48d9036bfe6e28987f61ecf4ab9162..ae08e4f8b47949b6c2267a4f53fd92394de6a552 100644 (file)
--- a/bti.xml
+++ b/bti.xml
@@ -35,6 +35,7 @@
           <arg><option>--logfile LOGFILE</option></arg>
           <arg><option>--config CONFIGFILE</option></arg>
           <arg><option>--replyto ID</option></arg>
+          <arg><option>--retweet ID</option></arg>
           <arg><option>--page PAGENUMBER</option></arg>
           <arg><option>--bash</option></arg>
           <arg><option>--shrink-urls</option></arg>
               </para>
             </listitem>
           </varlistentry>
+          <varlistentry>
+            <term><option>--retweet ID</option></term>
+            <listitem>
+              <para>
+               Status ID of a single post which you want to retweet.
+             </para>
+            </listitem>
+          </varlistentry>
           <varlistentry>
             <term><option>--shrink-urls</option></term>
             <listitem>
                 more suitable for micro-blogging.
               </para>
               <para>
-                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
+              </para>
+              <para>
+                See the documentation for bti-shrink-urls for the configuration options.
               </para>
             </listitem>
           </varlistentry>