     for str in strings
       message = new Xmpp.Element('message',
           from: @options.username
-          to: user
+          to: user.id
           type: 'chat' 
         ).
         c('body').t(str)

    message = if !message.match(new RegExp("^"+@name+":?","i")) then @name + " " + message else message

    # Send the message to the robot
    @receive new Robot.TextMessage from, message

  handlePresence: (stanza) =>
    # Check for buddy request
    return if stanza.attrs.type isnt 'subscribe'
    
    if @ignoreUser(stanza.attrs.from)
      console.log "Ignoring user subscribe because of whitelist: #{stanza.attrs.from}"
      console.log "  Accepted Users: " + @options.acceptUsers.join(',')
      console.log "  Accepted Domains: " + @options.acceptDomains.join(',')
      return

    # Accept
    @client.send new Xmpp.Element('presence',
      to:   stanza.attrs.from
      id:   stanza.attrs.id
      type: 'subscribed'
    )
    
  ignoreUser: (user) ->
    ignore = false
    
    if @options.acceptDomains.length > 0 or @options.acceptUsers.length > 0
      ignore = true
      [from, room] = user.split '/'
      if @options.acceptDomains.length > 0
        [username, domain] = from.split '@'
        ignore = false if domain in @options.acceptDomains
        
      if @options.acceptUsers.length > 0
        ignore = false if from in @options.acceptUsers
    
    return ignore
  


class Gtalkbot extends Robot
  run: ->
    Xmpp.JID.prototype.from = -> @bare().toString()

    # Client Options
    options = 
