--- parser3/src/classes/mail.C 2001/04/27 16:48:20 1.22.2.2 +++ parser3/src/classes/mail.C 2001/04/28 10:58:26 1.24 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: mail.C,v 1.22.2.2 2001/04/27 16:48:20 paf Exp $ + $Id: mail.C,v 1.24 2001/04/28 10:58:26 paf Exp $ */ #include "pa_config_includes.h" @@ -28,7 +28,9 @@ class MMail : public Methoded { public: MMail(Pool& pool); +public: // Methoded bool used_directly() { return true; } + void configure_user(Request& r); }; // helpers @@ -394,7 +396,7 @@ static void sendmail(Request& r, const S } else PTHROW(0, 0, &method_name, - "$"MAIN_CLASS_NAME":"MAIL_NAME" not defined"); + "$" MAIN_CLASS_NAME ":" MAIL_NAME " not defined"); #endif } @@ -419,13 +421,24 @@ static void _send(Request& r, const Stri sendmail(r, method_name, letter, from, to); } -// constructor +// constructor & configurator -MMail::MMail(Pool& pool) : Methoded(pool) { - set_name(NEW String(pool, MAIL_CLASS_NAME)); +MMail::MMail(Pool& apool) : Methoded(apool) { + set_name(*NEW String(pool(), MAIL_CLASS_NAME)); /// ^mail:send{hash} - vclass.add_native_method("send", Method::CT_STATIC, _send, 1, 1); + add_native_method("send", Method::CT_STATIC, _send, 1, 1); +} + +void MMail::configure_user(Request& r) { + Pool& pool=r.pool(); + + // $MAIN:MAIL[$SMTP[mail.design.ru]] + if(Value *mail_element=r.main_class->get_element(*mail_name)) + if(!(r.mail=mail_element->get_hash())) + PTHROW(0, 0, + 0, + "$" MAIL_CLASS_NAME ":" MAIL_NAME " is not hash"); } // global variable @@ -434,6 +447,6 @@ Methoded *mail_class; // creator -Methoded *MTable_create(Pool& pool) { +Methoded *MMail_create(Pool& pool) { return mail_class=new(pool) MMail(pool); }