ruby-net-nntp 0.2.2 → 1.0.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.
@@ -1,83 +0,0 @@
1
- module Net
2
-
3
- class NNTP
4
-
5
- class Group
6
- attr_reader :name, :article_count, :article_first, :article_last
7
- attr_reader :hi, :lo, :postingmode
8
-
9
- def initialize(name)
10
- @name = name
11
- @articles ||= Articles.new(self)
12
- #@articles.group = self
13
- @article_first = @article_last = @article_count = nil
14
- end
15
-
16
- # Set article_count, article_first, article_last (from GROUP command)
17
- #
18
- # Takes an array [count, first, last] as argument
19
- def article_info=(art_array)
20
- @article_count = art_array[0].to_i
21
- @article_first = art_array[1].to_i
22
- @article_last = art_array[2].to_i
23
- end
24
-
25
- def articles
26
- @articles
27
- end
28
-
29
- def articles=(articles)
30
- @articles = articles
31
- end
32
-
33
- # Sets hi and lo watermark alont with postingmode (from LIST ACTIVE command)
34
- def listinfo(hi, lo, postingmode)
35
- @hi = hi
36
- @lo = lo
37
- @postingmode = postingmode
38
- end
39
-
40
- def inspect
41
- "Group: #{@name} #{@article_count} #{@article_first} #{@article_last}"
42
- end
43
-
44
- class Articles
45
-
46
- attr_accessor :group
47
-
48
- def initialize(group)
49
- @articles ||=[]
50
- end
51
-
52
- # Stores articles in group attribute, using Net::NNTP::Article instances
53
- def build_from_over(over, format)
54
- article = Article.new
55
- article.overview_format = format
56
- article.overview(over)
57
- @articles << article
58
- end
59
-
60
- def length
61
- @articles.length
62
- end
63
-
64
- def <<(article)
65
- @articles << article
66
- end
67
-
68
- # Creates one Net::NNTP::Article instance, sets the group attribute to the
69
- # including group instances and adds the article to articles before returning it
70
- def create
71
- a = Article.new
72
- a.group = self.group
73
- @articles << a
74
- a
75
- end
76
-
77
- end
78
-
79
- end
80
-
81
- end
82
-
83
- end
@@ -1,288 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'net/nntp.rb'
4
- require 'mock/mock_socket'
5
-
6
-
7
- unless defined? log
8
- log = Log4r::Logger.new('net::nntp')
9
- fileout = Log4r::FileOutputter.new('net::nntp::fileout', :filename => File.join('logs', 'autotest.log'), :trunc => true)
10
- fileout.formatter = Log4r::PatternFormatter.new(:pattern => '%d [%5l] : %m')
11
- log.add fileout
12
- log.level = Log4r::ALL
13
- end
14
-
15
- module TestNet
16
- class TestNNTP < Test::Unit::TestCase
17
-
18
- def setup
19
- nntp_connect_and_auth('localhost', 119, 'dummy', 'test')
20
- end
21
-
22
- def test_new
23
- host = 'localhost'
24
- port = '119'
25
- timeout = 14
26
- assert_nothing_raised do
27
- @nntp = Net::NNTP.new(host)
28
- end
29
- assert_nothing_raised do
30
- nntp_new(host, port)
31
- end
32
- assert_nothing_raised do
33
- @nntp = Net::NNTP.new(host, port, timeout)
34
- end
35
- end
36
-
37
- def test_connect
38
- assert_nothing_raised do
39
- @nntp.connect
40
- assert @nntp.connected?
41
- end
42
- end
43
-
44
- def test_close
45
- assert_nothing_raised do
46
- @nntp.connect
47
- assert @nntp.connected?
48
- @nntp.close
49
- assert !@nntp.connected?
50
- end
51
- end
52
-
53
- def test_quit
54
- @nntp.connect
55
- quit = @nntp.quit.join
56
- assert_equal '200', quit[0..2]
57
- end
58
-
59
- def test_response_timeout
60
- assert_equal 10, @nntp.response_timeout
61
- @nntp.response_timeout = 11
62
- assert_equal 11, @nntp.response_timeout
63
- end
64
-
65
- def test_help
66
- help = @nntp.help.join
67
- assert_equal '100', help[0..2]
68
- assert_equal 429, help.length
69
- end
70
-
71
- def test_authenticate
72
- assert_nothing_raised do
73
- assert nntp_connect_and_auth('localhost', 119, 'dummy', 'test')
74
- end
75
- end
76
-
77
- def test_group
78
- assert_nothing_raised do
79
- group = @nntp.group('at.linux')
80
- assert_kind_of Net::NNTP::Group, group
81
- assert_equal 'at.linux', group.name
82
- assert_equal 12, group.article_count
83
- assert_equal 1363, group.article_first
84
- assert_equal 1375, group.article_last
85
- end
86
- end
87
-
88
- def test_xhdr
89
- headers = @nntp.xhdr('subject', 'at.linux', :from => 1363, :to => 1375)
90
- assert_equal 15, headers.length
91
- assert_equal '221', headers[0][0..2]
92
- assert_equal "1364", headers[2].split[0]
93
- header = @nntp.xhdr('subject', 'at.linux', :message_id => "<slrnf26akq.ci5.hjp-usenet2@zeno.hjp.at>").join
94
- assert_equal 47, header.length
95
- assert_equal "1375", header.split[0]
96
- end
97
-
98
- def test_xhdr_fails
99
- header = @nntp.xhdr('', 'at.linux', {}).join
100
- assert_equal '502', header[0..2]
101
- assert_raise(Net::NNTP::CommandFailedError) do
102
- header = @nntp.xhdr('at.xxx', 'subject', {})
103
- end
104
- end
105
-
106
-
107
- def test_group_fails
108
- assert_raise(Net::NNTP::CommandFailedError) do
109
- group = @nntp.group('at.xxx')
110
- end
111
- end
112
-
113
- def test_xover
114
- overviews = @nntp.xover('at.linux', :from => 1363, :to => 1375)
115
- assert_equal 15, overviews.length
116
- assert_equal '224', overviews[0][0..2]
117
- end
118
-
119
- def test_over_or_xover
120
- assert @nntp.has_xover?
121
- assert @nntp.has_over?
122
- end
123
-
124
- def test_xover_fails
125
- over = @nntp.xover('at.linux', :from => 1363, :to => 1375)
126
- over = @nntp.xover('at.linux', :message_id => "<slrnf26akq.ci5.hjp-usenet2@zeno.hjp.at>").join
127
- assert_equal '502', over[0..2]
128
- assert_raises(Net::NNTP::CommandFailedError) do
129
- over = @nntp.xover('at.xxx', :message_id => "<slrnf26akq.ci5.hjp-usenet2@zeno.hjp.at>")
130
- end
131
- end
132
-
133
- def test_listgroup
134
- list = @nntp.listgroup('at.linux')
135
- assert_equal 15, list.length
136
- match = /(\d{3}).*f\or\s+(\S+)\s/.match(list[0])
137
- assert_equal "211", match[1]
138
- assert_equal "at.linux", match[2]
139
- assert_equal "1365", list[3]
140
- end
141
-
142
- def test_list
143
- assert_respond_to @nntp, :list
144
- assert_nothing_raised do
145
- @nntp.list('overview.fmt')
146
- assert_equal 9, @nntp.overview_format.length
147
- @nntp.list()
148
- assert_not_equal 0, @nntp.grouplist.length
149
- assert_not_nil @nntp.grouplist
150
- assert_equal 'at.test', @nntp.grouplist['at.test'].name
151
- @nntp.list('active')
152
- assert_equal 'at.test', @nntp.grouplist['at.test'].name
153
- @nntp.list('active.times')
154
- @nntp.list('active.times', 'at.*')
155
- end
156
- assert_raise Net::NNTP::CommandFailedError do
157
- @nntp.list('distrib.pat', 'at.*')
158
- end
159
- end
160
-
161
- def test_article
162
- assert_raises Net::NNTP::CommandFailedError do
163
- article = @nntp.article
164
- end
165
- article = @nntp.article("<5d6be$4625ae23$51df8a12$32566@news.inode.at>")
166
- response, id, msgid = article[0].split
167
- assert_equal '220', response
168
- assert_equal '1392', id
169
- assert_equal "<5d6be$4625ae23$51df8a12$32566@news.inode.at>", msgid
170
- group = @nntp.group 'at.linux'
171
- article = @nntp.article '1392'
172
- response, id, msgid = article[0].split
173
- assert_equal '220', response
174
- assert_equal '1392', id
175
- assert_equal "<5d6be$4625ae23$51df8a12$32566@news.inode.at>", msgid
176
- end
177
-
178
- def test_head
179
- nntp_connect_and_auth('localhost', 119, 'dummy', 'test')
180
- assert_nothing_raised do
181
- assert_respond_to @nntp, :head
182
- end
183
- assert_raise Net::NNTP::CommandFailedError do
184
- head = @nntp.head
185
- end
186
- @nntp.group 'at.linux'
187
- @io = [
188
- "221 1430 <462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net> article retrieved - head follows\r\n",
189
- "Path: vietwist00.chello.at!newsfeed02.chello.at!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail\r\n",
190
- "Message-ID: <462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net>\r\n",
191
- "From: Gerhard Engler <gerhard.engler@gmx.de>\r\n",
192
- "Newsgroups: at.linux\r\n",
193
- "Subject: Re: udev_node_mknod: /dev/capi Operation not permitted\r\n",
194
- "Date: Tue, 24 Apr 2007 14:39:11 +0200\r\n",
195
- "References: <4629ee10$0$10187$9b4e6d93@newsspool4.arcor-online.net> <slrnf2np7k.a8e.tom-usenet@eristoteles.iwoars.net>\r\n",
196
- "Lines: 26\r\n",
197
- "User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)\r\n",
198
- "MIME-Version: 1.0\r\n",
199
- "In-Reply-To: <slrnf2np7k.a8e.tom-usenet@eristoteles.iwoars.net>\r\n",
200
- "Content-Type: text/plain; charset=ISO-8859-15; format=flowed\r\n",
201
- "Content-Transfer-Encoding: 7bit\r\n",
202
- "Organization: Arcor\r\n",
203
- "NNTP-Posting-Date: 24 Apr 2007 14:39:11 CEST\r\n",
204
- "NNTP-Posting-Host: 6cf11d8c.newsspool1.arcor-online.net\r\n",
205
- "X-Trace: DXC=Cd=D_AR>:`a^Y=RbYBPl4`ic==]BZ:afn4Fo<]lROoRaFl8W>\BH3Yb7K@fQgPi`FgUTEAfnAR\Ta@JWJ8E:^d<ob]cIfD6hVgh<SdIn0f]3?i\r\n",
206
- "X-Complaints-To: usenet-abuse@arcor.de\r\n",
207
- "Xref: sensor.twincode.net at.linux:1430\r\n",
208
- ".\r\n"
209
- ]
210
- head = @nntp.head
211
- assert_kind_of Array, head
212
- response, id, msgid = head[0].split
213
- assert_equal '221', response
214
- assert_equal '1430', id
215
- assert_equal '<462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net>', msgid
216
- end
217
-
218
- def test_body
219
- assert_raises Net::NNTP::CommandFailedError do
220
- body = @nntp.body
221
- end
222
- body = @nntp.body("<5d6be$4625ae23$51df8a12$32566@news.inode.at>")
223
- response, id, msgid = body[0].split
224
- assert_equal '222', response
225
- assert_equal '1392', id
226
- assert_equal "<5d6be$4625ae23$51df8a12$32566@news.inode.at>", msgid
227
- group = @nntp.group 'at.linux'
228
- body = @nntp.body '1392'
229
- response, id, msgid = body[0].split
230
- assert_equal '222', response
231
- assert_equal '1392', id
232
- assert_equal "<5d6be$4625ae23$51df8a12$32566@news.inode.at>", msgid
233
- end
234
-
235
- def test_stat
236
- assert_nothing_raised do
237
- assert_respond_to @nntp, :stat
238
- end
239
- end
240
-
241
- def test_last
242
- assert_raise Net::NNTP::ProtocolError do
243
- last = @nntp.last
244
- end
245
- @nntp.group 'at.linux'
246
- assert_raise Net::NNTP::CommandFailedError do
247
- last = @nntp.last
248
- end
249
- @nntp.next
250
- @nntp.next
251
- last = @nntp.last
252
- assert_kind_of String, last
253
- response, article, msgid, rest = last.split
254
- assert_equal "223", response
255
- assert_equal "1363", article
256
- end
257
-
258
- def test_next
259
- assert_raise Net::NNTP::ProtocolError do
260
- anext = @nntp.next
261
- end
262
- @nntp.group 'at.linux'
263
- anext = @nntp.next
264
- assert_kind_of String, anext
265
- response, article, msgid, rest = anext.split
266
- assert_equal "223", response
267
- assert_equal "1363", article
268
- assert_equal "<example.msgid@fake.host>", msgid
269
- anext = @nntp.next
270
- response, article, msgid, rest = anext.split
271
- assert_equal "1364", article
272
- end
273
-
274
- private
275
- def nntp_new(host, port=119)
276
- @nntp = Net::NNTP.new(host, port)
277
- end
278
- def nntp_connect_and_auth(host, port, user, pass)
279
- @nntp = Net::NNTP.new(host, port)
280
- @nntp.instance_variable_set :@socket_class, MockSocket
281
- @nntp.connect
282
- @nntp.socket.activate
283
- @nntp.authenticate(user, pass)
284
- end
285
- end
286
- end
287
-
288
-
@@ -1,359 +0,0 @@
1
- require 'mock'
2
- class MockSocket < Test::Unit::MockObject( TCPSocket )
3
- def initialize(host, port)
4
- super
5
- @io = ["200 Welcome\r\n"]
6
- @authenticated = false
7
- @group_selected = nil
8
- @last_article = nil
9
- @is_closed = false
10
- end
11
-
12
-
13
- def closed?
14
- super
15
- @is_closed
16
- end
17
-
18
- def close
19
- super
20
- @is_closed=true
21
- end
22
-
23
- def recv(len)
24
- return readline
25
- end
26
-
27
- def read( len )
28
- super # Call the mocked method to record the call
29
- rval = @io[0,len]
30
- @io[0,len] = ''
31
- return %w{ you should never reach this }
32
- end
33
-
34
- def puts(stuff)
35
- super
36
- stuff += "\r\n"
37
- write stuff
38
- end
39
-
40
- def write( str )
41
- super # Call the mocked method to record the call
42
- @io = []
43
- case str.downcase
44
- when /^body(.*)/
45
- body = [
46
- "222 1392 <5d6be$4625ae23$51df8a12$32566@news.inode.at> article retrieved - body follows\r\n",
47
- "Hi,\r\n",
48
- "\r\n",
49
- "kennt ihr eine Moeglichkeit den maximalen Speicherbedarf eines Programms \r\n",
50
- "ueber dessen gesamte Laufzeit zu ermitteln? Also keine Momentaufnahme \r\n",
51
- "wie mit ps, top & Co?\r\n",
52
- "\r\n",
53
- "Danke & vG\r\n",
54
- "Franz Hollerer\r\n",
55
- ".\r\n"
56
- ]
57
- case $1
58
- when /^\s+1392/, /^\s*$/
59
- if @group_selected
60
- @io = body
61
- else
62
- @io = ["412 No Group selected"]
63
- end
64
- when /^\s*<5d6be\$4625ae23\$51df8a12\$32566@news\.inode\.at>/
65
- @io = body
66
- else
67
- @io = ["No such article"]
68
- end
69
- when /^article(.*)/
70
- article = [
71
- "220 1392 <5d6be$4625ae23$51df8a12$32566@news.inode.at> article retrieved - text follows\r\n",
72
- "Path: vietwist00.chello.at!newsfeed02.chello.at!news.inode.at.POSTED!not-for-mail\r\n",
73
- "Message-ID: <5d6be$4625ae23$51df8a12$32566@news.inode.at>\r\n",
74
- "From: Franz Hollerer <franz.hollerer@ims.co.at>\r\n",
75
- "Newsgroups: at.linux\r\n",
76
- "Subject: Q: maximalen Speicherbedarfs eines Programms ueber dessen gesamte\r\n",
77
- " Laufzeit\r\n",
78
- "Date: Wed, 18 Apr 2007 07:34:56 +0200\r\n",
79
- "Lines: 8\r\n",
80
- "User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)\r\n",
81
- "MIME-Version: 1.0\r\n",
82
- "Content-Type: text/plain; charset=ISO-8859-15; format=flowed\r\n",
83
- "Content-Transfer-Encoding: 7bit\r\n",
84
- "X-Complaints-To: abuse@inode.at\r\n",
85
- "NNTP-Posting-Host: 81.223.138.18 (81.223.138.18)\r\n",
86
- "NNTP-Posting-Date: Wed, 18 Apr 2007 07:35:31 +0200\r\n",
87
- "X-Trace: 5d6be4625ae23f47a2fb732566\r\n",
88
- "Xref: sensor.twincode.net at.linux:1392\r\n",
89
- "\r\n",
90
- "Hi,\r\n",
91
- "\r\n",
92
- "kennt ihr eine Moeglichkeit den maximalen Speicherbedarf eines Programms \r\n",
93
- "ueber dessen gesamte Laufzeit zu ermitteln? Also keine Momentaufnahme \r\n",
94
- "wie mit ps, top & Co?\r\n",
95
- "\r\n",
96
- "Danke & vG\r\n",
97
- "Franz Hollerer\r\n",
98
- ".\r\n"
99
- ]
100
- case $1
101
- when /\s*1392/
102
- if @group_selected
103
- @io = article
104
- else
105
- @io = ["412 No Group selected"]
106
- end
107
- when /^\s*<5d6be\$4625ae23\$51df8a12\$32566@news\.inode\.at>/
108
- @io = article
109
- else
110
- @io = ["430 No such article"]
111
- end
112
- when /^list\b\s*(.*)\r\n$/
113
- case $1
114
- when /overview.fmt/i
115
- @io = ["215 Order of fields in overview database.\r\n", "Subject:\r\n", "From:\r\n", "Date:\r\n", "Message-ID:\r\n", "References:\r\n", "Bytes:\r\n", "Lines:\r\n", "Xref:full\r\n", ".\r\n" ]
116
- when /active\s*(.*)/
117
- @io = ["215 Newsgroups in form \"group high low flags\".", "at.test 200 100 y\r\n", "at.linux 100 90 n\r\n", ".\r\n"]
118
- when /^\s*$/
119
- @io = ["215 Newsgroups in form \"group high low flags\".", "at.test 200 100 y\r\n", "at.linux 100 90 n\r\n", ".\r\n"]
120
- else
121
- @io = ["501 Bad Command Usage"]
122
- end
123
- when "help\r\n" then
124
- @io = [
125
- "100 Legal commands on THIS server:\r\n",
126
- "ARTICLE [<Message-ID>|<Number>]\r\n",
127
- "BODY [<Message-ID>|<Number>]\r\n",
128
- "DATE\r\n",
129
- "GROUP <Newsgroup>\r\n",
130
- "HDR <Header> <Message-ID>|<Range>\r\n",
131
- "HEAD [<Message-ID>|<Number>]\r\n",
132
- "HELP\r\n",
133
- "LAST\r\n",
134
- "LIST [ACTIVE|NEWSGROUPS] [<Wildmat>]]\r\n",
135
- "LIST [ACTIVE.TIMES|EXTENSIONS|OVERVIEW.FMT]\r\n",
136
- "LISTGROUP <Newsgroup>\r\n",
137
- "MODE READER\r\n",
138
- "NEWGROUPS <yymmdd> <hhmmss> [GMT]\r\n",
139
- "NEXT\r\n",
140
- "POST\r\n",
141
- "OVER <Range>\r\n",
142
- "SLAVE\r\n",
143
- "STAT [<Message-ID>|<Number>]\r\n",
144
- "XHDR <Header> <Message-ID>|<Range>\r\n",
145
- "XOVER <Range>\r\n",
146
- ".\r\n"]
147
- when /^next/i
148
- if @group_selected
149
- if @last_article
150
- if @last_article < 1375
151
- @last_article += 1
152
- else
153
- @last_article = nil
154
- end
155
- else
156
- @last_article = 1363
157
- end
158
- @io = @last_article ? ["223 #{@last_article} <example.msgid@fake.host> retrieved"] : ['421 No next article in group']
159
- else
160
- @io = ['412 No Group selected']
161
- end
162
- when /^last/i
163
- if @group_selected
164
- if @last_article
165
- if @last_article > 1363
166
- @last_article -= 1
167
- else
168
- @last_article = nil
169
- end
170
- end
171
- @io = @last_article ? ["223 #{@last_article} <example.msgid@fake.host> retrieved"] : ['421 No next article in group']
172
- else
173
- @io = ['412 No Group selected']
174
- end
175
- when /^mode reader/i
176
- @io = ["200 Welcome"]
177
- when /^listgroup\s*(.*)\s*/i
178
- case $1
179
- when 'at.linux'
180
- @io = [
181
- "211 Article list for at.linux follows\r\n",
182
- "1363\r\n",
183
- "1364\r\n",
184
- "1365\r\n",
185
- "1366\r\n",
186
- "1367\r\n",
187
- "1368\r\n",
188
- "1369\r\n",
189
- "1370\r\n",
190
- "1371\r\n",
191
- "1372\r\n",
192
- "1373\r\n",
193
- "1374\r\n",
194
- "1375\r\n",
195
- ".\r\n"
196
- ]
197
- else
198
- if @group_selected
199
- @io = [
200
- "211 Article list for at.linux follows\r\n",
201
- "1363\r\n",
202
- "1364\r\n",
203
- "1365\r\n",
204
- "1366\r\n",
205
- "1367\r\n",
206
- "1368\r\n",
207
- "1369\r\n",
208
- "1370\r\n",
209
- "1371\r\n",
210
- "1372\r\n",
211
- "1373\r\n",
212
- "1374\r\n",
213
- "1375\r\n",
214
- ".\r\n"
215
- ]
216
- else
217
- @io = ['412 No Group selected']
218
- end
219
- end
220
- when "quit\r\n" then
221
- @io = ["200 Good bye"]
222
- when "authinfo user dummy\r\n"
223
- @io = ["381 More authentication details needed"]
224
- when "authinfo pass test\r\n"
225
- @io = ["281 Welcome to dummytest"]
226
- when /^group\s+(.+)\s*\r\n$/
227
- case $1
228
- when 'at.linux'
229
- @io = ["211 12 1363 1375 at.linux"]
230
- @group_selected = 'at.linux'
231
- else
232
- @io = ["411 No such group"]
233
- end
234
- when "xhdr subject <slrnf26akq.ci5.hjp-usenet2@zeno.hjp.at>\r\n"
235
- @io =
236
- ["1375 Re: Bitte um Meinungen ==> Virtualisierung\r\n"]
237
- when "xhdr subject 1363-1375\r\n"
238
- if @group_selected
239
- @io = [
240
- "221 Subject header (from overview) for postings 1363-1375\r\n",
241
- "1363 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
242
- "1364 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
243
- "1365 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
244
- "1366 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
245
- "1367 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
246
- "1368 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
247
- "1369 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
248
- "1370 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
249
- "1371 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
250
- "1372 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
251
- "1373 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
252
- "1374 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
253
- "1375 Re: Bitte um Meinungen ==> Virtualisierung\r\n",
254
- ".\r\n"
255
- ]
256
- else
257
- @io = ['412 No group selected']
258
- end
259
- when "xover 1363-1375\r\n"
260
- if @group_selected
261
- @io = [
262
- "224 Overview information for postings 1363-1375:\r\n",
263
- "1363 Re: Bitte um Meinungen ==> Virtualisierung \"Igo Besser\" <i.besser@aon.at> Sun, 15 Apr 2007 14:09:46 +0200 <46221541$0$2299$91cee783@newsreader01.highway.telekom.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <evt242$1jc7$1@geiz-ist-geil.priv.at> 1165 9 Xref: sensor.twincode.net at.linux:1363\r\n",
264
- "1364 Re: Bitte um Meinungen ==> Virtualisierung \"Igo Besser\" <i.besser@aon.at> Sun, 15 Apr 2007 14:14:12 +0200 <4622164b$0$25611$91cee783@newsreader02.highway.telekom.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <4621fc17$0$2315$91cee783@newsreader01.highway.telekom.at> <evt1p1$1jar$1@geiz-ist-geil.priv.at> 1229 13 Xref: sensor.twincode.net at.linux:1364\r\n",
265
- "1365 Re: Bitte um Meinungen ==> Virtualisierung \"Peter J. Holzer\" <hjp-usenet2@hjp.at> Sun, 15 Apr 2007 16:39:56 +0200 <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> 2643 42 Xref: sensor.twincode.net at.linux:1365\r\n",
266
- "1366 Re: Bitte um Meinungen ==> Virtualisierung \"Igo Besser\" <i.besser@aon.at> Sun, 15 Apr 2007 19:14:08 +0200 <46225c97$0$25626$91cee783@newsreader02.highway.telekom.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> 1344 13 Xref: sensor.twincode.net at.linux:1366\r\n",
267
- "1367 Re: Bitte um Meinungen ==> Virtualisierung \"Peter J. Holzer\" <hjp-usenet2@hjp.at> Sun, 15 Apr 2007 21:35:27 +0200 <slrnf24vjv.7pk.hjp-usenet2@zeno.hjp.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> <46225c97$0$25626$91cee783@newsreader02.highway.telekom.at> 1851 24 Xref: sensor.twincode.net at.linux:1367\r\n",
268
- "1368 Re: Bitte um Meinungen ==> Virtualisierung Wolfgang Steger <wolfgangs-spambox@utanet.at> Sun, 15 Apr 2007 21:48:48 +0200 <16caf4-581.ln1@swws1.dyndns.org> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> <46225c97$0$25626$91cee783@newsreader02.highway.telekom.at> 2248 20 Xref: sensor.twincode.net at.linux:1368\r\n",
269
- "1369 Re: Bitte um Meinungen ==> Virtualisierung Michael Prokop <devnull@michael-prokop.at> Sun, 15 Apr 2007 22:22:46 +0200 <2007-04-15T22-19-44@devnull.michael-prokop.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> <46225c97$0$25626$91cee783@newsreader02.highway.telekom.at> <slrnf24vjv.7pk.hjp-usenet2@zeno.hjp.at> 2022 23 Xref: sensor.twincode.net at.linux:1369\r\n",
270
- "1370 Re: Bitte um Meinungen ==> Virtualisierung Robert Annessi <robert@annessi.at> Sun, 15 Apr 2007 22:52:36 +0200 <46229089$0$10578$3b214f66@tunews.univie.ac.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> <46225c97$0$25626$91cee783@newsreader02.highway.telekom.at> <16caf4-581.ln1@swws1.dyndns.org> 1807 27 Xref: sensor.twincode.net at.linux:1370\r\n",
271
- "1371 Re: Bitte um Meinungen ==> Virtualisierung \"Thomas Spachinger\" <t.spachinger@gmx.at> Sun, 15 Apr 2007 22:58:17 +0200 <58fi18F2gdp4eU1@mid.individual.net> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <4621fc17$0$2315$91cee783@newsreader01.highway.telekom.at> <evt1p1$1jar$1@geiz-ist-geil.priv.at> <4622164b$0$25611$91cee783@newsreader02.highway.telekom.at> 1427 18 Xref: sensor.twincode.net at.linux:1371\r\n",
272
- "1372 Re: Bitte um Meinungen ==> Virtualisierung Bernd Haug <haug@berndhaug.net> Sun, 15 Apr 2007 23:54:05 +0200 <tgjaf4-lt9.ln1@this.is.a.news.server.you.goddamn.stupid.program> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> <46225c97$0$25626$91cee783@newsreader02.highway.telekom.at> <slrnf24vjv.7pk.hjp-usenet2@zeno.hjp.at> 1721 10 Xref: sensor.twincode.net at.linux:1372\r\n",
273
- "1373 Re: Bitte um Meinungen ==> Virtualisierung Wolfgang Fuschlberger <usenet-2006-05@fuschlberger.net> Sun, 15 Apr 2007 23:58:07 +0200 <fojaf4-kcj.ln1@window.dtdns.net> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <slrnf24e9s.dtb.hjp-usenet2@zeno.hjp.at> <46225c97$0$25626$91cee783@newsreader02.highway.telekom.at> <16caf4-581.ln1@swws1.dyndns.org> <46229089$0$10578$3b214f66@tunews.univie.ac.at> 1800 17 Xref: sensor.twincode.net at.linux:1373\r\n",
274
- "1374 Re: Bitte um Meinungen ==> Virtualisierung Andreas Labres <al-nospam0310&bounce@labres.at> Mon, 16 Apr 2007 08:57:43 +0200 <1tnru1ccirb05.dlg@al.lab.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> 1702 19 Xref: sensor.twincode.net at.linux:1374\r\n",
275
- "1375 Re: Bitte um Meinungen ==> Virtualisierung \"Peter J. Holzer\" <hjp-usenet2@hjp.at> Mon, 16 Apr 2007 09:49:46 +0200 <slrnf26akq.ci5.hjp-usenet2@zeno.hjp.at> <4621dbb8$0$2310$91cee783@newsreader01.highway.telekom.at> <dh49f4-qem.ln1@this.is.a.news.server.you.goddamn.stupid.program> <slrnf23snh.dfm.hjp-usenet2@zeno.hjp.at> <4621ff58$0$2307$91cee783@newsreader01.highway.telekom.at> <1tnru1ccirb05.dlg@al.lab.at> 2127 33 Xref: sensor.twincode.net at.linux:1375\r\n",
276
- ".\r\n"
277
- ]
278
- else
279
- @io = ["412 No Group selected"]
280
- end
281
- when /xover \<.+\>/
282
- @io = ["502 Usage: OVER first[-[last]]"]
283
- when /^xhdr\s*$/
284
- @io = ["502 Usage: HDR header [first[-last]]|[message-id]"]
285
- when /^head(.*)$/
286
- case $1
287
- when /^\s+(1430|<462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net>)/
288
- @io = [
289
- "221 1430 <462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net> article retrieved - head follows\r\n",
290
- "Path: vietwist00.chello.at!newsfeed02.chello.at!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail\r\n",
291
- "Message-ID: <462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net>\r\n",
292
- "From: Gerhard Engler <gerhard.engler@gmx.de>\r\n",
293
- "Newsgroups: at.linux\r\n",
294
- "Subject: Re: udev_node_mknod: /dev/capi Operation not permitted\r\n",
295
- "Date: Tue, 24 Apr 2007 14:39:11 +0200\r\n",
296
- "References: <4629ee10$0$10187$9b4e6d93@newsspool4.arcor-online.net> <slrnf2np7k.a8e.tom-usenet@eristoteles.iwoars.net>\r\n",
297
- "Lines: 26\r\n",
298
- "User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)\r\n",
299
- "MIME-Version: 1.0\r\n",
300
- "In-Reply-To: <slrnf2np7k.a8e.tom-usenet@eristoteles.iwoars.net>\r\n",
301
- "Content-Type: text/plain; charset=ISO-8859-15; format=flowed\r\n",
302
- "Content-Transfer-Encoding: 7bit\r\n",
303
- "Organization: Arcor\r\n",
304
- "NNTP-Posting-Date: 24 Apr 2007 14:39:11 CEST\r\n",
305
- "NNTP-Posting-Host: 6cf11d8c.newsspool1.arcor-online.net\r\n",
306
- "X-Trace: DXC=Cd=D_AR>:`a^Y=RbYBPl4`ic==]BZ:afn4Fo<]lROoRaFl8W>\BH3Yb7K@fQgPi`FgUTEAfnAR\Ta@JWJ8E:^d<ob]cIfD6hVgh<SdIn0f]3?i\r\n",
307
- "X-Complaints-To: usenet-abuse@arcor.de\r\n",
308
- "Xref: sensor.twincode.net at.linux:1430\r\n",
309
- ".\r\n"
310
- ]
311
-
312
- when /^\s?$/
313
- if @group_selected
314
- @io = [
315
- "221 1430 <462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net> article retrieved - head follows\r\n",
316
- "Path: vietwist00.chello.at!newsfeed02.chello.at!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail\r\n",
317
- "Message-ID: <462dfa6f$0$23135$9b4e6d93@newsspool1.arcor-online.net>\r\n",
318
- "From: Gerhard Engler <gerhard.engler@gmx.de>\r\n",
319
- "Newsgroups: at.linux\r\n",
320
- "Subject: Re: udev_node_mknod: /dev/capi Operation not permitted\r\n",
321
- "Date: Tue, 24 Apr 2007 14:39:11 +0200\r\n",
322
- "References: <4629ee10$0$10187$9b4e6d93@newsspool4.arcor-online.net> <slrnf2np7k.a8e.tom-usenet@eristoteles.iwoars.net>\r\n",
323
- "Lines: 26\r\n",
324
- "User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)\r\n",
325
- "MIME-Version: 1.0\r\n",
326
- "In-Reply-To: <slrnf2np7k.a8e.tom-usenet@eristoteles.iwoars.net>\r\n",
327
- "Content-Type: text/plain; charset=ISO-8859-15; format=flowed\r\n",
328
- "Content-Transfer-Encoding: 7bit\r\n",
329
- "Organization: Arcor\r\n",
330
- "NNTP-Posting-Date: 24 Apr 2007 14:39:11 CEST\r\n",
331
- "NNTP-Posting-Host: 6cf11d8c.newsspool1.arcor-online.net\r\n",
332
- "X-Trace: DXC=Cd=D_AR>:`a^Y=RbYBPl4`ic==]BZ:afn4Fo<]lROoRaFl8W>\BH3Yb7K@fQgPi`FgUTEAfnAR\Ta@JWJ8E:^d<ob]cIfD6hVgh<SdIn0f]3?i\r\n",
333
- "X-Complaints-To: usenet-abuse@arcor.de\r\n",
334
- "Xref: sensor.twincode.net at.linux:1430\r\n",
335
- ".\r\n"
336
- ]
337
- else
338
- @io = ["412 No Group selected"]
339
- end
340
- else
341
- @io = ["501 Bad Command"]
342
- end
343
- else
344
- @io = ["500 Unknown Command"]
345
- end
346
- return str.length
347
- end
348
-
349
- def readline
350
- super
351
- @io.shift
352
- end
353
-
354
- private
355
- def dp(x)
356
- $stdout.puts x
357
- end
358
-
359
- end