fluent-plugin-jabber 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -52,12 +52,6 @@ See source for details.
52
52
  jabber_warnings_log true
53
53
  </match>
54
54
 
55
- ### Message format
56
-
57
- {"body": "String for output"}
58
-
59
- If 'body' field not set, the plugin raises error.
60
-
61
55
  ## Contributing
62
56
 
63
57
  1. Fork it
@@ -68,6 +62,10 @@ If 'body' field not set, the plugin raises error.
68
62
 
69
63
  ## Changes
70
64
 
65
+ ### 0.4.0
66
+
67
+ * Add filter: uri_component
68
+
71
69
  ### 0.3.0
72
70
 
73
71
  * Add filter: br
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "fluent-plugin-jabber"
3
- gem.version = "0.3.0"
3
+ gem.version = "0.4.0"
4
4
  gem.authors = ["todesking"]
5
5
  gem.email = ["discommunicative@gmail.com"]
6
6
  gem.summary = %q{Fluentd output plugin for XMPP(Jabber) protocol}
@@ -5,6 +5,8 @@ require 'fluent/output'
5
5
  require 'xmpp4r'
6
6
  require 'xmpp4r/muc'
7
7
 
8
+ require 'uri'
9
+
8
10
  require 'pit'
9
11
 
10
12
  # Deal with Fluentd's Encoding.default_internal = 'ASCII_8BIT'.
@@ -98,6 +100,9 @@ class Fluent::JabberOutput < Fluent::Output
98
100
  data = escape_xhtml(data) if need_escape
99
101
  when 'br'
100
102
  data = escape_xhtml(data).gsub(/\n/, '<br />')
103
+ when 'uri_component'
104
+ data = URI.escape(data, Regexp.union(URI::UNSAFE, /[?&=+]/))
105
+ data = escape_xhtml(data) if need_escape
101
106
  else
102
107
  raise "Unknown filter: #{filter}"
103
108
  end
@@ -144,6 +144,12 @@ describe Fluent::JabberOutput do
144
144
  subject.format_with('${a|br}', 0, {'a'=>"<>\n"}, false).should == "&lt;&gt;<br />"
145
145
  end
146
146
  end
147
+ context '|u' do
148
+ it 'should escape params for uri_component' do
149
+ subject.format_with('${a|uri_component}', 0, {'a'=>'hoge'}, false).should == "hoge"
150
+ subject.format_with('${a|uri_component}', 0, {'a'=>'/?a=b+c&'}, false).should == "/%3Fa%3Db%2Bc%26"
151
+ end
152
+ end
147
153
  end
148
154
 
149
155
  context 'xhtml_format' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-jabber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-02 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -109,9 +109,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 1.8.24
112
+ rubygems_version: 1.8.19
113
113
  signing_key:
114
114
  specification_version: 3
115
115
  summary: Fluentd output plugin for XMPP(Jabber) protocol
116
116
  test_files:
117
117
  - spec/out_jabber_spec.rb
118
+ has_rdoc: