NAME

Liz::Forum::Message - module for Message objects at the Forum site


SYNOPSIS

 use Liz::Forum;
 $forum = new Liz::Forum;

 $message = $forum->Message;
 $message = $forum->Message( $messageID );

 $message->update;


EXAMPLES


DESCRIPTION

Provide object oriented access to the Message table of the Hospitality Net website. Usually not accessed directly, but rather through the Liz::Forum object and its Message method.


BASIC METHODS


new

Create a new Forum Message object from a Forum object.

Input Parameters

 1 Liz::Forum object
 2 ID to created Message object with
   (default: none = new message)
Output Parameters

 1 instantiated object
Note

It is not intended to call this method directly, but rather indirectly through the Liz::Forum module.

Example

 $forum = new Liz::Forum;
 $message = $forum->Message;
 $message = $forum->Message( $messageID );


receive

Create a new Forum Message object from a Forum object and a Liz::Mail object.

Input Parameters

 1 Liz::Forum object
 2 Liz::Mail object
Output Parameters

 1 instantiated Liz::Forum::Message object


update

Update a Forum Message object in the Liz::Forum database.

Output Parameters

 1 ID with which the object was updated
Example

 $message->update;


delete

Delete a Liz::Forum::Message object from the database.

Output Parameters

 1 flag: whether action was successful
Example

 $message->delete;


reset

Reset all message information in the forum.

Example

 $forum->reset;
 print "All messages has been removed\n";


CONTENT METHODS

The following methods allow changes to information that is associated with the message object.


AuthorID

Set or return the AuthorID information of the message object.

Output Parameters

 1 current value of the AuthorID
Example

 $message->AuthorID( $authorID );
 $authorID = $message->AuthorID;


Body

Specify the body of the message. Look at method HTML also if you would like to send an alternate version of the message in HTML format.

Input Parameters

 1 new body
   (default: no change)
Output Parameters

 1 current/old body
Example:

 $message->Body( <<EOD );
 Hi,

 what do you think of this message?  It was created with the
 Liz::Forum::Message module!

 Kind regards,

 Liz
 EOD


Created

Return the Created timestamp of the message object.

Output Parameters

 1 current timestamp value of the Created date
Example

 $created = $message->Created;


DirectorMessage

Return or set the DirectorMessage information of the message object. The meaning is entirely up to the developer, but is generally intended to indicate some judgement on the contents of the message by the people maintaining the forum.

Input Parameters

 1 new value of the DirectorMessage (0..255)
   (default: no change)
Output Parameters

 1 current/old value of the DirectorMessage
Example

 $message->DirectorMessage( 1 );
 $directormessage = $message->DirectorMessage;


File

Create a Liz::FileSet::File object for a new file associated with the object, or create a Liz::FileSet::File object for an existing file associated with the object, specified by its ID.

Use method FileIDs to obtain the list of IDs of files associated with the object.

Liz::FileSet::File objects created in this way, are automatically updated when the Message object is updated.

Input Parameters

 1 ID for existing associated file
   (default: create a new Liz::FileSet::File object)
Output Parameters

 1 instantiated Liz::FileSet::File compatible object
Example

 $file = $message->File;
 $file->Title( 'image.jpg' );
 $file->Extension( 'jpg' );
 $file->MIMEType( 'image/jpeg' );
 $file->Contents( $contents );
 $message->update;

 ($fileID) = $message->FileIDs;
 $file = $message->File( $fileID );
 $contents = $message->File( $fileID )->Contents;


FileIDs

Return the ID's of the Liz::FileSet::File objects that are associated with this object. Use method File to obtain the Liz::FileSet::File object with the ID specified.

Output Parameters

 1..N ID's of associated Liz::FileSet::File objects
Example

 foreach( $message->FileIDs ) {
   $message->File( $_ )->Get( qw(Title MIMEType Bytes) );
   print "$title ($mimetype,$bytes bytes)\n";
 }


ForeignKey

Specify the foreign key of the message. It is an additional means to identify a message in a forum, just as the ID.

The purpose of the foreign key is entirely up to the developer. When a message is converted from a Liz::Mail object with the receive method, then this method returns the value of the Message-Id field in the header of the email message.

Input Parameters

 1 new value of foreign key
   (default: no change)
Output Parameters

 1 current/old value of foreign key
Example:

 $foreignkey = $message->ForeignKey;
 $message->ForeignKey( '358jhkjs89878ahkjj' );


Header

Specify the header of the message. Look at method Body to specify the body of the message.

The purpose of the Header is entirely up to the developer. When a message is converted from a Liz::Mail object with the receive method, then this method returns the full header of the email message.

Input Parameters

 1 new contents of Header
   (default: no change)
Output Parameters

 1 current/old contents of Header
Example:

 $header = $message->Header;
 $message->Header( "This is a custom header\n" );


HTML

Specify the body of the message in HTML-format. This is an alternative version of the text specified with the Body method.

When a message object is created from a Liz::Mail object with the receive method, then this method returns the HTML-version of the email message when available.

Input Parameters

 1 new HTML-version of the body
   (default: no change)
Output Parameters

 1 current/old HTML-version of the body
Example:

 $mail->HTML( <<EOD );
 <HTML><BODY BGCOLOR="yellow">
 Hi,
 <P>
 what do you think of this message?  It was created with the
 Liz::Forum::Message module!
 <HR>
 Kind regards,

 <I>Liz</I>
 </BODY></HTML>
 EOD
