chatrix 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/lib/chatrix/api/room_actions.rb +6 -2
- data/lib/chatrix/components/messaging.rb +5 -2
- data/lib/chatrix/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba2375aa13d58ebfd71dd9b5638ece86b117ab7c
|
4
|
+
data.tar.gz: b1af2a00d81f14c65cb431a7e2dd5cda2c64f131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/chatrix/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|