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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18fbc5af5659289e45ccb6201b7224dc28ac2080
4
- data.tar.gz: b0f718ca1281610ae47a511698945962363a4e2c
3
+ metadata.gz: 9c4da3e382334afd2a055fedbace27798fe5f692
4
+ data.tar.gz: 0512c9771139fc9c084bd78a7c4ad4ccfbf68afb
5
5
  SHA512:
6
- metadata.gz: 46a77111afb343a466168d43da2998918b57ded1c3c3c4628645b974ecd5927e9a7cce39c99958758e95b745af31e49336cd09dec686a90ae1c10fdc07565b61
7
- data.tar.gz: a459c72e1b42cb800d3d6f6e2ce66321a7301d6152a8e5981a15939f43aef12bbc51b51348f38f9e8f5995ddc88d3ac6f5fdf8503936a935e79b4fc506a94302
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(time, sender_nick, message)
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
@@ -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(time, nick, message)
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
- msg = Jabber::Message.new(muc.room)
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
@@ -1,4 +1,4 @@
1
1
  module Robut # :nodoc:
2
2
  # Robut's version number.
3
- VERSION = "0.5.4"
3
+ VERSION = "0.6.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sclemmer-robut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Weiss