[PATCH 3/4] testbot/web: Use NotifyAdministrator() to send admin notifications.

Francois Gouget fgouget at codeweavers.com
Tue Sep 10 04:08:00 CDT 2019


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/web/Feedback.pl | 17 ++++++-----------
 testbot/web/Register.pl | 11 +----------
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/testbot/web/Feedback.pl b/testbot/web/Feedback.pl
index 2adc4cd4..36f0a2b0 100644
--- a/testbot/web/Feedback.pl
+++ b/testbot/web/Feedback.pl
@@ -26,6 +26,7 @@ our @ISA = qw(ObjectModel::CGI::FreeFormPage);
 
 use ObjectModel::BasicPropertyDescriptor;
 use WineTestBot::Config;
+use WineTestBot::Utils;
 
 
 sub _initialize($$$)
@@ -83,17 +84,11 @@ sub OnSend($)
     return !1;
   }
 
-  open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq");
-  print SENDMAIL <<"EOF";
-From: $RobotEMail
-To: $AdminEMail
-Subject: winetestbot feedback
-
-EOF
-  print SENDMAIL "Name: ", $self->GetParam("Name"), "\n";
-  print SENDMAIL "EMail: ", $self->GetParam("EMail"), "\n\n";
-  print SENDMAIL "Remarks:\n", $self->GetParam("Remarks"), "\n";
-  close(SENDMAIL);
+  NotifyAdministrator("winetestbot feedback",
+                      "Name: ". $self->GetParam("Name") ."\n".
+                      "EMail: ". $self->GetParam("EMail") ."\n\n".
+                      "Remarks:\n".
+                      $self->GetParam("Remarks"));
 
   return 1;
 }
diff --git a/testbot/web/Register.pl b/testbot/web/Register.pl
index 207728e7..23f57a9b 100644
--- a/testbot/web/Register.pl
+++ b/testbot/web/Register.pl
@@ -142,16 +142,7 @@ sub OnSendRequest($)
   my $URL = ($UseSSL ? "https://" : "http://") . $WebHostName .
             "/admin/UserDetails.pl?Key=" . uri_escape($self->GetParam("Name"));
   $Msg .= "\nTo approve or deny the request, please go to " . $URL;
-
-  open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq");
-  print SENDMAIL <<"EOF";
-From: $RobotEMail
-To: $AdminEMail
-Subject: winetestbot account request
-
-$Msg
-EOF
-  close(SENDMAIL);
+  NotifyAdministrator("winetestbot account request", $Msg);
 
   return 1;
 }
-- 
2.20.1




More information about the wine-devel mailing list