Note

Although intended for the HTML-version of the message, this field can of course be (ab)used for anything the developer likes.


ID

Return the ID of the message object. Please note that this value is only set after the first time the object is updated to the database with the update method.

Output Parameters

 1 current ID of the object
Example

 $ID = $message->ID;


Options

Set or return the Options of the Message object.

Input Parameters

 1 new value of Options
   (default: no change)
Output Parameters

 1 old/current value of Options
Example

 $message->Options( $options );
 $options = $message->Options;


Published

Return or set the Published timestamp of the message object.

Input Parameters

 1 new timestamp value of the Published date
   (default: no change)
Output Parameters

 1 current/old timestamp value of the Published date
Example

 $message->Published( $published );
 $published = $message->Published;


Status

Return or set the Status information of the message object. The meaning is entirely up to the developer.

Input Parameters

 1 new value of the Status (0..255)
   (default: no change)
Output Parameters

 1 current/old value of the Status
Example

 $message->Status( $status );
 $status = $message->Status;


Subject

Specify/Return the Subject: of the message object. This can also be done when the object is created with the new method.

Input Parameters

 1 new subject
   (default: no change)
Output Parameters

 1 current/old subject
Example:

 $message->Subject( 'About this and that' );
 $subject = $message->Subject;


UnFile

Remove a Liz::FileSet::File object associated with the object, specified by its ID.

Use method FileIDs to obtain the list of IDs of files associated with the object.

Input Parameters

 1..N ID's for existing associated files
Example

 $message->UnFile( $fileID );


Updated

Return the Updated timestamp of the message object.

Output Parameters

 1 current timestamp value of the Updated date
Example

 $updated = $message->Updated;


AUTHOR

Elizabeth Mattijsen ( lizperl@INC.nl )


COPYRIGHT

(C) 1998-1999 International Network Consultants


HISTORY

Version 1.10, 3 December 1999

Put module name between quotes to fix obscure bug in Perl 5.005x under ModPerl in method reset.

Version 1.09, 30 September 1999

Now no longer adds Exporter to ISA: it wasn't necessary.

Version 1.08, 11 May 1999

Any errors obtaining an existing record now sets the global variable ERROR with the error message (method new).

Version 1.07, 10 May 1999

Removed references to the old Attachments table in method new.

Adapted new and update so that the entire module can be subclassed with extra fields without having create specific ``new'' and ``update'' methods.

Changed typography of the source to the new indented format.

Version 1.06, 27 April 1999

Fixed problem in method update which would not return the ID of the object if the object was not changed.

Version 1.05, 18 April 1999

Method delete now properly deletes any associated files also.

Moved main part of File, FileIDs and UnFile to Liz::Forum. Only stubs remain if applicable.

Version 1.04, 13 April 1999

Fixed problem with DirectorMessage that was introduced on April 9th.

Version 1.03, 9 April 1999

Now inherits from Liz::Forum.

Version 1.02, 23 March 1999

Now also imports the internal field LANGUAGE in methods new and receive so that language settings are inherited.

Version 1.01, 22 March 1999

Added documentation for all possible methods for the message object, even the AUTOLOADed ones.

Added support for HTML-version for a message, to maintain compatibility with Liz::Mail. The HTML version of a message can be specified with the new HTML method.

Adapted method receive to Liz::Mail 2.0.

Version 1.0, 11 March 1999

Adapted method receive to the new File method.

Added method UnFile: remove the indicated file and its connection to the object.

Added method FileIDs: return list of ID's of Liz::FileSet::File objects that are associated with the object.

Changed method File to return a Liz::FileSet::File object, instead of doing propriatary things. This is ** INCOMPATIBLE ** with the previous version, but a preliminary investigation revealed that the old method had only been used in situations that can be easily mended.

Version 0.63, 3 February 1999

Fixed problem with receive if the From email address included a name also.

Version 0.62, 9 January 1999

Fixed problem with method Options which would take the options of the Forum object, instead of the message object itself.

Version 0.61, 15 December 1998

Support for Status added.

Version 0.6, 25 November 1998

Support for foreign keys added.

Method receive now stores the Message-ID of a mail header (e.g. when obtained from a mailing list or a news group) in the ForeignKey so that it can be easily used for searching later on.

New method ForeignKey added: set or return the foreign key of the message.

Version 0.54, 6 October 1998

Reduced memory footprint by fully qualifying global variables and external subroutines.

Version 0.53, 17 September 1998

Method update now returns the ID with which the object was created.

Version 0.52, 24 July 1998

Fixed problems in File and update. File attachments to messages now finally work.

Version 0.51, 22 July 1998

Fixed problem in File. Also added last updated information in the output parameters.

Version 0.5, 25 June 1998

Changed attachment table name to xxx__Attachments.

Version 0.4, 18 June 1998

Method update now collects any possible error messages and stores the in the ERROR field for later use.

Version 0.3, 4 June 1998

New method receive: create a Liz::Forum::Message object from a Liz::Mail object.

Changed methods new, File and update so that attached files are updated to the database at the moment an update is done, not before.

Version 0.2, 1 June 1998

Updated to new Bulk method.

Version 0.1, 25 May 1998

First version of this true Perl module.