       )
 
     # Check for buddy requests every so often
+    @client.send roster_query
     setInterval =>
       @client.send roster_query
     , @options.keepaliveInterval

  error: (err) =>
    console.error err

module.exports = Gtalkbot
    @receive new Robot.TextMessage from, message

  handlePresence: (stanza) =>
    return if stanza.attrs.type isnt 'subscribe'
    
    ignore = false
    if @options.acceptDomains.length > 0 or @options.acceptUsers.length > 0
      ignore = true
      [from, room] = stanza.attrs.from.split '/'
      if @options.acceptDomains.length > 0
        [username, domain] = stanza.attrs.from.split '@'
        ignore = false if domain in @options.acceptDomains
        
      if @options.acceptUsers.length > 0
        ignore = false if from in @options.acceptUsers
    
    # Check for buddy request
    if stanza.attrs.type is 'subscribe'
      if not ignore
        @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...) ->
