cinch 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cinch.rb +1 -1
- data/lib/cinch/PLANNED +4 -0
- data/lib/cinch/bot.rb +1 -1
- data/lib/cinch/irc.rb +1 -3
- data/lib/cinch/message_queue.rb +1 -1
- data/lib/cinch/plugin.rb +8 -4
- data/lib/cinch/user.rb +1 -1
- metadata +12 -4
data/lib/cinch.rb
CHANGED
data/lib/cinch/PLANNED
ADDED
data/lib/cinch/bot.rb
CHANGED
data/lib/cinch/irc.rb
CHANGED
@@ -32,9 +32,6 @@ module Cinch
|
|
32
32
|
else
|
33
33
|
@socket = tcp_socket
|
34
34
|
end
|
35
|
-
@socket.set_encoding(@bot.config.encoding || Encoding.default_external,
|
36
|
-
Encoding.default_internal,
|
37
|
-
{:invalid => :replace, :undef => :replace})
|
38
35
|
|
39
36
|
@queue = MessageQueue.new(@socket, @bot)
|
40
37
|
message "PASS #{@config.password}" if @config.password
|
@@ -45,6 +42,7 @@ module Cinch
|
|
45
42
|
begin
|
46
43
|
while line = @socket.gets
|
47
44
|
begin
|
45
|
+
line.force_encoding(@bot.config.encoding).encode!({:invalid => :replace, :undef => :replace})
|
48
46
|
parse line
|
49
47
|
rescue => e
|
50
48
|
@bot.logger.log_exception(e)
|
data/lib/cinch/message_queue.rb
CHANGED
@@ -55,7 +55,7 @@ module Cinch
|
|
55
55
|
@bot.logger.log(message, :outgoing) if @bot.config.verbose
|
56
56
|
|
57
57
|
@time_since_last_send = Time.now
|
58
|
-
@socket.print message + "\r\n"
|
58
|
+
@socket.print message.encode(@bot.config.encoding, {:invalid => :replace, :undef => :replace}) + "\r\n"
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/lib/cinch/plugin.rb
CHANGED
@@ -114,20 +114,24 @@ module Cinch
|
|
114
114
|
prefix = Regexp.escape(prefix)
|
115
115
|
end
|
116
116
|
@__cinch_patterns.each do |pattern|
|
117
|
+
pattern_to_register = nil
|
118
|
+
|
117
119
|
if pattern.use_prefix && prefix
|
118
120
|
case pattern.pattern
|
119
121
|
when Regexp
|
120
|
-
|
122
|
+
pattern_to_register = /^#{prefix}#{pattern.pattern}/
|
121
123
|
when String
|
122
|
-
|
124
|
+
pattern_to_register = prefix + pattern.pattern
|
123
125
|
end
|
126
|
+
else
|
127
|
+
pattern_to_register = pattern.pattern
|
124
128
|
end
|
125
129
|
|
126
130
|
react_on = @__cinch_react_on || :message
|
127
131
|
|
128
|
-
bot.debug "[plugin] #{plugin_name}: Registering executor with pattern `#{
|
132
|
+
bot.debug "[plugin] #{plugin_name}: Registering executor with pattern `#{pattern_to_register}`, reacting on `#{react_on}`"
|
129
133
|
|
130
|
-
bot.on(react_on,
|
134
|
+
bot.on(react_on, pattern_to_register, instance, pattern) do |message, plugin, pattern, *args|
|
131
135
|
if plugin.respond_to?(pattern.method)
|
132
136
|
method = plugin.method(pattern.method)
|
133
137
|
arity = method.arity - 1
|
data/lib/cinch/user.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Lee Jarvis
|
@@ -15,16 +16,18 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-09-02 00:00:00 +02:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: rspec
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - "="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 27
|
28
31
|
segments:
|
29
32
|
- 1
|
30
33
|
- 3
|
@@ -68,6 +71,7 @@ files:
|
|
68
71
|
- lib/cinch/user.rb
|
69
72
|
- lib/cinch/constants.rb
|
70
73
|
- lib/cinch/callback.rb
|
74
|
+
- lib/cinch/PLANNED
|
71
75
|
- lib/cinch/syncable.rb
|
72
76
|
- lib/cinch/message_queue.rb
|
73
77
|
- lib/cinch/helpers.rb
|
@@ -108,25 +112,29 @@ rdoc_options: []
|
|
108
112
|
require_paths:
|
109
113
|
- lib
|
110
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
111
116
|
requirements:
|
112
117
|
- - ">="
|
113
118
|
- !ruby/object:Gem::Version
|
119
|
+
hash: 49
|
114
120
|
segments:
|
115
121
|
- 1
|
116
122
|
- 9
|
117
123
|
- 1
|
118
124
|
version: 1.9.1
|
119
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
120
127
|
requirements:
|
121
128
|
- - ">="
|
122
129
|
- !ruby/object:Gem::Version
|
130
|
+
hash: 3
|
123
131
|
segments:
|
124
132
|
- 0
|
125
133
|
version: "0"
|
126
134
|
requirements: []
|
127
135
|
|
128
136
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.3.
|
137
|
+
rubygems_version: 1.3.7
|
130
138
|
signing_key:
|
131
139
|
specification_version: 3
|
132
140
|
summary: An IRC Bot Building Framework
|