twitter2jabber 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/twitter2jabber.rb +15 -10
- data/lib/twitter2jabber/version.rb +1 -1
- metadata +5 -5
data/README
CHANGED
data/lib/twitter2jabber.rb
CHANGED
@@ -73,8 +73,8 @@ class Twitter2Jabber
|
|
73
73
|
log.sync = true
|
74
74
|
logm 'HAI!'
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
twitter_connect(options[:twitter])
|
77
|
+
jabber_connect(options[:jabber])
|
78
78
|
|
79
79
|
@filter = options[:filter] || block
|
80
80
|
@formats = options[:formats] || DEFAULT_FORMATS
|
@@ -156,28 +156,32 @@ class Twitter2Jabber
|
|
156
156
|
|
157
157
|
private
|
158
158
|
|
159
|
-
def twitter_connect(options)
|
160
|
-
|
159
|
+
def twitter_connect(options = @twitter_options)
|
160
|
+
@twitter_options = options
|
161
|
+
|
162
|
+
auth = Twitter::OAuth.new(options[:consumer_token], options[:consumer_secret])
|
161
163
|
auth.authorize_from_access(options[:access_token], options[:access_secret])
|
162
164
|
|
163
|
-
|
165
|
+
@twitter = Twitter::Base.new(auth)
|
164
166
|
|
165
167
|
# verify credentials
|
166
|
-
|
168
|
+
@twitter.verify_credentials
|
167
169
|
|
168
170
|
logt 'connected'
|
169
171
|
|
170
|
-
|
172
|
+
@twitter
|
171
173
|
rescue Twitter::TwitterError => err
|
172
174
|
raise "Can't connect to Twitter with ID '#{options[:consumer_token]}': #{err}"
|
173
175
|
end
|
174
176
|
|
175
|
-
def jabber_connect(options)
|
176
|
-
|
177
|
+
def jabber_connect(options = @jabber_options)
|
178
|
+
@jabber_options = options
|
179
|
+
|
180
|
+
@jabber = Jabber::Simple.new(options[:user], options[:pass])
|
177
181
|
|
178
182
|
logj 'connected'
|
179
183
|
|
180
|
-
|
184
|
+
@jabber
|
181
185
|
rescue Jabber::JabberError => err
|
182
186
|
raise "Can't connect to Jabber with JID '#{options[:user]}': #{err}"
|
183
187
|
end
|
@@ -391,6 +395,7 @@ le[n[gth]] STATUS -- Determine length
|
|
391
395
|
jabber.deliver(recipient, msg)
|
392
396
|
rescue => err
|
393
397
|
warn "#{err} (#{err.class})"
|
398
|
+
jabber_connect and retry if err.is_a?(Jabber::ServerDisconnected)
|
394
399
|
end
|
395
400
|
|
396
401
|
def update(msg, options = {})
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter2jabber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jens Wille
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-03 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: twitter
|
@@ -149,7 +149,7 @@ rdoc_options:
|
|
149
149
|
- UTF-8
|
150
150
|
- --all
|
151
151
|
- --title
|
152
|
-
- twitter2jabber Application documentation (v0.3.
|
152
|
+
- twitter2jabber Application documentation (v0.3.2)
|
153
153
|
require_paths:
|
154
154
|
- lib
|
155
155
|
required_ruby_version: !ruby/object:Gem::Requirement
|