sclemmer-robut 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/robut/plugin.rb +2 -2
- data/lib/robut/presence.rb +2 -2
- data/lib/robut/room.rb +2 -11
- data/lib/robut/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: 9c4da3e382334afd2a055fedbace27798fe5f692
|
4
|
+
data.tar.gz: 0512c9771139fc9c084bd78a7c4ad4ccfbf68afb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 019eb92981b1a789d4ed91bec9bdbb94817ad0d7847d8c97c616d3347db0a110cef7cc6cd4a7ed675d546119ecd4e5a4a36b901cdc230e5114fda13b83adb972
|
7
|
+
data.tar.gz: f35d244057fb2bc44a7421ab0269b40c166cc7f0a3b78b11fd9fdd7c6476635b1da82b7b4f2d56fc6d60936d1be40029f66cce35688928f922f7c13ee30deec7
|
data/lib/robut/plugin.rb
CHANGED
@@ -145,7 +145,7 @@ module Robut::Plugin
|
|
145
145
|
# If you want to stop the plugin execution chain, return +true+ from this
|
146
146
|
# method. Plugins are handled in the order that they appear in
|
147
147
|
# Robut::Plugin.plugins
|
148
|
-
def handle(
|
148
|
+
def handle(room_name, sender_nick, message)
|
149
149
|
if matchers.empty?
|
150
150
|
raise NotImplementedError, "Implement me in #{self.class.name}!"
|
151
151
|
else
|
@@ -169,7 +169,7 @@ module Robut::Plugin
|
|
169
169
|
def fake_message(time, sender_nick, msg)
|
170
170
|
# TODO: ensure this connection is threadsafe
|
171
171
|
plugins = Robut::Plugin.plugins.map { |p| p.new(reply_to, private_sender) }
|
172
|
-
reply_to.handle_message(plugins, time, sender_nick, msg)
|
172
|
+
reply_to.handle_message(plugins, time, sender_nick, msg, name)
|
173
173
|
end
|
174
174
|
|
175
175
|
# Accessor for the store instance
|
data/lib/robut/presence.rb
CHANGED
@@ -10,7 +10,7 @@ class Robut::Presence
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# Sends the chat message +message+ through +plugins+.
|
13
|
-
def handle_message(plugins, time, nick, message)
|
13
|
+
def handle_message(plugins, time, nick, message, room_name=nil)
|
14
14
|
# ignore all messages sent by robut. If you really want robut to
|
15
15
|
# reply to itself, you can use +fake_message+.
|
16
16
|
return if nick == connection.config.nick
|
@@ -19,7 +19,7 @@ class Robut::Presence
|
|
19
19
|
return if time < (STARTED + 10)
|
20
20
|
plugins.each do |plugin|
|
21
21
|
begin
|
22
|
-
rsp = plugin.handle(
|
22
|
+
rsp = plugin.handle(room_name, nick, message)
|
23
23
|
break if rsp == true
|
24
24
|
rescue => e
|
25
25
|
error = "UH OH! #{plugin.class.name} just crashed!"
|
data/lib/robut/room.rb
CHANGED
@@ -17,7 +17,7 @@ class Robut::Room < Robut::Presence
|
|
17
17
|
# Add the callback from messages that occur inside the room
|
18
18
|
muc.on_message do |time, nick, message|
|
19
19
|
plugins = Robut::Plugin.plugins.map { |p| p.new(self) }
|
20
|
-
handle_message(plugins, time, nick, message)
|
20
|
+
handle_message(plugins, time, nick, message, name)
|
21
21
|
end
|
22
22
|
|
23
23
|
muc.join(self.name + '/' + connection.config.nick)
|
@@ -25,15 +25,6 @@ class Robut::Room < Robut::Presence
|
|
25
25
|
|
26
26
|
# Send +message+ to the room we're currently connected to
|
27
27
|
def reply(message, to)
|
28
|
-
|
29
|
-
if message =~ /</
|
30
|
-
msg.xhtml_body = message
|
31
|
-
else
|
32
|
-
msg.body = message
|
33
|
-
end
|
34
|
-
$stderr.puts 'msg: %s' % msg.inspect
|
35
|
-
$stderr.puts 'msg.body: %s' % msg.body.inspect
|
36
|
-
$stderr.puts 'msg.xhtml_body: %s' % msg.xhtml_body.inspect
|
37
|
-
muc.send(msg)
|
28
|
+
muc.send(Jabber::Message.new(muc.room, message))
|
38
29
|
end
|
39
30
|
end
|
data/lib/robut/version.rb
CHANGED