<commit_before>#*************************************************************************
#
#   OpenOffice.org - a multi-platform office productivity suite
#
#   $RCSfile: mail.pm,v $
#
#   $Revision: 1.6 $
#
#   last change: $Author: rt $ $Date: 2005-09-08 09:05:38 $
#
#   The Contents of this file are made available subject to
#   the terms of GNU Lesser General Public License Version 2.1.
#
#
#     GNU Lesser General Public License Version 2.1
#     =============================================
#     Copyright 2005 by Sun Microsystems, Inc.
#     901 San Antonio Road, Palo Alto, CA 94303, USA
#
#     This library is free software; you can redistribute it and/or
#     modify it under the terms of the GNU Lesser General Public
#     License version 2.1, as published by the Free Software Foundation.
#
#     This library is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with this library; if not, write to the Free Software
#     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
#     MA  02111-1307  USA
#
#*************************************************************************

package installer::mail;

use Net::SMTP;
use installer::converter;
use installer::exiter;
use installer::ziplist;

#########################################
# Sending a mail
#########################################

sub send_mail
{
    my ($message, $listenerstring, $mailinfostring, $languagesref, $destdir) = @_;

    my $listener = installer::converter::convert_stringlist_into_array($listenerstring, ",");
    my $mailinfo = installer::converter::convert_stringlist_into_array($mailinfostring, ",");

    my @listener = ();

    for ( my $i = 0; $i <= $#{$listener}; $i++ ) { push(@listener, ${$listener}[$i]); }
    for ( my $i = 0; $i <= $#{$mailinfo}; $i++ ) { ${$mailinfo}[$i] =~ s/\s*$//g; }

    my $smtphost = ${$mailinfo}[0];
    my $account = ${$mailinfo}[1];
    my $sender = ${$mailinfo}[2];

    if ( ! $smtphost ) { installer::exiter::exit_program("ERROR: Could not read SMTP Host in list file!", "send_mail"); }
    if ( ! $account ) { installer::exiter::exit_program("ERROR: Could not read Account in list file!", "send_mail"); }
    if ( ! $sender ) { installer::exiter::exit_program("ERROR: Could not read Sender in list file!", "send_mail"); }

    my $subject = "";
    my $basestring = $installer::globals::product . " " . $installer::globals::compiler . $installer::globals::productextension . " " . $installer::globals::build. " " . $installer::globals::buildid . " " . $$languagesref . "\n";
    if ( $message eq "ERROR" ) { $subject = "ERROR: $basestring" }
    if ( $message eq "SUCCESS" ) { $subject = "SUCCESS: $basestring" }

    my @message = ();

    push(@message, "Subject: $subject");
    push(@message, "\n");
    push(@message, "Located at $destdir");

    if ( $message eq "ERROR" )
    {
        for ( my $j = 0; $j <= $#installer::globals::errorlogfileinfo; $j++ )
        {
            my $line = $installer::globals::errorlogfileinfo[$j];
            $line =~ s/\s*$//g;
            push(@message, $line);
        }<commit_msg>INTEGRATION: CWS rt25_SRC680 (1.6.940); FILE MERGED 2008/01/14 14:39:58 rt 1.6.940.1: #i85224# Set 'to' header entry.<commit_after>#*************************************************************************
#
#   OpenOffice.org - a multi-platform office productivity suite
#
#   $RCSfile: mail.pm,v $
#
#   $Revision: 1.7 $
#
#   last change: $Author: rt $ $Date: 2008-01-16 08:45:48 $
#
#   The Contents of this file are made available subject to
#   the terms of GNU Lesser General Public License Version 2.1.
#
#
#     GNU Lesser General Public License Version 2.1
#     =============================================
#     Copyright 2005 by Sun Microsystems, Inc.
#     901 San Antonio Road, Palo Alto, CA 94303, USA
#
#     This library is free software; you can redistribute it and/or
#     modify it under the terms of the GNU Lesser General Public
#     License version 2.1, as published by the Free Software Foundation.
#
#     This library is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with this library; if not, write to the Free Software
#     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
#     MA  02111-1307  USA
#
#*************************************************************************

package installer::mail;

use Net::SMTP;
use installer::converter;
use installer::exiter;
use installer::ziplist;

#########################################
# Sending a mail
#########################################

sub send_mail
{
    my ($message, $listenerstring, $mailinfostring, $languagesref, $destdir) = @_;

    my $listener = installer::converter::convert_stringlist_into_array($listenerstring, ",");
    my $mailinfo = installer::converter::convert_stringlist_into_array($mailinfostring, ",");

    my @listener = ();

    for ( my $i = 0; $i <= $#{$listener}; $i++ ) { push(@listener, ${$listener}[$i]); }
    for ( my $i = 0; $i <= $#{$mailinfo}; $i++ ) { ${$mailinfo}[$i] =~ s/\s*$//g; }

    my $smtphost = ${$mailinfo}[0];
    my $account = ${$mailinfo}[1];
    my $sender = ${$mailinfo}[2];

    if ( ! $smtphost ) { installer::exiter::exit_program("ERROR: Could not read SMTP Host in list file!", "send_mail"); }
    if ( ! $account ) { installer::exiter::exit_program("ERROR: Could not read Account in list file!", "send_mail"); }
    if ( ! $sender ) { installer::exiter::exit_program("ERROR: Could not read Sender in list file!", "send_mail"); }

    my $subject = "";
    my $basestring = $installer::globals::product . " " . $installer::globals::compiler . $installer::globals::productextension . " " . $installer::globals::build. " " . $installer::globals::buildid . " " . $$languagesref . "\n";
    if ( $message eq "ERROR" ) { $subject = "ERROR: $basestring" }
    if ( $message eq "SUCCESS" ) { $subject = "SUCCESS: $basestring" }

    my @message = ();

    my $recipient_string = join ',', @listener;
    push(@message, "To: $recipient_string\n");
    push(@message, "Subject: $subject");
    push(@message, "\n");
    push(@message, "Located at $destdir");

    if ( $message eq "ERROR" )
    {
        for ( my $j = 0; $j <= $#installer::globals::errorlogfileinfo; $j++ )
        {
            my $line = $installer::globals::errorlogfileinfo[$j];
            $line =~ s/\s*$//g;
            push(@message, $line);
        }
{'fraction_non_alphanumeric': 0.21947695419737032, 'fraction_numerical': 0.02066175408178009, 'mean_word_length': 3.7573883161512027, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4211701', 'n_tokens_mistral': 2220, 'n_tokens_neox': 2051, 'n_words': 639}