class OmahPluginSps
Public Class Methods
new(settings: {address: 'localhost', port: 59000}, variables: {})
click to toggle source
# File lib/omah-plugin-sps.rb, line 9 def initialize(settings: {address: 'localhost', port: 59000}, variables: {}) address, port = settings[:address], settings[:port] @sps = SPSPub.new(address: address, port: port) h = variables @email_address = h[:email_address] ? h[:email_address] : \ h[:user_name] + '@' + h[:address].split('.')[1..-1].join('.') end
Public Instance Methods
on_newmail(messages, doc)
click to toggle source
# File lib/omah-plugin-sps.rb, line 19 def on_newmail(messages, doc) m = 'message' m += 's' if messages.length > 1 fqm = "email/new: %s received %s new %s" \ % [@email_address, messages.length, m] @sps.notice fqm end
on_newmessage(h)
click to toggle source
# File lib/omah-plugin-sps.rb, line 30 def on_newmessage(h) if h[:tags] then tag = h[:tags].split.first fqm = "email/notice/%s: from: %s subject: %s %s" % [tag, h[:from], h[:subject], h[:link]] @sps.notice fqm sleep 0.3 end end