spunk 0.1.1 → 0.1.2
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/spunk/base_parser.rb +7 -2
- data/lib/spunk/bot.rb +11 -3
- metadata +1 -1
data/lib/spunk/base_parser.rb
CHANGED
@@ -10,8 +10,13 @@ module Spunk
|
|
10
10
|
if command =~ /^INVITE #{bot.nickname}$/i
|
11
11
|
room = Helpers.parse_room(hash[:parameters])
|
12
12
|
hash[:logger].debug "Recieved invite for room #{room}"
|
13
|
-
if
|
14
|
-
|
13
|
+
if bot.invite_ok == true
|
14
|
+
if room
|
15
|
+
bot.join_room(room)
|
16
|
+
hash[:logger].debug "Joined #{room}"
|
17
|
+
end
|
18
|
+
else
|
19
|
+
hash[:logger].error "Invite support is turned off... can't be invited to a room"
|
15
20
|
end
|
16
21
|
end
|
17
22
|
if command =~ /^KICK (#\S+)\W(.*)\W?/
|
data/lib/spunk/bot.rb
CHANGED
@@ -4,15 +4,20 @@ require 'logger'
|
|
4
4
|
|
5
5
|
module Spunk
|
6
6
|
class Bot
|
7
|
-
attr_accessor :nickname, :server, :joined_rooms, :ssl, :server, :rooms, :token, :logger
|
7
|
+
attr_accessor :nickname, :server, :joined_rooms, :ssl, :server, :rooms, :token, :logger, :nickserv_password, :invite_ok
|
8
8
|
attr_reader :processors, :request_processors, :response_processors, :hostname
|
9
9
|
|
10
10
|
def initialize(options = {})
|
11
11
|
options.each do |option, value|
|
12
12
|
instance_variable_set("@#{option}", value)
|
13
13
|
end
|
14
|
-
@token = options[:token]
|
15
|
-
@ssl = options[:ssl]
|
14
|
+
@token = options[:token] ||= nil
|
15
|
+
@ssl = options[:ssl] ||= false
|
16
|
+
if options[:invite_ok].nil?
|
17
|
+
options[:invite_ok] = true
|
18
|
+
end
|
19
|
+
@invite_ok = options[:invite_ok]
|
20
|
+
@nickserv_password = options[:nickserv_password]
|
16
21
|
@processors = []
|
17
22
|
@request_processors = []
|
18
23
|
@response_processors = []
|
@@ -161,6 +166,9 @@ module Spunk
|
|
161
166
|
end
|
162
167
|
send_message "NICK #{@nickname}"
|
163
168
|
send_message "USER #{@username} #{@hostname} bla :#{@fullname}"
|
169
|
+
unless @nickserv_password.nil?
|
170
|
+
send_message "PRIVMSG NickServ :identify #{@nickserv_password}"
|
171
|
+
end
|
164
172
|
end
|
165
173
|
|
166
174
|
def join_room(room, password = nil)
|