From: Kai Grossjohann <grossjohann@charly.informatik.uni-dortmund.de>
Cc: ding@ifi.uio.no
Subject: Re: writable NNTP server -- getting mail/news
Date: 02 Nov 1996 14:21:30 +0100 [thread overview]
Message-ID: <vafaft063ad.fsf@ls6.informatik.uni-dortmund.de> (raw)
In-Reply-To: Kai Grossjohann's message of 01 Nov 1996 15:09:02 +0100
>>>>> Kai Grossjohann writes:
Kai> Hi there, I'm writing a backend for a `writable NNTP server',
Kai> ie an NNTP server which also groks a few additional commands
Kai> for moving message from one group to another, for deleting
Kai> messages and the like.
I've been hacking a bit. I've got a problem with implementing the
backend function *-request-accept-article. It seems that the status
string isn't set correctly: the nntp-status-string variable is ""
rather than containing the right message. Here's how the server
behaves:
,-----
| [bonny:~]91> telnet bonny 4242
| Trying 129.217.20.165...
| Connected to bonny.
| Escape character is '^]'.
| 200 NNML server 1.08 ready - posting allowed
| GROUP mail.misc
| 211 1125 13921 15045 mail.misc group selected
| XACCEPT
| 340 send article to be posted. End with <CR-LF>.<CR-LF>
| From: kai
| Subject: test
| Message-id: foo@bar.frob.org
|
| test test
| .
| 287 aricle accepted as 15046 in group mail.misc
| quit
| 205 closing connection - goodbye!
| Connection closed by foreign host.
`-----
My problem was retrieving the "287" message. Here's what I tried:
,-----
| (deffoo nnmk-request-accept-article (group &optional server last)
| "Take current buffer and insert it into GROUP."
| (nntp-possibly-change-group group server)
| (let ((resart))
| (when (nntp-send-command "^[23].*\r?\n" "XACCEPT")
| (nntp-send-buffer
| "^\\(287 ar.*icle accepted as \\([0-9]*\\) .*\\)\r?\n\\|[23].*\n")
| (setq resart
| (substring nnmk-status-string ; (nnheader-get-report 'nnmk)
| (match-beginning 1) (match-end 1))))
| resart))
`-----
But neither nntp-status-string nor nnmk-status-string nor
(nnheader-get-report 'nntp) nor (nnheader-get-report 'nnmk) returned
anything useful. The best I got was "". What did I do wrong?
The following hack works, but it's /ugly/ :-(
,-----
| (deffoo nnmk-request-accept-article (group &optional server last)
| "Take current buffer and insert it into GROUP."
| (nntp-possibly-change-group group server)
| (let ((resart))
| (when (nntp-send-command "^340 .*\r?\n" "XACCEPT")
| (save-excursion (set-buffer nntp-server-buffer)
| (erase-buffer))
| (nntp-send-buffer
| "^287 \\(.*\\)")
| (save-excursion
| (set-buffer nntp-server-buffer)
| (beginning-of-buffer)
| (if (re-search-forward
| "^287 .*art?icle accepted as \\([0-9]*\\) .*")
| (setq resart
| (buffer-substring (match-beginning 1)
| (match-end 1)))))
| resart)))
`-----
There's got to be a better way, no? Prolly only shows that I don't
grok nntp-send-buffer.
tia,
kai
--
Life is hard and then you die.
next prev parent reply other threads:[~1996-11-02 13:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-01 14:09 Kai Grossjohann
1996-11-02 13:21 ` Kai Grossjohann [this message]
1996-11-05 21:50 ` Lars Magne Ingebrigtsen
1996-11-01 14:10 Kai Grossjohann
1996-11-01 15:50 ` Steinar Bang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vafaft063ad.fsf@ls6.informatik.uni-dortmund.de \
--to=grossjohann@charly.informatik.uni-dortmund.de \
--cc=ding@ifi.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).