diff --git a/ttyverse.pl b/ttyverse.pl index a368852..a9c6ad4 100755 --- a/ttyverse.pl +++ b/ttyverse.pl @@ -6615,19 +6615,23 @@ sub dmrefresh { my $last_status_id = $j->{'last_status'}->{'id'} || $j->{'last_status'}->{'id_str'}; my $tracking_key = "${conversation_id}:${last_status_id}"; - print $stdout "-- DEBUG: DM #$i unread flag: " . ($is_unread ? "true" : "false") . ", tracking_key: $tracking_key\n" if ($verbose); + print $stdout "-- DEBUG: DM #$i unread flag: " . ($is_unread ? "true" : "false") . ", tracking_key: $tracking_key, dm_first_time: " . ($dm_first_time ? "true" : "false") . "\n" if ($verbose); - # Check if we've already seen this exact conversation+status combination - if ($dm_seen_status{$tracking_key}) { - print $stdout "-- DEBUG: Skipping DM #$i - already seen locally (key: $tracking_key)\n" if ($verbose); - next; - } - - # For servers that support unread flag, also check that - # But skip this check during first-time initialization to ensure DMs are shown - if (!$is_unread && !$dm_seen_status{$tracking_key} && !$dm_first_time) { - print $stdout "-- DEBUG: Skipping DM #$i - already read (unread=false)\n" if ($verbose); - next; + # During first-time initialization, show the most recent DMs regardless of seen status + if (!$dm_first_time) { + # Check if we've already seen this exact conversation+status combination + if ($dm_seen_status{$tracking_key}) { + print $stdout "-- DEBUG: Skipping DM #$i - already seen locally (key: $tracking_key)\n" if ($verbose); + next; + } + + # For servers that support unread flag, also check that + if (!$is_unread) { + print $stdout "-- DEBUG: Skipping DM #$i - already read (unread=false)\n" if ($verbose); + next; + } + } else { + print $stdout "-- DEBUG: First-time initialization - showing DM #$i regardless of seen/unread status\n" if ($verbose); } # Only play sound for the first unread conversation to avoid spam @@ -7632,7 +7636,7 @@ sub standarddm { my ($time, $ts) = &$wraptime($ref->{'last_status'}->{'created_at'}); my $text = &descape(&html_to_text($ref->{'last_status'}->{'content'})); - my $sns = &descape($ref->{'last_status'}->{'account'}->{'username'} || $ref->{'last_status'}->{'account'}->{'acct'}); + my $sns = &descape($ref->{'last_status'}->{'account'}->{'acct'} || $ref->{'last_status'}->{'account'}->{'username'}); # Add relative time for DMs my $relative_time = &format_relative_time($ref->{'last_status'}->{'created_at'});