Sha256: db212c0821091d6996c1d6e5bf07a5302d2425c3399252c781498ba8cb9463bd

Contents?: true

Size: 1.88 KB

Versions: 31

Compression:

Stored size: 1.88 KB

Contents

module ASF

  class Mail
    def self.list
      return @list if @list

      list = Hash.new

      # load info from LDAP
      ASF::Person.preload(['mail', 'asf-altEmail'])
      ASF::Person.collection.each do |name, person|
        (person.mail+person.alt_email).each do |mail|
          list[mail.downcase] = person
        end
      end

      # load all member emails in one pass
      ASF::Member.each do |id, text|
        Member.emails(text).each {|mail| list[mail.downcase] ||= Person[id]}
      end

      # load all ICLA emails in one pass
      ASF::ICLA.new.each do |id, name, email|
        list[email.downcase] ||= Person.find(id)
        next if id == 'notinavail'
        list["#{id.downcase}@apache.org"] ||= Person.find(id)
      end

      @list = list
    end

    def self.lists(public_private= false)
      apmail_bin = ASF::SVN['infra/infrastructure/apmail/trunk/bin']
      file = File.join(apmail_bin, '.archives')
      if not @lists or File.mtime(file) != @list_mtime
        @list_mtime = File.mtime(file)
        @lists = Hash[File.read(file).scan(
          /^\s+"(\w[-\w]+)", "\/home\/apmail\/(public|private)-arch\//
        )]
      end

      public_private ? @lists : @lists.keys
    end
  end

  class Person < Base
    def self.find_by_email(value)
      value.downcase!

      person = Mail.list[value]
      return person if person
    end

    def obsolete_emails
      return @obsolete_emails if @obsolete_emails
      result = []
      if icla
        unless active_emails.any? {|mail| mail.downcase == icla.email.downcase}
          result << icla.email
        end
      end
      @obsolete_emails = result
    end

    def active_emails
      (mail + alt_email + member_emails).uniq
    end

    def all_mail
      active_emails + obsolete_emails
    end
  end

  class Committee
    def mail_list
      return 'hc' if name == 'httpcomponents'
      name
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
whimsy-asf-0.0.31 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.30 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.29 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.28 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.27 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.26 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.25 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.24 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.23 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.22 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.21 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.20 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.19 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.18 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.17 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.16 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.15 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.14 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.13 lib/whimsy/asf/mail.rb
whimsy-asf-0.0.12 lib/whimsy/asf/mail.rb