ircinch 2.4.3 → 2.4.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -2
- data/lib/cinch/ban.rb +1 -1
- data/lib/cinch/bot.rb +2 -0
- data/lib/cinch/configuration.rb +1 -1
- data/lib/cinch/handler.rb +7 -1
- data/lib/cinch/handler_list.rb +17 -5
- data/lib/cinch/irc.rb +9 -3
- data/lib/cinch/logger.rb +8 -0
- data/lib/cinch/message.rb +5 -3
- data/lib/cinch/open_ended_queue.rb +47 -15
- data/lib/cinch/pattern.rb +5 -0
- data/lib/cinch/rubyext/module.rb +1 -1
- data/lib/cinch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c4b56b78380a166d6ff1806cd237fdb5d08699c8619fa7ad17a4a80cb414b3e
|
|
4
|
+
data.tar.gz: e7481dbd35a3831e48eb80447ff4a429938dd285677c4e08867c31efb8ad868c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9e7e645ddefb79ea5ab0489cfb2785624a6c33ea80a0d3cd51e5438e57ce6af6516adab7843256a51cc7041c9a4a35dfef4438ea4c5dab92ef1a6fd632c0692
|
|
7
|
+
data.tar.gz: 6a0e9526b4273cb3a670fc8a739f594f57888b679575d386d2715a767ead935af4c909e6bbad2eac2f2764e1cca2db09d895b2cb9b664842978ce55f71590931
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
* IRCinch 2.4.4, 14 January 2026
|
|
2
|
+
- Improve performance for high traffic channels
|
|
3
|
+
- Increase test coverage
|
|
4
|
+
- Bug fixes
|
|
5
|
+
|
|
1
6
|
* IRCinch 2.4.3, 27 December 2025
|
|
2
7
|
- Fix SASL auth time out by fixing IRC message parsing expression (fix by @janikrabe)
|
|
3
8
|
- Remove various duplicate methods
|
data/LICENSE.txt
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2010 Lee Jarvis, Dominik Honnef
|
|
4
|
-
Copyright (c) 2011
|
|
5
|
-
Copyright (c) 2022-2025 Matt Sias
|
|
4
|
+
Copyright (c) 2011 Dominik Honnef
|
|
6
5
|
|
|
7
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/cinch/ban.rb
CHANGED
|
@@ -40,7 +40,7 @@ module Cinch
|
|
|
40
40
|
# @raise [Exceptions::UnsupportedFeature] Cinch does not support
|
|
41
41
|
# Freenode's extended bans
|
|
42
42
|
def match(user)
|
|
43
|
-
raise UnsupportedFeature, "extended bans are not supported yet" if @extended
|
|
43
|
+
raise Exceptions::UnsupportedFeature, "extended bans are not supported yet" if @extended
|
|
44
44
|
@mask =~ user
|
|
45
45
|
end
|
|
46
46
|
alias_method :=~, :match
|
data/lib/cinch/bot.rb
CHANGED
data/lib/cinch/configuration.rb
CHANGED
|
@@ -31,7 +31,7 @@ module Cinch
|
|
|
31
31
|
def []=(key, value)
|
|
32
32
|
# FIXME also adjust method_missing
|
|
33
33
|
raise ArgumentError, "Unknown option #{key}" unless self.class::KNOWN_OPTIONS.include?(key)
|
|
34
|
-
|
|
34
|
+
super
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# Loads a configuration from a hash by merging the hash with
|
data/lib/cinch/handler.rb
CHANGED
|
@@ -75,7 +75,7 @@ module Cinch
|
|
|
75
75
|
@thread_group.list.each do |thread|
|
|
76
76
|
Thread.new do
|
|
77
77
|
@bot.loggers.debug "[Ending thread] Waiting 10 seconds for #{thread} to finish..."
|
|
78
|
-
thread.join(
|
|
78
|
+
thread.join(stop_timeout)
|
|
79
79
|
@bot.loggers.debug "[Killing thread] Killing #{thread}"
|
|
80
80
|
thread.kill
|
|
81
81
|
end
|
|
@@ -116,5 +116,11 @@ module Cinch
|
|
|
116
116
|
# TODO maybe add the number of running threads to the output?
|
|
117
117
|
"#<Cinch::Handler @event=#{@event.inspect} pattern=#{@pattern.inspect}>"
|
|
118
118
|
end
|
|
119
|
+
|
|
120
|
+
private
|
|
121
|
+
|
|
122
|
+
def stop_timeout
|
|
123
|
+
10
|
|
124
|
+
end
|
|
119
125
|
end
|
|
120
126
|
end
|
data/lib/cinch/handler_list.rb
CHANGED
|
@@ -38,11 +38,23 @@ module Cinch
|
|
|
38
38
|
return handlers
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
groups = Set.new
|
|
42
|
+
handlers.select { |handler|
|
|
43
|
+
if msg.match(handler.pattern.to_r(msg), type, handler.strip_colors)
|
|
44
|
+
if handler.group
|
|
45
|
+
if groups.include?(handler.group)
|
|
46
|
+
false
|
|
47
|
+
else
|
|
48
|
+
groups << handler.group
|
|
49
|
+
true
|
|
50
|
+
end
|
|
51
|
+
else
|
|
52
|
+
true
|
|
53
|
+
end
|
|
54
|
+
else
|
|
55
|
+
false
|
|
56
|
+
end
|
|
57
|
+
}
|
|
46
58
|
end
|
|
47
59
|
end
|
|
48
60
|
|
data/lib/cinch/irc.rb
CHANGED
|
@@ -12,6 +12,11 @@ module Cinch
|
|
|
12
12
|
class IRC
|
|
13
13
|
include Helpers
|
|
14
14
|
|
|
15
|
+
# @api private
|
|
16
|
+
REGISTRATION_COMMANDS = %w[001 002 003 004 422].freeze
|
|
17
|
+
# @api private
|
|
18
|
+
PRIVMSG_NOTICE_COMMANDS = %w[PRIVMSG NOTICE].freeze
|
|
19
|
+
|
|
15
20
|
# @return [ISupport]
|
|
16
21
|
attr_reader :isupport
|
|
17
22
|
|
|
@@ -236,7 +241,7 @@ module Cinch
|
|
|
236
241
|
msg = Message.new(input, @bot)
|
|
237
242
|
events = [[:catchall]]
|
|
238
243
|
|
|
239
|
-
if
|
|
244
|
+
if REGISTRATION_COMMANDS.include?(msg.command)
|
|
240
245
|
@registration << msg.command
|
|
241
246
|
if registered?
|
|
242
247
|
events << [:connect]
|
|
@@ -245,7 +250,7 @@ module Cinch
|
|
|
245
250
|
end
|
|
246
251
|
end
|
|
247
252
|
|
|
248
|
-
if
|
|
253
|
+
if PRIVMSG_NOTICE_COMMANDS.include?(msg.command)
|
|
249
254
|
events << [:ctcp] if msg.ctcp?
|
|
250
255
|
events << if msg.channel?
|
|
251
256
|
[:channel]
|
|
@@ -759,8 +764,9 @@ module Cinch
|
|
|
759
764
|
end
|
|
760
765
|
@in_lists << :names
|
|
761
766
|
|
|
767
|
+
prefix_regex = /^([#{@isupport["PREFIX"].values.join}]+)/
|
|
762
768
|
msg.params[3].split(" ").each do |user|
|
|
763
|
-
m = user.match(
|
|
769
|
+
m = user.match(prefix_regex)
|
|
764
770
|
if m
|
|
765
771
|
prefixes = m[1].chars.map { |s| @isupport["PREFIX"].key(s) }
|
|
766
772
|
nick = user[prefixes.size..]
|
data/lib/cinch/logger.rb
CHANGED
data/lib/cinch/message.rb
CHANGED
|
@@ -86,6 +86,8 @@ module Cinch
|
|
|
86
86
|
# @since 2.3.0
|
|
87
87
|
attr_reader :statusmsg_mode
|
|
88
88
|
|
|
89
|
+
MSG_REGEX = /\A(?:@([^ ]+) )?(?::(\S+) )?(\S+)(.*)/
|
|
90
|
+
|
|
89
91
|
def initialize(msg, bot)
|
|
90
92
|
@raw = msg
|
|
91
93
|
@bot = bot
|
|
@@ -99,7 +101,7 @@ module Cinch
|
|
|
99
101
|
# @api private
|
|
100
102
|
# @return [void]
|
|
101
103
|
def parse
|
|
102
|
-
match = @raw.match(
|
|
104
|
+
match = @raw.match(MSG_REGEX)
|
|
103
105
|
tags, @prefix, @command, raw_params = match.captures
|
|
104
106
|
|
|
105
107
|
if @bot.irc.network.ngametv?
|
|
@@ -280,7 +282,7 @@ module Cinch
|
|
|
280
282
|
|
|
281
283
|
class << self
|
|
282
284
|
def to_symbol(string)
|
|
283
|
-
string.tr(
|
|
285
|
+
string.tr("-", "_").downcase.to_sym
|
|
284
286
|
end
|
|
285
287
|
end
|
|
286
288
|
|
|
@@ -343,7 +345,7 @@ module Cinch
|
|
|
343
345
|
chantypes = @bot.irc.isupport["CHANTYPES"]
|
|
344
346
|
statusmsg = @bot.irc.isupport["STATUSMSG"]
|
|
345
347
|
if statusmsg.include?(s[0]) && chantypes.include?(s[1])
|
|
346
|
-
status = @bot.irc.isupport["PREFIX"].
|
|
348
|
+
status = @bot.irc.isupport["PREFIX"].key(s[0])
|
|
347
349
|
[s[1..], status]
|
|
348
350
|
elsif chantypes.include?(s[0])
|
|
349
351
|
[s, nil]
|
|
@@ -4,23 +4,55 @@
|
|
|
4
4
|
# objects.
|
|
5
5
|
#
|
|
6
6
|
# @api private
|
|
7
|
-
class OpenEndedQueue
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
class OpenEndedQueue
|
|
8
|
+
def initialize
|
|
9
|
+
@queue = []
|
|
10
|
+
@mutex = Mutex.new
|
|
11
|
+
@cv = ConditionVariable.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def <<(obj)
|
|
15
|
+
push(obj)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def push(obj)
|
|
19
|
+
@mutex.synchronize do
|
|
20
|
+
@queue.push(obj)
|
|
21
|
+
@cv.signal
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
10
25
|
def unshift(obj)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
@mutex.synchronize do
|
|
27
|
+
@queue.unshift(obj)
|
|
28
|
+
@cv.signal
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def pop(non_block = false)
|
|
33
|
+
@mutex.synchronize do
|
|
34
|
+
while @queue.empty?
|
|
35
|
+
raise ThreadError, "queue empty" if non_block
|
|
36
|
+
@cv.wait(@mutex)
|
|
19
37
|
end
|
|
20
|
-
|
|
21
|
-
begin
|
|
22
|
-
t&.run
|
|
23
|
-
rescue ThreadError
|
|
38
|
+
@queue.shift
|
|
24
39
|
end
|
|
25
40
|
end
|
|
41
|
+
alias_method :shift, :pop
|
|
42
|
+
alias_method :deq, :pop
|
|
43
|
+
alias_method :enq, :push
|
|
44
|
+
|
|
45
|
+
def empty?
|
|
46
|
+
@mutex.synchronize { @queue.empty? }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def size
|
|
50
|
+
@mutex.synchronize { @queue.size }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
alias_method :length, :size
|
|
54
|
+
|
|
55
|
+
def clear
|
|
56
|
+
@mutex.synchronize { @queue.clear }
|
|
57
|
+
end
|
|
26
58
|
end
|
data/lib/cinch/pattern.rb
CHANGED
|
@@ -46,9 +46,14 @@ module Cinch
|
|
|
46
46
|
attr_reader :pattern
|
|
47
47
|
def initialize(prefix, pattern, suffix)
|
|
48
48
|
@prefix, @pattern, @suffix = prefix, pattern, suffix
|
|
49
|
+
if !@prefix.is_a?(Proc) && !@pattern.is_a?(Proc) && !@suffix.is_a?(Proc)
|
|
50
|
+
@cached_regex = to_r
|
|
51
|
+
end
|
|
49
52
|
end
|
|
50
53
|
|
|
51
54
|
def to_r(msg = nil)
|
|
55
|
+
return @cached_regex if @cached_regex
|
|
56
|
+
|
|
52
57
|
pattern = Pattern.resolve_proc(@pattern, msg)
|
|
53
58
|
|
|
54
59
|
case pattern
|
data/lib/cinch/rubyext/module.rb
CHANGED
data/lib/cinch/version.rb
CHANGED