From b8e25eb0c62e9b843644718128d42ef4d58a4d4f Mon Sep 17 00:00:00 2001 From: missdeer Date: Tue, 15 Oct 2013 23:46:28 -0800 Subject: [PATCH 1/4] (+)add a plugin which implements the quote function --- ttytter-quote.pl | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 ttytter-quote.pl diff --git a/ttytter-quote.pl b/ttytter-quote.pl new file mode 100755 index 0000000..ff096fc --- /dev/null +++ b/ttytter-quote.pl @@ -0,0 +1,58 @@ +################### +# +# ttytter-r2a.pl -- a TTYtter extension +# +# Copyright (C) 2013 by Ben Cotton and others +# +# See README.txt for more information +# +# Licensed under GNU Public License v2.0. See LICENSE for full text. +# +################### + +$TTYtter_R2A_VERSION='1.1'; + +$addaction = sub { + my @command = split(/ /,$_,3); + + # Check to see what command was given + if ( ( lc($command[0]) eq '/quote' ) || + ( lc($command[0]) eq '/quot' ) || + ( lc($command[0]) eq '/quo' ) || + ( lc($command[0]) eq '/qu' ) ) { + + # Get information about the tweet + my $tweet_id = $command[1]; + my $tweet = &get_tweet($tweet_id); + my $witty_reply = $command[2]; + + # Is the witty reply empty? Don't tweet it, that's obnoxious. + if ( $witty_reply eq '' ) { + print $stdout "-- There is no message here. Are you drunk?\n"; + return 1; + } + + # Check that the tweet exists. If not, it will be hard to reply to it. + if (!$tweet->{'id_str'}) { + print $stdout "-- You have to wait for that tweet to exist!\n"; + return 1; + } + + # Who sent the tweet that we're replying to? + $screen_name = &descape($tweet->{'user'}->{'screen_name'}); + + # Who is mentioned in the tweet? + my $reply_tweet = $tweet->{'text'}; + + $witty_reply = "$witty_reply RT \@$screen_name $reply_tweet"; + + &common_split_post($witty_reply, $in_reply_to, undef); + # All done! + return 1; + } + + # You didn't ask to reply to all. Tell TTYtter that we don't want to deal + # with this input. + return 0; +}; + From 735b06c566453a35d527b05e80b2856e6462043f Mon Sep 17 00:00:00 2001 From: missdeer Date: Wed, 16 Oct 2013 00:05:46 -0800 Subject: [PATCH 2/4] (*)descape the message text --- ttytter-quote.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttytter-quote.pl b/ttytter-quote.pl index ff096fc..b7c230e 100755 --- a/ttytter-quote.pl +++ b/ttytter-quote.pl @@ -42,7 +42,7 @@ $screen_name = &descape($tweet->{'user'}->{'screen_name'}); # Who is mentioned in the tweet? - my $reply_tweet = $tweet->{'text'}; + my $reply_tweet = &descape($tweet->{'text'}); $witty_reply = "$witty_reply RT \@$screen_name $reply_tweet"; From 24da270764cf4c128c22408eccac593b90c64872 Mon Sep 17 00:00:00 2001 From: missdeer Date: Wed, 16 Oct 2013 00:41:00 -0800 Subject: [PATCH 3/4] (*)change version string --- ttytter-quote.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttytter-quote.pl b/ttytter-quote.pl index b7c230e..70b78d0 100755 --- a/ttytter-quote.pl +++ b/ttytter-quote.pl @@ -10,7 +10,7 @@ # ################### -$TTYtter_R2A_VERSION='1.1'; +$TTYtter_QUOTE_VERSION='1.0'; $addaction = sub { my @command = split(/ /,$_,3); From 739c0b4369be05295461010cff4f283b7470db31 Mon Sep 17 00:00:00 2001 From: missdeer Date: Wed, 16 Oct 2013 02:04:57 -0800 Subject: [PATCH 4/4] (*)add expand prompt --- ttytter-quote.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ttytter-quote.pl b/ttytter-quote.pl index 70b78d0..3ab755c 100755 --- a/ttytter-quote.pl +++ b/ttytter-quote.pl @@ -46,6 +46,8 @@ $witty_reply = "$witty_reply RT \@$screen_name $reply_tweet"; + print $stdout "(expand to $witty_reply)\n"; + &common_split_post($witty_reply, $in_reply_to, undef); # All done! return 1;