chatrix 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c4ccf55e9b611ac9df88a62fbc8e1924815abf3
4
- data.tar.gz: cb828784148992194d31f5771a7a653c07b9fa24
3
+ metadata.gz: ba2375aa13d58ebfd71dd9b5638ece86b117ab7c
4
+ data.tar.gz: b1af2a00d81f14c65cb431a7e2dd5cda2c64f131
5
5
  SHA512:
6
- metadata.gz: 3ce6a0c0835155c222cebaf4f4621f544f343c067fd60db25b250f1210fa2cf09082f7916a6de15e3fe47ab78987020f5037462f74747c45bd177c4bccad0cd0
7
- data.tar.gz: f0d9572000576c1085f211807e3eac8063fa4f4f88e5fadc936230b5b454440a416bd0f8f8b24ae1205506d9e0694baa06cc20fce745654dd19a89c80f3dc0cb
6
+ metadata.gz: d024ab9abac227ab99042caa3a3a30659c892f4f1345d7c304905c59df88c06aaf39ca00557d43863833da8ae4ef68a656ee84bd60e21355358177110b5e1a9a
7
+ data.tar.gz: 58b18862a142eb30a0c366dbe0a085d4c5a8519129da9615c63c04aa624cfa92ebea37ee421b4264a807ad201598a242f09b11514402ffe9d8180a0f7978fdbe
@@ -202,17 +202,21 @@ module Chatrix
202
202
  #
203
203
  # @param room [String] The room to send to.
204
204
  # @param html [String] The HTML formatted text to send.
205
+ # @param clean [String, nil] If set, this will be put in the `body`
206
+ # field of the content, to be used as the message when the formatted
207
+ # version cannot be displayed.
208
+ #
205
209
  # @return (see #send_message_raw)
206
210
  #
207
211
  # @example Sending an HTML message
208
212
  # send_html('#html:matrix.org',
209
213
  # '<strong>Hello</strong> <em>world</em>!')
210
- def send_html(room, html)
214
+ def send_html(room, html, clean = nil)
211
215
  send_message_raw(
212
216
  room,
213
217
  msgtype: 'm.text',
214
218
  format: 'org.matrix.custom.html',
215
- body: html.gsub(%r{</?[^>]*?>}, ''), # TODO: Make this better
219
+ body: clean || html.gsub(%r{</?[^>]*?>}, ''), # TODO: Make this better
216
220
  formatted_body: html
217
221
  )
218
222
  end
@@ -36,9 +36,12 @@ module Chatrix
36
36
 
37
37
  # Sends an HTML message to the room.
38
38
  # @param message [String] The HTML formatted message to send.
39
+ # @param clean [String, nil] The "clean" message to use for the `body`
40
+ # field for clients that are unable to render the formatted
41
+ # message.
39
42
  # @return (see #send_message)
40
- def send_html(message)
41
- @matrix.rooms.actions.send_html @room.id, message
43
+ def send_html(message, clean = nil)
44
+ @matrix.rooms.actions.send_html @room.id, message, clean
42
45
  end
43
46
  end
44
47
  end
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Chatrix
5
5
  # The current version of this gem.
6
- VERSION = '1.1.0'.freeze
6
+ VERSION = '1.2.0'.freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hellberg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-03 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty