Gnus development mailing list
 help / color / mirror / Atom feed
* Q: Extending nntp (for nndb)
@ 1996-03-26 10:37 Kai Grossjohann
  1996-03-27  4:49 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Kai Grossjohann @ 1996-03-26 10:37 UTC (permalink / raw)


Hi there,

I'm trying to extend nntp so that it deals with the things that make
sense for `private' nndb groups, like `B c' and `B m' and expiry and
stuff.  I admit that I've never really looked into the source before,
and I'm not sure what I should do.

There are several issues:
    - What exactly are the backend functions supposed to do?
    - How do I deal with all the variables and group parameters?

Ad 1:  Backend functions.

The documentation for, say, nnchoke-request-accept-article, says:

,-----
| `(nnchoke-request-accept-article GROUP &optional LAST)'
|      This function takes the current buffer and inserts it into
|      GROUP.  If LAST in `nil', that means that there will be more
|      calls to this function in short order.
| 
|      There should be no data returned.
`-----

Note the last sentence.  From debugging nnml, however, it seems that
this function should return ("<group name>" <article number>).  What's
the story?  How do the return values interact with this strange buffer
that's supposed to contain the results, if any?

Are there other things that the docs don't mention but I should know?
Remember that this was my first cut at trying anything.


Ad 2: Variables, group parameters.

I created a file nndb.el with a lot of defalias statements, for all
the functions that already exist in nntp.el.  I figured that this way,
I would only need to write the missing functions.

However, I would like nndb to use port 9000 by default, changeable via
parameters, as usual.  How would I go about this?

Further, when in a function, how do I find out the values of all the
parameters (host, port, whatever), considering that the currenly valid
value may come from a group parameter, may come from the server
definition, or may come from one of the variables which change the
defaults.  And this isn't considering the environment variables, even.

Maybe this was a completely stupid approach of doing it?  Should I've
copied nntp.el then change every occurrence of "nntp" to "nndb", then
change the defaults at will?  Should I've extended nntp.el instead to
recognize the new servers?  Is ELisp object oriented and supports
inheritance but I don't know it?

Thanks a lot for you kind help for a novice Gnus programmer,
        kai
--
There ain't no cure for the summer time blues.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Q: Extending nntp (for nndb)
  1996-03-26 10:37 Q: Extending nntp (for nndb) Kai Grossjohann
@ 1996-03-27  4:49 ` Lars Magne Ingebrigtsen
  1996-03-27  7:34   ` Kai Grossjohann
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 1996-03-27  4:49 UTC (permalink / raw)


Kai Grossjohann <grossjoh@ls6.informatik.uni-dortmund.de> writes:

> The documentation for, say, nnchoke-request-accept-article, says:
> 
> ,-----
> | `(nnchoke-request-accept-article GROUP &optional LAST)'
> |      This function takes the current buffer and inserts it into
> |      GROUP.  If LAST in `nil', that means that there will be more
> |      calls to this function in short order.
> | 
> |      There should be no data returned.
> `-----
> 
> Note the last sentence. 

By "data", the manual means "data in the nntpd buffer".  I forgot to
mention the function return value.

> Further, when in a function, how do I find out the values of all the
> parameters (host, port, whatever), considering that the currenly valid
> value may come from a group parameter, may come from the server
> definition, or may come from one of the variables which change the
> defaults.  And this isn't considering the environment variables, even.

The `*-open-server' function sets all variables in the backend.  So
all the other functions can assume that they are working on variables
local to the current virtual server.  

> Maybe this was a completely stupid approach of doing it?  Should I've
> copied nntp.el then change every occurrence of "nntp" to "nndb", then
> change the defaults at will?  

Yes, probably.  nndb and nntp are sufficiently different that there
probably should be a new nndb.el file.

-- 
  "Yes.  The journey through the human heart 
     would have to wait until some other time."


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Q: Extending nntp (for nndb)
  1996-03-27  4:49 ` Lars Magne Ingebrigtsen
@ 1996-03-27  7:34   ` Kai Grossjohann
  1996-03-27  8:11     ` Per Abrahamsen
  1996-03-29 16:10     ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Kai Grossjohann @ 1996-03-27  7:34 UTC (permalink / raw)
  Cc: ding

>>>>> On 27 Mar 1996 04:49:37 +0000, Lars Magne Ingebrigtsen
>>>>> <larsi@ifi.uio.no> said:

  Lars> By "data", the manual means "data in the nntpd buffer".  I
  Lars> forgot to mention the function return value.

