From 872c0dac93041ddc23e1275e009256de23e2ce48 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 27 Jul 2025 23:49:23 -0400 Subject: [PATCH] More cleanup. Now pretty much done, for real this time. --- ttyverse.pl | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ttyverse.pl b/ttyverse.pl index 6410aab..beccb64 100755 --- a/ttyverse.pl +++ b/ttyverse.pl @@ -8,7 +8,7 @@ # Original TTYtter (c)2007-2012 Cameron Kaiser (and contributors) # Original source: http://www.floodgap.com/software/ttytter/ # -# Fediverse modifications and migration from fediverse to Mastodon/ActivityPub +# Fediverse modifications and migration from Twitter to Mastodon/ActivityPub/fediverse # This derivative work distributed under the Floodgap Free Software License # http://www.floodgap.com/software/ffsl/ # @@ -1121,11 +1121,6 @@ $BEL = pack("C", 7); # to force unambiguous bareword interpretation $true = 'true'; -sub true { return 'true'; } -$false = 'false'; -sub false { return 'false'; } -$null = undef; -sub null { return undef; } select($stdout); $|++; @@ -1639,7 +1634,7 @@ for(;;) { } if ($rv || &is_fail_whale($data) || &is_json_error($data)) { if (&is_fail_whale($data)) { - print "FAILED -- Fail Whale detected\n"; + print $stdout "FAILED -- Fail Whale detected\n"; } elsif ($x = &is_json_error($data)) { print "FAILED!\n*** server reports: \"$x\"\n"; print "check your password or configuration.\n"; @@ -2940,7 +2935,7 @@ EOF # Look up account ID for the username my $account_id = &lookup_account_id($uname); if (!$account_id) { - print $stdout "-- ERROR: Could not find account for user: $uname\n"; + &report_account_not_found($uname, 1); return 0; } @@ -2963,7 +2958,7 @@ EOF # Look up account ID for the username my $account_id = &lookup_account_id($uname); if (!$account_id) { - print $stdout "-- ERROR: Could not find account for user: $uname\n"; + &report_account_not_found($uname, 1); return 0; } @@ -3129,7 +3124,7 @@ EOF # Look up account ID for the username my $account_id = &lookup_account_id($who); if (!$account_id) { - print $stdout "-- ERROR: Could not find account for user: $who\n"; + &report_account_not_found($who, 1); return 0; } @@ -6382,7 +6377,7 @@ sub foruuser { # Look up account ID for the username my $account_id = &lookup_account_id($uname); if (!$account_id) { - print $stdout "-- ERROR: Could not find account for user: $uname\n" if ($interactive); + &report_account_not_found($uname, $interactive); return 1; } @@ -6403,7 +6398,7 @@ sub boruuser { # Look up account ID for the username my $account_id = &lookup_account_id($uname); if (!$account_id) { - print $stdout "-- ERROR: Could not find account for user: $uname\n" if ($interactive); + &report_account_not_found($uname, $interactive); return 1; } @@ -6425,7 +6420,7 @@ sub rtsonoffuser { # Look up account ID for the username my $account_id = &lookup_account_id($uname); if (!$account_id) { - print $stdout "-- ERROR: Could not find account for user: $uname\n" if ($interactive); + &report_account_not_found($uname, $interactive); return 1; } @@ -7336,6 +7331,13 @@ sub lookup_list_id { return undef; } +# Helper function for consistent error reporting +sub report_account_not_found { + my ($username, $interactive) = @_; + return unless ($interactive || $verbose); + print $stdout "-- ERROR: Could not find account for user: $username\n"; +} + sub defaulteventhandle { (&flag_default_call, return) if ($multi_module_context); my $event_ref = shift;