matrix_sdk 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/matrix_sdk/api.rb +1 -1
- data/lib/matrix_sdk/protocols/ss.rb +1 -1
- data/lib/matrix_sdk/room.rb +35 -16
- data/lib/matrix_sdk/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 444586f27d6c0e30f71f5a9c064c0a3690ac692c819c477642fd143949d06c67
|
4
|
+
data.tar.gz: 5391c9869e9534f2e3fffd09313423c12228e90931d41d5e3724795b96ea4d20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 641b169f971c77acc2123f3750f920aff520074972e5bf307706a0bd644eafd9415a4a7d2a9996f9389aed40683da823c26615b6766b0785fdaeec3c9686be71
|
7
|
+
data.tar.gz: 6c0486fab519db6bc9e33bd1f3826d49128d84974d463105d82370461fba2dba3e6aa44f9b2dc0b4662e8bb4d43106b9b10025833b3be860f68402dc32737bdb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## v1.1.1 - 2019-06-05
|
2
|
+
|
3
|
+
- Fixes a faulty include which broke the single implemented S2S endpoint
|
4
|
+
- Replaces the room name handling with a cached lazy loading system
|
5
|
+
|
1
6
|
## v1.1.0 - 2019-06-04
|
2
7
|
|
3
8
|
- The create_room method in the client abstraction now automatically stores the created room
|
data/lib/matrix_sdk/api.rb
CHANGED
@@ -13,7 +13,7 @@ module MatrixSdk
|
|
13
13
|
include MatrixSdk::Protocols::AS
|
14
14
|
include MatrixSdk::Protocols::CS
|
15
15
|
include MatrixSdk::Protocols::IS
|
16
|
-
include MatrixSdk::Protocols::
|
16
|
+
include MatrixSdk::Protocols::SS
|
17
17
|
|
18
18
|
USER_AGENT = "Ruby Matrix SDK v#{MatrixSdk::VERSION}"
|
19
19
|
DEFAULT_HEADERS = {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module MatrixSdk::Protocols::SS
|
4
4
|
# Gets the server version
|
5
5
|
def server_version
|
6
|
-
Response.new(self, request(:get, :federation_v1, '/version').server).tap do |resp|
|
6
|
+
MatrixSdk::Response.new(self, request(:get, :federation_v1, '/version').server).tap do |resp|
|
7
7
|
resp.instance_eval <<-'CODE', __FILE__, __LINE__ + 1
|
8
8
|
def to_s
|
9
9
|
"#{name} #{version}"
|
data/lib/matrix_sdk/room.rb
CHANGED
@@ -39,7 +39,7 @@ module MatrixSdk
|
|
39
39
|
# @return [Array(Object)] the last +event_history_limit+ events to arrive in the room
|
40
40
|
# @see https://matrix.org/docs/spec/client_server/r0.3.0.html#get-matrix-client-r0-sync
|
41
41
|
# The timeline events are what will end up in here
|
42
|
-
attr_reader :id, :client, :
|
42
|
+
attr_reader :id, :client, :topic, :aliases, :members, :events
|
43
43
|
|
44
44
|
# @!attribute [r] on_event
|
45
45
|
# @return [EventHandlerArray] The list of event handlers for all events
|
@@ -81,6 +81,8 @@ module MatrixSdk
|
|
81
81
|
instance_variable_set("@#{k}", v) if instance_variable_defined? "@#{k}"
|
82
82
|
end
|
83
83
|
|
84
|
+
@name_checked = Time.new(0)
|
85
|
+
|
84
86
|
logger.debug "Created room #{room_id}"
|
85
87
|
end
|
86
88
|
|
@@ -125,6 +127,16 @@ module MatrixSdk
|
|
125
127
|
members
|
126
128
|
end
|
127
129
|
|
130
|
+
def name
|
131
|
+
return @name if Time.now - @name_checked < 10
|
132
|
+
|
133
|
+
@name_checked = Time.now
|
134
|
+
@name ||= client.api.get_room_name(id)
|
135
|
+
rescue MatrixNotFoundError
|
136
|
+
# No room name has been specified
|
137
|
+
nil
|
138
|
+
end
|
139
|
+
|
128
140
|
# Gets the avatar url of the room - if any
|
129
141
|
def avatar_url
|
130
142
|
@avatar_url ||= client.api.get_room_state(id, 'm.room.avatar').url
|
@@ -410,12 +422,14 @@ module MatrixSdk
|
|
410
422
|
# Reloads the name of the room
|
411
423
|
# @return [Boolean] if the name was changed or not
|
412
424
|
def reload_name!
|
413
|
-
data =
|
414
|
-
|
425
|
+
data = begin
|
426
|
+
client.api.get_room_name(id)
|
427
|
+
rescue MatrixNotFoundError
|
428
|
+
nil
|
429
|
+
end
|
430
|
+
changed = data[:name] != @name
|
415
431
|
@name = data[:name] if changed
|
416
432
|
changed
|
417
|
-
rescue MatrixNotFoundError
|
418
|
-
nil
|
419
433
|
end
|
420
434
|
alias refresh_name! reload_name!
|
421
435
|
|
@@ -427,12 +441,14 @@ module MatrixSdk
|
|
427
441
|
# Reloads the topic of the room
|
428
442
|
# @return [Boolean] if the topic was changed or not
|
429
443
|
def reload_topic!
|
430
|
-
data =
|
431
|
-
|
444
|
+
data = begin
|
445
|
+
client.api.get_room_topic(id)
|
446
|
+
rescue MatrixNotFoundError
|
447
|
+
nil
|
448
|
+
end
|
449
|
+
changed = data[:topic] != @topic
|
432
450
|
@topic = data[:topic] if changed
|
433
451
|
changed
|
434
|
-
rescue MatrixNotFoundError
|
435
|
-
nil
|
436
452
|
end
|
437
453
|
alias refresh_topic! reload_topic!
|
438
454
|
|
@@ -449,18 +465,21 @@ module MatrixSdk
|
|
449
465
|
# @note The list of aliases is not sorted, ordering changes will result in
|
450
466
|
# alias list updates.
|
451
467
|
def reload_aliases!
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
468
|
+
begin
|
469
|
+
new_aliases = client.api.get_room_state(id, 'm.room.aliases').aliases
|
470
|
+
rescue MatrixNotFoundError
|
471
|
+
data = client.api.get_room_state(id)
|
472
|
+
new_aliases = data.select { |chunk| chunk[:type] == 'm.room.aliases' && chunk.key?(:content) && chunk[:content].key?(:aliases) }
|
473
|
+
.map { |chunk| chunk[:content][:aliases] }
|
474
|
+
.flatten
|
475
|
+
.compact
|
476
|
+
end
|
477
|
+
|
457
478
|
return false if new_aliases.nil?
|
458
479
|
|
459
480
|
changed = new_aliases != aliases
|
460
481
|
@aliases = new_aliases if changed
|
461
482
|
changed
|
462
|
-
rescue MatrixNotFoundError
|
463
|
-
nil
|
464
483
|
end
|
465
484
|
alias refresh_aliases! reload_aliases!
|
466
485
|
|
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: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Olofsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.0.
|
149
|
+
rubygems_version: 3.0.3
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: SDK for applications using the Matrix protocol
|