blackwinter-twitter2jabber 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/TODO +1 -1
- data/lib/twitter2jabber.rb +24 -12
- data/lib/twitter2jabber/version.rb +1 -1
- data/sample/templates/tweet.html +1 -1
- data/sample/templates/tweet.txt +1 -1
- metadata +2 -2
data/README
CHANGED
data/TODO
CHANGED
data/lib/twitter2jabber.rb
CHANGED
@@ -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) {
|
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]]
|
232
|
+
h[e[lp]] -- Print this help
|
228
233
|
|
229
|
-
de[bug]
|
230
|
-
de[bug] on|off
|
234
|
+
de[bug] -- Print debug mode
|
235
|
+
de[bug] on|off -- Turn debug mode on/off
|
231
236
|
|
232
|
-
bl[ock] #
|
233
|
-
fa[v[orite]] #ID
|
237
|
+
bl[ock] #USER -- Block USER
|
238
|
+
fa[v[orite]] #ID -- Add #ID to favorites
|
234
239
|
|
235
|
-
|
236
|
-
|
237
|
-
|
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+#?(\
|
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!(/\
|
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
|
288
|
+
if body.sub!(/\A!(?:\s+|\z)/, '')
|
277
289
|
force = true
|
278
290
|
end
|
279
291
|
|
data/sample/templates/tweet.html
CHANGED
@@ -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 %>
|
data/sample/templates/tweet.txt
CHANGED
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.
|
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-
|
12
|
+
date: 2009-08-22 00:00:00 -07:00
|
13
13
|
default_executable: twitter2jabber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|