Diff for /parser3/src/classes/mail.C between versions 1.56 and 1.61

version 1.56, 2002/03/25 11:55:26 version 1.61, 2002/04/01 09:37:50
Line 137  static const String& attach_hash_to_stri Line 137  static const String& attach_hash_to_stri
         if(Value *value=static_cast<Value *>(attach_hash.get(*value_name)))          if(Value *value=static_cast<Value *>(attach_hash.get(*value_name)))
                 vfile=value->as_vfile(String::UL_AS_IS); // bad with html attaches. todo: solve                  vfile=value->as_vfile(String::UL_AS_IS); // bad with html attaches. todo: solve
         else          else
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         &origin_string,                          &origin_string,
                         "has no $value");                          "has no $value");
   
Line 160  static const String& attach_hash_to_stri Line 160  static const String& attach_hash_to_stri
         if(!type/*default = uue*/ || *type=="uue") {          if(!type/*default = uue*/ || *type=="uue") {
                 uuencode(result, file_name_cstr, *vfile);                  uuencode(result, file_name_cstr, *vfile);
         } else // for now          } else // for now
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         type,                          type,
                         "unknown attachment encode format");                          "unknown attachment encode format");
                   
Line 170  static const String& attach_hash_to_stri Line 170  static const String& attach_hash_to_stri
   
 #ifndef DOXYGEN  #ifndef DOXYGEN
 struct Mail_info {  struct Mail_info {
         Charset *charset;          Charset *charset; const char *content_charset_name;
         String *header;          String *header;
         const String **from, **to;          const String **from, **to;
 };  };
Line 196  static void add_header_attribute(const H Line 196  static void add_header_attribute(const H
         *mi.header <<           *mi.header << 
                 aattribute << ":" <<                   aattribute << ":" << 
                 attributed_meaning_to_string(lmeaning, String::UL_MAIL_HEADER).                  attributed_meaning_to_string(lmeaning, String::UL_MAIL_HEADER).
                         cstr(String::UL_UNSPECIFIED, 0, mi.charset) <<                           cstr(String::UL_UNSPECIFIED, 0, mi.charset, mi.content_charset_name) << 
                 "\n";                  "\n";
 }  }
   
Line 216  static int get_part_name_weight(const Ha Line 216  static int get_part_name_weight(const Ha
                 cstr+=6;                  cstr+=6;
                 offset=ATTACHMENT_WEIGHT;                  offset=ATTACHMENT_WEIGHT;
         } else          } else
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         &part_name,                          &part_name,
                         "is neither text# nor attach#");                          "is neither text# nor attach#");
   
Line 246  static const String& letter_hash_to_stri Line 246  static const String& letter_hash_to_stri
         String& result=*new(pool) String(pool);          String& result=*new(pool) String(pool);
   
         Charset *charset;          Charset *charset;
         if(Value *vcharset_name=static_cast<Value *>(letter_hash.get(*charset_name)))          if(Value *vrecodecharset_name=static_cast<Value *>(letter_hash.get(*charset_name)))
                 charset=&charsets->get_charset(vcharset_name->as_string());                  charset=&charsets->get_charset(vrecodecharset_name->as_string());
         else          else
                 charset=&pool.get_source_charset();                  charset=&pool.get_source_charset();
   
           const char *content_charset_name=0;
           if(Value *vcontent_type=static_cast<Value *>(letter_hash.get(*content_type_name)))
                   if(Hash *hcontent_type=vcontent_type->get_hash(0))
                           if(Value *vcontentcharset_name=static_cast<Value *>(hcontent_type->get(*charset_name)))
                                   content_charset_name=vcontentcharset_name->as_string().cstr();
   
         if(from)          if(from)
                 *from=0;                  *from=0;
         if(to)          if(to)
                 *to=0;                  *to=0;
         Mail_info mail_info={          Mail_info mail_info={
                 charset,                  charset, content_charset_name,
                 &result,                  &result,
                 from, to                  from, to
         };          };
Line 298  static const String& letter_hash_to_stri Line 304  static const String& letter_hash_to_stri
                                                 result << letter_hash_to_string(r, method_name, *part_hash,                                                   result << letter_hash_to_string(r, method_name, *part_hash, 
                                                         level+1, 0, 0);                                                          level+1, 0, 0);
                                 else                                  else
                                         throw Exception(0, 0,                                          throw Exception("parser.runtime",
                                                 seq[i].name,                                                  seq[i].name,
                                                 "part is not hash");                                                  "part is not hash");
                         }                          }
Line 322  static const String& letter_hash_to_stri Line 328  static const String& letter_hash_to_stri
                         result.APPEND_CLEAN((const char*)mail_ptr, mail_size, 0, 0);                          result.APPEND_CLEAN((const char*)mail_ptr, mail_size, 0, 0);
                 }                  }
         } else           } else 
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         &method_name,                          &method_name,
                         "has no $body");                          "has no $body");
   
