matrix_sdk 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/matrix_sdk/api.rb +8 -8
- data/lib/matrix_sdk/client.rb +3 -2
- data/lib/matrix_sdk/protocols/cs.rb +1 -1
- data/lib/matrix_sdk/room.rb +15 -0
- data/lib/matrix_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af1e7af0f473a5c44df1ede83655cdbdb120e215e42f125b6af576740b88aa6
|
4
|
+
data.tar.gz: cca80fe97ca22f0ddb0c5a2b39b24b70345baa25fb20bea305fa019f46ca7d3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e4c694d8489dae1b2602d01f4aab08b20119c6697e83b41a2a463adb7ebcaf7b1afd439db04a6e54a0979c5a93be865c8afa3d2d03b4ca34b98f82afae87a5f
|
7
|
+
data.tar.gz: 8f52c12d1eb8af55ac5bc011852c9d5f648e9de1cc3241ea1ed76530036b02cff373cb69b8a4c721956add3df1359377d79b2fa2562e8dab8efe5ce877596e2d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 2.1.2 - 2020-09-10
|
2
|
+
|
3
|
+
- Adds method for reading complete member lists for rooms, improves the CS spec adherence
|
4
|
+
- Adds test for state events
|
5
|
+
- Fixes state event handler for rooms not actually passing events
|
6
|
+
- Fixes Api#new_for_domain using a faulty URI in certain cases
|
7
|
+
|
1
8
|
## 2.1.1 - 2020-08-21
|
2
9
|
|
3
10
|
- Fixes crash if state event content is null (#11)
|
data/lib/matrix_sdk/api.rb
CHANGED
@@ -115,10 +115,10 @@ module MatrixSdk
|
|
115
115
|
if target_uri.nil?
|
116
116
|
# Attempt .well-known discovery for server-to-server
|
117
117
|
well_known = begin
|
118
|
-
|
119
|
-
logger.debug "Trying #{
|
120
|
-
data = Net::HTTP.start(
|
121
|
-
http.get(
|
118
|
+
wk_uri = URI("https://#{domain}/.well-known/matrix/server")
|
119
|
+
logger.debug "Trying #{wk_uri}..."
|
120
|
+
data = Net::HTTP.start(wk_uri.host, wk_uri.port, use_ssl: true, open_timeout: 5, read_timeout: 5, write_timeout: 5) do |http|
|
121
|
+
http.get(wk_uri.path).body
|
122
122
|
end
|
123
123
|
JSON.parse(data)
|
124
124
|
rescue StandardError => e
|
@@ -133,10 +133,10 @@ module MatrixSdk
|
|
133
133
|
elsif %i[client identity].include? target
|
134
134
|
# Attempt .well-known discovery
|
135
135
|
well_known = begin
|
136
|
-
|
137
|
-
logger.debug "Trying #{
|
138
|
-
data = Net::HTTP.start(
|
139
|
-
http.get(
|
136
|
+
wk_uri = URI("https://#{domain}/.well-known/matrix/client")
|
137
|
+
logger.debug "Trying #{wk_uri}..."
|
138
|
+
data = Net::HTTP.start(wk_uri.host, wk_uri.port, use_ssl: true, open_timeout: 5, read_timeout: 5, write_timeout: 5) do |http|
|
139
|
+
http.get(wk_uri.path).body
|
140
140
|
end
|
141
141
|
data = JSON.parse(data)
|
142
142
|
rescue StandardError => e
|
data/lib/matrix_sdk/client.rb
CHANGED
@@ -343,7 +343,7 @@ module MatrixSdk
|
|
343
343
|
|
344
344
|
# Joins an already created room
|
345
345
|
#
|
346
|
-
# @param room_id_or_alias [String,MXID] A room alias (#room:
|
346
|
+
# @param room_id_or_alias [String,MXID] A room alias (#room:example.com) or a room ID (!id:example.com)
|
347
347
|
# @param server_name [Array[String]] A list of servers to attempt the join through, required for IDs
|
348
348
|
# @return [Room] The resulting room
|
349
349
|
# @see Protocols::CS#join_room
|
@@ -561,6 +561,7 @@ module MatrixSdk
|
|
561
561
|
return unless state_event.key? :type
|
562
562
|
|
563
563
|
room = ensure_room(room_id)
|
564
|
+
room.send :put_state_event, state_event
|
564
565
|
content = state_event[:content]
|
565
566
|
case state_event[:type]
|
566
567
|
when 'm.room.name'
|
@@ -617,7 +618,7 @@ module MatrixSdk
|
|
617
618
|
|
618
619
|
join[:timeline][:events].each do |event|
|
619
620
|
event[:room_id] = room_id.to_s
|
620
|
-
handle_state(room_id, event)
|
621
|
+
handle_state(room_id, event) if event.key? :state_key
|
621
622
|
room.send :put_event, event
|
622
623
|
|
623
624
|
fire_event(MatrixEvent.new(self, event), event[:type])
|
@@ -1637,7 +1637,7 @@ module MatrixSdk::Protocols::CS
|
|
1637
1637
|
|
1638
1638
|
room_id = ERB::Util.url_encode room_id.to_s
|
1639
1639
|
|
1640
|
-
request(:get, :client_r0, "/rooms/#{room_id}/members", query: query)
|
1640
|
+
request(:get, :client_r0, "/rooms/#{room_id}/members", query: query.merge(params))
|
1641
1641
|
end
|
1642
1642
|
|
1643
1643
|
# Gets a list of the joined members in a room
|
data/lib/matrix_sdk/room.rb
CHANGED
@@ -157,6 +157,17 @@ module MatrixSdk
|
|
157
157
|
members
|
158
158
|
end
|
159
159
|
|
160
|
+
# Get all members (member events) in the room
|
161
|
+
#
|
162
|
+
# @note This will also count members who've knocked, been invited, have left, or have been banned.
|
163
|
+
#
|
164
|
+
# @param params [Hash] Additional query parameters to pass to the room member listing - e.g. for filtering purposes.
|
165
|
+
#
|
166
|
+
# @return [Array(User)] The complete list of members in the room, regardless of membership state
|
167
|
+
def all_members(**params)
|
168
|
+
client.api.get_room_members(id, **params)[:chunk].map { |ch| client.get_user(ch[:state_key]) }
|
169
|
+
end
|
170
|
+
|
160
171
|
# Gets the current name of the room, querying the API if necessary
|
161
172
|
#
|
162
173
|
# @note Will cache the current name for 15 minutes
|
@@ -680,5 +691,9 @@ module MatrixSdk
|
|
680
691
|
def put_ephemeral_event(event)
|
681
692
|
fire_ephemeral_event MatrixEvent.new(self, event)
|
682
693
|
end
|
694
|
+
|
695
|
+
def put_state_event(event)
|
696
|
+
fire_state_event MatrixEvent.new(self, event)
|
697
|
+
end
|
683
698
|
end
|
684
699
|
end
|
data/lib/matrix_sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matrix_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Olofsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mocha
|