CQHTTP 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/cqhttp-dbus +64 -14
- data/lib/CQHTTP/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db0b0a77276f93d3b81abb0fad47c050c7fe4d5c
|
4
|
+
data.tar.gz: 22e17482ba89fcaba487c81a16b3d40153e7112b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 184000c2b7eb45220139af5bb2a64a5e90412ad67cbc3ef8a144ebda343fb7953982a753063e5a9f8b1302e0b27028d70d0f9e63aa4179cf953b79ee45483dba
|
7
|
+
data.tar.gz: 96a9840f5d89175f6def2ebfb302435f1f68584837b3b2e901a2cd6d8bab7a5ed3ec2ea87e004192fe8a7f85921ec8a8280a7dae0a9f03c612d047bfd8116d9a
|
data/exe/cqhttp-dbus
CHANGED
@@ -16,7 +16,19 @@ class CQHTTP2DBus < DBus::Object
|
|
16
16
|
end
|
17
17
|
|
18
18
|
dbus_signal :message, 'message_type:s, json:s'
|
19
|
+
%i[private group get_group_list].each do |i|
|
20
|
+
dbus_signal i, 'json:s'
|
21
|
+
end
|
19
22
|
dbus_signal :event, 'event:s, json:s'
|
23
|
+
%i[
|
24
|
+
group_upload
|
25
|
+
group_admin
|
26
|
+
group_decrease
|
27
|
+
group_increase
|
28
|
+
friend_add
|
29
|
+
].each do
|
30
|
+
dbus_signal i, 'json:s'
|
31
|
+
end
|
20
32
|
dbus_signal :friend_request, 'json:s'
|
21
33
|
dbus_signal :join_request, 'json:s'
|
22
34
|
dbus_signal :invite_request, 'json:s'
|
@@ -25,27 +37,65 @@ class CQHTTP2DBus < DBus::Object
|
|
25
37
|
end
|
26
38
|
end
|
27
39
|
|
28
|
-
|
29
|
-
|
30
|
-
obj
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
40
|
+
# case signal
|
41
|
+
class Case
|
42
|
+
def initialize(info, obj)
|
43
|
+
@info = info
|
44
|
+
@obj = obj
|
45
|
+
@json = gen_json
|
46
|
+
end
|
47
|
+
|
48
|
+
def gen_json
|
49
|
+
JSON.pretty_generate @info
|
50
|
+
end
|
51
|
+
|
52
|
+
def send_json(name)
|
53
|
+
@obj.send name, @json
|
54
|
+
end
|
55
|
+
|
56
|
+
def unknow
|
57
|
+
@obj.send_json :unknow
|
58
|
+
end
|
59
|
+
|
60
|
+
def run
|
61
|
+
send_json :all
|
62
|
+
case @info['post_type']
|
63
|
+
when 'message' then message
|
64
|
+
when 'event' then event
|
65
|
+
when 'request' then request
|
66
|
+
else unknow
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def message
|
71
|
+
@obj.message @info['message_type'], @json
|
72
|
+
send_json @info['message_type']
|
73
|
+
end
|
74
|
+
|
75
|
+
def event
|
76
|
+
@obj.event @info['event'], @json
|
77
|
+
send_json @info['event']
|
78
|
+
end
|
79
|
+
|
80
|
+
def request
|
81
|
+
case @info['request_type']
|
82
|
+
when 'friend' then send_json :friend_request
|
37
83
|
when 'group'
|
38
84
|
case j['sub_type']
|
39
|
-
when 'add' then
|
40
|
-
when 'invite' then
|
41
|
-
else
|
85
|
+
when 'add' then send_json :join_request
|
86
|
+
when 'invite' then send_json :invite_request
|
87
|
+
else unknow
|
42
88
|
end
|
43
|
-
else
|
89
|
+
else unknow
|
44
90
|
end
|
45
|
-
else obj.unknow j.to_json
|
46
91
|
end
|
47
92
|
end
|
48
93
|
|
94
|
+
def cqhttp2dbus(c, obj)
|
95
|
+
j = c.json
|
96
|
+
Case.new(j, obj).run
|
97
|
+
end
|
98
|
+
|
49
99
|
bus = DBus::SessionBus.instance
|
50
100
|
service = bus.request_service 'org.dastudio.qq'
|
51
101
|
obj = CQHTTP2DBus.new '/org/dastudio/qq'
|
data/lib/CQHTTP/version.rb
CHANGED