indexing description: "Simple mail message." author: "Patrick Ruckstuhl " date: "$Date$" revision: "$Revision$" class O_MAIL_MESSAGE inherit O_MESSAGE rename make as make_message redefine make_from_generic end O_MAIL_CONSTANTS undefine out end create make create {O_MESSAGE_FACTORY} make_from_generic feature {NONE} -- Initialization make (a_recipient: like recipient; a_sender: like sender; a_subject: like subject; a_text: like text) is -- Create. require a_recipient_ok: a_recipient /= Void and then not a_recipient.is_empty a_subject_ok: a_subject /= Void and then not a_subject.is_empty a_text_ok: a_text /= Void and then not a_text.is_empty a_sender_ok: a_sender /= Void and then not a_sender.is_empty do make_message recipient := a_recipient sender := a_sender subject := a_subject text := a_text ensure recipient_set: recipient = a_recipient sender_set: sender = a_sender subject_set: subject = a_subject text_set: text = a_text end make_from_generic (a_msg: O_GENERIC_MESSAGE) is -- Create from a generic message. local l_args: HASH_TABLE [STRING, STRING] do Precursor (a_msg) l_args := a_msg.arguments recipient := l_args.item (recipient_argument) subject := l_args.item (subject_argument) text := l_args.item (text_argument) sender := l_args.item (sender_argument) end feature -- Access namespace: STRING is -- Namespace of the message type. once Result := mail_namespace end type: STRING is -- Type of the message. once Result := mail_simple_type end recipient: STRING -- Mail address of the recipient sender: STRING -- Name of the sender subject: STRING -- Subject of the message text: STRING -- Text of the message arguments: HASH_TABLE [STRING, STRING] is -- Named arguments. do create Result.make (4) Result.force (recipient, recipient_argument) Result.force (sender, sender_argument) Result.force (subject, subject_argument) Result.force (text, text_argument) end feature {NONE} -- Implementation recipient_argument: STRING is "recipient" sender_argument: STRING is "sender" subject_argument: STRING is "subject" text_argument: STRING is "text" invariant recipient_ok: recipient /= Void and then not recipient.is_empty sender_ok: sender /= Void and then not sender.is_empty subject_ok: subject /= Void and then not subject.is_empty text_ok: text /= Void and then not text.is_empty end