blackwinter-twitter2jabber 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to twitter2jabber version 0.0.6
5
+ This documentation refers to twitter2jabber version 0.0.7
6
6
 
7
7
 
8
8
  == DESCRIPTION
data/TODO CHANGED
@@ -1,4 +1,4 @@
1
- - in reply to
1
+ - 'direct message' command
2
2
  - persistent cache! (friends_timeline: since/since_id?)
3
3
  - OAuth (register: http://twitter.com/oauth_clients/new)
4
4
  - better interrupt handling (in loop mode)
@@ -102,7 +102,10 @@ class Twitter2Jabber
102
102
 
103
103
  i, seen = 1, Hash.new { |h, k| h[k] = true; false }
104
104
 
105
- trap(:INT) { i = -1 }
105
+ trap(:INT) {
106
+ log "SIGINT received #{Time.now}, shutting down..."
107
+ i = -1
108
+ }
106
109
 
107
110
  while i > 0
108
111
  run(recipients, seen, i % ratio == 1, &block)
@@ -111,6 +114,8 @@ class Twitter2Jabber
111
114
 
112
115
  i += 1
113
116
  end
117
+
118
+ log "KTHXBYE (#{Time.now})"
114
119
  end
115
120
 
116
121
  def deliver_tweets(recipients, seen = {}, &block)
@@ -224,17 +229,19 @@ class Twitter2Jabber
224
229
  case body
225
230
  when /\Ahe?(?:lp)?\z/i
226
231
  deliver(from, <<-HELP) if execute
227
- h[e[lp]] -- Print this help
232
+ h[e[lp]] -- Print this help
228
233
 
229
- de[bug] -- Print debug mode
230
- de[bug] on|off -- Turn debug mode on/off
234
+ de[bug] -- Print debug mode
235
+ de[bug] on|off -- Turn debug mode on/off
231
236
 
232
- bl[ock] #ID -- Block ID
233
- fa[v[orite]] #ID -- Create favorite #ID
237
+ bl[ock] #USER -- Block USER
238
+ fa[v[orite]] #ID -- Add #ID to favorites
234
239
 
235
- re[ply] #ID[:] [!] STATUS -- Reply to ID (Force if too long)
236
- le[n[gth]] STATUS -- Determine length
237
- [!] STATUS -- Update status (Force if too long)
240
+ rt|retweet #ID[:] [!] [STATUS] -- Retweet ID (Force if too long)
241
+ re[ply] #ID[:] [!] STATUS -- Reply to ID (Force if too long)
242
+
243
+ le[n[gth]] STATUS -- Determine length
244
+ [!] STATUS -- Update status (Force if too long)
238
245
 
239
246
  (Note: Message body must be shorter than #{MAX_LENGTH} characters)
240
247
  HELP
@@ -251,7 +258,7 @@ le[n[gth]] STATUS -- Determine length
251
258
 
252
259
  deliver(from, "DEBUG = #{debug ? 'on' : 'off'}")
253
260
  end
254
- when /\Abl(?:ock)?\s+#?(\d+)\z/i
261
+ when /\Abl(?:ock)?\s+#?(\w+)\z/i
255
262
  twitter.block($1) if execute && !debug
256
263
  when /\Afav?(?:orite)?\s+#?(\d+)\z/i
257
264
  twitter.favorite_create($1) if execute && !debug
@@ -269,11 +276,16 @@ le[n[gth]] STATUS -- Determine length
269
276
  return
270
277
  end
271
278
 
272
- if body.sub!(/\Are(?:ply)?\s+#?(\d+):?\s+/i, '')
279
+ if body.sub!(/\A(?:rt|retweet)?\s+#?(\d+)(?::?\s+|\z)/i, '')
280
+ tweet = twitter.status($1)
281
+
282
+ body << ' ' unless body.empty?
283
+ body << '@' << tweet.user.screen_name << ': ' << tweet.body
284
+ elsif body.sub!(/\Are(?:ply)?\s+#?(\d+):?\s+/i, '')
273
285
  options[:in_reply_to_status_id] = $1
274
286
  end
275
287
 
276
- if body.sub!(/\A!\s+/, '')
288
+ if body.sub!(/\A!(?:\s+|\z)/, '')
277
289
  force = true
278
290
  end
279
291
 
@@ -4,7 +4,7 @@ class Twitter2Jabber
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- TINY = 6
7
+ TINY = 7
8
8
 
9
9
  class << self
10
10
 
@@ -1,3 +1,3 @@
1
1
  <%= user.name %> (<a href="http://twitter.com/<%= user.screen_name %>"><%= user.screen_name %></a>) [<%= tweet.created_at %>]:
2
2
  <br /><br />
3
- <img src="<%= user.profile_image_url %>" alt="[<%= user.screen_name %>]" /> <%= tweet.text %> | #<%= tweet.id %>
3
+ <img src="<%= user.profile_image_url %>" alt="[<%= user.screen_name %>]" /> <%= tweet.text %> | #<%= tweet.id %><% if tweet.in_reply_to_id %> (irt <a href="http://twitter.com/<%= tweet.in_reply_to_screen_name %>/status/<%= tweet.in_reply_to_id %>"><%= tweet.in_reply_to_screen_name %></a>)<% end %>
@@ -1,3 +1,3 @@
1
1
  <%= user.name %> (<%= user.screen_name %>) [<%= tweet.created_at %>]:
2
2
 
3
- <%= tweet.text %> | #<%= tweet.id %>
3
+ <%= tweet.text %> | #<%= tweet.id %><% if tweet.in_reply_to_id %> (irt <%= tweet.in_reply_to_screen_name %>)<% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackwinter-twitter2jabber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-21 00:00:00 -07:00
12
+ date: 2009-08-22 00:00:00 -07:00
13
13
  default_executable: twitter2jabber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency