Gnus development mailing list
 help / color / mirror / Atom feed
From: "Steven E. Harris" <steven.harris@tenzing.com>
Subject: Re: nnimap RFC2342 support (IMAP4 Namespace)
Date: 01 Feb 2001 11:29:02 -0800	[thread overview]
Message-ID: <87ae86fbi9.fsf@torus.tenzing.com> (raw)
In-Reply-To: <Pine.LNX.4.30.0101312255390.3286-100000@lie.extundo.com>

Simon Josefsson <jas@extundo.com> writes:

> [1] NAMESPACE is only a way for the server to indicate what kind of
> mailbox hierarchies there are.  All it does is saying "All your
> private mailboxes begin with INBOX", "All your newsgroups begin with
> #news", "All shared folders on this server begin with bb."

Well, not quite. It also lets you know what the hierarchy delimiter
is. Given that, Gnus could see that

  foo/bar

is really the same as

  INBOX.foo.bar

on another server, provided that it stores these paths as lists rather
than literal strings. That, or it remembers the hierarchy delimiter so
that it could split, then reassemble a folder name on a new server
with a different delimiter. Here's some experimental code I was
playing around with:

==================================================
(defconst sep-display ":")
(defconst sep-orig "/")
(defconst sep-new ".")

(defun tokenize-string (str start sep)
  (if (string-match sep str start)
      (cons (substring str start (match-beginning 0))
	    (tokenize-string str (match-end 0) sep))
    (list (substring str start))))

(defun pedantic-replace (str sep-old sep-new)
  (mapconcat 'identity
	     (tokenize-string str 0 sep-old)
	     sep-new))

(defun get-current-ns-sep ()
  sep-orig)

(defun get-new-ns-sep ()
  sep-new)

(defun make-folder-display-name (folder)
  (pedantic-replace folder (get-current-ns-sep) sep-display))

(defun migrate-folder-name (folder)
  (pedantic-replace folder (get-current-ns-sep) (get-new-ns-sep)))



(make-folder-display-name "foo/bar/baz")
(migrate-folder-name "foo/bar/baz")
==================================================

The `pedantic-replace' function isn't the most efficient way to
replace one string with another, but it shows that we could be storing
the IMAP folder hierarchy as a list that can be split and joined
without much trouble.

I didn't take masking the leading "INBOX" into account, but I imagine
this would involve storing some special symbol at the beginning of the
list that would have a corresponding string (possibly
empty) for each server.

Also, note the `make-folder-display-name' function, which would let
the user concoct her own way of showing a folder name, independent of
the underlying server's representation.

-- 
Steven E. Harris        :: steven.harris@tenzing.com
Tenzing                 :: http://www.tenzing.com



      parent reply	other threads:[~2001-02-01 19:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-31 21:33 Steven E. Harris
2001-01-31 22:21 ` Simon Josefsson
2001-02-01  2:34   ` NAGY Andras
2001-02-01  3:06     ` NAGY Andras
2001-02-01 18:37     ` Steven E. Harris
2001-02-11  1:58     ` NAGY Andras
2001-02-01 19:29   ` Steven E. Harris [this message]

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=87ae86fbi9.fsf@torus.tenzing.com \
    --to=steven.harris@tenzing.com \
    /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).