From b36accb5e91b991b5dc497a9e54ee9b61cc2715d Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Mon, 10 Jun 2024 10:44:42 +0300 Subject: [PATCH 1/2] Add support for embedding calendars https://github.com/webmin/webmin/pull/2193 --- mailbox/view_mail.cgi | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mailbox/view_mail.cgi b/mailbox/view_mail.cgi index 35dd3d61..2b7ed1de 100755 --- a/mailbox/view_mail.cgi +++ b/mailbox/view_mail.cgi @@ -119,6 +119,15 @@ if ($userconfig{'auto_mark'}) { my ($deccode, $decmessage) = &decrypt_attachments($mail); my @attach = @{$mail->{'attach'}}; +# Calendar attachments +my @calendars; +eval { +foreach my $i (grep { $_->{'data'} } + grep { $_->{'type'} =~ /^text\/calendar/ } @attach) { + my $calendars = &parse_calendar_file($i->{'data'}); + push(@calendars, @{$calendars}); + }}; + # Find body attachment and type my ($textbody, $htmlbody, $body) = &find_body($mail, $userconfig{'view_html'}); $body = $htmlbody if ($in{'body'} == 2); @@ -247,10 +256,13 @@ my $image_mode = int(defined($in{'images'}) ? $in{'images'} : $userconfig{'view_images'}); my @bodyright; my $bodycontents; +my $calendars = &get_calendar_data(\@calendars); if ($body && $body->{'data'} =~ /\S/) { if ($body eq $textbody) { # Show plain text $bodycontents = "
";
+		$bodycontents .= $calendars->{'text'}
+			if ($calendars->{'text'});
 		foreach my $l (&wrap_lines(&eucconv($body->{'data'}),
 					$userconfig{'wrap_width'})) {
 			$bodycontents .= &link_urls_and_escape($l,
@@ -264,7 +276,9 @@ if ($body && $body->{'data'} =~ /\S/) {
 		}
 	elsif ($body eq $htmlbody) {
 		# Attempt to show HTML
-		$bodycontents = $body->{'data'};
+		$bodycontents = $calendars->{'html'}
+			if ($calendars->{'html'});
+		$bodycontents .= $body->{'data'};
 		my @imageurls;
 		$bodycontents = &disable_html_images($bodycontents, $image_mode,
 						     \@imageurls);

From 2a562a5d376d99fcfb76769f4318c075926fa1d9 Mon Sep 17 00:00:00 2001
From: Ilia Ross 
Date: Mon, 10 Jun 2024 13:06:04 +0300
Subject: [PATCH 2/2] Fix recommended package

---
 makerpm.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makerpm.pl b/makerpm.pl
index bdfe6403..6e503584 100755
--- a/makerpm.pl
+++ b/makerpm.pl
@@ -78,7 +78,7 @@
 Provides: %{name}-%{version}
 Requires(pre): /bin/sh /usr/bin/perl
 Requires: /bin/sh /usr/bin/perl perl(lib) perl(open) perl(Net::SSLeay) perl(Time::Local) perl(Data::Dumper) perl(File::Path) perl(File::Basename) perl(Digest::SHA) perl(Digest::MD5) openssl unzip tar gzip
-Recommends: perl(DateTime) perl(DateTime::TimeZone) perl(DateTime::Locale) perl(Time::Piece) perl(Encode::Detect) perl(Time::HiRes) lynx shared-mime-info perl-File-Basename perl-File-Path
+Recommends: perl(DateTime) perl(DateTime::TimeZone) perl(DateTime::Locale) perl(Time::Piece) perl(Encode::Detect) perl(Time::HiRes) perl(Socket6) lynx shared-mime-info perl-File-Basename perl-File-Path
 AutoReq: 0
 License: BSD-3-clause
 Group: System/Tools