Add favorite and boost counts to metadata line if they are greater than 0.
This commit is contained in:
+50
-13
@@ -1407,6 +1407,7 @@ $dmmarkread = 1 if (!defined $dmmarkread); # Default to enabled
|
||||
$notificationpause = 6 if (!defined $notificationpause); # NOT ||= ... zero is a VALID value!
|
||||
$notificationpause = 0 if ($anonymous);
|
||||
$notificationpause = 0 if ($pause eq '0');
|
||||
$notifies ||= 'boost,favourite,favorite'; # Default notification types for sound alerts (both spellings)
|
||||
$ansi = ($noansi) ? 0 :
|
||||
(($ansi || $ENV{'TERM'} eq 'ansi' || $ENV{'TERM'} eq 'xterm-color')
|
||||
? 1 : 0);
|
||||
@@ -6492,7 +6493,7 @@ sub notifications_tdisplay {
|
||||
my $sound_class = $type;
|
||||
$sound_class = 'mention' if ($type eq 'mention');
|
||||
$sound_class = 'boost' if ($type eq 'reblog');
|
||||
$sound_class = 'favourite' if ($type eq 'favourite');
|
||||
$sound_class = 'favourite' if ($type eq 'favourite' || $type eq 'favorite');
|
||||
$sound_class = 'follow' if ($type eq 'follow');
|
||||
|
||||
# Process as individual post with proper class
|
||||
@@ -7025,10 +7026,11 @@ sub notificationrefresh {
|
||||
my $sound_class = $type;
|
||||
$sound_class = 'mention' if ($type eq 'mention');
|
||||
$sound_class = 'boost' if ($type eq 'reblog');
|
||||
$sound_class = 'favourite' if ($type eq 'favourite');
|
||||
$sound_class = 'favourite' if ($type eq 'favourite' || $type eq 'favorite');
|
||||
$sound_class = 'follow' if ($type eq 'follow');
|
||||
|
||||
print $stdout "-- DEBUG: Processing notification type '$type' as sound class '$sound_class'\n" if ($verbose);
|
||||
# Always debug notification types to help troubleshoot
|
||||
print $stdout "-- DEBUG: Received notification type='$type', mapped to sound_class='$sound_class'\n" if ($verbose || $type eq 'favourite');
|
||||
|
||||
# Use existing notification display handler
|
||||
if ($notification_display_only) {
|
||||
@@ -7144,12 +7146,21 @@ sub cordfav {
|
||||
my $text = shift;
|
||||
my $verb = shift;
|
||||
|
||||
my ($en, $em) = ¢ral_cd_dispatch("id=$id", $interactive, $basefav);
|
||||
print $stdout "-- favourite $verb for post id #${id}: \"$text\"\n"
|
||||
if ($interactive && !$en);
|
||||
print $stdout "*** (was the favourite already ${verb}?)\n"
|
||||
if ($interactive && $en);
|
||||
return 0;
|
||||
# Substitute the post ID into the URL template
|
||||
my $fav_url = $basefav;
|
||||
$fav_url =~ s/%I/$id/;
|
||||
|
||||
print $stdout "-- DEBUG: cordfav called with id=$id, url=$fav_url\n" if ($verbose);
|
||||
my ($en, $em) = ¢ral_cd_dispatch("id=$id", $interactive, $fav_url);
|
||||
print $stdout "-- DEBUG: central_cd_dispatch returned en=$en, em=$em\n" if ($verbose);
|
||||
if ($interactive) {
|
||||
if (!$en) {
|
||||
print $stdout "-- favourite $verb for post id #${id}: \"$text\"\n";
|
||||
} else {
|
||||
print $stdout "*** (was the favourite already ${verb}?)\n";
|
||||
}
|
||||
}
|
||||
return $en;
|
||||
}
|
||||
|
||||
# follow or unfollow a user
|
||||
@@ -7399,10 +7410,27 @@ sub standardpost {
|
||||
$info_line .= " [$cw_text]";
|
||||
}
|
||||
|
||||
# fediverse doesn't always do this right.
|
||||
$h = $ref->{'reblogs_count'}; $h += 0; #$h = "${h}+" if ($h >= 100);
|
||||
# fediverse doesn't always handle single reposts right. good f'n grief.
|
||||
$info_line = "(x${h}) $info_line" if ($h > 1 && !$noreblogs);
|
||||
# Add engagement stats (boosts and favorites) when > 0
|
||||
my $engagement_stats = '';
|
||||
my $boost_count = $ref->{'reblogs_count'} || 0;
|
||||
my $fav_count = $ref->{'favorite_count'} || $ref->{'favourites_count'} || 0;
|
||||
|
||||
$boost_count += 0; # normalize to number
|
||||
$fav_count += 0; # normalize to number
|
||||
|
||||
# Debug engagement counts
|
||||
if ($verbose && ($boost_count > 0 || $fav_count > 0)) {
|
||||
print $stdout "-- DEBUG: Engagement - boost_count=$boost_count, fav_count=$fav_count\n";
|
||||
print $stdout "-- DEBUG: Fields - reblogs_count='" . ($ref->{'reblogs_count'} || 'undef') . "', favorite_count='" . ($ref->{'favorite_count'} || 'undef') . "', favourites_count='" . ($ref->{'favourites_count'} || 'undef') . "'\n";
|
||||
}
|
||||
|
||||
# Build engagement stats for later use
|
||||
if ($boost_count > 0 && !$noreblogs) {
|
||||
$engagement_stats .= "boosts: ${boost_count}";
|
||||
}
|
||||
if ($fav_count > 0) {
|
||||
$engagement_stats .= ($engagement_stats ? ", favorites: ${fav_count}" : "favorites: ${fav_count}");
|
||||
}
|
||||
|
||||
# br3nda's modified timestamp patch (absolute timestamp)
|
||||
if ($timestamp) {
|
||||
@@ -7410,6 +7438,9 @@ sub standardpost {
|
||||
$info_line = "[$ts] $info_line";
|
||||
}
|
||||
|
||||
# Add engagement stats at the end of the info line
|
||||
$info_line .= " ($engagement_stats)" if ($engagement_stats);
|
||||
|
||||
# Combine info line + content with newline separation
|
||||
$post = $info_line . "\n" . $post;
|
||||
|
||||
@@ -8032,6 +8063,12 @@ sub sendnotifies { # this is a default subroutine of a sort, right?
|
||||
my $notify_enabled = $notify_list{$class} ? 'YES' : 'NO';
|
||||
print $stdout "-- DEBUG: notify_list{$class} = $notify_enabled\n" if ($verbose);
|
||||
|
||||
# Special debug for favorite notifications
|
||||
if ($class eq 'favourite' || $class eq 'favorite') {
|
||||
print $stdout "-- DEBUG: FAVORITE NOTIFICATION - class='$class', enabled=$notify_enabled, initial_load=$initial_load_in_progress\n";
|
||||
print $stdout "-- DEBUG: notify_list keys: " . join(',', keys %notify_list) . "\n";
|
||||
}
|
||||
|
||||
# Send notification if we have a valid class, it's enabled, AND initial load is complete
|
||||
if (length($class) && $notify_list{$class} && !$initial_load_in_progress) {
|
||||
print $stdout "-- DEBUG: Calling notifytype_dispatch for class='$class'\n" if ($verbose);
|
||||
|
||||
Reference in New Issue
Block a user