I see.  By  reading a bit more, I found that there is in fact one
function where the return value is mentioned: a list of article
numbers.  Can I assume that this is the same for other functions?

  Lars> The `*-open-server' function sets all variables in the
  Lars> backend.  So all the other functions can assume that they are
  Lars> working on variables local to the current virtual server.

So if I were to add to the nntp.el file a new function, said function
could just use the variable nntp-address to get the name of the nntp
server?

  Kai> Maybe this was a completely stupid approach of doing it?
  Kai> Should I've copied nntp.el then change every occurrence of
  Kai> "nntp" to "nndb", then change the defaults at will?

  Lars> Yes, probably.  nndb and nntp are sufficiently different that
  Lars> there probably should be a new nndb.el file.

Really?  Please note that nndb offers a superset of the nntp protocol.
Therefore, the nntp subset would have to be maintained twice if the
two were completely independent nndb.el and nntp.el files.  Well, I
don't like this idea, but you're the guru, so I'll comply.

Why is ELisp not object-oriented?

        kai
--
There ain't no cure for the summer time blues.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Q: Extending nntp (for nndb)
  1996-03-27  7:34   ` Kai Grossjohann
@ 1996-03-27  8:11     ` Per Abrahamsen
  1996-03-29 16:10     ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Per Abrahamsen @ 1996-03-27  8:11 UTC (permalink / raw)



>>>>> "KG" == Kai Grossjohann <grossjoh@charly.informatik.uni-dortmund.de> writes:

KG> Why is ELisp not object-oriented?

You can write OO code in any language.  I think nn* packages would
benefit much from being specified in a way that used and allowed
inheritance.  When I (attempted to) write nnsoup I constantly wanted
to be able to say "this is just like nnml, except...".  There is a lot
of duplication between the backends which could be avoided. 

nndir is actually written as a kind of subclass of nnmh, so you might
want to look at that.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Q: Extending nntp (for nndb)
  1996-03-27  7:34   ` Kai Grossjohann
  1996-03-27  8:11     ` Per Abrahamsen
@ 1996-03-29 16:10     ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 1996-03-29 16:10 UTC (permalink / raw)


Kai Grossjohann <grossjoh@ls6.informatik.uni-dortmund.de> writes:

>   Lars> By "data", the manual means "data in the nntpd buffer".  I
>   Lars> forgot to mention the function return value.
> 
> I see.  By  reading a bit more, I found that there is in fact one
> function where the return value is mentioned: a list of article
> numbers.  Can I assume that this is the same for other functions?

Nope.  Most of the functions do not return any useful function values,
but the ones that do return useful things all return in different
formats.  For instance, `*-retrieve-headers' return `nov' or
`headers'.  This should be documented better.

> So if I were to add to the nntp.el file a new function, said function
> could just use the variable nntp-address to get the name of the nntp
> server?

Yes.  If you look over the code, most of the functions start with 
`(nntp-possibly-change-server group server)', which deal with all that
gruft.  After calling that function, all variables should be ok.

>   Lars> Yes, probably.  nndb and nntp are sufficiently different that
>   Lars> there probably should be a new nndb.el file.
> 
> Really?  Please note that nndb offers a superset of the nntp protocol.
> Therefore, the nntp subset would have to be maintained twice if the
> two were completely independent nndb.el and nntp.el files.  Well, I
> don't like this idea, but you're the guru, so I'll comply.

Well, I didn't mean that you should rewrite all functions.  Here's
a typical nndir function.  (nndir is a wrapper around nnmh in much the
same way nnbd would be a wrapper around nntp.)

(defun nndir-request-newgroups (date &optional server)
  (nndir-execute-nnmh-command
   `(nnmh-request-newgroups ,date ,server)))

`nndir-execute-nnmh-command' binds the relevant nntp variables and
evals that form.

The main reason that I'd rather not see functions like
`nntp-request-accept-article' is that nntp servers are read-only, and
the presence of such a function would make Gnus believe that Gnus
could delete articles from the nntp backend.  Which isn't really true.

-- 
  "Yes.  The journey through the human heart 
     would have to wait until some other time."


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1996-03-29 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-26 10:37 Q: Extending nntp (for nndb) Kai Grossjohann
1996-03-27  4:49 ` Lars Magne Ingebrigtsen
1996-03-27  7:34   ` Kai Grossjohann
1996-03-27  8:11     ` Per Abrahamsen
1996-03-29 16:10     ` Lars Magne Ingebrigtsen

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).