Skip to Content.
Sympa Menu

devel - [proposal] new object class: Message.pm

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: address@concealed
  • To: address@concealed
  • Subject: [proposal] new object class: Message.pm
  • Date: Tue, 26 Feb 2002 18:20:57 +0100

Of course you know the story with the guy who forgets the
attachments ? :-)

With my apologies,

--
Dominique QUATRAVAUX Ingénieur développeur sénior
01 44 42 00 35 IDEALX

# RCS Identication ; $Revision: 1.246 $ ; $Date: 2002/02/21 16:39:52 $
#
# Sympa - SYsteme de Multi-Postage Automatique
# Copyright (c) 1997, 1998, 1999, 2000, 2001 Comite Reseau des Universites
# Copyright (c) 1997,1998, 1999 Institut Pasteur & Christophe Wolfhugel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

=pod "

=head1 NAME

Message.pm - a class for representing messages inside Sympa.

=head1 SYNOPSIS

my $message=Message->readfrom($filename);

=head1 DESCRIPTION

C<Message> is a subclass of L<MIME::Entity> that provides the same
services, and then some fields and functionalities that are specific to
Sympa: X509 certificate handling, command parsing in messages, verbatim
retransmission of signed messages.

This class should be used as the preferred container type for incoming
messages handled by Sympa. Outgoing mails, whether from the list or from
the administrative robots, do not need it (yet) and should use
functions from smtp.pm instead.

=cut "

package Message;

use Carp;

use MIME::Parser;
use MIME::Entity;

use Conf;

=head1 CONSTRUCTOR

=item read( FILENAME )

my $msg=Message->read("/some/file");

Creates a new object which will be used for a message and
loads it. Returns a Message object or undef upon failure.

=back

=head1 METHODS

All methods from L<MIME::Entity> are available, plus the following:

=over 4

=item is_signed ( )

Returns a true value if the message was validly signed by a certificate that
we trust.

=item get_signing_certificate ( )

Returns the PEM-encoded X509 certificate that was used to sign the message,
only if C<is_signed()> would return true, or undef.

=item is_encrypted_for_Sympa ( )

Returns a true value if the message was encrypted with our public key. In
this case, sending it to the list as-is makes no sense, we should decrypt
it beforehand.

=item decrypt ( )

Decrypt the message and return a newly created Message object, or
undef if decryption failed for any reason.

=item get_modified ( )

Gets the "modified" flag for this Message object. It is initially set
to zero, and becomes true when set_modified() is called.

=item set_modified ( )

Sets the "modified" flag for this Message object. To be called whenever the
message's body is modified, because this will invalidate any cryptographic
signature.

=item get_verbatim ( )

Gets the original text of the message, as it was at object initialization
time (through read() or decrypt()). This is a bitwise copy returned as a
string, so that any cryptographic signature inside should still check OK.

=item get_verbatim_body ( )

Same as get_verbatim() above, but weeds out the headers (which are typically
not signed).

=item is_command_mail ( )

Returns true if this mail contains commands.

=item get_commands ( )

Returns a list of all commands contained in this mail.

=cut


#################################################################

## Packages must return true.
1;







Archive powered by MHonArc 2.6.19+.

Top of Page