cinch 2.0.5 → 2.0.6
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/examples/plugins/custom_prefix.rb +1 -1
- data/examples/plugins/lambdas.rb +1 -1
- data/lib/cinch/bot.rb +2 -0
- data/lib/cinch/channel.rb +8 -0
- data/lib/cinch/irc.rb +13 -5
- data/lib/cinch/version.rb +1 -1
- metadata +2 -2
data/examples/plugins/lambdas.rb
CHANGED
@@ -9,7 +9,7 @@ class DirectAddressing
|
|
9
9
|
#
|
10
10
|
# The reason we are using a lambda is that the bot's nick can change
|
11
11
|
# and the prefix has to be up to date.
|
12
|
-
prefix lambda{ |m| Regexp.new("^" + Regexp.escape(m.bot.nick + ": " ))}
|
12
|
+
set :prefix, lambda{ |m| Regexp.new("^" + Regexp.escape(m.bot.nick + ": " ))}
|
13
13
|
|
14
14
|
match "hello", method: :greet
|
15
15
|
def greet(m)
|
data/lib/cinch/bot.rb
CHANGED
data/lib/cinch/channel.rb
CHANGED
@@ -59,6 +59,14 @@ module Cinch
|
|
59
59
|
|
60
60
|
@synced_attributes = Set.new
|
61
61
|
@when_requesting_synced_attribute = lambda {|attr|
|
62
|
+
if @in_channel && attr == :topic && !attribute_synced?(:topic)
|
63
|
+
# Even if we are in the channel, if there's no topic set,
|
64
|
+
# the attribute won't be synchronised yet. Explicitly
|
65
|
+
# request the topic.
|
66
|
+
@bot.irc.send "TOPIC #@name"
|
67
|
+
next
|
68
|
+
end
|
69
|
+
|
62
70
|
unless @in_channel
|
63
71
|
unsync(attr)
|
64
72
|
case attr
|
data/lib/cinch/irc.rb
CHANGED
@@ -544,15 +544,23 @@ module Cinch
|
|
544
544
|
end
|
545
545
|
|
546
546
|
|
547
|
-
if msg.message =~ /^\001DCC SEND (?:"([^"]+)"|(\S+)) (\
|
547
|
+
if msg.message =~ /^\001DCC SEND (?:"([^"]+)"|(\S+)) (\S+) (\d+)(?: (\d+))?\001$/
|
548
548
|
process_dcc_send($1 || $2, $3, $4, $5, msg, events)
|
549
549
|
end
|
550
550
|
end
|
551
551
|
|
552
552
|
# @since 2.0.0
|
553
553
|
def process_dcc_send(filename, ip, port, size, m, events)
|
554
|
-
ip
|
555
|
-
|
554
|
+
if ip =~ /^\d$/
|
555
|
+
# If ip is a single integer, assume it's a specification
|
556
|
+
# compliant IPv4 address in network byte order. If it's any
|
557
|
+
# other string, assume that it's a valid IPv4 or IPv6 address.
|
558
|
+
# If it's not valid, let someone higher up the chain notice
|
559
|
+
# that.
|
560
|
+
ip = ip.to_i
|
561
|
+
ip = [24, 16, 8, 0].collect {|b| (ip >> b) & 255}.join('.')
|
562
|
+
end
|
563
|
+
|
556
564
|
port = port.to_i
|
557
565
|
size = size.to_i
|
558
566
|
|
@@ -632,8 +640,8 @@ module Cinch
|
|
632
640
|
def on_319(msg, events)
|
633
641
|
# RPL_WHOISCHANNELS
|
634
642
|
user = User(msg.params[1])
|
635
|
-
channels = msg.params[2].scan(
|
636
|
-
user.
|
643
|
+
channels = msg.params[2].scan(/[#{@isupport["CHANTYPES"].join}][^ ]+/o).map {|c| Channel(c) }
|
644
|
+
@whois_updates[user].merge!({:channels => channels})
|
637
645
|
end
|
638
646
|
|
639
647
|
def on_324(msg, events)
|
data/lib/cinch/version.rb
CHANGED
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.
|
4
|
+
version: 2.0.6
|
5
5
|
prerelease:
|
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: 2013-
|
12
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A simple, friendly DSL for creating IRC bots
|
15
15
|
email:
|