[PATCH] IMAP - Fetch Command now working with Mozilla

2002-09-03 Thread Sascha Kulawik

 
Hello,

Here is the new CommandFetch for a working Fetch with Mozilla.
Haven't made a diff, diff says to me: every old line out, all new lines in
- doesn't seems useful for me.

Regards,
Sascha

attachment: winmail.dat
--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re: [PATCH] IMAP - Fetch Command now working with Mozilla

2002-09-03 Thread Andrew C. Oliver

Sascha Kulawik wrote:
  
 Hello,
 
 Here is the new CommandFetch for a working Fetch with Mozilla.
 Haven't made a diff, diff says to me: every old line out, all new lines in
 - doesn't seems useful for me.
 
 Regards,
 Sascha
 
 
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]

invest in the command dos2unix assuming you're using cygwin.  if on 
linux do:

cat myfile | tr -d '\r'  myfile

That will convert the line feeds.

For me (reading from mozilla on winblows at the moment) your attachment 
became a winmail.dat file.




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: [PATCH] IMAP - Fetch Command now working with Mozilla

2002-09-03 Thread Sascha Kulawik

 invest in the command dos2unix assuming you're using cygwin.  if on 
 linux do:
 
 cat myfile | tr -d '\r'  myfile
 
 That will convert the line feeds.
 
 For me (reading from mozilla on winblows at the moment) your 
 attachment 
 became a winmail.dat file.

Sorry, using Outlook here, sometimes Outlook sends with RitchText, but
I've ASCII-only selected :(
This file is not the same as the previous, I've seen, that there was an
error in the prior file.
Please upload this one.
Currently I have no Cygwin here, because of using Linux for this cases. 
Have tried it to remove the Lf, but the same procedure... :(

Sascha


/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE file.
 */
package org.apache.james.imapserver;

import org.apache.james.AccessControlException;
import org.apache.james.AuthorizationException;
import org.apache.james.core.MimeMessageWrapper;
import org.apache.james.imapserver.commands.ImapCommand;

import javax.mail.MessagingException;
import javax.mail.internet.InternetHeaders;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

/**
 * Implements the IMAP FETCH command for a given ImapRequestImpl.
 *
 * References: rfc 2060, rfc 2193, rfc 2221
 * @author a href=mailto:[EMAIL PROTECTED];Sascha Kulawik/a
 * @author a href=mailto:[EMAIL PROTECTED];Charles Benett/a
 * @version 0.2 on 04 Aug 2002
 */
public class CommandFetch
extends BaseCommand implements ImapCommand
{

//mainly to switch on stack traces and catch responses;
private static final boolean DEEP_DEBUG = true;

private static final String OK = OK;
private static final String NO = NO;
private static final String BAD = BAD;
private static final String UNTAGGED = *;
private static final String SP =  ;

private StringTokenizer commandLine;
private boolean useUIDs;
private ACLMailbox currentMailbox;
private String commandRaw;
private PrintWriter out;
private OutputStream outs;
private String tag;
private String user;
private SingleThreadedConnectionHandler caller;
private String currentFolder;

public boolean validForState( ImapSessionState state )
{
return ( state == ImapSessionState.SELECTED );
}

public boolean process( ImapRequest request, ImapSession session )
{
setRequest( request );
	StringTokenizer txt = request.getCommandLine();

/*	System.out.println(CommandFetch.process: #args=+txt.countTokens());
while (txt.hasMoreTokens()) {
System.out.println(CommandFetch.process: arg='+txt.nextToken()+');
}
*/
   // ((ImapRequestImpl)request).setCommandLine(new java.util.StringTokenizer(request.getCommandRaw()));
if ( request.arguments()  2 ) {
session.badResponse( #args=+request.arguments()+ '+request.getCommandLine().nextToken()+', '+request.getCommandLine().nextToken()+' Command should be tag FETCH message set message data item names );
return true;
}
service();
return true;
}

/**
 * Debugging method - will probably disappear
 */
public void setRequest(ImapRequest request) {
commandLine = request.getCommandLine();
useUIDs = request.useUIDs();
currentMailbox = request.getCurrentMailbox();
System.out.println(currentMailbox=+((currentMailbox!=null)?currentMailbox.getClass().getName():null));
commandRaw = request.getCommandRaw();
tag = request.getTag();
currentFolder = request.getCurrentFolder();

caller = request.getCaller();
out = caller.getPrintWriter();
outs = caller.getOutputStream();
user = caller.getUser();
}

/**
 * Implements IMAP fetch commands given an ImapRequestImpl.
 * This implementation attempts to satisfy the fetch command with the
 * smallest objects deserialized from storage.
 * pWarning - maybecome service(ImapRequestImpl request)
 * pNot yet complete - no partial (octet-counted or sub-parts) fetches.
 */
public void service() {
// decode the message set
List set;
List uidsList = null;
String setArg = commandLine.nextToken();
if (useUIDs) {
uidsList = currentMailbox.listUIDs(user);
set = decodeUIDSet(setArg, uidsList);
} else {
set = decodeSet(setArg, currentMailbox.getExists());
}
if (DEEP_DEBUG) {
getLogger().debug(Fetching message set of size:  + set.size());
}
String firstFetchArg = commandLine.nextToken();
int pos =  commandRaw.indexOf(firstFetchArg);
//int pos = commandRaw.indexOf(setArg) + setArg.length() + 1;
String fetchAttrsRaw = null;
if (firstFetchArg.startsWith(()) {