Re: reopening a stream with OP_HALFOPEN

2004-12-02 Thread Tomas Pospisek's Mailing Lists
On Wed, 1 Dec 2004, Mark Crispin wrote:
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
... but - are you saying that I don't even need to change into HALFOPEN 
mode in order to be able to append messages to any kind of mailbox without 
the Status: O flag being set? That I just have to keep the stream in 
READONLY mode?
Stream readonly status refers to operations on the opened mailbox (the 
selected mailbox in IMAP terms); it affects such operations as 
setting/clearing flags and expunging.  It does not in any way affect 
operations that work on a mailbox by name, such as append.

So I think that the answer to your question (if I understand it correctly) is 
yes.
Hmm - this is starting to be interesting for me. So this means that I 
could switch from mailbox to mailbox by opening them READONLY and that 
this would not issue internally an open/close on the stream and thus not 
require a re-authentication?

So in the general case, that is for local and remote mailboxes of a random 
format supported by c-client I can:

foreach mailbox in mailboxes_at_a_location {
  stream = open(mailbox, READONLY); # first step (read)
  read_mails(stream)#
  stream = open(mailbox, READWRITE);# second step (expunge)
  flag_removed_mails(stream);   #
  expunge(stream);  #
  stream = open(mailbox, READONLY); # third step
  append(new_mails, mailbox-name);  #
}
Q1: If I ommit the second step, then I can guarantee that all email stati
are maintained, especially Status: O will not be set by c-client or
the IMAP server no matter what format the mailbox is in. Correct?
Q2: It would be interesting if there exists a way to delete emails in a
mailbox (that is the second step) without affecting the Status: 
respectively the flags of any other email in that mailbox or any other
mailbox (this again for the general case).
Q3: Or if there is a way to remove Status: O after the fact
(afterwards). As I understand though this is not possible for the
general case. Correct?
If any of the two (preferable the later method - removing Status: O)
could be achieved, then mailsync could be implemented in a perfect
way.
Thanks,
*t
--
---
  Tomas Pospisek
  http://sourcepole.com -  Linux  Open Source Solutions
---


reopening a stream with OP_HALFOPEN

2004-12-01 Thread Tomas Pospisek's Mailing Lists
I've got reports [1] against Debian's version of c-client 2002e that when 
opening a stream, that is not OP_HALFOPEN (such as OP_READONLY or NIL), 
c-client will actually close and open the stream again (thus requiring the 
user to re-authenticate).

Is this:
* a known problem?
* a feature with a rationale?
* fixed in c-client 2004?
Any other comment?
*t
[1] http://bugs.debian.org/257418
--
---
  Tomas Pospisek
  http://sourcepole.com -  Linux  Open Source Solutions
---
--
--
For information about this mailing list, and its archives, see: 
http://www.washington.edu/imap/c-client-list.html
--


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
I've got reports [1] against Debian's version of c-client 2002e that when 
opening a stream, that is not OP_HALFOPEN (such as OP_READONLY or NIL), 
c-client will actually close and open the stream again (thus requiring the 
user to re-authenticate).
I assume that you're talking about recycling an already-open stream?
A close and open will happen if c-client determines that the new mailbox 
name is not compatible with the existing stream.

If you recycle a non-halfopen stream, and decide that you want the stream 
to be halfopen now, a close/open is required unless the server supports 
the UNSELECT capability.  That's the only reliable way to get a halfopen 
session if the server does not have UNSELECT.

If you don't care if the stream is halfopen or not, then you probably 
should not call mail_open() with the OP_HALFOPEN flag to recycle the 
stream.

-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Tomas Pospisek's Mailing Lists
On Wed, 1 Dec 2004, Mark Crispin wrote:
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
I've got reports [1] against Debian's version of c-client 2002e that when 
opening a stream, that is not OP_HALFOPEN (such as OP_READONLY or NIL), 
c-client will actually close and open the stream again (thus requiring the 
user to re-authenticate).
I assume that you're talking about recycling an already-open stream?
Yes.
A close and open will happen if c-client determines that the new mailbox name 
is not compatible with the existing stream.

If you recycle a non-halfopen stream, and decide that you want the stream to 
be halfopen now, a close/open is required unless the server supports the 
UNSELECT capability.  That's the only reliable way to get a halfopen session 
if the server does not have UNSELECT.

If you don't care if the stream is halfopen or not, then you probably should 
not call mail_open() with the OP_HALFOPEN flag to recycle the stream.
I'm looking at messages in readonly mode in order to determine which ones 
need to be synchronized between two sites.

Then I'm flagging those as deleted that have been removed on one side.
After that I'm appending new messages to mailboxes at both sides. In order 
to do this without having the Status: O set by c-client I need to change 
down into OP_HALFOPEN mode.

Thanks for the answer!
*t
--
---
  Tomas Pospisek
  http://sourcepole.com -  Linux  Open Source Solutions
---


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
I'm looking at messages in readonly mode in order to determine which ones 
need to be synchronized between two sites.
Then I'm flagging those as deleted that have been removed on one side.
After that I'm appending new messages to mailboxes at both sides. In order to 
do this without having the Status: O set by c-client I need to change 
down into OP_HALFOPEN mode.
Thanks for explaining so clearly what you're doing.  I understand the 
issue.

If the mailbox is opened readonly then there shouldn't be any Status: O 
set.  c-client doesn't do this; the IMAP server does.  If one of the IMAP 
servers is UW imapd, then indeed Status: O will happen when messages are 
appended to a mailbox that is open readwrite, since the readwrite session 
will see the messages.  But that won't happen if it's open readonly.

So, if Status: O is being written then I think that must be something 
that is happening in some other server.  Or perhaps you don't really have 
the mailbox open readonly (perhaps because you don't always see new mail 
in readonly sessions).

Anyway, the correct long-term fix is to upgrade to servers that support 
UNSELECT.

-- Mark --
http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
... but - are you saying that I don't even need to change into HALFOPEN mode 
in order to be able to append messages to any kind of mailbox without the 
Status: O flag being set? That I just have to keep the stream in READONLY 
mode?
Stream readonly status refers to operations on the opened mailbox (the 
selected mailbox in IMAP terms); it affects such operations as 
setting/clearing flags and expunging.  It does not in any way affect 
operations that work on a mailbox by name, such as append.

So I think that the answer to your question (if I understand it correctly) 
is yes.

-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
[1] http://www.mail-archive.com/c-client@u.washington.edu/msg00220.html
That message did not consider the case of the stream being opened 
readonly.

-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.