fargo 0.2.0 → 0.3.0
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/README.md +61 -0
- data/ext/fargo/extconf.rb +1 -1
- data/ext/fargo/fargo_tth.c +0 -2
- data/lib/fargo/client.rb +30 -24
- data/lib/fargo/parser.rb +90 -59
- data/lib/fargo/protocol/dc.rb +24 -8
- data/lib/fargo/protocol/hub.rb +41 -20
- data/lib/fargo/protocol/peer.rb +114 -0
- data/lib/fargo/protocol/{download.rb → peer_download.rb} +51 -115
- data/lib/fargo/protocol/peer_upload.rb +160 -0
- data/lib/fargo/search.rb +38 -5
- data/lib/fargo/supports/downloads.rb +17 -17
- data/lib/fargo/supports/local_file_list.rb +164 -0
- data/lib/fargo/supports/nick_list.rb +18 -5
- data/lib/fargo/supports/persistence.rb +2 -2
- data/lib/fargo/supports/{file_list.rb → remote_file_list.rb} +4 -5
- data/lib/fargo/supports/searches.rb +5 -12
- data/lib/fargo/supports/uploads.rb +24 -5
- data/lib/fargo/version.rb +1 -1
- data/lib/fargo.rb +12 -3
- data/spec/fargo/parser_spec.rb +198 -0
- data/spec/fargo/protocol/dc_spec.rb +77 -0
- data/spec/fargo/protocol/hub_spec.rb +155 -0
- data/spec/fargo/protocol/peer_download_spec.rb +104 -0
- data/spec/fargo/protocol/peer_spec.rb +58 -0
- data/spec/fargo/protocol/peer_upload_spec.rb +128 -0
- data/spec/fargo/search_spec.rb +107 -0
- data/spec/fargo/supports/chat_spec.rb +33 -0
- data/spec/fargo/supports/local_file_list_spec.rb +70 -0
- data/spec/fargo/supports/nick_list_spec.rb +35 -0
- data/spec/fargo/utils_spec.rb +26 -0
- data/spec/spec_helper.rb +47 -0
- data/spec/support/matchers.rb +17 -0
- metadata +37 -9
- data/lib/fargo/search_result.rb +0 -31
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fargo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Crichton
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-04 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -100,20 +100,36 @@ files:
|
|
100
100
|
- lib/fargo/client.rb
|
101
101
|
- lib/fargo/parser.rb
|
102
102
|
- lib/fargo/protocol/dc.rb
|
103
|
-
- lib/fargo/protocol/download.rb
|
104
103
|
- lib/fargo/protocol/hub.rb
|
104
|
+
- lib/fargo/protocol/peer.rb
|
105
|
+
- lib/fargo/protocol/peer_download.rb
|
106
|
+
- lib/fargo/protocol/peer_upload.rb
|
105
107
|
- lib/fargo/search.rb
|
106
|
-
- lib/fargo/search_result.rb
|
107
108
|
- lib/fargo/supports/chat.rb
|
108
109
|
- lib/fargo/supports/downloads.rb
|
109
|
-
- lib/fargo/supports/
|
110
|
+
- lib/fargo/supports/local_file_list.rb
|
110
111
|
- lib/fargo/supports/nick_list.rb
|
111
112
|
- lib/fargo/supports/persistence.rb
|
113
|
+
- lib/fargo/supports/remote_file_list.rb
|
112
114
|
- lib/fargo/supports/searches.rb
|
113
115
|
- lib/fargo/supports/timeout.rb
|
114
116
|
- lib/fargo/supports/uploads.rb
|
115
117
|
- lib/fargo/utils.rb
|
116
118
|
- lib/fargo/version.rb
|
119
|
+
- README.md
|
120
|
+
- spec/fargo/parser_spec.rb
|
121
|
+
- spec/fargo/protocol/dc_spec.rb
|
122
|
+
- spec/fargo/protocol/hub_spec.rb
|
123
|
+
- spec/fargo/protocol/peer_download_spec.rb
|
124
|
+
- spec/fargo/protocol/peer_spec.rb
|
125
|
+
- spec/fargo/protocol/peer_upload_spec.rb
|
126
|
+
- spec/fargo/search_spec.rb
|
127
|
+
- spec/fargo/supports/chat_spec.rb
|
128
|
+
- spec/fargo/supports/local_file_list_spec.rb
|
129
|
+
- spec/fargo/supports/nick_list_spec.rb
|
130
|
+
- spec/fargo/utils_spec.rb
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/support/matchers.rb
|
117
133
|
has_rdoc: true
|
118
134
|
homepage: http://github.com/alexcrichton/fargo
|
119
135
|
licenses: []
|
@@ -149,5 +165,17 @@ rubygems_version: 1.3.7
|
|
149
165
|
signing_key:
|
150
166
|
specification_version: 3
|
151
167
|
summary: A client for the DC protocol
|
152
|
-
test_files:
|
153
|
-
|
168
|
+
test_files:
|
169
|
+
- spec/fargo/parser_spec.rb
|
170
|
+
- spec/fargo/protocol/dc_spec.rb
|
171
|
+
- spec/fargo/protocol/hub_spec.rb
|
172
|
+
- spec/fargo/protocol/peer_download_spec.rb
|
173
|
+
- spec/fargo/protocol/peer_spec.rb
|
174
|
+
- spec/fargo/protocol/peer_upload_spec.rb
|
175
|
+
- spec/fargo/search_spec.rb
|
176
|
+
- spec/fargo/supports/chat_spec.rb
|
177
|
+
- spec/fargo/supports/local_file_list_spec.rb
|
178
|
+
- spec/fargo/supports/nick_list_spec.rb
|
179
|
+
- spec/fargo/utils_spec.rb
|
180
|
+
- spec/spec_helper.rb
|
181
|
+
- spec/support/matchers.rb
|
data/lib/fargo/search_result.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Fargo
|
2
|
-
class SearchResult
|
3
|
-
|
4
|
-
# Needs :file, :filesize, :client, :target (if passive)
|
5
|
-
def initialize file, filesize, client, target = nil
|
6
|
-
@file, @filesize, @client, @target = file, filesize, client, target
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_s
|
10
|
-
file = @file.gusb '/', "\\"
|
11
|
-
if File.directory? @file
|
12
|
-
s = file
|
13
|
-
else
|
14
|
-
s = "#{file}\005#{@filesize}"
|
15
|
-
end
|
16
|
-
|
17
|
-
s << sprintf(" %d/%d\005%s (%s:%d)", @client.open_slots,
|
18
|
-
@client.config.upload_slots,
|
19
|
-
@client.hub.hubname,
|
20
|
-
@client.config.hub_address,
|
21
|
-
@client.config.hub_port)
|
22
|
-
s << "\005#{@target}" if @client.config.passive
|
23
|
-
end
|
24
|
-
|
25
|
-
def active_send nick, ip, port
|
26
|
-
socket = EventMachine.open_datagram_socket '0.0.0.0', 0
|
27
|
-
socket.send_datagram "$SR #{nick} #{to_s}", ip, port
|
28
|
-
socket.close_connection_after_writing
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|