twitter2jabber 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to twitter2jabber version 0.2.4
5
+ This documentation refers to twitter2jabber version 0.2.5
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -4,7 +4,7 @@ class Twitter2Jabber
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 2
7
- TINY = 4
7
+ TINY = 5
8
8
 
9
9
  class << self
10
10
 
@@ -280,7 +280,7 @@ le[n[gth]] STATUS -- Determine length
280
280
  when /\Afav?(?:orite)?\s+#?(\d+)\z/i
281
281
  twitter.favorite_create($1) if execute && !debug
282
282
  else
283
- options = {}
283
+ command, options = nil, {}
284
284
 
285
285
  if execute && body.sub!(/\Alen?(?:gth)?\s+/i, '')
286
286
  if body = handle_command(body, from, false)
@@ -300,8 +300,12 @@ le[n[gth]] STATUS -- Determine length
300
300
  tweet = twitter.status(id)
301
301
  raise Twitter::NotFound unless tweet.is_a?(Hashie::Mash)
302
302
 
303
- body << ' ' unless body.empty?
304
- body << "RT @#{tweet.user.screen_name}#{colon} #{tweet.text}"
303
+ if body.empty?
304
+ options[:id] = id
305
+ command = :rt
306
+ else
307
+ body << " RT @#{tweet.user.screen_name}#{colon} #{tweet.text}"
308
+ end
305
309
  elsif body.sub!(/\Are(?:ply)?\s+#?(\d+)(:?)\s+/i, '')
306
310
  id, colon = $1, $2
307
311
 
@@ -320,7 +324,7 @@ le[n[gth]] STATUS -- Determine length
320
324
 
321
325
  if body.sub!(/\A(?:dm?|direct(?:_message)?)\s+[@#]?(\w+):?\s+/i, '')
322
326
  options[:user] = $1
323
- dm = true
327
+ command = :dm
324
328
  end
325
329
 
326
330
  if body.sub!(/\A!(?:\s+|\z)/, '')
@@ -334,16 +338,21 @@ le[n[gth]] STATUS -- Determine length
334
338
  return body unless execute
335
339
 
336
340
  if force || body.length <= MAX_LENGTH
337
- if dm
338
- user = options[:user]
339
-
340
- if debug
341
- logt "DM: #{body} (#{options.inspect})", true
341
+ case command
342
+ when :rt
343
+ if debug
344
+ logt "RT: #{options.inspect}", true
345
+ else
346
+ twitter.retweet(options[:id])
347
+ end
348
+ when :dm
349
+ if debug
350
+ logt "DM: #{body} (#{options.inspect})", true
351
+ else
352
+ twitter.direct_message_create(options[:user], body)
353
+ end
342
354
  else
343
- twitter.direct_message_create(user, body)
344
- end
345
- else
346
- update(body, options)
355
+ update(body, options)
347
356
  end
348
357
 
349
358
  deliver(from, "MSG SENT: #{body.inspect}, #{options.inspect}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter2jabber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
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: 2010-01-01 00:00:00 +01:00
12
+ date: 2010-01-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency