     options = 
       jid: process.env.HUBOT_GTALK_USERNAME
       password: process.env.HUBOT_GTALK_PASSWORD
-      acceptDomains: process.env.HUBOT_GTALK_WHITELIST_DOMAINS.split(',')
-      acceptUsers: process.env.HUBOT_GTALK_WHITELIST_USERS.split(',')
+      acceptDomains: (entry.trim() for entry in (process.env.HUBOT_GTALK_WHITELIST_DOMAINS ? '').split(',') when entry.trim() != '')
+      acceptUsers: (entry.trim() for entry in (process.env.HUBOT_GTALK_WHITELIST_USERS ? '').split(',') when entry.trim() != '')
       host: 'talk.google.com'
       port: 5222
       keepaliveInterval: 15000 # ms interval to send query to gtalk server
+    
+    if not options.jid or not options.password
+      throw Error('You need to set HUBOT_GTALK_USERNAME and HUBOT_GTALK_PASSWORD anv vars for gtalk to work')
 
     # Connect to gtalk servers
     @client = new Xmpp.Client 

    @receive new Robot.TextMessage from, message

  handlePresence: (stanza) =>

    domainRegexStr = "^*@["+@options.acceptDomains.join('|')+"]$"
    domainRegex = new RegExp(domainRegexStr,"i")
    # Check for buddy request
    if stanza.attrs.type is 'subscribe' and stanza.attrs.from in @options.acceptUsers or stanza.attrs.from.match(domainRegex)
      @client.send new Xmpp.Element('presence',
        to:   stanza.attrs.from
        id:   stanza.attrs.id
        type: 'subscribed'
      )
    else
      console.log "We denied: " + stanza.attrs.from
      # Lets see what we are trying to match
      console.log "Accepted Users: " + @options.acceptUsers.join(',')
      console.log "Accepted Domains: " + @options.acceptDomains.join(',')
    

  send: (user, strings...) ->

  error: (err) =>
    console.error err

module.exports = Gtalkbot
