Branch: Tag:

1997-09-15

1997-09-15 07:17:09 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

these are not finished, but some maybe be useful already

Rev: lib/modules/Protocols.pmod/DNS.pmod:1.1
Rev: lib/modules/Protocols.pmod/NNTP.pmod:1.1
Rev: lib/modules/Protocols.pmod/SMTP.pmod:1.1

1: + class protocol + { +  // Maybe this should be the other way around? +  inherit NNTP.protocol; + }    -  + class client + { +  inherit protocol; +  +  void create(void|string server) +  { +  if(!server) +  { +  // Lookup MX record here (Using DNS.pmod) +  object dns=master()->resolv("Protocols")["DNS"]->client(); +  server=dns->get_primary_mx(gethostname()); +  } +  +  if(!connect(server,25)) +  { +  throw(({"Failed to connect to news server.\n",backtrace()})); +  } +  +  if(readreturncode()/100 != 2) +  throw(({"Connection refused by SMTP server.\n",backtrace()})); +  +  if(command("EHLO "+gethostname())/100 !=2) +  if(command("HELO "+gethostname())/100 != 2) +  throw(({"SMTP: greeting failed.\n",backtrace()})); +  } +  +  void send_message(string *to, string body) +  { +  // Not yet done +  } + }   Newline at end of file added.