Line 339  static void sendmail(Request& r, const S Line 345  static void sendmail(Request& r, const S
   
 #ifdef _MSC_VER  #ifdef _MSC_VER
         if(!from)          if(!from)
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         &method_name,                          &method_name,
                         "has no 'from' header specified");                          "has no 'from' header specified");
         if(!to)          if(!to)
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         &method_name,                          &method_name,
                         "has no 'to' header specified");                          "has no 'to' header specified");
   
Line 360  static void sendmail(Request& r, const S Line 366  static void sendmail(Request& r, const S
   
                 smtp.Send(server, port, letter_cstr, from->cstr(), to->cstr());                  smtp.Send(server, port, letter_cstr, from->cstr(), to->cstr());
         } else          } else
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         &method_name,                          &method_name,
                         "$"MAIN_CLASS_NAME":"MAIL_NAME".SMTP not defined");                          "$"MAIN_CLASS_NAME":"MAIL_NAME".SMTP not defined");
 #else  #else
Line 370  static void sendmail(Request& r, const S Line 376  static void sendmail(Request& r, const S
   
         const String *sendmail_command;          const String *sendmail_command;
 #ifdef PA_FORCED_SENDMAIL  #ifdef PA_FORCED_SENDMAIL
         sendmail_command=PA_FORCED_SENDMAIL;          sendmail_command=new(pool) String(pool, PA_FORCED_SENDMAIL);
 #else  #else
         const char *sendmailkey_cstr="sendmail";          const char *sendmailkey_cstr="sendmail";
         if(mail_conf) {          if(mail_conf) {
                 if(Value *sendmail_value=static_cast<Value *>(mail_conf->get(String(pool, sendmailkey_cstr))))                  if(Value *sendmail_value=static_cast<Value *>(mail_conf->get(String(pool, sendmailkey_cstr))))
                         sendmail_command=&sendmail_value->as_string();                          sendmail_command=&sendmail_value->as_string();
                 else                  else
                         throw Exception(0, 0,                          throw Exception("parser.runtime",
                                 &method_name,                                  &method_name,
                                 "$"MAIN_CLASS_NAME":"MAIL_NAME".%s not defined",                                   "$"MAIN_CLASS_NAME":"MAIL_NAME".%s not defined", 
                                 sendmailkey_cstr);                                  sendmailkey_cstr);
Line 403  static void sendmail(Request& r, const S Line 409  static void sendmail(Request& r, const S
         }          }
   
         if(!file_executable(*file_spec))          if(!file_executable(*file_spec))
                 throw Exception(0, 0,                  throw Exception(0,
                         file_spec,                           file_spec, 
                         "is not executable."                          "is not executable."
 #ifdef PA_FORCED_SENDMAIL  #ifdef PA_FORCED_SENDMAIL
                           " Use configure key \"--with-sendmail=appropriate sendmail command\""
   #else
                         " Set $"MAIN_CLASS_NAME":"MAIL_NAME".%s with appropriate sendmail command",                           " Set $"MAIN_CLASS_NAME":"MAIL_NAME".%s with appropriate sendmail command", 
                                 sendmailkey_cstr                                  sendmailkey_cstr
 #else  
                         " Use configure key --with-sendmail=\"appropriate sendmail command\""  
 #endif  #endif
                 );                  );
   
Line 423  static void sendmail(Request& r, const S Line 429  static void sendmail(Request& r, const S
 #else  #else
                 false                  false
 #endif  #endif
                 *file_spec,                  , *file_spec,
                 0/*default env*/,                  0/*default env*/,
                 &argv,                  &argv,
                 in, out, err);                  in, out, err);
         if(exit_status || err.size())          if(exit_status || err.size())
                 throw Exception(0, 0,                  throw Exception(0,
                         &method_name,                          &method_name,
                         "'%s' reported problem: %s (%d)",                          "'%s' reported problem: %s (%d)",
                                 file_spec->cstr(),                                  file_spec->cstr(),
Line 446  static void _send(Request& r, const Stri Line 452  static void _send(Request& r, const Stri
         Value& vhash=params->as_no_junction(0, "message must not be code");          Value& vhash=params->as_no_junction(0, "message must not be code");
         Hash *hash=vhash.get_hash(&method_name);          Hash *hash=vhash.get_hash(&method_name);
         if(!hash)          if(!hash)
                 throw Exception(0, 0,                  throw Exception("parser.runtime",
                         &method_name,                          &method_name,
                         "message must be hash");                          "message must be hash");
   
Line 478  void MMail::configure_user(Request& r) { Line 484  void MMail::configure_user(Request& r) {
                 if(Hash *mail_conf=mail_element->get_hash(0))                  if(Hash *mail_conf=mail_element->get_hash(0))
                         r.classes_conf.put(name(), mail_conf);                          r.classes_conf.put(name(), mail_conf);
                 else                  else
                         throw Exception(0, 0,                          throw Exception("parser.runtime",
                                 0,                                  0,
                                 "$" MAIL_CLASS_NAME ":" MAIL_NAME " is not hash");                                  "$" MAIL_CLASS_NAME ":" MAIL_NAME " is not hash");
 }  }

Removed from v.1.56  
changed lines
  Added in v.1.61


E-mail: