Gnus development mailing list
 help / color / mirror / Atom feed
* Strange nntp port number?
@ 1996-04-10 17:02 Kai Grossjohann
  1996-04-12  3:16 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Grossjohann @ 1996-04-10 17:02 UTC (permalink / raw)



Hi all,

suppose I wanted to write a backend nndb.el which is just like nntp.el
but connects on port 9000 by default rather than "nntp" (and also to
host localhost rather than the nntp host).

I have learned from inspecting nndir.el that I should write a function
nndb-execute-nntp-command which calls the nntp-functions, then use
this to redirect all nntp-* functions.

Right now, this is what nndb-execute-nntp-command looks like:

    (defun nndb-execute-nntp-command (command)
      (let ((nntp-port-number nndb-port-number)
            (nntp-address nndb-address))
        (eval command)))

I use this, among other places, in nndb-open-server:

    (defun nndb-open-server (server &optional defs connectionless)
      "Similar to nntp-open-server, but uses different port number
    and server address."
      (nnheader-set-init-variables nndb-server-variables defs)
      (nndb-execute-nntp-command
       `(nntp-open-server ,server ,defs ,connectionless)))

It doesn't work, though :-(

Lars has told me to do it that way, but I really don't seem to be able
to come up with something useful :-(  There must be a fundamental
error I'm making.

Thanks a lot in advance for your help,
kai
--
There ain't no cure for the summertime blues.


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

* Re: Strange nntp port number?
  1996-04-10 17:02 Strange nntp port number? Kai Grossjohann
@ 1996-04-12  3:16 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 1996-04-12  3:16 UTC (permalink / raw)


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

> I have learned from inspecting nndir.el that I should write a function
> nndb-execute-nntp-command which calls the nntp-functions, then use
> this to redirect all nntp-* functions.
> 
> Right now, this is what nndb-execute-nntp-command looks like:
> 
>     (defun nndb-execute-nntp-command (command)
>       (let ((nntp-port-number nndb-port-number)
>             (nntp-address nndb-address))
>         (eval command)))

I think something like the following might do the trick:

     (defun nndb-execute-nntp-command (command)
       (unless (nntp-server-opened nndb-current-server)
	 (nntp-open-server nndb-current-server 
			   `((nntp-port-number ,nndb-port-number)
			     (nntp-address ,nndb-address))))
       (eval command))

The backend thing feels kinda kludgy.  Perhaps I should think more
OO-y thoughts and implement some kind of inheretance scheme.  It's
just loose thoughts at the moment, but perhaps one should be able to
say something like:

(nnheader-inherit 'nntp 'nndb)

This would define all nndb interface functions as the nntp functions,
but with a wrapper like the one above around each function call.  That
means that one should have a:

(nnheader-define-server 'nndb
  `((nntp-port-number ,nndb-port-number)
    (nntp-address ,nndb-address)))

That defines the mapping from nndb variables to nntp variables.

Hm.  But one should be able to inherit functions from several
backends.  (nndir uses both nnml and nnmh functions, for instance.)

(defun nndb-request-article (&rest args)
  (nnheader-call-function 'nntp 'nndb args))

Hm.  Then one neeps several mappings like the define-server call
above...   

These are all rather easy to implement.  Perhaps we should think some
more and come up with a totally new backend interface scheme.  Any
ideas? 

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


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

end of thread, other threads:[~1996-04-12  3:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-10 17:02 Strange nntp port number? Kai Grossjohann
1996-04-12  3:16 ` 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).