tinder 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.6 - 2008-03-07
2
+ * Added Room#topic for getting the current topic [Even Weaver]
3
+ * Trap INT in #listen(&block) [borrowed from Chris Shea's Pyre]
4
+
1
5
  0.1.5 - 2008-01-25
2
6
  * Fixed Room#listen, which was broken by latest Campfire deploy
3
7
  * Fixed timeout when listening but not speaking that will eventually log you out [Clinton R. Nixon]
@@ -89,11 +89,6 @@ module Tinder
89
89
  room ? transcripts[room.to_s] : transcripts
90
90
  end
91
91
 
92
- # Deprecated: only included for backwards compatability
93
- def host #:nodoc:
94
- uri.host
95
- end
96
-
97
92
  # Is the connection to campfire using ssl?
98
93
  def ssl?
99
94
  uri.scheme == 'https'
data/lib/tinder/room.rb CHANGED
@@ -65,6 +65,16 @@ module Tinder
65
65
  topic if verify_response(post("room/#{id}/change_topic", { 'room' => { 'topic' => topic }}, :ajax => true), :success)
66
66
  end
67
67
 
68
+ # Get the current topic
69
+ def topic
70
+ join
71
+ h = (Hpricot(@room.body)/"#topic")
72
+ if h
73
+ (h/:span).remove
74
+ h.inner_text.strip
75
+ end
76
+ end
77
+
68
78
  # Lock the room to prevent new users from entering and to disable logging
69
79
  def lock
70
80
  verify_response(post("room/#{id}/lock", {}, :ajax => true), :success)
@@ -123,10 +133,13 @@ module Tinder
123
133
  def listen(interval = 5)
124
134
  join
125
135
  if block_given?
126
- loop do
127
- ping
128
- self.messages.each {|msg| yield msg }
129
- sleep interval
136
+ catch(:stop_listening) do
137
+ trap('INT') { throw :stop_listening }
138
+ loop do
139
+ ping
140
+ self.messages.each {|msg| yield msg }
141
+ sleep interval
142
+ end
130
143
  end
131
144
  else
132
145
  self.messages
@@ -188,16 +201,10 @@ module Tinder
188
201
  end
189
202
  end
190
203
 
191
- def post(*args)
192
- @campfire.send :post, *args
193
- end
194
-
195
- def get(*args)
196
- @campfire.send :get, *args
197
- end
198
-
199
- def verify_response(*args)
200
- @campfire.send :verify_response, *args
204
+ [:post, :get, :verify_response].each do |method|
205
+ define_method method do |*args|
206
+ @campfire.send method, *args
207
+ end
201
208
  end
202
209
 
203
210
  end
@@ -2,7 +2,7 @@ module Tinder #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-25 00:00:00 -05:00
12
+ date: 2008-03-07 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -37,7 +37,7 @@ dependencies:
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.4.0
40
+ version: 1.5.1
41
41
  version:
42
42
  description: An API for interfacing with Campfire, the 37Signals chat application.
43
43
  email: brandon@opensoul.org