Sha256: 77f8a29d19a8f1f08b9f4cde15312bbf815cbbf2915677b16ceef80e1f348c8f

Contents?: true

Size: 752 Bytes

Versions: 6

Compression:

Stored size: 752 Bytes

Contents

class ProxyLink < ActiveRecord::Base
    belongs_to :mailinglist
    belongs_to :address
    validates_presence_of :mailinglist
    validates_presence_of :address

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

    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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sugoi-mail-0.0.1 app/models/proxy_link.rb
sugoi-mail-0.0.0 app/models/proxy_link.rb
sugoi-mail-0.1.0 app/models/proxy_link.rb
sugoi-mail-0.0.3 app/models/proxy_link.rb
sugoi-mail-0.0.2 app/models/proxy_link.rb
sugoi-mail-0.0.5 app/models/proxy_link.rb