spunk 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 room
14
- bot.join_room(room)
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?/
@@ -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] || nil
15
- @ssl = options[:ssl] || false
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spunk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: