Class: Remailer::SMTP::Server::Interpreter

Inherits:
Interpreter
  • Object
show all
Defined in:
lib/remailer/smtp/server/interpreter.rb

Instance Attribute Summary

Attributes inherited from Interpreter

#delegate, #error, #state

Instance Method Summary collapse

Methods inherited from Interpreter

config, create_parser_for_spec, default, default_interpreter, default_parser, #error?, #finished?, initial_state, initial_state=, #initialize, #interpret, on_error, on_error_handler, parse, #parse, #parser, #process, state, state_defined?, states, states_default, states_defined, states_empty?, #will_interpret?

Constructor Details

This class inherits a constructor from Remailer::Interpreter

Instance Method Details

#check_for_timeout!Object



220
221
222
223
224
# File 'lib/remailer/smtp/server/interpreter.rb', line 220

def check_for_timeout!
  if (self.ttl_expired?)
    enter_state(:timeout)
  end
end

#connection_ttlObject



212
213
214
# File 'lib/remailer/smtp/server/interpreter.rb', line 212

def connection_ttl
  10
end

#enter_state(state) ⇒ Object



206
207
208
209
210
# File 'lib/remailer/smtp/server/interpreter.rb', line 206

def enter_state(state)
  self.reset_ttl!
  
  super(state)
end

#reset_transaction!Object

Instance Methods =====================================================



194
195
196
# File 'lib/remailer/smtp/server/interpreter.rb', line 194

def reset_transaction!
  @transaction = Remailer::SMTP::Server::Transaction.new
end

#reset_ttl!Object



202
203
204
# File 'lib/remailer/smtp/server/interpreter.rb', line 202

def reset_ttl!
  @timeout_at = Time.now + self.connection_ttl
end

#send_bannerObject



198
199
200
# File 'lib/remailer/smtp/server/interpreter.rb', line 198

def send_banner
  delegate.send_line("220 #{delegate.server_name} Remailer ESMTP Server Ready")
end

#ttl_expired?Boolean

Returns:

  • (Boolean)


216
217
218
# File 'lib/remailer/smtp/server/interpreter.rb', line 216

def ttl_expired?
  @timeout_at ? (Time.now > @timeout_at) : false
end

#will_accept_recipient(recipient) ⇒ Object



230
231
232
# File 'lib/remailer/smtp/server/interpreter.rb', line 230

def will_accept_recipient(recipient)
  [ true, "250 Accepted" ]
end

#will_accept_sender(sender) ⇒ Object



226
227
228
# File 'lib/remailer/smtp/server/interpreter.rb', line 226

def will_accept_sender(sender)
  [ true, "250 Accepted" ]
end

#will_accept_transaction(transaction) ⇒ Object



234
235
236
# File 'lib/remailer/smtp/server/interpreter.rb', line 234

def will_accept_transaction(transaction)
  [ true, "250 Accepted" ]
end