nonprism.patch 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. diff --git a/bti-bashcompletion b/bti-bashcompletion
  2. index fa55d75..f957b32 100644
  3. --- a/bti-bashcompletion
  4. +++ b/bti-bashcompletion
  5. @@ -12,7 +12,7 @@ _bti()
  6. fi
  7. if [[ "${prev}" == "--host" ]] ; then
  8. - COMPREPLY=( $(compgen -W "twitter identica" -- ${cur} ) )
  9. + COMPREPLY=( $(compgen -W "statusnet" -- ${cur} ) )
  10. fi
  11. if [[ "${prev}" == "--action" ]] ; then
  12. diff --git a/bti.1 b/bti.1
  13. index bdd6c76..3577e98 100644
  14. --- a/bti.1
  15. +++ b/bti.1
  16. @@ -28,23 +28,23 @@
  17. .\" * MAIN CONTENT STARTS HERE *
  18. .\" -----------------------------------------------------------------
  19. .SH "NAME"
  20. -bti \- send a tweet to twitter\&.com from the command line
  21. +bti \- send a tweet to status\&.net from the command line
  22. .SH "SYNOPSIS"
  23. .HP \w'\fBbti\fR\ 'u
  24. \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]
  25. .SH "DESCRIPTION"
  26. .PP
  27. -bti sends a tweet message to twitter\&.com\&.
  28. +bti sends a tweet message to status\&.net\&.
  29. .SH "OPTIONS"
  30. .PP
  31. \fB\-\-account account\fR
  32. .RS 4
  33. -Specify the twitter\&.com account name\&.
  34. +Specify the status\&.net account name\&.
  35. .RE
  36. .PP
  37. \fB\-\-password password\fR
  38. .RS 4
  39. -Specify the password of your twitter\&.com account\&.
  40. +Specify the password of your status\&.net account\&.
  41. .RE
  42. .PP
  43. \fB\-\-action action\fR
  44. @@ -59,9 +59,9 @@ Specify the user whose messages you want to see when the action is "user", and t
  45. .PP
  46. \fB\-\-host HOST_NAME\fR
  47. .RS 4
  48. -Specify the host which you want to send your message to\&. Valid options are "twitter" to send to twitter\&.com\&.
  49. +Specify the host which you want to send your message to\&. Valid options are "statusnet" to send to status\&.net\&.
  50. .sp
  51. -If no host is specified, the default is to send to twitter\&.com\&.
  52. +If no host is specified, the default is to send to status\&.net\&.
  53. .RE
  54. .PP
  55. \fB\-\-proxy PROXY:PORT\fR
  56. @@ -85,8 +85,6 @@ Specify a config file for bti to read from\&. By default, bti looks in the ~/\&.
  57. .RS 4
  58. Status ID of a single post to which you want to create a threaded reply to\&.
  59. .sp
  60. -For twitter, this is ignored unless the message starts with the @name of the owner of the post with the status ID\&.
  61. -.sp
  62. 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\&.
  63. .RE
  64. .PP
  65. @@ -167,12 +165,12 @@ The account and password can be stored in a configuration file in the users home
  66. .PP
  67. \fBaccount\fR
  68. .RS 4
  69. -The twitter\&.com account name you wish to use to send this message with\&.
  70. +The status\&.net account name you wish to use to send this message with\&.
  71. .RE
  72. .PP
  73. \fBpassword\fR
  74. .RS 4
  75. -The twitter\&.com password for the account you wish to use to send this message with\&.
  76. +The status\&.net password for the account you wish to use to send this message with\&.
  77. .RE
  78. .PP
  79. \fB\-\-action action\fR
  80. @@ -187,7 +185,7 @@ Specify the user you want to see his/her messages while the action is "user"\&.
  81. .PP
  82. \fBhost\fR
  83. .RS 4
  84. -The host you want to use to send the message to\&. Valid options is "twitter" or "custom" to specify your own server\&.
  85. +The host you want to use to send the message to\&. Valid options is "statusnet" or "custom" to specify your own server\&.
  86. .RE
  87. .PP
  88. \fBproxy\fR
  89. diff --git a/bti.c b/bti.c
  90. index f4b2c4d..226e111 100644
  91. --- a/bti.c
  92. +++ b/bti.c
  93. @@ -53,7 +53,7 @@ int debug;
  94. static void display_help(void)
  95. {
  96. - fprintf(stdout, "bti - send tweet to twitter or identi.ca\n"
  97. + fprintf(stdout, "bti - send tweet to status.net\n"
  98. "Version: %s\n"
  99. "Usage:\n"
  100. " bti [options]\n"
  101. @@ -258,14 +258,12 @@ static void bti_curl_buffer_free(struct bti_curl_buffer *buffer)
  102. free(buffer);
  103. }
  104. -const char twitter_host[] = "https://api.twitter.com/1.1/statuses";
  105. -const char twitter_host_stream[] = "https://stream.twitter.com/1.1/statuses"; /*this is not reset, and doesnt work */
  106. -const char twitter_host_simple[] = "https://api.twitter.com/1.1";
  107. -const char twitter_name[] = "twitter";
  108. +const char statusnet_host[] = "https://status.net/api/statuses";
  109. +const char statusnet_name[] = "statusnet";
  110. -static const char twitter_request_token_uri[] = "https://twitter.com/oauth/request_token";
  111. -static const char twitter_access_token_uri[] = "https://twitter.com/oauth/access_token";
  112. -static const char twitter_authorize_uri[] = "https://twitter.com/oauth/authorize?oauth_token=";
  113. +static const char statusnet_request_token_uri[] = "https://status.net/api/oauth/request_token?oauth_callback=oob";
  114. +static const char statusnet_access_token_uri[] = "https://status.net/api/oauth/access_token";
  115. +static const char statusnet_authorize_uri[] = "https://status.net/api/oauth/authorize?oauth_token=";
  116. static const char custom_request_token_uri[] = "/../oauth/request_token?oauth_callback=oob";
  117. static const char custom_access_token_uri[] = "/../oauth/access_token";
  118. static const char custom_authorize_uri[] = "/../oauth/authorize?oauth_token=";
  119. @@ -792,9 +790,9 @@ static int request_access_token(struct session *session)
  120. if (!session)
  121. return -EINVAL;
  122. - if (session->host == HOST_TWITTER)
  123. + if (session->host == HOST_STATUSNET)
  124. request_url = oauth_sign_url2(
  125. - twitter_request_token_uri, NULL,
  126. + statusnet_request_token_uri, NULL,
  127. OA_HMAC, NULL, session->consumer_key,
  128. session->consumer_secret, NULL, NULL);
  129. else {
  130. @@ -825,11 +823,11 @@ static int request_access_token(struct session *session)
  131. "Please open the following link in your browser, and "
  132. "allow 'bti' to access your account. Then paste "
  133. "back the provided PIN in here.\n");
  134. - if (session->host == HOST_TWITTER) {
  135. - fprintf(stdout, "%s%s\nPIN: ", twitter_authorize_uri, at_key);
  136. + if (session->host == HOST_STATUSNET) {
  137. + fprintf(stdout, "%s%s\nPIN: ", statusnet_authorize_uri, at_key);
  138. verifier = session->readline(NULL);
  139. sprintf(at_uri, "%s?oauth_verifier=%s",
  140. - twitter_access_token_uri, verifier);
  141. + statusnet_access_token_uri, verifier);
  142. } else {
  143. fprintf(stdout, "%s%s%s\nPIN: ",
  144. session->hosturl, custom_authorize_uri, at_key);
  145. @@ -883,7 +881,7 @@ static int send_request(struct session *session)
  146. return -EINVAL;
  147. if (!session->hosturl)
  148. - session->hosturl = strdup(twitter_host);
  149. + session->hosturl = strdup(statusnet_host);
  150. if (session->no_oauth || session->guest) {
  151. curl_buf = bti_curl_buffer_alloc(session->action);
  152. @@ -898,7 +896,7 @@ static int send_request(struct session *session)
  153. }
  154. if (!session->hosturl)
  155. - session->hosturl = strdup(twitter_host);
  156. + session->hosturl = strdup(statusnet_host);
  157. switch (session->action) {
  158. case ACTION_UPDATE:
  159. @@ -959,7 +957,7 @@ static int send_request(struct session *session)
  160. case ACTION_PUBLIC:
  161. /*snprintf(endpoint, endpoint_size, "%s%s?page=%d", session->hosturl,*/
  162. - snprintf(endpoint, endpoint_size, "%s%s", twitter_host_stream,
  163. + snprintf(endpoint, endpoint_size, "%s%s", statusnet_host,
  164. public_uri);
  165. curl_easy_setopt(curl, CURLOPT_URL, endpoint);
  166. break;
  167. @@ -972,7 +970,6 @@ static int send_request(struct session *session)
  168. break;
  169. case ACTION_DIRECT:
  170. - /* NOT IMPLEMENTED - twitter requires authentication anyway */
  171. break;
  172. default:
  173. @@ -1052,7 +1049,6 @@ static int send_request(struct session *session)
  174. } else {
  175. switch (session->action) {
  176. case ACTION_UPDATE:
  177. - /* dont test it here, let twitter return an error that we show */
  178. if (strlen_utf8(session->tweet) > 140 + 1000 ) {
  179. printf("E: tweet is too long!\n");
  180. goto skip_tweet;
  181. @@ -1083,7 +1079,7 @@ static int send_request(struct session *session)
  182. mentions_uri, session->page);
  183. break;
  184. case ACTION_PUBLIC:
  185. - sprintf(endpoint, "%s%s", twitter_host_stream,
  186. + sprintf(endpoint, "%s%s", statusnet_host,
  187. public_uri);
  188. break;
  189. case ACTION_GROUP:
  190. @@ -1102,7 +1098,7 @@ static int send_request(struct session *session)
  191. break;
  192. case ACTION_DIRECT:
  193. escaped_tweet = oauth_url_escape(session->tweet);
  194. - sprintf(endpoint, "%s%s?user=%s&text=%s", twitter_host_simple,
  195. + sprintf(endpoint, "%s%s?user=%s&text=%s", statusnet_host,
  196. direct_uri, session->user, escaped_tweet);
  197. is_post = 1;
  198. break;
  199. @@ -1691,10 +1687,10 @@ int main(int argc, char *argv[], char *envp[])
  200. free(session->hosturl);
  201. if (session->hostname)
  202. free(session->hostname);
  203. - if (strcasecmp(optarg, "twitter") == 0) {
  204. - session->host = HOST_TWITTER;
  205. - session->hosturl = strdup(twitter_host);
  206. - session->hostname = strdup(twitter_name);
  207. + if (strcasecmp(optarg, "statusnet") == 0) {
  208. + session->host = HOST_STATUSNET;
  209. + session->hosturl = strdup(statusnet_host);
  210. + session->hostname = strdup(statusnet_name);
  211. } else {
  212. session->host = HOST_CUSTOM;
  213. session->hosturl = strdup(optarg);
  214. @@ -1750,31 +1746,8 @@ int main(int argc, char *argv[], char *envp[])
  215. if (debug)
  216. display_version();
  217. - if (session->host == HOST_TWITTER) {
  218. - if (!session->consumer_key || !session->consumer_secret) {
  219. - if (session->action == ACTION_USER ||
  220. - session->action == ACTION_PUBLIC) {
  221. - /*
  222. - * Some actions may still work without
  223. - * authentication
  224. - */
  225. - session->guest = 1;
  226. - } else {
  227. - fprintf(stderr,
  228. - "Twitter no longer supports HTTP basic authentication.\n"
  229. - "Both consumer key, and consumer secret are required"
  230. - " for bti in order to behave as an OAuth consumer.\n");
  231. - goto exit;
  232. - }
  233. - }
  234. - if (session->action == ACTION_GROUP) {
  235. - fprintf(stderr, "Groups only work in Identi.ca.\n");
  236. - goto exit;
  237. - }
  238. - } else {
  239. - if (!session->consumer_key || !session->consumer_secret)
  240. - session->no_oauth = 1;
  241. - }
  242. + if (!session->consumer_key || !session->consumer_secret)
  243. + session->no_oauth = 1;
  244. if (session->no_oauth) {
  245. if (!session->account) {
  246. diff --git a/bti.example b/bti.example
  247. index 57c55c9..29afa11 100644
  248. --- a/bti.example
  249. +++ b/bti.example
  250. @@ -5,7 +5,7 @@
  251. # a message.
  252. account=twitmaster
  253. password=icanhascheezburger
  254. -host=identica
  255. +host=statusnet
  256. # Example of a custom StatusNet installation
  257. #host=http://army.twit.tv/api/statuses
  258. logfile=.bti.log
  259. diff --git a/bti.h b/bti.h
  260. index 3d5ed9c..e466c2a 100644
  261. --- a/bti.h
  262. +++ b/bti.h
  263. @@ -17,7 +17,7 @@
  264. #define __BTI_H
  265. enum host {
  266. - HOST_TWITTER = 0,
  267. + HOST_STATUSNET = 1,
  268. HOST_CUSTOM = 2
  269. };
  270. @@ -75,8 +75,8 @@ struct bti_curl_buffer {
  271. int length;
  272. };
  273. -extern const char twitter_host[];
  274. -extern const char twitter_name[];
  275. +extern const char statusnet_host[];
  276. +extern const char statusnet_name[];
  277. extern int debug;
  278. extern void bti_parse_configfile(struct session *session);
  279. diff --git a/bti.xml b/bti.xml
  280. index c0b89ee..00ad9a8 100644
  281. --- a/bti.xml
  282. +++ b/bti.xml
  283. @@ -21,7 +21,7 @@
  284. <refnamediv>
  285. <refname>bti</refname>
  286. - <refpurpose>send a tweet to twitter.com from the command line</refpurpose>
  287. + <refpurpose>send a tweet to status.net from the command line</refpurpose>
  288. </refnamediv>
  289. <refsynopsisdiv>
  290. @@ -49,7 +49,7 @@
  291. </refsynopsisdiv>
  292. <refsect1><title>DESCRIPTION</title>
  293. - <para>bti sends a tweet message to twitter.com.
  294. + <para>bti sends a tweet message to status.net.
  295. </para>
  296. </refsect1>
  297. @@ -59,7 +59,7 @@
  298. <term><option>--account account</option></term>
  299. <listitem>
  300. <para>
  301. - Specify the twitter.com account name.
  302. + Specify the status.net account name.
  303. </para>
  304. </listitem>
  305. </varlistentry>
  306. @@ -67,7 +67,7 @@
  307. <term><option>--password password</option></term>
  308. <listitem>
  309. <para>
  310. - Specify the password of your twitter.com account.
  311. + Specify the password of your status.net account.
  312. </para>
  313. </listitem>
  314. </varlistentry>
  315. @@ -100,10 +100,10 @@
  316. <listitem>
  317. <para>
  318. Specify the host which you want to send your message to. Valid
  319. - options are "twitter" to send to twitter.com.
  320. + options are "statusnet" to send to status.net.
  321. </para>
  322. <para>
  323. - If no host is specified, the default is to send to twitter.com.
  324. + If no host is specified, the default is to send to status.net.
  325. </para>
  326. </listitem>
  327. </varlistentry>
  328. @@ -149,10 +149,6 @@
  329. reply to.
  330. </para>
  331. <para>
  332. - For twitter, this is ignored unless the message starts with the
  333. - @name of the owner of the post with the status ID.
  334. - </para>
  335. - <para>
  336. For status.net, this can link any two messages into context with
  337. each other. Status.net will also link a message that contains an
  338. @name without this without regard to context.
  339. @@ -301,7 +297,7 @@
  340. <term><option>account</option></term>
  341. <listitem>
  342. <para>
  343. - The twitter.com account name you wish to use to send this
  344. + The status.net account name you wish to use to send this
  345. message with.
  346. </para>
  347. </listitem>
  348. @@ -310,7 +306,7 @@
  349. <term><option>password</option></term>
  350. <listitem>
  351. <para>
  352. - The twitter.com password for the account you wish to use
  353. + The status.net password for the account you wish to use
  354. to send this message with.
  355. </para>
  356. </listitem>
  357. @@ -341,7 +337,7 @@
  358. <listitem>
  359. <para>
  360. The host you want to use to send the message to. Valid
  361. - options is "twitter" or "custom" to specify your own server.
  362. + options is "statusnet" or "custom" to specify your own server.
  363. </para>
  364. </listitem>
  365. diff --git a/config.c b/config.c
  366. index e6fecc1..0bbc186 100644
  367. --- a/config.c
  368. +++ b/config.c
  369. @@ -219,10 +219,10 @@ static int retweet_callback(struct session *session, char *value)
  370. static int host_callback(struct session *session, char *value)
  371. {
  372. - if (strcasecmp(value, "twitter") == 0) {
  373. - session->host = HOST_TWITTER;
  374. - session->hosturl = strdup(twitter_host);
  375. - session->hostname = strdup(twitter_name);
  376. + if (strcasecmp(value, "statusnet") == 0) {
  377. + session->host = HOST_STATUSNET;
  378. + session->hosturl = strdup(statusnet_host);
  379. + session->hostname = strdup(statusnet_name);
  380. } else {
  381. session->host = HOST_CUSTOM;
  382. session->hosturl = strdup(value);