user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 5/5] wwwatomstream: avoid uninitialized warnings for $email
  2020-07-07 20:37  6% [PATCH 0/5] uninitialized vs blank fixes Eric Wong
@ 2020-07-07 20:37  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-07-07 20:37 UTC (permalink / raw)
  To: meta

As in Import, we'll fall back to Sender: if From: is missing,
and use the primary_address of the inboxes to indicate the total
absence of those fields.
---
 lib/PublicInbox/WwwAtomStream.pm | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm
index 3b5b133a5..2f9b953b2 100644
--- a/lib/PublicInbox/WwwAtomStream.pm
+++ b/lib/PublicInbox/WwwAtomStream.pm
@@ -136,16 +136,13 @@ sub feed_entry {
 	$title = '(no subject)' unless defined $title && $title ne '';
 	$title = title_tag($title);
 
-	my $from = $hdr->header('From') or return;
+	my $from = $hdr->header('From') // $hdr->header('Sender') //
+		$ctx->{-inbox}->{-primary_address};
 	my ($email) = PublicInbox::Address::emails($from);
-	my $name = join(', ',PublicInbox::Address::names($from));
-	$name = ascii_html($name);
-	$email = ascii_html($email);
+	my $name = ascii_html(join(', ', PublicInbox::Address::names($from)));
+	$email = ascii_html($email // $ctx->{-inbox}->{-primary_address});
 
-	my $s = '';
-	if (delete $ctx->{emit_header}) {
-		$s .= atom_header($ctx, $title);
-	}
+	my $s = delete($ctx->{emit_header}) ? atom_header($ctx, $title) : '';
 	$s .= "<entry><author><name>$name</name><email>$email</email>" .
 		"</author>$title$updated" .
 		qq(<link\nhref="$href"/>).

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] uninitialized vs blank fixes
@ 2020-07-07 20:37  6% Eric Wong
  2020-07-07 20:37  7% ` [PATCH 5/5] wwwatomstream: avoid uninitialized warnings for $email Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-07-07 20:37 UTC (permalink / raw)
  To: meta

This quiets some uninitialized variable warnings in various
places and includes minor fixes around "//" vs "||".

Eric Wong (5):
  viewvcs: allow "0" as a path name
  hval: to_filename: return `undef' instead of empty string
  viewvcs: stop checking unused "B" query parameter
  imap: avoid warnings on non-slice mailboxes
  wwwatomstream: avoid uninitialized warnings for $email

 lib/PublicInbox/Hval.pm          |  4 ++--
 lib/PublicInbox/IMAP.pm          |  1 +
 lib/PublicInbox/Mbox.pm          |  4 ++--
 lib/PublicInbox/MboxGz.pm        |  3 +--
 lib/PublicInbox/SolverGit.pm     |  2 +-
 lib/PublicInbox/ViewVCS.pm       |  8 +++++---
 lib/PublicInbox/WWW.pm           |  5 ++---
 lib/PublicInbox/WwwAtomStream.pm | 13 +++++--------
 t/hval.t                         |  8 +++++---
 t/imapd.t                        |  4 ++++
 10 files changed, 28 insertions(+), 24 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-07-07 20:37  6% [PATCH 0/5] uninitialized vs blank fixes Eric Wong
2020-07-07 20:37  7% ` [PATCH 5/5] wwwatomstream: avoid uninitialized warnings for $email Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).