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
+'\" t
.\" Title: bti-shrink-urls
.\" Author: [see the "AUTHOR" section]
-.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: March 2009
.\" Manual: bti-shrink-urls
.\" Source: bti-shrink-urls
.\"
.TH "BTI\-SHRINK\-URLS" "1" "March 2009" "bti-shrink-urls" "bti-shrink-urls"
.\" -----------------------------------------------------------------
-.\" * (re)Define some macros
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" toupper - uppercase a string (locale-aware)
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.de toupper
-.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
-\\$*
-.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
-..
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" SH-xref - format a cross-reference to an SH section
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.de SH-xref
-.ie n \{\
-.\}
-.toupper \\$*
-.el \{\
-\\$*
-.\}
-..
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" SH - level-one heading that works better for non-TTY output
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.de1 SH
-.\" put an extra blank line of space above the head in non-TTY output
-.if t \{\
-.sp 1
-.\}
-.sp \\n[PD]u
-.nr an-level 1
-.set-an-margin
-.nr an-prevailing-indent \\n[IN]
-.fi
-.in \\n[an-margin]u
-.ti 0
-.HTML-TAG ".NH \\n[an-level]"
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-\." make the size of the head bigger
-.ps +3
-.ft B
-.ne (2v + 1u)
-.ie n \{\
-.\" if n (TTY output), use uppercase
-.toupper \\$*
-.\}
-.el \{\
-.nr an-break-flag 0
-.\" if not n (not TTY), use normal case (not uppercase)
-\\$1
-.in \\n[an-margin]u
-.ti 0
-.\" if not n (not TTY), put a border/line under subheading
-.sp -.6
-\l'\n(.lu'
-.\}
-..
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" SS - level-two heading that works better for non-TTY output
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.de1 SS
-.sp \\n[PD]u
-.nr an-level 1
-.set-an-margin
-.nr an-prevailing-indent \\n[IN]
-.fi
-.in \\n[IN]u
-.ti \\n[SN]u
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.ps \\n[PS-SS]u
-\." make the size of the head bigger
-.ps +2
-.ft B
-.ne (2v + 1u)
-.if \\n[.$] \&\\$*
-..
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" BB/BE - put background/screen (filled box) around block of text
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.de BB
-.if t \{\
-.sp -.5
-.br
-.in +2n
-.ll -2n
-.gcolor red
-.di BX
-.\}
-..
-.de EB
-.if t \{\
-.if "\\$2"adjust-for-leading-newline" \{\
-.sp -1
-.\}
-.br
-.di
-.in
-.ll
-.gcolor
-.nr BW \\n(.lu-\\n(.i
-.nr BH \\n(dn+.5v
-.ne \\n(BHu+.5v
-.ie "\\$2"adjust-for-leading-newline" \{\
-\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
-.\}
-.el \{\
-\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
-.\}
-.in 0
-.sp -.5v
-.nf
-.BX
-.in
-.sp .5v
-.fi
-.\}
-..
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" BM/EM - put colored marker in margin next to block of text
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.de BM
-.if t \{\
-.br
-.ll -2n
-.gcolor red
-.di BX
-.\}
-..
-.de EM
-.if t \{\
-.br
-.di
-.ll
-.gcolor
-.nr BH \\n(dn
-.ne \\n(BHu
-\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
-.in 0
-.nf
-.BX
-.in
-.fi
-.\}
-..
-.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
-.SH "Name"
+.SH "NAME"
bti-shrink-urls \- convert URLs to a shorter form using a web service
-.SH "Synopsis"
-.fam C
+.SH "SYNOPSIS"
.HP \w'\fBbti\fR\ 'u
\fBbti\fR [\fB\-\-escaped\fR] [\fB\-\-help\fR] [\fBURL\fR]
-.fam
.SH "DESCRIPTION"
.PP
bti\-shrink\-urls converts URLs to a shorter form using a web service\&.
.PP
-Currently only http://2tu\&.us/ is supported\&.
+Currently http://2tu\&.us/ (default) and http://bit\&.ly / http://j\&.mp are supported\&.
.SH "OPTIONS"
.PP
\fB\-\-escaped\fR
.RS 4
Specify the URL to be converted\&. If no URL is given bti\-shrink\-urls waits for input on stdin\&.
.RE
+.SH "CONFIGURATION"
+.PP
+bti\-shrink\-urls is configured by setting some values in ~/\&.bti:
+.PP
+\fBshrink_host\fR
+.RS 4
+Possible values: 2tu\&.us (default), bit\&.ly, j\&.mp
+.RE
+.PP
+\fBshrink_bitly_login\fR
+.RS 4
+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
+.RE
+.PP
+\fBshrink_bitly_key\fR
+.RS 4
+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
+.RE
.SH "AUTHOR"
.PP
Written by Bart Trojanowski
-\FCbart@jukie\&.net\F[]\&.
+bart@jukie\&.net\&.
.SH "COPYRIGHT AND LICENSE"
.PP
Copyright (C) 2009 Bart Trojanowski
-\FCbart@jukie\&.net\F[]\&.
+bart@jukie\&.net\&.
.PP
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License\&.
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>
bti \- send a tweet to twitter\&.com or identi\&.ca from the command line
.SH "SYNOPSIS"
.HP \w'\fBbti\fR\ 'u
-\fBbti\fR [\fB\-\-account\ account\fR] [\fB\-\-password\ password\fR] [\fB\-\-action\ action\fR] [\fB\-\-user\ screenname\fR] [\fB\-\-host\ HOST_NAME\fR] [\fB\-\-proxy\ PROXY:PORT\fR] [\fB\-\-logfile\ LOGFILE\fR] [\fB\-\-config\ CONFIGFILE\fR] [\fB\-\-replyto\ ID\fR] [\fB\-\-page\ PAGENUMBER\fR] [\fB\-\-bash\fR] [\fB\-\-shrink\-urls\fR] [\fB\-\-debug\fR] [\fB\-\-dry\-run\fR] [\fB\-\-verbose\fR] [\fB\-\-version\fR] [\fB\-\-help\fR]
+\fBbti\fR [\fB\-\-account\ account\fR] [\fB\-\-password\ password\fR] [\fB\-\-action\ action\fR] [\fB\-\-user\ screenname\fR] [\fB\-\-host\ HOST_NAME\fR] [\fB\-\-proxy\ PROXY:PORT\fR] [\fB\-\-logfile\ LOGFILE\fR] [\fB\-\-config\ CONFIGFILE\fR] [\fB\-\-replyto\ ID\fR] [\fB\-\-retweet\ ID\fR] [\fB\-\-page\ PAGENUMBER\fR] [\fB\-\-bash\fR] [\fB\-\-shrink\-urls\fR] [\fB\-\-debug\fR] [\fB\-\-dry\-run\fR] [\fB\-\-verbose\fR] [\fB\-\-version\fR] [\fB\-\-help\fR]
.SH "DESCRIPTION"
.PP
bti sends a tweet message to twitter\&.com or identi\&.ca\&.
For status\&.net, this can link any two messages into context with each other\&. Status\&.net will also link a message that contains an @name without this without regard to context\&.
.RE
.PP
+\fB\-\-retweet ID\fR
+.RS 4
+Status ID of a single post which you want to retweet\&.
+.RE
+.PP
\fB\-\-shrink\-urls\fR
.RS 4
Scans the tweet text for valid URL patterns and passes each through the supplied bti\-shrink\-urls script\&. The script will pass the URL to a web service that shrinks the URLs, making it more suitable for micro\-blogging\&.
.sp
-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
+.sp
+See the documentation for bti\-shrink\-urls for the configuration options\&.
.RE
.PP
\fB\-\-debug\fR
int dry_run;
int page;
int no_oauth;
+ int guest;
enum host host;
enum action action;
void *readline_handle;
if (!session->hosturl)
session->hosturl = strdup(twitter_host);
- if (session->no_oauth) {
+ if (session->no_oauth || session->guest) {
curl_buf = bti_curl_buffer_alloc(session->action);
if (!curl_buf)
return -ENOMEM;
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))
if (session->host == HOST_TWITTER) {
if (!session->consumer_key || !session->consumer_secret) {
- fprintf(stderr,
- "Twitter no longer supports HTTP basic authentication.\n"
- "Both consumer key, and consumer secret are required"
- " for bti in order to behave as an OAuth consumer.\n");
- goto exit;
+ if (session->action == ACTION_USER ||
+ session->action == ACTION_PUBLIC) {
+ /* Some actions may still work without authentication */
+ session->guest = 1;
+ } else {
+ fprintf(stderr,
+ "Twitter no longer supports HTTP basic authentication.\n"
+ "Both consumer key, and consumer secret are required"
+ " for bti in order to behave as an OAuth consumer.\n");
+ goto exit;
+ }
}
if (session->action == ACTION_GROUP) {
fprintf(stderr, "Groups only work in Identi.ca.\n");
session->hostname);
session->password = strdup(password);
}
- } else {
+ } else if (!session->guest) {
if (!session->access_token_key ||
!session->access_token_secret) {
request_access_token(session);
#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
<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>