 KONFIG        = require 'koding-config-manager'
-redis         = require 'redis'
-REDIS_KEY     = 'social:disposable-email-addresses'
 DOMAINS       = require 'disposable-email-domains'
 
 LOW_QUALITY_DOMAINS = [

  'yahoo.com.ph'
  'yahoo.com.vn'

  # -- latest redis entries
  # -- ongoing discussion here: https://github.com/ivolo/disposable-email-domains/pull/22
  '10mail.org'
  '10minutemail.co.za'

endsWith = (str, suffix) ->
  str.toLowerCase().indexOf(suffix.toLowerCase(), str.length - suffix.length) isnt -1

check = (email) ->
  for domain in DOMAINS
    return no  if endsWith email, "@#{domain}"
  return yes

module.exports = emailchecker = (email, callback = -> ) ->

  unless email
    callback no
    return no

  return check email
