Browse files

Merge remote-tracking branch 'assaf/master'

* assaf/master:
  Don't use userForId for private messages, only use it to resolve ID->name for public rooms.

Conflicts:
	src/hubot/hipchat.coffee
  • Loading branch information...
2 parents 79df1b9 + 6e60486 commit 55d3b42b6bc5fee9e963fc17250f879e0399a475 @cesar cesar committed Oct 26, 2011
Showing with 6 additions and 7 deletions.
  1. +6 −7 src/hubot/hipchat.coffee
View
13 src/hubot/hipchat.coffee
@@ -7,7 +7,7 @@ class HipChat extends Robot
send: (user, strings...) ->
console.log "Sending"
strings.forEach (str) =>
- @bot.message user.room || user.jid, str
+ @bot.message user.reply_to, str
reply: (user, strings...) ->
console.log "Replying"
@@ -50,15 +50,14 @@ class HipChat extends Robot
console.log "Can't list rooms: #{err}"
bot.onError (message, stanza)->
console.log "Received error from HipChat:", message, stanza
- bot.onMessage RegExp(mention,'i'), (channel, from, message)->
- author = self.userForName(from)
- author.room = channel
- console.log "#{from}@#{channel}: #{message}"
+ bot.onMessage RegExp(mention,'i'), (channel, from, message)->
+ #console.log "#{from}@#{channel}: #{message}"
+ author = { name: from, reply_to: channel }
hubot_msg=message.replace(RegExp(mention,'i'),"#{self.name}: ")
self.receive new Robot.Message(author, hubot_msg)
bot.onPrivateMessage (from, message)=>
- author = self.userForId(from.match(/_(\d+)@/)[1])
- author.jid = from
+ user = self.userForId(from.match(/_(\d+)@/)[1])
+ author = { name: user.name, reply_to: from }
self.receive new Robot.Message(author, "#{self.name}: #{message}")
bot.connect()

0 comments on commit 55d3b42

Please sign in to comment.