jabber_admin 1.0.4 → 1.0.5
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/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/jabber_admin/commands/get_room_affiliations.rb +23 -0
- data/lib/jabber_admin/version.rb +1 -1
- data/lib/jabber_admin.rb +15 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f66fd5543a21b130fc4a24d7c6d9d05659e63b956c379f7973028f7902595e81
|
4
|
+
data.tar.gz: a4e3cb834dec2a20f2d093e1588ba24167d06cdb1db2d0ce0722d0c750a39c47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9b6847f6493eee80e7086ab76a01ab4bf0f29e11fc58451d048ece7954db51bd7c349bf7e572260475ef34982d4a7cdf92fe546105bacf55189ecead923f80e
|
7
|
+
data.tar.gz: 4dd98caa90adb727d1cca90bc4b4c914c6cb744826965819cd54695535a9d729d695b135318adf9a140b06782a9bd3790961b77cae2f3fa9b4aa346765de93a6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 1.0.5
|
2
|
+
|
3
|
+
* Added support for the predefined command `get_room_affiliations` (#10)
|
4
|
+
* Added the top-level helper `JabberAdmin.room_exist?` to determine whether
|
5
|
+
a room exists or not (#10)
|
6
|
+
|
1
7
|
### 1.0.4
|
2
8
|
|
3
9
|
* Added support for the predefined command `destroy_room`
|
data/README.md
CHANGED
@@ -115,6 +115,7 @@ Here comes a list of all supported predefined commands:
|
|
115
115
|
- [unregister](https://bit.ly/2wwYnDE)
|
116
116
|
- [unsubscribe_room](https://bit.ly/2G5zcrj)
|
117
117
|
- [destroy_room](https://bit.ly/31CtqxB)
|
118
|
+
- [get_room_affiliations](https://bit.ly/3qI9Nyq)
|
118
119
|
|
119
120
|
If you want to contribute more, we accept pull requests!
|
120
121
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JabberAdmin
|
4
|
+
module Commands
|
5
|
+
# Get room affiliations.
|
6
|
+
#
|
7
|
+
# @see https://bit.ly/3qI9Nyq
|
8
|
+
class GetRoomAffiliations
|
9
|
+
# Pass the correct data to the given callable.
|
10
|
+
#
|
11
|
+
# @param callable [Proc, #call] the callable to call
|
12
|
+
# @param room [String] room JID (eg. +room1@conference.localhost+)
|
13
|
+
def self.call(callable, room:)
|
14
|
+
name, service = room.split('@')
|
15
|
+
res = callable.call('get_room_affiliations', check_res_body: false,
|
16
|
+
name: name,
|
17
|
+
service: service)
|
18
|
+
|
19
|
+
res.body ? JSON.parse(res.body) : nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/jabber_admin/version.rb
CHANGED
data/lib/jabber_admin.rb
CHANGED
@@ -112,6 +112,21 @@ module JabberAdmin
|
|
112
112
|
proc { |*args| ApiCall.send(method, *args) }
|
113
113
|
end
|
114
114
|
|
115
|
+
# Determine if a room exists. This is a convenience method for the
|
116
|
+
# +JabberAdmin::Commands::GetRoomAffiliations+ command, which can be used
|
117
|
+
# to reliably determine whether a room exists or not.
|
118
|
+
#
|
119
|
+
# @param room [String] the name of the room to check
|
120
|
+
# @return [Boolean] whether the room exists or not
|
121
|
+
def self.room_exist?(room)
|
122
|
+
get_room_affiliations!(room: room)
|
123
|
+
true
|
124
|
+
rescue JabberAdmin::CommandError => e
|
125
|
+
raise e unless /room does not exist/.match? e.response.body
|
126
|
+
|
127
|
+
false
|
128
|
+
end
|
129
|
+
|
115
130
|
# We support all methods if you ask for. This is our dynamic command approach
|
116
131
|
# here to support predefined and custom commands in the same namespace.
|
117
132
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jabber_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Vogt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -260,6 +260,7 @@ files:
|
|
260
260
|
- lib/jabber_admin/commands/create_room.rb
|
261
261
|
- lib/jabber_admin/commands/create_room_with_opts.rb
|
262
262
|
- lib/jabber_admin/commands/destroy_room.rb
|
263
|
+
- lib/jabber_admin/commands/get_room_affiliations.rb
|
263
264
|
- lib/jabber_admin/commands/get_vcard.rb
|
264
265
|
- lib/jabber_admin/commands/muc_register_nick.rb
|
265
266
|
- lib/jabber_admin/commands/register.rb
|
@@ -298,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
299
|
- !ruby/object:Gem::Version
|
299
300
|
version: '0'
|
300
301
|
requirements: []
|
301
|
-
rubygems_version: 3.
|
302
|
+
rubygems_version: 3.0.9
|
302
303
|
signing_key:
|
303
304
|
specification_version: 4
|
304
305
|
summary: Library for the ejabberd RESTful admin API
|