Permalink
Browse files

Added topic changing to Campfire adapter.

  • Loading branch information...
1 parent ceff5fd commit 48a384024dc2a9131ce5d084ed1d713255a3a87f @horaceko horaceko committed Dec 7, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/adapters/campfire.coffee
@@ -15,6 +15,10 @@ class Campfire extends Adapter
reply: (user, strings...) ->
@send user, strings.map((str) -> "#{user.name}: #{str}")...
+ topic: (user, strings...) ->
+ @bot.Room(user.room).speak "Changing topic: #{strings.join}"
+ @bot.topic(strings.join("\n"))
+
run: ->
self = @
@@ -108,6 +112,9 @@ class CampfireStreaming extends EventEmitter
paste: (text, callback) ->
@message text, "PasteMessage", callback
+ topic: (text, callback) ->
+ self.put "/room/#{id}", text, callback
+
sound: (text, callback) ->
@message text, "SoundMessage", callback
@@ -184,6 +191,9 @@ class CampfireStreaming extends EventEmitter
post: (path, body, callback) ->
@request "POST", path, body, callback
+ put: (path, body, callback) ->
+ @request "PUT", path, body, callback
+
request: (method, path, body, callback) ->
headers =
"Authorization" : @authorization

0 comments on commit 48a3840

Please sign in to comment.