       port: @options.port
 
     # Events
-    @client.on 'online', @online
-    @client.on 'stanza', @readStanza
-    @client.on 'error', @error
+    @client.on 'online', => @online()
+    @client.on 'stanza', (stanza) => @readStanza(stanza)
+    @client.on 'error', => @error()
 
   online: ->
     @client.send new Xmpp.Element('presence')
-    
+
     # He is alive!
     console.log @name + ' is online, talk.google.com!'
 

    return unless body

    message = body.getText()

    # Pad the message with robot name just incase it was not provided.
    message = if not message.match(new RegExp("^"+@name+":?","i")) then @name + " " + message else message

    # Send the message to the robot
    @receive new Robot.TextMessage @getUser(jid), message

  handlePresence: (stanza) ->
    jid = new Xmpp.JID(stanza.attrs.from)

    console.error err

exports.use = (robot) ->
  new Gtalkbot robot

