Pulse 1.2.1 → 1.2.2
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/library/pulse/client.rb +4 -3
- data/library/pulse/dcc.rb +3 -2
- data/library/pulse/handling.rb +7 -2
- metadata +2 -2
data/library/pulse/client.rb
CHANGED
@@ -80,6 +80,10 @@ module Pulse
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
def transmit name, *args
|
84
|
+
@connection.transmit name, *args
|
85
|
+
end
|
86
|
+
|
83
87
|
private
|
84
88
|
|
85
89
|
def emit name, *args
|
@@ -103,8 +107,5 @@ module Pulse
|
|
103
107
|
(@callbacks[name] ||= []) << block
|
104
108
|
end
|
105
109
|
|
106
|
-
def transmit name, *args
|
107
|
-
@connection.transmit name, *args
|
108
|
-
end
|
109
110
|
end
|
110
111
|
end
|
data/library/pulse/dcc.rb
CHANGED
@@ -6,8 +6,8 @@ module Pulse
|
|
6
6
|
class DCC
|
7
7
|
Duration = 150
|
8
8
|
|
9
|
-
def initialize path
|
10
|
-
@path = path
|
9
|
+
def initialize path, position = 0
|
10
|
+
@path, @position = path, 0
|
11
11
|
end
|
12
12
|
|
13
13
|
def listen
|
@@ -29,6 +29,7 @@ module Pulse
|
|
29
29
|
|
30
30
|
def each_chunk
|
31
31
|
File.open @path, ?r do |file|
|
32
|
+
file.readpartial @position if @position > 0
|
32
33
|
yield file.readpartial 1024 until file.eof?
|
33
34
|
end
|
34
35
|
end
|
data/library/pulse/handling.rb
CHANGED
@@ -44,6 +44,7 @@ module Pulse
|
|
44
44
|
# mk!mk@maero.dk PRIVMSG #maero :tp: kod
|
45
45
|
def got_privmsg command
|
46
46
|
name, message = command.params
|
47
|
+
return unless command.sender.respond_to? :nickname
|
47
48
|
|
48
49
|
if channel = @channels[name]
|
49
50
|
user = channel.user command.sender.nickname
|
@@ -55,8 +56,12 @@ module Pulse
|
|
55
56
|
(@conversations[command.sender.nickname] ||= Conversation.new user, self).tap do |conversation|
|
56
57
|
user.channel = conversation
|
57
58
|
|
58
|
-
if message
|
59
|
-
|
59
|
+
if message =~ /^\x01DCC (.*?)\x01$/
|
60
|
+
if $1.starts_with? "RESUME"
|
61
|
+
emit :dcc_resume_file, user, conversation, $1.split
|
62
|
+
else
|
63
|
+
emit :dcc, user, conversation, $1.split
|
64
|
+
end
|
60
65
|
else
|
61
66
|
emit :conversation, user, conversation, message
|
62
67
|
end
|