Massive rebranding under way. Removing twitter terminology replacing with fediverse terminology. Thanks Claude-code for the help. :)
This commit is contained in:
+130
-131
@@ -71,7 +71,7 @@ BEGIN {
|
|||||||
%opts_boolean = map { $_ => 1 } qw(
|
%opts_boolean = map { $_ => 1 } qw(
|
||||||
ansi noansi verbose superverbose ttytteristas noprompt
|
ansi noansi verbose superverbose ttytteristas noprompt
|
||||||
seven silent hold daemon script anonymous readline ssl
|
seven silent hold daemon script anonymous readline ssl
|
||||||
newline vcheck verify noratelimit notrack nonewrts notimeline
|
newline vcheck verify noratelimit notrack noreblogs notimeline
|
||||||
synch exception_is_maskable mentions simplestart
|
synch exception_is_maskable mentions simplestart
|
||||||
location readlinerepaint nocounter notifyquiet
|
location readlinerepaint nocounter notifyquiet
|
||||||
signals_use_posix dostream nostreamreplies streamallreplies
|
signals_use_posix dostream nostreamreplies streamallreplies
|
||||||
@@ -85,13 +85,13 @@ BEGIN {
|
|||||||
nostreamreplies mentions wtrendurl atrendurl filterusers
|
nostreamreplies mentions wtrendurl atrendurl filterusers
|
||||||
filterats filterrts filteratonly filterflags nofilter
|
filterats filterrts filteratonly filterflags nofilter
|
||||||
); %opts_urls = map {$_ => 1} qw(
|
); %opts_urls = map {$_ => 1} qw(
|
||||||
url dmurl uurl rurl wurl frurl rlurl update shorturl
|
url dmurl uurl rurl wurl frurl rlurl update shoreblogurl
|
||||||
apibase fediverseserver queryurl idurl delurl dmdelurl favsurl
|
apibase fediverseserver queryurl idurl delurl dmdelurl favsurl
|
||||||
favurl favdelurl followurl leaveurl
|
favurl favdelurl followurl leaveurl
|
||||||
dmupdate credurl blockurl blockdelurl friendsurl
|
dmupdate credurl blockurl blockdelurl friendsurl
|
||||||
modifyliurl adduliurl delliurl getliurl getlisurl getfliurl
|
modifyliurl adduliurl delliurl getliurl getlisurl getfliurl
|
||||||
creliurl delliurl deluliurl crefliurl delfliurl
|
creliurl delliurl deluliurl crefliurl delfliurl
|
||||||
getuliurl getufliurl dmsenturl rturl rtsbyurl dmidurl
|
getuliurl getufliurl dmsenturl reblogurl rtsbyurl dmidurl
|
||||||
statusliurl followliurl leaveliurl followersurl
|
statusliurl followliurl leaveliurl followersurl
|
||||||
oauthurl oauthauthurl oauthaccurl oauthbase wtrendurl
|
oauthurl oauthauthurl oauthaccurl oauthbase wtrendurl
|
||||||
atrendurl frupdurl lookupidurl rtsofmeurl
|
atrendurl frupdurl lookupidurl rtsofmeurl
|
||||||
@@ -107,7 +107,7 @@ BEGIN {
|
|||||||
%opts_can_set = map { $_ => 1 } qw(
|
%opts_can_set = map { $_ => 1 } qw(
|
||||||
url pause dmurl dmpause superverbose ansi verbose
|
url pause dmurl dmpause superverbose ansi verbose
|
||||||
update uurl rurl wurl avatar ttytteristas frurl track
|
update uurl rurl wurl avatar ttytteristas frurl track
|
||||||
rlurl noprompt shorturl newline wrap verify autosplit
|
rlurl noprompt shoreblogurl newline wrap verify autosplit
|
||||||
notimeline queryurl fediverseserver colourprompt colourme
|
notimeline queryurl fediverseserver colourprompt colourme
|
||||||
colourdm colourreply colourwarn coloursearch colourlist idurl
|
colourdm colourreply colourwarn coloursearch colourlist idurl
|
||||||
urlopen delurl notrack dmdelurl favsurl
|
urlopen delurl notrack dmdelurl favsurl
|
||||||
@@ -117,7 +117,7 @@ BEGIN {
|
|||||||
nocounter linelength friendsurl followersurl lists
|
nocounter linelength friendsurl followersurl lists
|
||||||
modifyliurl adduliurl delliurl getliurl getlisurl getfliurl
|
modifyliurl adduliurl delliurl getliurl getlisurl getfliurl
|
||||||
creliurl delliurl deluliurl crefliurl delfliurl atrendurl
|
creliurl delliurl deluliurl crefliurl delfliurl atrendurl
|
||||||
getuliurl getufliurl dmsenturl rturl rtsbyurl wtrendurl
|
getuliurl getufliurl dmsenturl reblogurl rtsbyurl wtrendurl
|
||||||
statusliurl followliurl leaveliurl dmidurl nostreamreplies
|
statusliurl followliurl leaveliurl dmidurl nostreamreplies
|
||||||
frupdurl filterusers filterats filterrts filterflags
|
frupdurl filterusers filterats filterrts filterflags
|
||||||
filteratonly nofilter rtsofmeurl
|
filteratonly nofilter rtsofmeurl
|
||||||
@@ -125,7 +125,7 @@ BEGIN {
|
|||||||
lynx curl seven silent maxhist noansi hold status
|
lynx curl seven silent maxhist noansi hold status
|
||||||
daemon timestamp twarg user anonymous script readline
|
daemon timestamp twarg user anonymous script readline
|
||||||
leader ssl rc norc vcheck apibase notifytype exts
|
leader ssl rc norc vcheck apibase notifytype exts
|
||||||
nonewrts synch runcommand authtype oauthkey oauthsecret
|
noreblogs synch runcommand authtype oauthkey oauthsecret
|
||||||
tokenkey tokensecret credurl keyf readlinerepaint
|
tokenkey tokensecret credurl keyf readlinerepaint
|
||||||
simplestart exception_is_maskable oldperl notco
|
simplestart exception_is_maskable oldperl notco
|
||||||
notify_tool_path oauthurl oauthauthurl oauthaccurl oauthbase
|
notify_tool_path oauthurl oauthauthurl oauthaccurl oauthbase
|
||||||
@@ -221,7 +221,7 @@ EOF
|
|||||||
$uurl = "${apibase}/accounts/%I/statuses";
|
$uurl = "${apibase}/accounts/%I/statuses";
|
||||||
$idurl = "${apibase}/statuses/%I";
|
$idurl = "${apibase}/statuses/%I";
|
||||||
$delurl = "${apibase}/statuses/%I";
|
$delurl = "${apibase}/statuses/%I";
|
||||||
$rturl = "${apibase}/statuses/%I/reblog";
|
$reblogurl = "${apibase}/statuses/%I/reblog";
|
||||||
$wurl = "${apibase}/accounts/%I";
|
$wurl = "${apibase}/accounts/%I";
|
||||||
$followurl = "${apibase}/accounts/%I/follow";
|
$followurl = "${apibase}/accounts/%I/follow";
|
||||||
$leaveurl = "${apibase}/accounts/%I/unfollow";
|
$leaveurl = "${apibase}/accounts/%I/unfollow";
|
||||||
@@ -505,7 +505,7 @@ $alphabet = "abcdefghijkLmnopqrstuvwxyz";
|
|||||||
%store_hash = ();
|
%store_hash = ();
|
||||||
$mini_split = 250; # i.e., 10 tweets for the mini-menu (/th)
|
$mini_split = 250; # i.e., 10 tweets for the mini-menu (/th)
|
||||||
# leaving 50 tweets for the foreground temporary menus
|
# leaving 50 tweets for the foreground temporary menus
|
||||||
$tweet_counter = 0;
|
$post_counter = 0;
|
||||||
%dm_store_hash = ();
|
%dm_store_hash = ();
|
||||||
$dm_counter = 0;
|
$dm_counter = 0;
|
||||||
%id_cache = ();
|
%id_cache = ();
|
||||||
@@ -513,7 +513,7 @@ $dm_counter = 0;
|
|||||||
|
|
||||||
# set up threading management
|
# set up threading management
|
||||||
$in_reply_to = 0;
|
$in_reply_to = 0;
|
||||||
$expected_tweet_ref = undef;
|
$expected_post_ref = undef;
|
||||||
|
|
||||||
# interpret -script at this level
|
# interpret -script at this level
|
||||||
if ($script) {
|
if ($script) {
|
||||||
@@ -575,7 +575,7 @@ if (length($exts) && $exts ne '0') {
|
|||||||
|
|
||||||
# these methods are multi-module safe
|
# these methods are multi-module safe
|
||||||
foreach $arry (qw(
|
foreach $arry (qw(
|
||||||
handle exception tweettype conclude dmhandle dmconclude
|
handle exception posttype conclude dmhandle dmconclude
|
||||||
heartbeat precommand prepost postpost addaction
|
heartbeat precommand prepost postpost addaction
|
||||||
eventhandle listhandle userhandle shutdown)) {
|
eventhandle listhandle userhandle shutdown)) {
|
||||||
if (defined($$arry)) {
|
if (defined($$arry)) {
|
||||||
@@ -607,7 +607,7 @@ if (length($exts) && $exts ne '0') {
|
|||||||
|
|
||||||
$handle = \&multihandle;
|
$handle = \&multihandle;
|
||||||
$exception = \&multiexception;
|
$exception = \&multiexception;
|
||||||
$tweettype = \&multitweettype;
|
$posttype = \&multiposttype;
|
||||||
$conclude = \&multiconclude;
|
$conclude = \&multiconclude;
|
||||||
$dmhandle = \&multidmhandle;
|
$dmhandle = \&multidmhandle;
|
||||||
$dmconclude = \&multidmconclude;
|
$dmconclude = \&multidmconclude;
|
||||||
@@ -628,7 +628,7 @@ if (length($exts) && $exts ne '0') {
|
|||||||
|
|
||||||
$handle = \&defaulthandle;
|
$handle = \&defaulthandle;
|
||||||
$exception = \&defaultexception;
|
$exception = \&defaultexception;
|
||||||
$tweettype = \&defaulttweettype;
|
$posttype = \&defaultposttype;
|
||||||
$conclude = \&defaultconclude;
|
$conclude = \&defaultconclude;
|
||||||
$dmhandle = \&defaultdmhandle;
|
$dmhandle = \&defaultdmhandle;
|
||||||
$dmconclude = \&defaultdmconclude;
|
$dmconclude = \&defaultdmconclude;
|
||||||
@@ -761,7 +761,7 @@ $fediverseserver ||= "mastodon.social";
|
|||||||
$oauthbase ||= $apibase || "${http_proto}://${fediverseserver}";
|
$oauthbase ||= $apibase || "${http_proto}://${fediverseserver}";
|
||||||
# this needs to be AFTER oauthbase so that apibase can set oauthbase.
|
# this needs to be AFTER oauthbase so that apibase can set oauthbase.
|
||||||
$apibase ||= "${http_proto}://${fediverseserver}/api/v1";
|
$apibase ||= "${http_proto}://${fediverseserver}/api/v1";
|
||||||
$nonewrts ||= 0;
|
$noreblogs ||= 0;
|
||||||
|
|
||||||
# special case: if we explicitly refuse backload, don't load initially.
|
# special case: if we explicitly refuse backload, don't load initially.
|
||||||
$backload = 30 if (!defined($backload)); # zero is valid!
|
$backload = 30 if (!defined($backload)); # zero is valid!
|
||||||
@@ -782,7 +782,7 @@ $uurl ||= "${apibase}/accounts/%I/statuses";
|
|||||||
$idurl ||= "${apibase}/statuses/%I";
|
$idurl ||= "${apibase}/statuses/%I";
|
||||||
$delurl ||= "${apibase}/statuses/%I";
|
$delurl ||= "${apibase}/statuses/%I";
|
||||||
|
|
||||||
$rturl ||= "${apibase}/statuses/%I/reblog";
|
$reblogurl ||= "${apibase}/statuses/%I/reblog";
|
||||||
$rtsbyurl ||= "${apibase}/statuses/retweets/%I.json";
|
$rtsbyurl ||= "${apibase}/statuses/retweets/%I.json";
|
||||||
$rtsofmeurl ||= "${apibase}/statuses/retweets_of_me.json";
|
$rtsofmeurl ||= "${apibase}/statuses/retweets_of_me.json";
|
||||||
|
|
||||||
@@ -834,8 +834,8 @@ $wtrendurl ||= "${apibase}/trends";
|
|||||||
$atrendurl ||= "${apibase}/trends";
|
$atrendurl ||= "${apibase}/trends";
|
||||||
|
|
||||||
# pick ONE!
|
# pick ONE!
|
||||||
#$shorturl ||= "http://api.tr.im/v1/trim_simple?url=";
|
#$shoreblogurl ||= "http://api.tr.im/v1/trim_simple?url=";
|
||||||
$shorturl ||= "http://is.gd/api.php?longurl=";
|
$shoreblogurl ||= "http://is.gd/api.php?longurl=";
|
||||||
|
|
||||||
# figure out the domain to stop shortener loops
|
# figure out the domain to stop shortener loops
|
||||||
&generate_shortdomain;
|
&generate_shortdomain;
|
||||||
@@ -1916,11 +1916,11 @@ print $stdout "*** invalid UTF-8: partial delete of a wide character?\n";
|
|||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
print $stdout "(expanded to \"$_\")\n" ;
|
print $stdout "(expanded to \"$_\")\n" ;
|
||||||
$in_reply_to = $expected_tweet_ref->{'id_str'} || 0
|
$in_reply_to = $expected_post_ref->{'id_str'} || 0
|
||||||
if (defined $expected_tweet_ref &&
|
if (defined $expected_post_ref &&
|
||||||
ref($expected_tweet_ref) eq 'HASH');
|
ref($expected_post_ref) eq 'HASH');
|
||||||
} else {
|
} else {
|
||||||
$expected_tweet_ref = undef;
|
$expected_post_ref = undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0 unless length; # actually possible to happen
|
return 0 unless length; # actually possible to happen
|
||||||
@@ -1950,13 +1950,13 @@ print $stdout "*** invalid UTF-8: partial delete of a wide character?\n";
|
|||||||
if (m#^/du(mp)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
if (m#^/du(mp)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
||||||
my $code = lc($2);
|
my $code = lc($2);
|
||||||
unless ($code =~ /^d[0-9][0-9]+$/) { # this is a DM.
|
unless ($code =~ /^d[0-9][0-9]+$/) { # this is a DM.
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
my $k;
|
my $k;
|
||||||
my $sn;
|
my $sn;
|
||||||
my $id;
|
my $id;
|
||||||
my @superfields = (
|
my @superfields = (
|
||||||
[ "user", "screen_name" ], # must always be first
|
[ "user", "screen_name" ], # must always be first
|
||||||
[ "retweeted_status", "id_str" ],
|
[ "reblog", "id_str" ],
|
||||||
[ "user", "geo_enabled" ],
|
[ "user", "geo_enabled" ],
|
||||||
[ "place", "id" ],
|
[ "place", "id" ],
|
||||||
[ "place", "country_code" ],
|
[ "place", "country_code" ],
|
||||||
@@ -1987,7 +1987,7 @@ print $stdout "*** invalid UTF-8: partial delete of a wide character?\n";
|
|||||||
print $stdout "geo->coordinates (" .
|
print $stdout "geo->coordinates (" .
|
||||||
join(', ', @{ $tweet->{'geo'}->{'coordinates'} })
|
join(', ', @{ $tweet->{'geo'}->{'coordinates'} })
|
||||||
. ")\n";
|
. ")\n";
|
||||||
foreach $k (sort keys %{ $tweet }) {
|
foreach $k (sort keys %{ $post }) {
|
||||||
next if (ref($tweet->{$k}));
|
next if (ref($tweet->{$k}));
|
||||||
print $stdout
|
print $stdout
|
||||||
substr("$k ", 0, 25) .
|
substr("$k ", 0, 25) .
|
||||||
@@ -2910,15 +2910,15 @@ EOF
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
my $code = lc($3);
|
my $code = lc($3);
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout "-- no such post (yet?): $code\n";
|
print $stdout "-- no such post (yet?): $code\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
my $limit = 9;
|
my $limit = 9;
|
||||||
my $id = $tweet->{'retweeted_status'}->{'id_str'} ||
|
my $id = $tweet->{'reblog'}->{'id_str'} ||
|
||||||
$tweet->{'in_reply_to_status_id_str'};
|
$tweet->{'in_reply_to_status_id_str'};
|
||||||
my $thread_ref = [ $tweet ];
|
my $thread_ref = [ $post ];
|
||||||
while ($id && $limit) {
|
while ($id && $limit) {
|
||||||
print $stdout "-- thread: fetching $id\n"
|
print $stdout "-- thread: fetching $id\n"
|
||||||
if ($verbose);
|
if ($verbose);
|
||||||
@@ -2929,7 +2929,7 @@ EOF
|
|||||||
if (defined($next) && ref($next) eq 'HASH') {
|
if (defined($next) && ref($next) eq 'HASH') {
|
||||||
push(@{ $thread_ref },
|
push(@{ $thread_ref },
|
||||||
&fix_geo_api_data($next));
|
&fix_geo_api_data($next));
|
||||||
$id = $next->{'retweeted_status'}->{'id_str'}
|
$id = $next->{'reblog'}->{'id_str'}
|
||||||
|| $next->{'in_reply_to_status_id_str'}
|
|| $next->{'in_reply_to_status_id_str'}
|
||||||
|| 0;
|
|| 0;
|
||||||
}
|
}
|
||||||
@@ -2958,7 +2958,7 @@ EOF
|
|||||||
$thing = "DM";
|
$thing = "DM";
|
||||||
$genurl = $dmidurl;
|
$genurl = $dmidurl;
|
||||||
} else {
|
} else {
|
||||||
$hash = &get_tweet($code);
|
$hash = &get_post($code);
|
||||||
$thing = "tweet";
|
$thing = "tweet";
|
||||||
$genurl = $idurl;
|
$genurl = $idurl;
|
||||||
}
|
}
|
||||||
@@ -2976,9 +2976,9 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if a retweeted status, get the status.
|
# if a retweeted status, get the status.
|
||||||
$hash = $hash->{'retweeted_status'}
|
$hash = $hash->{'reblog'}
|
||||||
if (defined($hash->{'retweeted_status'}) &&
|
if (defined($hash->{'reblog'}) &&
|
||||||
ref($hash->{'retweeted_status'}) eq 'HASH');
|
ref($hash->{'reblog'}) eq 'HASH');
|
||||||
|
|
||||||
my $didprint = 0;
|
my $didprint = 0;
|
||||||
# Twitter puts entities in multiple fields.
|
# Twitter puts entities in multiple fields.
|
||||||
@@ -3021,12 +3021,12 @@ EOF
|
|||||||
}
|
}
|
||||||
if (m#^/(url|open) ([dDzZ]?[a-zA-Z]?[0-9]+)$#) {
|
if (m#^/(url|open) ([dDzZ]?[a-zA-Z]?[0-9]+)$#) {
|
||||||
my $code = lc($2);
|
my $code = lc($2);
|
||||||
my $tweet;
|
my $post;
|
||||||
my $genurl = undef;
|
my $genurl = undef;
|
||||||
$urlshort = undef;
|
$urlshort = undef;
|
||||||
|
|
||||||
if ($code =~ /^d/ && length($code) > 2) {
|
if ($code =~ /^d/ && length($code) > 2) {
|
||||||
$tweet = &get_dm($code); # USO!
|
$post = &get_dm($code); # USO!
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout
|
print $stdout
|
||||||
"-- no such DM (yet?): $code\n";
|
"-- no such DM (yet?): $code\n";
|
||||||
@@ -3034,7 +3034,7 @@ EOF
|
|||||||
}
|
}
|
||||||
$genurl = $dmidurl;
|
$genurl = $dmidurl;
|
||||||
} else {
|
} else {
|
||||||
$tweet = &get_tweet($code);
|
$post = &get_post($code);
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout
|
print $stdout
|
||||||
"-- no such post (yet?): $code\n";
|
"-- no such post (yet?): $code\n";
|
||||||
@@ -3046,7 +3046,7 @@ EOF
|
|||||||
# to be TOS-compliant, we must try entities first to use
|
# to be TOS-compliant, we must try entities first to use
|
||||||
# t.co wrapped links. this is a tiny version of /entities.
|
# t.co wrapped links. this is a tiny version of /entities.
|
||||||
unless ($notco) {
|
unless ($notco) {
|
||||||
my $id = $tweet->{'retweeted_status'}->{'id_str'}
|
my $id = $tweet->{'reblog'}->{'id_str'}
|
||||||
|| $tweet->{'id_str'};
|
|| $tweet->{'id_str'};
|
||||||
my $hash;
|
my $hash;
|
||||||
|
|
||||||
@@ -3159,7 +3159,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
"-- hmm. seems contradictory. no dice.\n";
|
"-- hmm. seems contradictory. no dice.\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout "-- no such post (yet?): $code\n";
|
print $stdout "-- no such post (yet?): $code\n";
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3180,20 +3180,20 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
if (s#^/([oe]?)boost ([zZ]?[a-zA-Z]?[0-9]+)\s*##) {
|
if (s#^/([oe]?)boost ([zZ]?[a-zA-Z]?[0-9]+)\s*##) {
|
||||||
my $mode = $1;
|
my $mode = $1;
|
||||||
my $code = lc($2);
|
my $code = lc($2);
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout "-- no such post (yet?): $code\n";
|
print $stdout "-- no such post (yet?): $code\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
# use a native retweet unless we can't (or user used /ort /ert)
|
# use a native retweet unless we can't (or user used /ort /ert)
|
||||||
unless ($nonewrts || length || length($mode)) {
|
unless ($noreblogs || length || length($mode)) {
|
||||||
# we don't always get rs->text, so we simulate it.
|
# we don't always get rs->text, so we simulate it.
|
||||||
my $text = &descape($tweet->{'text'});
|
my $text = &descape($tweet->{'text'});
|
||||||
$text =~ s/^RT \@[^\s]+:\s+//
|
$text =~ s/^RT \@[^\s]+:\s+//
|
||||||
if ($tweet->{'retweeted_status'}->{'id_str'});
|
if ($tweet->{'reblog'}->{'id_str'});
|
||||||
print $stdout "-- status boosted\n"
|
print $stdout "-- status boosted\n"
|
||||||
unless(&updatest($text, 1, 0, undef,
|
unless(&updatest($text, 1, 0, undef,
|
||||||
$tweet->{'retweeted_status'}->{'id_str'}
|
$tweet->{'reblog'}->{'id_str'}
|
||||||
|| $tweet->{'id_str'}));
|
|| $tweet->{'id_str'}));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3213,7 +3213,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
goto TWEETPRINT; # fugly! FUGLY!
|
goto TWEETPRINT; # fugly! FUGLY!
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m#^/(re)?rts?of?me?(\s+\+\d+)?$# && !$nonewrts) {
|
if (m#^/(re)?rts?of?me?(\s+\+\d+)?$# && !$noreblogs) {
|
||||||
#TODO
|
#TODO
|
||||||
# when more fields are added, integrate them over the JSON_ref
|
# when more fields are added, integrate them over the JSON_ref
|
||||||
my $mode = $1;
|
my $mode = $1;
|
||||||
@@ -3229,16 +3229,16 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m#^/rts?of\s+([zZ]?[a-zA-Z]?[0-9]+)$# && !$nonewrts) {
|
if (m#^/rts?of\s+([zZ]?[a-zA-Z]?[0-9]+)$# && !$noreblogs) {
|
||||||
my $code = lc($1);
|
my $code = lc($1);
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
my $id;
|
my $id;
|
||||||
|
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout "-- no such post (yet?): $code\n";
|
print $stdout "-- no such post (yet?): $code\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$id = $tweet->{'retweeted_status'}->{'id_str'} ||
|
$id = $tweet->{'reblog'}->{'id_str'} ||
|
||||||
$tweet->{'id_str'};
|
$tweet->{'id_str'};
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
print $stdout "-- hmmm, that post is major bogus.\n";
|
print $stdout "-- hmmm, that post is major bogus.\n";
|
||||||
@@ -3262,7 +3262,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# enable and disable NewRTs from users
|
# enable and disable NewRTs from users
|
||||||
# we allow this even if newRTs are off from -nonewrts
|
# we allow this even if newRTs are off from -noreblogs
|
||||||
if (s#^/rts(on|off)\s+## && length) {
|
if (s#^/rts(on|off)\s+## && length) {
|
||||||
&rtsonoffuser($_, 1, ($1 eq 'on'));
|
&rtsonoffuser($_, 1, ($1 eq 'on'));
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3271,7 +3271,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
if (m#^/del(ete)?\s+([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
if (m#^/del(ete)?\s+([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
||||||
my $code = lc($2);
|
my $code = lc($2);
|
||||||
unless ($code =~ /^d[0-9][0-9]+$/) { # this is a DM.
|
unless ($code =~ /^d[0-9][0-9]+$/) { # this is a DM.
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout "-- no such post (yet?): $code\n";
|
print $stdout "-- no such post (yet?): $code\n";
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3347,7 +3347,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
my $mode = $1;
|
my $mode = $1;
|
||||||
my $code = lc($3);
|
my $code = lc($3);
|
||||||
unless ($code =~ /^d[0-9][0-9]+/) { # this is a DM
|
unless ($code =~ /^d[0-9][0-9]+/) { # this is a DM
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout "-- no such post (yet?): $code\n";
|
print $stdout "-- no such post (yet?): $code\n";
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3356,7 +3356,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
$_ = '@' . $target . " $_";
|
$_ = '@' . $target . " $_";
|
||||||
unless ($mode eq 'v') {
|
unless ($mode eq 'v') {
|
||||||
$in_reply_to = $tweet->{'id_str'};
|
$in_reply_to = $tweet->{'id_str'};
|
||||||
$expected_tweet_ref = $tweet;
|
$expected_post_ref = $tweet;
|
||||||
} else {
|
} else {
|
||||||
$_ = ".$_";
|
$_ = ".$_";
|
||||||
}
|
}
|
||||||
@@ -3392,7 +3392,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
my $code = $5;
|
my $code = $5;
|
||||||
|
|
||||||
# common code from /vreply
|
# common code from /vreply
|
||||||
my $tweet = &get_tweet($code);
|
my $post = &get_post($code);
|
||||||
if (!defined($tweet)) {
|
if (!defined($tweet)) {
|
||||||
print $stdout "-- no such post (yet?): $code\n";
|
print $stdout "-- no such post (yet?): $code\n";
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3402,7 +3402,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
|
|||||||
$_ = '@' . $target;
|
$_ = '@' . $target;
|
||||||
unless ($mode eq 'v') {
|
unless ($mode eq 'v') {
|
||||||
$in_reply_to = $tweet->{'id_str'};
|
$in_reply_to = $tweet->{'id_str'};
|
||||||
$expected_tweet_ref = $tweet;
|
$expected_post_ref = $tweet;
|
||||||
} else {
|
} else {
|
||||||
$_ = ".$_";
|
$_ = ".$_";
|
||||||
}
|
}
|
||||||
@@ -4274,7 +4274,7 @@ EOF
|
|||||||
$suspend_output = 0; # reset our status
|
$suspend_output = 0; # reset our status
|
||||||
goto RESTART_SELECT;
|
goto RESTART_SELECT;
|
||||||
} elsif ($rout =~ /^pipet (..)/) {
|
} elsif ($rout =~ /^pipet (..)/) {
|
||||||
my $key = &get_tweet($1);
|
my $key = &get_post($1);
|
||||||
my $ms = $key->{'menu_select'} || 'XX';
|
my $ms = $key->{'menu_select'} || 'XX';
|
||||||
my $ds = $key->{'created_at'} || 'argh, no created_at';
|
my $ds = $key->{'created_at'} || 'argh, no created_at';
|
||||||
$ds =~ s/\s/_/g;
|
$ds =~ s/\s/_/g;
|
||||||
@@ -4282,7 +4282,7 @@ EOF
|
|||||||
$src =~ s/\|//g; # shouldn't be any anyway.
|
$src =~ s/\|//g; # shouldn't be any anyway.
|
||||||
$key = substr(( "$ms ".($key->{'id_str'})." ".
|
$key = substr(( "$ms ".($key->{'id_str'})." ".
|
||||||
($key->{'in_reply_to_status_id_str'})." ".
|
($key->{'in_reply_to_status_id_str'})." ".
|
||||||
($key->{'retweeted_status'}->{'id_str'})." ".
|
($key->{'reblog'}->{'id_str'})." ".
|
||||||
($key->{'user'}->{'geo_enabled'} || "false") . " ".
|
($key->{'user'}->{'geo_enabled'} || "false") . " ".
|
||||||
($key->{'geo'}->{'coordinates'}->[0]). " ".
|
($key->{'geo'}->{'coordinates'}->[0]). " ".
|
||||||
($key->{'geo'}->{'coordinates'}->[1]). " ".
|
($key->{'geo'}->{'coordinates'}->[1]). " ".
|
||||||
@@ -4292,7 +4292,7 @@ EOF
|
|||||||
unpack("${pack_magic}H*", $key->{'place'}->{'full_name'})." ".
|
unpack("${pack_magic}H*", $key->{'place'}->{'full_name'})." ".
|
||||||
$key->{'tag'}->{'type'}. " ". # NO SPACES!
|
$key->{'tag'}->{'type'}. " ". # NO SPACES!
|
||||||
unpack("${pack_magic}H*", $key->{'tag'}->{'payload'}). " ".
|
unpack("${pack_magic}H*", $key->{'tag'}->{'payload'}). " ".
|
||||||
($key->{'retweet_count'} || "0") . " " .
|
($key->{'reblogs_count'} || "0") . " " .
|
||||||
$key->{'user'}->{'screen_name'}." $ds $src|".
|
$key->{'user'}->{'screen_name'}." $ds $src|".
|
||||||
unpack("${pack_magic}H*", $key->{'text'}).
|
unpack("${pack_magic}H*", $key->{'text'}).
|
||||||
$space_pad), 0, 1024);
|
$space_pad), 0, 1024);
|
||||||
@@ -4777,13 +4777,13 @@ sub handle_twitter_stream_event {
|
|||||||
$payload->{'tag'}->{'payload'} = 'stream';
|
$payload->{'tag'}->{'payload'} = 'stream';
|
||||||
|
|
||||||
# filter replies from streaming socket if the
|
# filter replies from streaming socket if the
|
||||||
# user requested it. use $tweettype to determine
|
# user requested it. use $posttype to determine
|
||||||
# this so the user can interpose custom logic.
|
# this so the user can interpose custom logic.
|
||||||
if ($nostreamreplies) {
|
if ($nostreamreplies) {
|
||||||
my $sn = &descape(
|
my $sn = &descape(
|
||||||
$payload->{'user'}->{'screen_name'});
|
$payload->{'user'}->{'screen_name'});
|
||||||
my $text = &descape($payload->{'text'});
|
my $text = &descape($payload->{'text'});
|
||||||
return if (&$tweettype($payload, $sn, $text) eq
|
return if (&$posttype($payload, $sn, $text) eq
|
||||||
'reply');
|
'reply');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4846,7 +4846,7 @@ sub handle_mastodon_stream_event {
|
|||||||
if ($nostreamreplies) {
|
if ($nostreamreplies) {
|
||||||
my $sn = &descape($payload->{'user'}->{'screen_name'});
|
my $sn = &descape($payload->{'user'}->{'screen_name'});
|
||||||
my $text = &descape($payload->{'text'});
|
my $text = &descape($payload->{'text'});
|
||||||
return if (&$tweettype($payload, $sn, $text) eq 'reply');
|
return if (&$posttype($payload, $sn, $text) eq 'reply');
|
||||||
}
|
}
|
||||||
|
|
||||||
# Filter and dedupe
|
# Filter and dedupe
|
||||||
@@ -5123,7 +5123,7 @@ sub refresh {
|
|||||||
sub killtw { my $j = shift; $filtered++; $filter_next{$j->{'id_str'}}++
|
sub killtw { my $j = shift; $filtered++; $filter_next{$j->{'id_str'}}++
|
||||||
if ($is_background); }
|
if ($is_background); }
|
||||||
|
|
||||||
# handle (i.e., display) an array of tweets in standard format
|
# handle (i.e., display) an array of posts in standard format
|
||||||
sub tdisplay { # used by both synchronous /again and asynchronous refreshes
|
sub tdisplay { # used by both synchronous /again and asynchronous refreshes
|
||||||
my $my_json_ref = shift;
|
my $my_json_ref = shift;
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
@@ -5141,13 +5141,13 @@ sub tdisplay { # used by both synchronous /again and asynchronous refreshes
|
|||||||
#TODO
|
#TODO
|
||||||
# generalize this at some point instead of hardcoded menu codes
|
# generalize this at some point instead of hardcoded menu codes
|
||||||
# maybe an ma0-mz9?
|
# maybe an ma0-mz9?
|
||||||
$save_counter = $tweet_counter;
|
$save_counter = $post_counter;
|
||||||
$tweet_counter = $mini_split;
|
$post_counter = $mini_split;
|
||||||
for(0..9) {
|
for(0..9) {
|
||||||
undef $store_hash{"zz$_"};
|
undef $store_hash{"zz$_"};
|
||||||
}
|
}
|
||||||
}# else {
|
}# else {
|
||||||
# $tweet_counter = $back_split;
|
# $post_counter = $back_split;
|
||||||
# %store_hash = ();
|
# %store_hash = ();
|
||||||
#}
|
#}
|
||||||
}
|
}
|
||||||
@@ -5182,16 +5182,16 @@ sub tdisplay { # used by both synchronous /again and asynchronous refreshes
|
|||||||
# and if the tweet has a retweeted status, do for
|
# and if the tweet has a retweeted status, do for
|
||||||
# that.
|
# that.
|
||||||
(&killtw($j), next) if
|
(&killtw($j), next) if
|
||||||
($j->{'retweeted_status'} &&
|
($j->{'reblog'} &&
|
||||||
$filterusers_sub &&
|
$filterusers_sub &&
|
||||||
&$filterusers_sub(lc(&descape($j->
|
&$filterusers_sub(lc(&descape($j->
|
||||||
{'retweeted_status'}->
|
{'reblog'}->
|
||||||
{'user'}->{'screen_name'}))));
|
{'user'}->{'screen_name'}))));
|
||||||
|
|
||||||
# second, filterrts. this is almost as fast.
|
# second, filterrts. this is almost as fast.
|
||||||
(&killtw($j), next) if
|
(&killtw($j), next) if
|
||||||
($filterrts_sub &&
|
($filterrts_sub &&
|
||||||
length($j->{'retweeted_status'}->{'id_str'})&&
|
length($j->{'reblog'}->{'id_str'})&&
|
||||||
&$filterrts_sub($sn));
|
&$filterrts_sub($sn));
|
||||||
|
|
||||||
# third, filteratonly. this has a fast case and a
|
# third, filteratonly. this has a fast case and a
|
||||||
@@ -5213,12 +5213,12 @@ sub tdisplay { # used by both synchronous /again and asynchronous refreshes
|
|||||||
# damn it, user may actually want this tweet.
|
# damn it, user may actually want this tweet.
|
||||||
# assign menu codes and place into caches
|
# assign menu codes and place into caches
|
||||||
$key = (($is_background) ? '' : 'z' ).
|
$key = (($is_background) ? '' : 'z' ).
|
||||||
substr($alphabet, $tweet_counter/10, 1) .
|
substr($alphabet, $post_counter/10, 1) .
|
||||||
$tweet_counter % 10;
|
$post_counter % 10;
|
||||||
$tweet_counter =
|
$post_counter =
|
||||||
($tweet_counter == 259) ? $mini_split :
|
($post_counter == 259) ? $mini_split :
|
||||||
($tweet_counter == ($mini_split - 1))
|
($post_counter == ($mini_split - 1))
|
||||||
? 0 : ($tweet_counter+1);
|
? 0 : ($post_counter+1);
|
||||||
$j->{'menu_select'} = $key;
|
$j->{'menu_select'} = $key;
|
||||||
$key = lc($key);
|
$key = lc($key);
|
||||||
|
|
||||||
@@ -5243,7 +5243,7 @@ sub tdisplay { # used by both synchronous /again and asynchronous refreshes
|
|||||||
undef))));
|
undef))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tweet_counter = $save_counter if ($save_counter > -1);
|
$post_counter = $save_counter if ($save_counter > -1);
|
||||||
sleep 5 while ($suspend_output > 0);
|
sleep 5 while ($suspend_output > 0);
|
||||||
&$exception(6,"*** warning: more tweets than menu codes; truncated\n")
|
&$exception(6,"*** warning: more tweets than menu codes; truncated\n")
|
||||||
if (scalar(@{ $my_json_ref }) > $print_max);
|
if (scalar(@{ $my_json_ref }) > $print_max);
|
||||||
@@ -5489,7 +5489,7 @@ sub updatest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $return = &backticks($baseagent, '/dev/null', undef,
|
my $return = &backticks($baseagent, '/dev/null', undef,
|
||||||
($rt_id) ? "$rturl/${rt_id}.json" : $update,
|
($rt_id) ? "$reblogurl/${rt_id}.json" : $update,
|
||||||
$i, 0, @wend);
|
$i, 0, @wend);
|
||||||
print $stdout "-- return --\n$return\n-- return --\n"
|
print $stdout "-- return --\n$return\n-- return --\n"
|
||||||
if ($superverbose);
|
if ($superverbose);
|
||||||
@@ -5659,22 +5659,22 @@ sub graburl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# format a tweet based on user options
|
# format a tweet based on user options
|
||||||
sub standardtweet {
|
sub standardpost {
|
||||||
my $ref = shift;
|
my $ref = shift;
|
||||||
my $nocolour = shift;
|
my $nocolour = shift;
|
||||||
|
|
||||||
my $sn = &descape($ref->{'user'}->{'screen_name'});
|
my $sn = &descape($ref->{'user'}->{'screen_name'});
|
||||||
my $tweet = &descape($ref->{'text'});
|
my $post = &descape($ref->{'text'});
|
||||||
|
|
||||||
# Debug boost display
|
# Debug boost display
|
||||||
if (exists($ref->{'boost_attribution'}) && $ref->{'boost_attribution'}) {
|
if (exists($ref->{'boost_attribution'}) && $ref->{'boost_attribution'}) {
|
||||||
print $stdout "-- DEBUG: standardtweet - user: '$sn', text: '$tweet', boost_attribution: '" . $ref->{'boost_attribution'} . "'\n" if ($verbose);
|
print $stdout "-- DEBUG: standardpost - user: '$sn', text: '$post', boost_attribution: '" . $ref->{'boost_attribution'} . "'\n" if ($verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add boost attribution if this is a boosted post
|
# Add boost attribution if this is a boosted post
|
||||||
if (exists($ref->{'boost_attribution'}) && $ref->{'boost_attribution'}) {
|
if (exists($ref->{'boost_attribution'}) && $ref->{'boost_attribution'}) {
|
||||||
my $booster = &descape($ref->{'boost_attribution'});
|
my $booster = &descape($ref->{'boost_attribution'});
|
||||||
$tweet = "[boosted $booster] $tweet";
|
$post = "[boosted $booster] $post";
|
||||||
}
|
}
|
||||||
my $colour;
|
my $colour;
|
||||||
my $g;
|
my $g;
|
||||||
@@ -5683,7 +5683,7 @@ sub standardtweet {
|
|||||||
# wordwrap really ruins our day here, thanks a lot, @augmentedfourth
|
# wordwrap really ruins our day here, thanks a lot, @augmentedfourth
|
||||||
# have to insinuate the ansi sequences after the string is wordwrapped
|
# have to insinuate the ansi sequences after the string is wordwrapped
|
||||||
|
|
||||||
$g = $colour = ${'CC' . scalar(&$tweettype($ref, $sn, $tweet)) }
|
$g = $colour = ${'CC' . scalar(&$posttype($ref, $sn, $tweet)) }
|
||||||
unless ($nocolour);
|
unless ($nocolour);
|
||||||
$colour = $OFF . $colour
|
$colour = $OFF . $colour
|
||||||
unless ($nocolour);
|
unless ($nocolour);
|
||||||
@@ -5696,36 +5696,36 @@ sub standardtweet {
|
|||||||
$ref->{'geo'}->{'coordinates'}->[1] ne 'undef' &&
|
$ref->{'geo'}->{'coordinates'}->[1] ne 'undef' &&
|
||||||
length($ref->{'geo'}->{'coordinates'}->[0])) ||
|
length($ref->{'geo'}->{'coordinates'}->[0])) ||
|
||||||
length($ref->{'place'}->{'id'})));
|
length($ref->{'place'}->{'id'})));
|
||||||
$sn = "%$sn" if (length($ref->{'retweeted_status'}->{'id_str'}));
|
$sn = "%$sn" if (length($ref->{'reblog'}->{'id_str'}));
|
||||||
$sn = "*$sn" if ($ref->{'source'} =~ /TTYverse/ && $ttytteristas);
|
$sn = "*$sn" if ($ref->{'source'} =~ /TTYverse/ && $ttytteristas);
|
||||||
# prepend list information, if this tweet originated from a list
|
# prepend list information, if this tweet originated from a list
|
||||||
$sn = "($ref->{'tag'}->{'payload'})$sn"
|
$sn = "($ref->{'tag'}->{'payload'})$sn"
|
||||||
if (length($ref->{'tag'}->{'payload'}) &&
|
if (length($ref->{'tag'}->{'payload'}) &&
|
||||||
$ref->{'tag'}->{'type'} eq 'list');
|
$ref->{'tag'}->{'type'} eq 'list');
|
||||||
$tweet = "<$sn> $tweet";
|
$post = "<$sn> $post";
|
||||||
# twitter doesn't always do this right.
|
# twitter doesn't always do this right.
|
||||||
$h = $ref->{'retweet_count'}; $h += 0; #$h = "${h}+" if ($h >= 100);
|
$h = $ref->{'reblogs_count'}; $h += 0; #$h = "${h}+" if ($h >= 100);
|
||||||
# twitter doesn't always handle single retweets right. good f'n grief.
|
# twitter doesn't always handle single retweets right. good f'n grief.
|
||||||
$tweet = "(x${h}) $tweet" if ($h > 1 && !$nonewrts);
|
$post = "(x${h}) $post" if ($h > 1 && !$noreblogs);
|
||||||
# br3nda's modified timestamp patch
|
# br3nda's modified timestamp patch
|
||||||
if ($timestamp) {
|
if ($timestamp) {
|
||||||
my ($time, $ts) = &$wraptime($ref->{'created_at'});
|
my ($time, $ts) = &$wraptime($ref->{'created_at'});
|
||||||
$tweet = "[$ts] $tweet";
|
$post = "[$ts] $post";
|
||||||
}
|
}
|
||||||
|
|
||||||
# pull it all together
|
# pull it all together
|
||||||
$tweet = &wwrap($tweet, ($wrapseq <= 1) ? ((&$prompt(1))[1]) : 0)
|
$post = &wwrap($post, ($wrapseq <= 1) ? ((&$prompt(1))[1]) : 0)
|
||||||
if ($wrap); # remember to account for prompt length on #1
|
if ($wrap); # remember to account for prompt length on #1
|
||||||
$tweet =~ s/^([^<]*)<([^>]+)>/${g}\1<${EM}\2${colour}>/
|
$post =~ s/^([^<]*)<([^>]+)>/${g}\1<${EM}\2${colour}>/
|
||||||
unless ($nocolour);
|
unless ($nocolour);
|
||||||
$tweet =~ s/\n*$//;
|
$post =~ s/\n*$//;
|
||||||
$tweet .= ($nocolour) ? "\n" : "$OFF\n";
|
$post .= ($nocolour) ? "\n" : "$OFF\n";
|
||||||
|
|
||||||
# highlight anything that we have in track
|
# highlight anything that we have in track
|
||||||
if(scalar(@tracktags)) { # I'm paranoid
|
if(scalar(@tracktags)) { # I'm paranoid
|
||||||
foreach $h (@tracktags) {
|
foreach $h (@tracktags) {
|
||||||
$h =~ s/^"//; $h =~ s/"$//; # just in case
|
$h =~ s/^"//; $h =~ s/"$//; # just in case
|
||||||
$tweet =~ s/(^|[^a-zA-Z0-9])($h)([^a-zA-Z0-9]|$)/\1${EM}\2${colour}\3/ig
|
$post =~ s/(^|[^a-zA-Z0-9])($h)([^a-zA-Z0-9]|$)/\1${EM}\2${colour}\3/ig
|
||||||
unless ($nocolour);
|
unless ($nocolour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5733,15 +5733,15 @@ $tweet =~ s/(^|[^a-zA-Z0-9])($h)([^a-zA-Z0-9]|$)/\1${EM}\2${colour}\3/ig
|
|||||||
# smb's underline/bold patch goes on last (modified for lists)
|
# smb's underline/bold patch goes on last (modified for lists)
|
||||||
unless ($nocolour) {
|
unless ($nocolour) {
|
||||||
# only do this after the < > portion.
|
# only do this after the < > portion.
|
||||||
my $k = index($tweet, ">");
|
my $k = index($post, ">");
|
||||||
my $botsub = substr($tweet, $k);
|
my $botsub = substr($post, $k);
|
||||||
my $topsub = substr($tweet, 0, $k);
|
my $topsub = substr($post, 0, $k);
|
||||||
$botsub =~
|
$botsub =~
|
||||||
s/(^|[^a-zA-Z0-9_])\@([a-zA-Z0-9_\/]+)/\1\@${UNDER}\2${colour}/g;
|
s/(^|[^a-zA-Z0-9_])\@([a-zA-Z0-9_\/]+)/\1\@${UNDER}\2${colour}/g;
|
||||||
$tweet = $topsub . $botsub;
|
$post = $topsub . $botsub;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tweet;
|
return $post;
|
||||||
}
|
}
|
||||||
|
|
||||||
# format a DM based on standard user options
|
# format a DM based on standard user options
|
||||||
@@ -6079,8 +6079,8 @@ sub multiprepost {
|
|||||||
sub multipostpost {
|
sub multipostpost {
|
||||||
&multi_module_dispatch(\&defaultpostpost, \@m_postpost, 0, @_);
|
&multi_module_dispatch(\&defaultpostpost, \@m_postpost, 0, @_);
|
||||||
}
|
}
|
||||||
sub multitweettype {
|
sub multiposttype {
|
||||||
&multi_module_dispatch(\&defaulttweettype, \@m_tweettype, sub {
|
&multi_module_dispatch(\&defaultposttype, \@m_posttype, sub {
|
||||||
# if this module DID NOT call default, exit now.
|
# if this module DID NOT call default, exit now.
|
||||||
return (!$this_call_default);
|
return (!$this_call_default);
|
||||||
}, @_);
|
}, @_);
|
||||||
@@ -6120,18 +6120,18 @@ sub defaultlisthandle {
|
|||||||
}
|
}
|
||||||
sub defaulthandle {
|
sub defaulthandle {
|
||||||
(&flag_default_call, return) if ($multi_module_context);
|
(&flag_default_call, return) if ($multi_module_context);
|
||||||
my $tweet_ref = shift;
|
my $post_ref = shift;
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $dclass = ($verbose) ? "{$class,$tweet_ref->{'id_str'}} " : '';
|
my $dclass = ($verbose) ? "{$class,$post_ref->{'id_str'}} " : '';
|
||||||
my $sn = &descape($tweet_ref->{'user'}->{'screen_name'});
|
my $sn = &descape($post_ref->{'user'}->{'screen_name'});
|
||||||
my $tweet = &descape($tweet_ref->{'text'});
|
my $post = &descape($post_ref->{'text'});
|
||||||
|
|
||||||
# Debug: Check what data defaulthandle receives for boost posts
|
# Debug: Check what data defaulthandle receives for boost posts
|
||||||
if (exists($tweet_ref->{'boost_attribution'}) && $tweet_ref->{'boost_attribution'}) {
|
if (exists($post_ref->{'boost_attribution'}) && $post_ref->{'boost_attribution'}) {
|
||||||
print $stdout "-- DEBUG: defaulthandle received boost - user: '$sn', text: '$tweet', boost_attribution: '" . $tweet_ref->{'boost_attribution'} . "'\n" if ($verbose);
|
print $stdout "-- DEBUG: defaulthandle received boost - user: '$sn', text: '$post', boost_attribution: '" . $post_ref->{'boost_attribution'} . "'\n" if ($verbose);
|
||||||
}
|
}
|
||||||
my $stweet = &standardtweet($tweet_ref);
|
my $spost = &standardpost($post_ref);
|
||||||
my $menu_select = $tweet_ref->{'menu_select'};
|
my $menu_select = $post_ref->{'menu_select'};
|
||||||
|
|
||||||
$menu_select = (length($menu_select) && !$script)
|
$menu_select = (length($menu_select) && !$script)
|
||||||
? (($menu_select =~ /^z/) ?
|
? (($menu_select =~ /^z/) ?
|
||||||
@@ -6139,8 +6139,8 @@ sub defaulthandle {
|
|||||||
"${menu_select}> ")
|
"${menu_select}> ")
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
print $streamout $menu_select . $dclass . $stweet;
|
print $streamout $menu_select . $dclass . $spost;
|
||||||
&sendnotifies($tweet_ref, $class);
|
&sendnotifies($post_ref, $class);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
sub defaultuserhandle {
|
sub defaultuserhandle {
|
||||||
@@ -6171,33 +6171,33 @@ EOF
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sub sendnotifies { # this is a default subroutine of a sort, right?
|
sub sendnotifies { # this is a default subroutine of a sort, right?
|
||||||
my $tweet_ref = shift;
|
my $post_ref = shift;
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
|
|
||||||
my $sn = &descape($tweet_ref->{'user'}->{'screen_name'});
|
my $sn = &descape($post_ref->{'user'}->{'screen_name'});
|
||||||
my $tweet = &descape($tweet_ref->{'text'});
|
my $post = &descape($post_ref->{'text'});
|
||||||
|
|
||||||
# interactive? first time?
|
# interactive? first time?
|
||||||
unless (length($class) || !$last_id || !length($tweet)) {
|
unless (length($class) || !$last_id || !length($tweet)) {
|
||||||
$class = scalar(&$tweettype($tweet_ref, $sn, $tweet));
|
$class = scalar(&$posttype($post_ref, $sn, $tweet));
|
||||||
¬ifytype_dispatch($class,
|
¬ifytype_dispatch($class,
|
||||||
&standardtweet($tweet_ref, 1), $tweet_ref)
|
&standardpost($post_ref, 1), $post_ref)
|
||||||
if ($notify_list{$class});
|
if ($notify_list{$class});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub defaulttweettype {
|
sub defaultposttype {
|
||||||
(&flag_default_call, return) if ($multi_module_context);
|
(&flag_default_call, return) if ($multi_module_context);
|
||||||
my $ref = shift;
|
my $ref = shift;
|
||||||
my $sn = shift;
|
my $sn = shift;
|
||||||
my $tweet = shift;
|
my $post = shift;
|
||||||
|
|
||||||
# br3nda's and smb's modified colour patch
|
# br3nda's and smb's modified colour patch
|
||||||
unless ($anonymous) {
|
unless ($anonymous) {
|
||||||
if (lc($sn) eq $whoami) {
|
if (lc($sn) eq $whoami) {
|
||||||
# if it's me speaking, colour the line yellow
|
# if it's me speaking, colour the line yellow
|
||||||
return 'me';
|
return 'me';
|
||||||
} elsif ($tweet =~ /\@$whoami(\b|$)/i) {
|
} elsif ($post =~ /\@$whoami(\b|$)/i) {
|
||||||
# if I'm in the tweet, colour red
|
# if I'm in the tweet, colour red
|
||||||
return 'reply';
|
return 'reply';
|
||||||
}
|
}
|
||||||
@@ -6422,7 +6422,7 @@ sub notifier_libnotify {
|
|||||||
# this is the central routine that takes a rolling tweet code, figures
|
# this is the central routine that takes a rolling tweet code, figures
|
||||||
# out where that tweet is, and returns something approximating a tweet
|
# out where that tweet is, and returns something approximating a tweet
|
||||||
# structure (or the actual tweet structure itself if it can).
|
# structure (or the actual tweet structure itself if it can).
|
||||||
sub get_tweet {
|
sub get_post {
|
||||||
my $code = lc(shift);
|
my $code = lc(shift);
|
||||||
|
|
||||||
#TODO
|
#TODO
|
||||||
@@ -6458,7 +6458,7 @@ sub get_tweet {
|
|||||||
$k =~ s/\s+$//; # remove trailing spaces
|
$k =~ s/\s+$//; # remove trailing spaces
|
||||||
print $stdout "-- background store fetch: $k\n" if ($verbose);
|
print $stdout "-- background store fetch: $k\n" if ($verbose);
|
||||||
($w->{'menu_select'}, $w->{'id_str'}, $w->{'in_reply_to_status_id_str'},
|
($w->{'menu_select'}, $w->{'id_str'}, $w->{'in_reply_to_status_id_str'},
|
||||||
$w->{'retweeted_status'}->{'id_str'},
|
$w->{'reblog'}->{'id_str'},
|
||||||
$w->{'user'}->{'geo_enabled'},
|
$w->{'user'}->{'geo_enabled'},
|
||||||
$w->{'geo'}->{'coordinates'}->[0],
|
$w->{'geo'}->{'coordinates'}->[0],
|
||||||
$w->{'geo'}->{'coordinates'}->[1],
|
$w->{'geo'}->{'coordinates'}->[1],
|
||||||
@@ -6468,7 +6468,7 @@ sub get_tweet {
|
|||||||
$w->{'place'}->{'full_name'},
|
$w->{'place'}->{'full_name'},
|
||||||
$w->{'tag'}->{'type'},
|
$w->{'tag'}->{'type'},
|
||||||
$w->{'tag'}->{'payload'},
|
$w->{'tag'}->{'payload'},
|
||||||
$w->{'retweet_count'},
|
$w->{'reblogs_count'},
|
||||||
$w->{'user'}->{'screen_name'}, $w->{'created_at'},
|
$w->{'user'}->{'screen_name'}, $w->{'created_at'},
|
||||||
$l) = split(/\s/, $k, 17);
|
$l) = split(/\s/, $k, 17);
|
||||||
($w->{'source'}, $k) = split(/\|/, $l, 2);
|
($w->{'source'}, $k) = split(/\|/, $l, 2);
|
||||||
@@ -6490,12 +6490,12 @@ sub get_dm {
|
|||||||
my $w = {'sender' => {}};
|
my $w = {'sender' => {}};
|
||||||
return undef if (length($code) < 3 || $code !~ s/^d//);
|
return undef if (length($code) < 3 || $code !~ s/^d//);
|
||||||
|
|
||||||
# Handle foreground/background like get_tweet does
|
# Handle foreground/background like get_post does
|
||||||
if ($is_background) {
|
if ($is_background) {
|
||||||
return $dm_store_hash{$code};
|
return $dm_store_hash{$code};
|
||||||
}
|
}
|
||||||
|
|
||||||
# this is the aforementioned "similar code" (see get_tweet).
|
# this is the aforementioned "similar code" (see get_post).
|
||||||
# optimization: I doubt ANY of us can get DMIDs less than 9.
|
# optimization: I doubt ANY of us can get DMIDs less than 9.
|
||||||
return &grabjson("${dmidurl}?id=$code", 0, 0, 0, undef, 1)
|
return &grabjson("${dmidurl}?id=$code", 0, 0, 0, undef, 1)
|
||||||
if ($code =~ /^[0-9]+$/ && (0+$code > 9));
|
if ($code =~ /^[0-9]+$/ && (0+$code > 9));
|
||||||
@@ -6639,7 +6639,7 @@ sub setvariable {
|
|||||||
# handle special values
|
# handle special values
|
||||||
&generate_ansi if ($key eq 'ansi' ||
|
&generate_ansi if ($key eq 'ansi' ||
|
||||||
$key =~ /^colour/);
|
$key =~ /^colour/);
|
||||||
&generate_shortdomain if ($key eq 'shorturl');
|
&generate_shortdomain if ($key eq 'shoreblogurl');
|
||||||
&tracktags_makearray if ($key eq 'track');
|
&tracktags_makearray if ($key eq 'track');
|
||||||
&filter_compile if ($key eq 'filter');
|
&filter_compile if ($key eq 'filter');
|
||||||
¬ify_compile if ($key eq 'notifies');
|
¬ify_compile if ($key eq 'notifies');
|
||||||
@@ -6735,19 +6735,19 @@ sub generate_shortdomain {
|
|||||||
my $x;
|
my $x;
|
||||||
my $y;
|
my $y;
|
||||||
|
|
||||||
undef $shorturldomain;
|
undef $shoreblogurldomain;
|
||||||
($shorturl =~ m#^http://([^/]+)/#) && ($x = $1);
|
($shoreblogurl =~ m#^http://([^/]+)/#) && ($x = $1);
|
||||||
# chop off any leading hostname stuff (like api., etc.)
|
# chop off any leading hostname stuff (like api., etc.)
|
||||||
while(1) {
|
while(1) {
|
||||||
$y = $x;
|
$y = $x;
|
||||||
$x =~ s/^[^\.]*\.//;
|
$x =~ s/^[^\.]*\.//;
|
||||||
if ($x !~ /\./) { # a cut too far
|
if ($x !~ /\./) { # a cut too far
|
||||||
$shorturldomain = "http://$y/";
|
$shoreblogurldomain = "http://$y/";
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print $stdout "-- warning: couldn't parse shortener service\n"
|
print $stdout "-- warning: couldn't parse shortener service\n"
|
||||||
if (!length($shorturldomain));
|
if (!length($shoreblogurldomain));
|
||||||
}
|
}
|
||||||
|
|
||||||
sub openurl {
|
sub openurl {
|
||||||
@@ -6768,9 +6768,9 @@ sub urlshorten {
|
|||||||
|
|
||||||
$url = "http://gopher.floodgap.com/gopher/gw?".&url_oauth_sub($url)
|
$url = "http://gopher.floodgap.com/gopher/gw?".&url_oauth_sub($url)
|
||||||
if ($url =~ m#^gopher://#);
|
if ($url =~ m#^gopher://#);
|
||||||
return $url if ($url =~ /^$shorturldomain/i); # stop loops
|
return $url if ($url =~ /^$shoreblogurldomain/i); # stop loops
|
||||||
$url = &url_oauth_sub($url);
|
$url = &url_oauth_sub($url);
|
||||||
$cl = "$simple_agent \"${shorturl}$url\"";
|
$cl = "$simple_agent \"${shoreblogurl}$url\"";
|
||||||
print $stdout "$cl\n" if ($superverbose);
|
print $stdout "$cl\n" if ($superverbose);
|
||||||
chomp($rc = `$cl`);
|
chomp($rc = `$cl`);
|
||||||
return ($urlshort = (($rc =~ m#^http://#) ? $rc : undef));
|
return ($urlshort = (($rc =~ m#^http://#) ? $rc : undef));
|
||||||
@@ -7527,7 +7527,7 @@ sub destroy_all_tco {
|
|||||||
# - if the calling function has specified a tag, tag the tweets, since
|
# - if the calling function has specified a tag, tag the tweets, since
|
||||||
# we're iterating through them anyway. the tag should be a hashref payload.
|
# we're iterating through them anyway. the tag should be a hashref payload.
|
||||||
# - if the tweet is an newRT, unwrap it so that the full tweet text is
|
# - if the tweet is an newRT, unwrap it so that the full tweet text is
|
||||||
# revealed (unless -nonewrts).
|
# revealed (unless -noreblogs).
|
||||||
# - if this appears to be a tweet, put in a stub geo hash if one does
|
# - if this appears to be a tweet, put in a stub geo hash if one does
|
||||||
# not yet exist.
|
# not yet exist.
|
||||||
# - if coordinates are flat string 'null', turn into a real null.
|
# - if coordinates are flat string 'null', turn into a real null.
|
||||||
@@ -7587,16 +7587,16 @@ sub normalizejson {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# normalize newRTs
|
# normalize newRTs
|
||||||
# if we get newRTs with -nonewrts, oh well
|
# if we get newRTs with -noreblogs, oh well
|
||||||
my $boost_content = '';
|
my $boost_content = '';
|
||||||
my $boost_attribution = '';
|
my $boost_attribution = '';
|
||||||
my $boost_user = undef;
|
my $boost_user = undef;
|
||||||
|
|
||||||
if (!$nonewrts && ($rt = $i->{'retweeted_status'})) {
|
if (!$noreblogs && ($rt = $i->{'reblog'})) {
|
||||||
# reconstruct the boost in fediverse format: <author> [boosted <booster@domain>] content
|
# reconstruct the boost in fediverse format: <author> [boosted <booster@domain>] content
|
||||||
# without truncation, but detco it first
|
# without truncation, but detco it first
|
||||||
$rt = &destroy_all_tco($rt);
|
$rt = &destroy_all_tco($rt);
|
||||||
$i->{'retweeted_status'} = $rt;
|
$i->{'reblog'} = $rt;
|
||||||
|
|
||||||
# Get original author and content
|
# Get original author and content
|
||||||
my $original_author = $rt->{'user'}->{'screen_name'} || 'unknown_user';
|
my $original_author = $rt->{'user'}->{'screen_name'} || 'unknown_user';
|
||||||
@@ -7844,8 +7844,7 @@ sub map_single_status {
|
|||||||
$status->{'text'} = &html_to_text($status->{'content'});
|
$status->{'text'} = &html_to_text($status->{'content'});
|
||||||
}
|
}
|
||||||
$status->{'user'} = $status->{'account'} if exists($status->{'account'});
|
$status->{'user'} = $status->{'account'} if exists($status->{'account'});
|
||||||
$status->{'retweeted_status'} = $status->{'reblog'} if exists($status->{'reblog'});
|
# reblog and reblogs_count fields are already in correct format for ActivityPub
|
||||||
$status->{'retweet_count'} = $status->{'reblogs_count'} if exists($status->{'reblogs_count'});
|
|
||||||
$status->{'favorite_count'} = $status->{'favourites_count'} if exists($status->{'favourites_count'});
|
$status->{'favorite_count'} = $status->{'favourites_count'} if exists($status->{'favourites_count'});
|
||||||
$status->{'in_reply_to_status_id_str'} = $status->{'in_reply_to_id'} if exists($status->{'in_reply_to_id'});
|
$status->{'in_reply_to_status_id_str'} = $status->{'in_reply_to_id'} if exists($status->{'in_reply_to_id'});
|
||||||
|
|
||||||
@@ -7859,9 +7858,9 @@ sub map_single_status {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Recursively map reblogged status - with depth limit to prevent infinite recursion
|
# Recursively map reblogged status - with depth limit to prevent infinite recursion
|
||||||
if (exists($status->{'retweeted_status'})) {
|
if (exists($status->{'reblog'})) {
|
||||||
print $stdout "-- DEBUG: Processing reblogged status recursively (depth: $recursion_depth)\n" if ($verbose);
|
print $stdout "-- DEBUG: Processing reblogged status recursively (depth: $recursion_depth)\n" if ($verbose);
|
||||||
$status->{'retweeted_status'} = &map_single_status($status->{'retweeted_status'}, $recursion_depth + 1);
|
$status->{'reblog'} = &map_single_status($status->{'reblog'}, $recursion_depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
|
|||||||
Reference in New Issue
Block a user