del 0.1.14 → 0.1.15
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/del/configuration.rb +0 -2
- data/lib/del/connection.rb +12 -14
- data/lib/del/repository.rb +3 -1
- data/lib/del/user.rb +4 -0
- data/lib/del/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c692700ff52b08475986f45fd13437d99d69dfa93123bde4d96021200894cd4
|
4
|
+
data.tar.gz: 3343f38e6ae8c7760d5bcee2315abe2c20f972b298beb1a201c34c1001ee26c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e68e68bad8620911482ae6a029bd4bab2e41e0ce7c21ee295221e68327a39c5cd8702a256a408751623c09522b63d96ca0f95f92f4f401d4c322b7aa78fb0842
|
7
|
+
data.tar.gz: 57f62a3bc023b8003d8c872864e94be4f6a3fc4ad7e6352793846d8deb6ed8b63689cbf4feda04f73bbdbaefae29b31018131eb3df7d769478fe6ead240d5dba
|
data/lib/del/configuration.rb
CHANGED
@@ -9,7 +9,6 @@ module Del
|
|
9
9
|
attr_accessor :muc_domain
|
10
10
|
attr_accessor :name
|
11
11
|
attr_accessor :password
|
12
|
-
attr_accessor :rooms
|
13
12
|
attr_accessor :router
|
14
13
|
attr_accessor :users
|
15
14
|
attr_accessor :socket_file
|
@@ -23,7 +22,6 @@ module Del
|
|
23
22
|
@muc_domain = settings.fetch(:muc_domain, "conf.hipchat.com")
|
24
23
|
@name = settings.fetch(:full_name)
|
25
24
|
@password = settings.fetch(:password)
|
26
|
-
@rooms = Repository.new
|
27
25
|
@router = DefaultRouter.new
|
28
26
|
@socket_file = settings.fetch(:socket_file, SOCKET_FILE)
|
29
27
|
@users = Repository.new
|
data/lib/del/connection.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module Del
|
2
2
|
class Connection
|
3
|
-
attr_reader :configuration
|
3
|
+
attr_reader :configuration
|
4
4
|
|
5
5
|
def initialize(configuration:)
|
6
6
|
@configuration = configuration
|
7
|
-
@rooms = configuration.rooms
|
8
|
-
@users = configuration.users
|
9
7
|
@mucs = {}
|
10
8
|
end
|
11
9
|
|
@@ -19,7 +17,7 @@ module Del
|
|
19
17
|
client.auth(configuration.password)
|
20
18
|
roster = Jabber::Roster::Helper.new(client, false)
|
21
19
|
roster.add_update_callback do |old_item, item|
|
22
|
-
users.upsert(item['jid'], item.attributes) if item
|
20
|
+
configuration.users.upsert(item['jid'], item.attributes) if item
|
23
21
|
end
|
24
22
|
roster.get_roster
|
25
23
|
roster.wait_for_roster
|
@@ -30,7 +28,7 @@ module Del
|
|
30
28
|
end
|
31
29
|
client.send(Jabber::Presence.new(:chat))
|
32
30
|
configuration.default_rooms.each do |room|
|
33
|
-
Del.logger.debug("Joining #{room} as #{robot.name}")
|
31
|
+
Del.logger.debug("Joining room '#{room}' as '#{robot.name}'")
|
34
32
|
room_jid = jid_for(room, configuration.muc_domain.dup, robot.name)
|
35
33
|
stripped_jid = room_jid.strip.to_s
|
36
34
|
next if @mucs[stripped_jid]
|
@@ -44,9 +42,9 @@ module Del
|
|
44
42
|
end
|
45
43
|
muc.join(room_jid)
|
46
44
|
end
|
47
|
-
list_rooms(configuration.muc_domain).each do |room|
|
48
|
-
rooms.upsert(room)
|
49
|
-
end
|
45
|
+
#list_rooms(configuration.muc_domain).each do |room|
|
46
|
+
#rooms.upsert(room)
|
47
|
+
#end
|
50
48
|
end
|
51
49
|
|
52
50
|
def deliver(jid, message)
|
@@ -77,14 +75,14 @@ module Del
|
|
77
75
|
@jid ||= jid_for(configuration.jid, "chat.hipchat.com", "bot")
|
78
76
|
end
|
79
77
|
|
80
|
-
def list_rooms(muc_domain)
|
81
|
-
Jabber::MUC::MUCBrowser.new(client).muc_rooms(muc_domain).map do |jid, name|
|
82
|
-
jid.to_s
|
83
|
-
end
|
84
|
-
end
|
78
|
+
#def list_rooms(muc_domain)
|
79
|
+
#Jabber::MUC::MUCBrowser.new(client).muc_rooms(muc_domain).map do |jid, name|
|
80
|
+
#jid.to_s
|
81
|
+
#end
|
82
|
+
#end
|
85
83
|
|
86
84
|
def encode_string(s)
|
87
|
-
s.encode("UTF-8", invalid: :replace, undef: :replace)
|
85
|
+
s.to_s.encode("UTF-8", invalid: :replace, undef: :replace)
|
88
86
|
end
|
89
87
|
|
90
88
|
def jid_for(jid, domain, resource)
|
data/lib/del/repository.rb
CHANGED
data/lib/del/user.rb
CHANGED
data/lib/del/version.rb
CHANGED