Class: RubySpamAssassin::SpamClient
- Inherits:
-
Object
- Object
- RubySpamAssassin::SpamClient
- Defined in:
- lib/RubySpamAssassin.rb
Instance Method Summary collapse
- #check(message) ⇒ Object
-
#initialize(host = "localhost", port = 783, timeout = 5) ⇒ SpamClient
constructor
A new instance of SpamClient.
- #ping ⇒ Object
- #reconnect ⇒ Object
- #report(message) ⇒ Object (also: #process)
- #report_ifspam(message) ⇒ Object
- #send_symbol(message) ⇒ Object
- #skip ⇒ Object
Constructor Details
#initialize(host = "localhost", port = 783, timeout = 5) ⇒ SpamClient
Returns a new instance of SpamClient.
25 26 27 28 29 30 |
# File 'lib/RubySpamAssassin.rb', line 25 def initialize(host="localhost", port=783, timeout=5) @port = port @host = host @timeout =timeout @socket = TCPSocket.open(@host, @port) end |
Instance Method Details
#check(message) ⇒ Object
42 43 44 45 |
# File 'lib/RubySpamAssassin.rb', line 42 def check() protocol_response = ("CHECK", ) result = process_headers protocol_response[0...2] end |
#ping ⇒ Object
61 62 63 64 |
# File 'lib/RubySpamAssassin.rb', line 61 def ping protocol_response = ("PING", ) result = process_headers protocol_response[0] end |
#reconnect ⇒ Object
32 33 34 |
# File 'lib/RubySpamAssassin.rb', line 32 def reconnect @socket = @socket || TCPSocket.open(@host, @port) end |
#report(message) ⇒ Object Also known as: process
47 48 49 50 51 |
# File 'lib/RubySpamAssassin.rb', line 47 def report() protocol_response = ("REPORT", ) result = process_headers protocol_response[0...2] result.report = protocol_response[3..-1].join end |
#report_ifspam(message) ⇒ Object
53 54 55 |
# File 'lib/RubySpamAssassin.rb', line 53 def report_ifspam() result = report().spam? end |
#send_symbol(message) ⇒ Object
36 37 38 39 40 |
# File 'lib/RubySpamAssassin.rb', line 36 def send_symbol() protocol_response = ("SYMBOLS", ) result = process_headers protocol_response[0...2] result. = protocol_response[3...-1].join(" ").split(',') end |
#skip ⇒ Object
57 58 59 |
# File 'lib/RubySpamAssassin.rb', line 57 def skip protocol_response = ("SKIP", ) end |