123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- diff --git a/bti-bashcompletion b/bti-bashcompletion
- index fa55d75..f957b32 100644
- --- a/bti-bashcompletion
- +++ b/bti-bashcompletion
- @@ -12,7 +12,7 @@ _bti()
- fi
-
- if [[ "${prev}" == "--host" ]] ; then
- - COMPREPLY=( $(compgen -W "twitter identica" -- ${cur} ) )
- + COMPREPLY=( $(compgen -W "statusnet" -- ${cur} ) )
- fi
-
- if [[ "${prev}" == "--action" ]] ; then
- diff --git a/bti.1 b/bti.1
- index bdd6c76..3577e98 100644
- --- a/bti.1
- +++ b/bti.1
- @@ -28,23 +28,23 @@
- .\" * MAIN CONTENT STARTS HERE *
- .\" -----------------------------------------------------------------
- .SH "NAME"
- -bti \- send a tweet to twitter\&.com from the command line
- +bti \- send a tweet to status\&.net 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\-\-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\&.
- +bti sends a tweet message to status\&.net\&.
- .SH "OPTIONS"
- .PP
- \fB\-\-account account\fR
- .RS 4
- -Specify the twitter\&.com account name\&.
- +Specify the status\&.net account name\&.
- .RE
- .PP
- \fB\-\-password password\fR
- .RS 4
- -Specify the password of your twitter\&.com account\&.
- +Specify the password of your status\&.net account\&.
- .RE
- .PP
- \fB\-\-action action\fR
- @@ -59,9 +59,9 @@ Specify the user whose messages you want to see when the action is "user", and t
- .PP
- \fB\-\-host HOST_NAME\fR
- .RS 4
- -Specify the host which you want to send your message to\&. Valid options are "twitter" to send to twitter\&.com\&.
- +Specify the host which you want to send your message to\&. Valid options are "statusnet" to send to status\&.net\&.
- .sp
- -If no host is specified, the default is to send to twitter\&.com\&.
- +If no host is specified, the default is to send to status\&.net\&.
- .RE
- .PP
- \fB\-\-proxy PROXY:PORT\fR
- @@ -85,8 +85,6 @@ Specify a config file for bti to read from\&. By default, bti looks in the ~/\&.
- .RS 4
- Status ID of a single post to which you want to create a threaded reply to\&.
- .sp
- -For twitter, this is ignored unless the message starts with the @name of the owner of the post with the status ID\&.
- -.sp
- 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
- @@ -167,12 +165,12 @@ The account and password can be stored in a configuration file in the users home
- .PP
- \fBaccount\fR
- .RS 4
- -The twitter\&.com account name you wish to use to send this message with\&.
- +The status\&.net account name you wish to use to send this message with\&.
- .RE
- .PP
- \fBpassword\fR
- .RS 4
- -The twitter\&.com password for the account you wish to use to send this message with\&.
- +The status\&.net password for the account you wish to use to send this message with\&.
- .RE
- .PP
- \fB\-\-action action\fR
- @@ -187,7 +185,7 @@ Specify the user you want to see his/her messages while the action is "user"\&.
- .PP
- \fBhost\fR
- .RS 4
- -The host you want to use to send the message to\&. Valid options is "twitter" or "custom" to specify your own server\&.
- +The host you want to use to send the message to\&. Valid options is "statusnet" or "custom" to specify your own server\&.
- .RE
- .PP
- \fBproxy\fR
- diff --git a/bti.c b/bti.c
- index f4b2c4d..226e111 100644
- --- a/bti.c
- +++ b/bti.c
- @@ -53,7 +53,7 @@ int debug;
-
- static void display_help(void)
- {
- - fprintf(stdout, "bti - send tweet to twitter or identi.ca\n"
- + fprintf(stdout, "bti - send tweet to status.net\n"
- "Version: %s\n"
- "Usage:\n"
- " bti [options]\n"
- @@ -258,14 +258,12 @@ static void bti_curl_buffer_free(struct bti_curl_buffer *buffer)
- free(buffer);
- }
-
- -const char twitter_host[] = "https://api.twitter.com/1.1/statuses";
- -const char twitter_host_stream[] = "https://stream.twitter.com/1.1/statuses"; /*this is not reset, and doesnt work */
- -const char twitter_host_simple[] = "https://api.twitter.com/1.1";
- -const char twitter_name[] = "twitter";
- +const char statusnet_host[] = "https://status.net/api/statuses";
- +const char statusnet_name[] = "statusnet";
-
- -static const char twitter_request_token_uri[] = "https://twitter.com/oauth/request_token";
- -static const char twitter_access_token_uri[] = "https://twitter.com/oauth/access_token";
- -static const char twitter_authorize_uri[] = "https://twitter.com/oauth/authorize?oauth_token=";
- +static const char statusnet_request_token_uri[] = "https://status.net/api/oauth/request_token?oauth_callback=oob";
- +static const char statusnet_access_token_uri[] = "https://status.net/api/oauth/access_token";
- +static const char statusnet_authorize_uri[] = "https://status.net/api/oauth/authorize?oauth_token=";
- static const char custom_request_token_uri[] = "/../oauth/request_token?oauth_callback=oob";
- static const char custom_access_token_uri[] = "/../oauth/access_token";
- static const char custom_authorize_uri[] = "/../oauth/authorize?oauth_token=";
- @@ -792,9 +790,9 @@ static int request_access_token(struct session *session)
- if (!session)
- return -EINVAL;
-
- - if (session->host == HOST_TWITTER)
- + if (session->host == HOST_STATUSNET)
- request_url = oauth_sign_url2(
- - twitter_request_token_uri, NULL,
- + statusnet_request_token_uri, NULL,
- OA_HMAC, NULL, session->consumer_key,
- session->consumer_secret, NULL, NULL);
- else {
- @@ -825,11 +823,11 @@ static int request_access_token(struct session *session)
- "Please open the following link in your browser, and "
- "allow 'bti' to access your account. Then paste "
- "back the provided PIN in here.\n");
- - if (session->host == HOST_TWITTER) {
- - fprintf(stdout, "%s%s\nPIN: ", twitter_authorize_uri, at_key);
- + if (session->host == HOST_STATUSNET) {
- + fprintf(stdout, "%s%s\nPIN: ", statusnet_authorize_uri, at_key);
- verifier = session->readline(NULL);
- sprintf(at_uri, "%s?oauth_verifier=%s",
- - twitter_access_token_uri, verifier);
- + statusnet_access_token_uri, verifier);
- } else {
- fprintf(stdout, "%s%s%s\nPIN: ",
- session->hosturl, custom_authorize_uri, at_key);
- @@ -883,7 +881,7 @@ static int send_request(struct session *session)
- return -EINVAL;
-
- if (!session->hosturl)
- - session->hosturl = strdup(twitter_host);
- + session->hosturl = strdup(statusnet_host);
-
- if (session->no_oauth || session->guest) {
- curl_buf = bti_curl_buffer_alloc(session->action);
- @@ -898,7 +896,7 @@ static int send_request(struct session *session)
- }
-
- if (!session->hosturl)
- - session->hosturl = strdup(twitter_host);
- + session->hosturl = strdup(statusnet_host);
-
- switch (session->action) {
- case ACTION_UPDATE:
- @@ -959,7 +957,7 @@ static int send_request(struct session *session)
-
- case ACTION_PUBLIC:
- /*snprintf(endpoint, endpoint_size, "%s%s?page=%d", session->hosturl,*/
- - snprintf(endpoint, endpoint_size, "%s%s", twitter_host_stream,
- + snprintf(endpoint, endpoint_size, "%s%s", statusnet_host,
- public_uri);
- curl_easy_setopt(curl, CURLOPT_URL, endpoint);
- break;
- @@ -972,7 +970,6 @@ static int send_request(struct session *session)
- break;
-
- case ACTION_DIRECT:
- - /* NOT IMPLEMENTED - twitter requires authentication anyway */
- break;
-
- default:
- @@ -1052,7 +1049,6 @@ static int send_request(struct session *session)
- } else {
- switch (session->action) {
- case ACTION_UPDATE:
- - /* dont test it here, let twitter return an error that we show */
- if (strlen_utf8(session->tweet) > 140 + 1000 ) {
- printf("E: tweet is too long!\n");
- goto skip_tweet;
- @@ -1083,7 +1079,7 @@ static int send_request(struct session *session)
- mentions_uri, session->page);
- break;
- case ACTION_PUBLIC:
- - sprintf(endpoint, "%s%s", twitter_host_stream,
- + sprintf(endpoint, "%s%s", statusnet_host,
- public_uri);
- break;
- case ACTION_GROUP:
- @@ -1102,7 +1098,7 @@ static int send_request(struct session *session)
- break;
- case ACTION_DIRECT:
- escaped_tweet = oauth_url_escape(session->tweet);
- - sprintf(endpoint, "%s%s?user=%s&text=%s", twitter_host_simple,
- + sprintf(endpoint, "%s%s?user=%s&text=%s", statusnet_host,
- direct_uri, session->user, escaped_tweet);
- is_post = 1;
- break;
- @@ -1691,10 +1687,10 @@ int main(int argc, char *argv[], char *envp[])
- free(session->hosturl);
- if (session->hostname)
- free(session->hostname);
- - if (strcasecmp(optarg, "twitter") == 0) {
- - session->host = HOST_TWITTER;
- - session->hosturl = strdup(twitter_host);
- - session->hostname = strdup(twitter_name);
- + if (strcasecmp(optarg, "statusnet") == 0) {
- + session->host = HOST_STATUSNET;
- + session->hosturl = strdup(statusnet_host);
- + session->hostname = strdup(statusnet_name);
- } else {
- session->host = HOST_CUSTOM;
- session->hosturl = strdup(optarg);
- @@ -1750,31 +1746,8 @@ int main(int argc, char *argv[], char *envp[])
- if (debug)
- display_version();
-
- - if (session->host == HOST_TWITTER) {
- - if (!session->consumer_key || !session->consumer_secret) {
- - 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");
- - goto exit;
- - }
- - } else {
- - if (!session->consumer_key || !session->consumer_secret)
- - session->no_oauth = 1;
- - }
- + if (!session->consumer_key || !session->consumer_secret)
- + session->no_oauth = 1;
-
- if (session->no_oauth) {
- if (!session->account) {
- diff --git a/bti.example b/bti.example
- index 57c55c9..29afa11 100644
- --- a/bti.example
- +++ b/bti.example
- @@ -5,7 +5,7 @@
- # a message.
- account=twitmaster
- password=icanhascheezburger
- -host=identica
- +host=statusnet
- # Example of a custom StatusNet installation
- #host=http://army.twit.tv/api/statuses
- logfile=.bti.log
- diff --git a/bti.h b/bti.h
- index 3d5ed9c..e466c2a 100644
- --- a/bti.h
- +++ b/bti.h
- @@ -17,7 +17,7 @@
- #define __BTI_H
-
- enum host {
- - HOST_TWITTER = 0,
- + HOST_STATUSNET = 1,
- HOST_CUSTOM = 2
- };
-
- @@ -75,8 +75,8 @@ struct bti_curl_buffer {
- int length;
- };
-
- -extern const char twitter_host[];
- -extern const char twitter_name[];
- +extern const char statusnet_host[];
- +extern const char statusnet_name[];
- extern int debug;
-
- extern void bti_parse_configfile(struct session *session);
- diff --git a/bti.xml b/bti.xml
- index c0b89ee..00ad9a8 100644
- --- a/bti.xml
- +++ b/bti.xml
- @@ -21,7 +21,7 @@
-
- <refnamediv>
- <refname>bti</refname>
- - <refpurpose>send a tweet to twitter.com from the command line</refpurpose>
- + <refpurpose>send a tweet to status.net from the command line</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- @@ -49,7 +49,7 @@
- </refsynopsisdiv>
-
- <refsect1><title>DESCRIPTION</title>
- - <para>bti sends a tweet message to twitter.com.
- + <para>bti sends a tweet message to status.net.
- </para>
- </refsect1>
-
- @@ -59,7 +59,7 @@
- <term><option>--account account</option></term>
- <listitem>
- <para>
- - Specify the twitter.com account name.
- + Specify the status.net account name.
- </para>
- </listitem>
- </varlistentry>
- @@ -67,7 +67,7 @@
- <term><option>--password password</option></term>
- <listitem>
- <para>
- - Specify the password of your twitter.com account.
- + Specify the password of your status.net account.
- </para>
- </listitem>
- </varlistentry>
- @@ -100,10 +100,10 @@
- <listitem>
- <para>
- Specify the host which you want to send your message to. Valid
- - options are "twitter" to send to twitter.com.
- + options are "statusnet" to send to status.net.
- </para>
- <para>
- - If no host is specified, the default is to send to twitter.com.
- + If no host is specified, the default is to send to status.net.
- </para>
- </listitem>
- </varlistentry>
- @@ -149,10 +149,6 @@
- reply to.
- </para>
- <para>
- - For twitter, this is ignored unless the message starts with the
- - @name of the owner of the post with the status ID.
- - </para>
- - <para>
- 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.
- @@ -301,7 +297,7 @@
- <term><option>account</option></term>
- <listitem>
- <para>
- - The twitter.com account name you wish to use to send this
- + The status.net account name you wish to use to send this
- message with.
- </para>
- </listitem>
- @@ -310,7 +306,7 @@
- <term><option>password</option></term>
- <listitem>
- <para>
- - The twitter.com password for the account you wish to use
- + The status.net password for the account you wish to use
- to send this message with.
- </para>
- </listitem>
- @@ -341,7 +337,7 @@
- <listitem>
- <para>
- The host you want to use to send the message to. Valid
- - options is "twitter" or "custom" to specify your own server.
- + options is "statusnet" or "custom" to specify your own server.
-
- </para>
- </listitem>
- diff --git a/config.c b/config.c
- index e6fecc1..0bbc186 100644
- --- a/config.c
- +++ b/config.c
- @@ -219,10 +219,10 @@ static int retweet_callback(struct session *session, char *value)
-
- static int host_callback(struct session *session, char *value)
- {
- - if (strcasecmp(value, "twitter") == 0) {
- - session->host = HOST_TWITTER;
- - session->hosturl = strdup(twitter_host);
- - session->hostname = strdup(twitter_name);
- + if (strcasecmp(value, "statusnet") == 0) {
- + session->host = HOST_STATUSNET;
- + session->hosturl = strdup(statusnet_host);
- + session->hostname = strdup(statusnet_name);
- } else {
- session->host = HOST_CUSTOM;
- session->hosturl = strdup(value);
|