Hello!
Some weeks ago somebody posted a way to retrieve a complete message in
the terminal by the msg id.
Does somebody know where that has been posted?
Marco Moock <mm+usenet-es@dorfdsl.de> writes:
Some weeks ago somebody posted a way to retrieve a complete message in the terminal by the msg id.
...but this is one way that kind of does the trick:
$ printf '%s\r\n' 'article <upo6l1$3k6a0$1@dont-email.me>' quit . | nc news.uni-stuttgart.de nntp
....but this is one way that kind of does the trick:
for line in io.stdin:lines() do
if line == "." then break end
if line:sub(1,1) == "." then
io.write(line:sub(2,-1).."\n")
else
io.write(line.."\n")
end
end
local function nerr(s) io.stderr:write(s.."\n") os.exit(1) end--- Synchronet 3.21d-Linux NewsLink 1.2
local function recvresp(stream)
return assert(stream:receive("*l")):match("^([0-9]+)[ \t]*(.-)[ \t]*$") end
local msgid, host, port = ...
port = not port and 119 or tonumber(port)
if not (msgid and host and port) then
nerr("Usage: message-id host [port]")
end
local socket = require("socket") -- Lua Socket Library
local stream = assert(socket.connect(host, port))
local resp, line = recvresp(stream)
if resp ~= "200" and resp ~= "201" then
nerr("Fail: Server gave unhandled welcome: "..resp.." "..line)
end
assert(stream:send("ARTICLE "..msgid.."\r\n"))
stream:send("QUIT\r\n") stream:shutdown("send") -- don't care if this fails
local resp, line = recvresp(stream)
if resp == "220" then -- all good
elseif resp == "430" then
nerr("Fail: Message not found.")
else
-- Servers give a human-redable error description
-- which may be more specific than a client can come up with,
-- so it's best to just print it unless we can deal with it.
nerr("Fail: Server gave unhandled response: "..resp.." "..line)
end
-- 480: Authentication needed
-- Feel free to implement this yourself from RFC 4643
-- Easier is to pick a host that allows reading without auth.
-- 500: Server does not support ARTICLE
-- 501: Likely malformed message-id
for line in function() return assert(stream:receive("*l")) end do
if line == "." then break end
if line:sub(1,1) == "." then line = line:sub(2,-1) end
io.write(line.."\n")
end
stream:close()
$ printf '%s\r\n' 'article <upo6l1$3k6a0$1@dont-email.me>' quit . |
nc news.uni-stuttgart.de nntp
Some weeks ago somebody posted a way to retrieve a complete message in
the terminal by the msg id.
Does somebody know where that has been posted?
lynx -source "nntp://news.i2pn2.org/<msgid>"
Some weeks ago somebody posted a way to retrieve a complete message in
the terminal by the msg id.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 63 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 492950:10:50 |
| Calls: | 840 |
| Files: | 1,300 |
| D/L today: |
7 files (1,507K bytes) |
| Messages: | 261,291 |