Class: ProxyLink

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/proxy_link.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.real_address(addrstr) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/proxy_link.rb', line 11

def self.real_address(addrstr)
    matches=addrstr.match(/(.+)-([\d]+)@(.*)/)
    if matches
        mlname, proxyid, domainname = matches[1..3]
        domain=Domain.find_by_name domainname
        ml=Mailinglist.find_all_by_name(mlname).find do |m|
            m.domain == domain
        end
        pl=self.find(proxyid.to_i)
        if pl.mailinglist_id == ml.id then
            return pl.address.address
        end
    end
end

Instance Method Details

#proxy_addressObject



7
8
9
# File 'app/models/proxy_link.rb', line 7

def proxy_address
    "#{mailinglist.name}-#{id}@#{mailinglist.domain.name}"
end