omnibot 0.0.6 → 0.0.7
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.
- data/lib/omnibot/jabberbot.rb +9 -1
- data/lib/omnibot/version.rb +1 -1
- metadata +14 -14
data/lib/omnibot/jabberbot.rb
CHANGED
@@ -19,8 +19,14 @@ module OmniBot
|
|
19
19
|
OmniLog::debug "Presence changed:\n...old #{dump_presence old_presence}\n...new #{dump_presence new_presence}"
|
20
20
|
if is_needed_user? old_presence.from
|
21
21
|
@subscriber_online = check_presence? old_presence
|
22
|
+
@subscriber_concrete_jid = old_presence.from
|
22
23
|
OmniLog::debug "Subscriber #{@subscriber} is #{@subscriber_online ? "ready" : "not ready"}"
|
23
24
|
pump_messages if @subscriber_online
|
25
|
+
|
26
|
+
unless @greeting_done
|
27
|
+
@greeting_done = true
|
28
|
+
add_message [Time.now, 'Hello, I am online']
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
@@ -148,6 +154,7 @@ module OmniBot
|
|
148
154
|
|
149
155
|
@messages = []
|
150
156
|
@subscriber_online = false
|
157
|
+
@subscriber_concrete_jid = nil
|
151
158
|
|
152
159
|
@client.on_exception { |e, stream, sym_where| on_exception_handler(e, stream, sym_where) }
|
153
160
|
@client.add_message_callback { |m| on_message_handler m }
|
@@ -179,6 +186,7 @@ module OmniBot
|
|
179
186
|
|
180
187
|
def send message
|
181
188
|
raise 'Not connected' unless @client.is_connected?
|
189
|
+
raise 'No concrete jid' unless @subscriber_concrete_jid
|
182
190
|
|
183
191
|
OmniLog::info "Sending a message..."
|
184
192
|
orig = message[0]
|
@@ -187,7 +195,7 @@ module OmniBot
|
|
187
195
|
body = "Omnibot reported " + say_when_human(orig, Time.now) + ":\n" + content.to_s
|
188
196
|
OmniLog::debug body
|
189
197
|
|
190
|
-
msg = Jabber::Message::new(@
|
198
|
+
msg = Jabber::Message::new(@subscriber_concrete_jid, body)
|
191
199
|
msg.type = :chat
|
192
200
|
@client.send(msg)
|
193
201
|
end
|
data/lib/omnibot/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnibot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- theirix
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-25 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
@@ -28,12 +28,12 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 0
|
30
30
|
version: "0"
|
31
|
+
requirement: *id001
|
31
32
|
prerelease: false
|
32
|
-
version_requirements: *id001
|
33
|
-
type: :runtime
|
34
33
|
name: xmpp4r
|
34
|
+
type: :runtime
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
37
|
none: false
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
@@ -42,12 +42,12 @@ dependencies:
|
|
42
42
|
segments:
|
43
43
|
- 0
|
44
44
|
version: "0"
|
45
|
+
requirement: *id002
|
45
46
|
prerelease: false
|
46
|
-
version_requirements: *id002
|
47
|
-
type: :runtime
|
48
47
|
name: eventmachine
|
48
|
+
type: :runtime
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
segments:
|
57
57
|
- 0
|
58
58
|
version: "0"
|
59
|
+
requirement: *id003
|
59
60
|
prerelease: false
|
60
|
-
version_requirements: *id003
|
61
|
-
type: :runtime
|
62
61
|
name: amqp
|
62
|
+
type: :runtime
|
63
63
|
description: Works with AMQP for sending messages at server side.Sends notifications to an user via XMPP.Can monitor system by performing daily commands.
|
64
64
|
email: theirix@gmail.com
|
65
65
|
executables:
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
115
115
|
- AMQP-compatible server (for example, RabbitMQ)
|
116
116
|
rubyforge_project: nowarning
|
117
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 1.6.2
|
118
118
|
signing_key:
|
119
119
|
specification_version: 3
|
120
120
|
summary: Simple XMPP bot for server monitoring
|