twitter2jabber 0.0.8 → 0.0.9
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 +1 -1
- data/Rakefile +1 -1
- data/lib/twitter2jabber/version.rb +1 -1
- data/lib/twitter2jabber.rb +10 -1
- data/sample/templates/tweet.html +1 -1
- metadata +12 -2
data/README
CHANGED
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ begin
|
|
16
16
|
:homepage => %q{http://twitter2jabber.rubyforge.org/},
|
17
17
|
:files => FileList['lib/**/*.rb', 'bin/*'].to_a,
|
18
18
|
:extra_files => FileList['[A-Z]*', 'sample/**/*'].to_a,
|
19
|
-
:dependencies => %w[twitter xmpp4r-simple highline shorturl]
|
19
|
+
:dependencies => %w[twitter xmpp4r-simple highline shorturl longurl]
|
20
20
|
}
|
21
21
|
}}
|
22
22
|
rescue LoadError
|
data/lib/twitter2jabber.rb
CHANGED
@@ -199,6 +199,7 @@ class Twitter2Jabber
|
|
199
199
|
|
200
200
|
# cf. <http://devblog.famundo.com/articles/2006/10/18/ruby-and-xmpp-jabber-part-3-adding-html-to-the-messages>
|
201
201
|
def format_element(format, text)
|
202
|
+
text = process_message(text)
|
202
203
|
body = REXML::Element.new('body')
|
203
204
|
|
204
205
|
case format
|
@@ -209,15 +210,23 @@ class Twitter2Jabber
|
|
209
210
|
html.add(body.add_namespace(XHTML_NS))
|
210
211
|
html
|
211
212
|
else
|
212
|
-
REXML::Text.new(text, true, body, true, nil, /.^/)
|
213
|
+
REXML::Text.new(process_text(text), true, body, true, nil, /.^/)
|
213
214
|
body
|
214
215
|
end
|
215
216
|
end
|
216
217
|
|
218
|
+
def process_message(text)
|
219
|
+
text.gsub(/https?:\/\/\S+/) { |match| LongURL.expand(match) rescue match }
|
220
|
+
end
|
221
|
+
|
217
222
|
def process_html(text)
|
218
223
|
text.gsub(/((?:\A|\s)@)(\w+)/, '\1<a href="http://twitter.com/\2">\2</a>')
|
219
224
|
end
|
220
225
|
|
226
|
+
def process_text(text)
|
227
|
+
text
|
228
|
+
end
|
229
|
+
|
221
230
|
def handle_command(body, from, execute = true)
|
222
231
|
case body
|
223
232
|
when /\Ahe?(?:lp)?\z/i
|
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 %> |
|
3
|
+
<img src="<%= user.profile_image_url %>" alt="[<%= user.screen_name %>]" /> <%= tweet.text %> | #<a href="http://twitter.com/<%= user.screen_name %>/status/<%= tweet.id %>"><%= tweet.id %></a><% if tweet.in_reply_to_status_id %> (irt <a href="http://twitter.com/<%= tweet.in_reply_to_screen_name %>/status/<%= tweet.in_reply_to_status_id %>"><%= tweet.in_reply_to_screen_name %></a>)<% end %>
|
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.0.
|
4
|
+
version: 0.0.9
|
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-31 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -52,6 +52,16 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: "0"
|
54
54
|
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: longurl
|
57
|
+
type: :runtime
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
55
65
|
description: Twitter-to-Jabber gateway.
|
56
66
|
email: jens.wille@uni-koeln.de
|
57
67
|
executables:
|