cinch 2.0.0.pre.4 → 2.0.0.pre.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/cinch/bot.rb CHANGED
@@ -76,7 +76,8 @@ module Cinch
76
76
  # @return [Array<Channel>] All channels the bot currently is in
77
77
  attr_reader :channels
78
78
 
79
- # @return [PluginList] All registered plugins
79
+ # @return [PluginList] The {PluginList} giving access to
80
+ # (un)loading plugins
80
81
  # @version 2.0.0
81
82
  attr_reader :plugins
82
83
 
@@ -93,10 +94,6 @@ module Cinch
93
94
  # @since 1.1.0
94
95
  attr_reader :channel_list
95
96
 
96
- # @return [PluginList] All loaded plugins.
97
- # @version 2.0.0
98
- attr_reader :plugins
99
-
100
97
  # @return [Boolean]
101
98
  # @api private
102
99
  attr_accessor :last_connection_was_successful
@@ -356,6 +353,9 @@ module Cinch
356
353
  @channel_list = ChannelList.new(self)
357
354
  @plugins = PluginList.new(self)
358
355
 
356
+ @join_handler = nil
357
+ @join_timer = nil
358
+
359
359
  super(nil, self)
360
360
  instance_eval(&b) if block_given?
361
361
  end
data/lib/cinch/channel.rb CHANGED
@@ -296,6 +296,7 @@ module Cinch
296
296
  @bot.irc.send("INVITE #{user} #@name")
297
297
  end
298
298
 
299
+ undef_method(:topic=)
299
300
  # Sets the topic.
300
301
  #
301
302
  # @param [String] new_topic the new topic
@@ -43,6 +43,8 @@ module Cinch
43
43
  # dcc.accept(t)
44
44
  # t.close
45
45
  # end
46
+ #
47
+ # @attr_reader filename
46
48
  class Send
47
49
  # @private
48
50
  PRIVATE_NETS = [IPAddr.new("fc00::/7"),
@@ -57,9 +59,6 @@ module Cinch
57
59
  # @return [User]
58
60
  attr_reader :user
59
61
 
60
- # @return [String]
61
- attr_reader :filename
62
-
63
62
  # @return [Integer]
64
63
  attr_reader :size
65
64
 
data/lib/cinch/irc.rb CHANGED
@@ -666,12 +666,13 @@ module Cinch
666
666
  def on_352(msg, events)
667
667
  # RPL_WHOREPLY
668
668
  # "<channel> <user> <host> <server> <nick> <H|G>[*][@|+] :<hopcount> <real name>"
669
- _, channel, user, host, server, nick, flags, hopsrealname = msg.params
670
- hops, realname = hopsrealname.split(" ", 2)
669
+ _, channel, user, host, _, nick, _, hopsrealname = msg.params
670
+ _, realname = hopsrealname.split(" ", 2)
671
671
  channel = Channel(channel)
672
672
  user_object = User(nick)
673
673
  user_object.sync(:user, user, true)
674
674
  user_object.sync(:host, host, true)
675
+ user_object.sync(:realname, realname, true)
675
676
  end
676
677
 
677
678
  def on_354(msg, events)
@@ -689,6 +690,7 @@ module Cinch
689
690
  user_object = User(nick)
690
691
  user_object.sync(:user, user, true)
691
692
  user_object.sync(:host, host, true)
693
+ user_object.sync(:realname, realname, true)
692
694
  user_object.sync(:authname, account == "0" ? nil : account, true)
693
695
  end
694
696
 
@@ -87,7 +87,7 @@ module Cinch
87
87
  options.each do |option|
88
88
  name, value = option.split("=")
89
89
  if value
90
- proc = @@mappings.find {|key, value| key.include?(name)}
90
+ proc = @@mappings.find {|key, _| key.include?(name)}
91
91
  self[name] = (proc && proc[1].call(value)) || value
92
92
  else
93
93
  self[name] = true
@@ -40,6 +40,7 @@ module Cinch
40
40
  end
41
41
 
42
42
  def format_general(message)
43
+ # :print: doesn't call all of :space: so use both.
43
44
  message.gsub(/[^[:print:][:space:]]/) do |m|
44
45
  colorize(m.inspect[1..-2], :bg_white, :black)
45
46
  end
data/lib/cinch/network.rb CHANGED
@@ -82,7 +82,7 @@ module Cinch
82
82
  # @return [Numeric] The `messages per second` value that best suits
83
83
  # the current network
84
84
  def default_messages_per_second
85
- case @network
85
+ case @name
86
86
  when :freenode
87
87
  0.7
88
88
  else
@@ -93,7 +93,7 @@ module Cinch
93
93
  # @return [Integer] The `server queue size` value that best suits
94
94
  # the current network
95
95
  def default_server_queue_size
96
- case @network
96
+ case @name
97
97
  when :quakenet
98
98
  40
99
99
  else
@@ -5,6 +5,7 @@ class Module
5
5
  #
6
6
  # @api private
7
7
  def synced_attr_reader(attribute)
8
+ undef_method(attribute)
8
9
  define_method(attribute) do
9
10
  attr(attribute)
10
11
  end
@@ -44,15 +44,17 @@ module Cinch
44
44
  # @return [User, nil]
45
45
  def find(nick)
46
46
  downcased_nick = nick.irc_downcase(@bot.irc.isupport["CASEMAPPING"])
47
- @cache[downcased_nick]
47
+ @mutex.synchronize do
48
+ return @cache[downcased_nick]
49
+ end
48
50
  end
49
51
 
50
52
  # @api private
51
53
  # @return [void]
52
54
  def update_nick(user)
53
55
  @mutex.synchronize do
54
- @cache[user.nick.irc_downcase(@bot.irc.isupport["CASEMAPPING"])] = user
55
56
  @cache.delete user.last_nick.irc_downcase(@bot.irc.isupport["CASEMAPPING"])
57
+ @cache[user.nick.irc_downcase(@bot.irc.isupport["CASEMAPPING"])] = user
56
58
  end
57
59
  end
58
60
 
data/lib/cinch/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Cinch
2
2
  # Version of the library
3
- VERSION = '2.0.0-pre.4'
3
+ VERSION = '2.0.0-pre.5'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.4
4
+ version: 2.0.0.pre.5
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-07 00:00:00.000000000 Z
12
+ date: 2012-03-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A simple, friendly DSL for creating IRC bots
15
15
  email: