*** smtpd.tcl.orig	Thu Oct 24 11:51:44 2002
--- smtpd.tcl	Thu Oct 24 17:41:47 2002
***************
*** 99,105 ****
--- 99,108 ----
      }
  
      if {$myaddr != {}} {
+         set options(myaddr) "$myaddr"
          set myaddr "-myaddr $myaddr"
+     } else {
+         set options(myaddr) [info hostname]
      }
      set options(socket) [eval socket \
                               -server [namespace current]::accept $myaddr $port]
***************
*** 158,164 ****
      if {$accepted} {
          # Accept the connection
          log::log notice "connect from $client_addr:$client_port on $channel"
!         puts $channel "220 [info hostname] tcllib smtpd $version; [timestamp]"
      }
      
      return
--- 161,167 ----
      if {$accepted} {
          # Accept the connection
          log::log notice "connect from $client_addr:$client_port on $channel"
!         puts $channel "220 $options(myaddr) tcllib smtpd $version; [timestamp]"
      }
      
      return
***************
*** 343,348 ****
--- 346,353 ----
  #   RFC2821 4.1.1.1
  #
  proc smtpd::HELO {channel line} {
+     variable options
+ 
      if {[state $channel domain] != {}} {
          puts $channel "503 bad sequence of commands"
          log::log debug "HELO received out of sequence."
***************
*** 355,361 ****
          log::log debug "HELO received \"$line\""
          return
      }
!     puts $channel "250-[info hostname] Hello $domain\
                       \[[state $channel client_addr]\], pleased to meet you"
      puts $channel "250 Ready for mail."
      state $channel domain $domain
--- 360,366 ----
          log::log debug "HELO received \"$line\""
          return
      }
!     puts $channel "250-$options(myaddr) Hello $domain\
                       \[[state $channel client_addr]\], pleased to meet you"
      puts $channel "250 Ready for mail."
      state $channel domain $domain
***************
*** 368,373 ****
--- 373,380 ----
  # Reference:
  #   RFC2821 4.1.1.1
  proc smtpd::EHLO {channel line} {
+     variable options
+ 
      if {[state $channel domain] != {}} {
          puts $channel "503 bad sequence of commands"
          log::log debug "EHLO received out of sequence."
***************
*** 380,386 ****
          log::log debug "EHLO received \"$line\""
          return
      }
!     puts $channel "250-[info hostname] Hello $domain\
                       \[[state $channel client_addr]\], pleased to meet you"
      puts $channel "250 Ready for mail."
      state $channel domain $domain
--- 387,393 ----
          log::log debug "EHLO received \"$line\""
          return
      }
!     puts $channel "250-$options(myaddr) Hello $domain\
                       \[[state $channel client_addr]\], pleased to meet you"
      puts $channel "250 Ready for mail."
      state $channel domain $domain
***************
*** 490,495 ****
--- 497,504 ----
  #
  proc smtpd::DATA {channel line} {
      variable version
+     variable options
+ 
      if { [state $channel from] != {} && [state $channel to] != {} } {
          puts $channel "354 Enter mail, end with \".\" on a line by itself"
          state $channel id [uid]
***************
*** 497,503 ****
          eval array set sndr [mime::parseaddress [state $channel from]]
  
          set trace "Received: from [state $channel domain] \[[state $channel client_addr]\]\n\
!               \tby [info hostname] ($version) id [state $channel id]; [timestamp]"
          state $channel data [list $trace]
          fconfigure $channel -translation auto
      } else {
--- 506,512 ----
          eval array set sndr [mime::parseaddress [state $channel from]]
  
          set trace "Received: from [state $channel domain] \[[state $channel client_addr]\]\n\
!               \tby $options(myaddr) ($version) id [state $channel id]; [timestamp]"
          state $channel data [list $trace]
          fconfigure $channel -translation auto
      } else {
***************
*** 581,588 ****
  #   a QUIT message.
  #
  proc smtpd::QUIT {channel line} {
      log::log debug "QUIT on $channel"
!     puts $channel "221 [info hostname] Service closing transmission channel"
      close $channel
          
      # cleanup the session state array.
--- 590,599 ----
  #   a QUIT message.
  #
  proc smtpd::QUIT {channel line} {
+     variable options
+ 
      log::log debug "QUIT on $channel"
!     puts $channel "221 $options(myaddr) Service closing transmission channel"
      close $channel
          
      # cleanup the session state array.
