Package org.apache.james.protocols.pop3.mailbox

Examples of org.apache.james.protocols.pop3.mailbox.ImapMessageMetaData


        for (AbstractPassCmdHandler handler: authHandlers) {
            handlers.add(handler);
        }
       
        handlers.add(new CapaCmdHandler());
        handlers.add(new UserCmdHandler());
        handlers.add(new ListCmdHandler());
        handlers.add(new UidlCmdHandler());
        handlers.add(new RsetCmdHandler());
        handlers.add(new DeleCmdHandler());
        handlers.add(new NoopCmdHandler());
View Full Code Here


        handlers.add(new NoopCmdHandler());
        handlers.add(new RetrCmdHandler());
        handlers.add(new TopCmdHandler());
        handlers.add(new StatCmdHandler());
        handlers.add(new QuitCmdHandler());
        handlers.add(new WelcomeMessageHandler());
        handlers.add(new UnknownCmdHandler());
        handlers.add(new StlsCmdHandler());
        handlers.add(new CommandDispatcher<POP3Session>());
      
        return handlers;
View Full Code Here

        public final MessageMetaData meta;

        public Message(String headers, String body) {
            this.headers = headers;
            this.body = body;
            this.meta = new ImapMessageMetaData(UIDS.incrementAndGet(), headers.length() + body.length() + 2);
        }
View Full Code Here

        Response response = null;
        if (session.getHandlerState() == POP3Session.AUTHENTICATION_READY || session.getHandlerState() == POP3Session.AUTHENTICATION_USERSET) {
            return SIGN_OFF;
        }
        List<String> toBeRemoved = (List<String>) session.getAttachment(POP3Session.DELETED_UID_LIST, State.Transaction);
        Mailbox mailbox = session.getUserMailbox();
        try {
            String[] uids = toBeRemoved.toArray(new String[toBeRemoved.size()]);
            mailbox.remove(uids);
            response = SIGN_OFF;
        } catch (Exception ex) {
            response = SIGN_OFF_NOT_CLEAN;
            session.getLogger().error("Some deleted messages were not removed", ex);
        }
        try {
            mailbox.close();
        } catch (IOException e) {
            // ignore on close
        }
        return response;
    }
View Full Code Here

        String parameters = request.getArgument();
        POP3Response response = null;
        if (session.getHandlerState() == POP3Session.AUTHENTICATION_USERSET && parameters != null) {
            String passArg = parameters;
            try {
                Mailbox mailbox = mailboxManager.getMailbox(session, passArg);
                if (mailbox != null) {
                  session.setUserMailbox(mailbox);
                  stat(session);
               
                  StringBuilder responseBuffer = new StringBuilder(64).append("Welcome ").append(session.getUser());
View Full Code Here

            response = new POP3Response(POP3Response.OK_RESPONSE, "Apache James POP3 Server signing off.");
            response.setEndSession(true);
            return response;
        }
        List<Long> toBeRemoved = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);
        Mailbox mailbox = session.getUserMailbox();
        try {
            ;
            long uids[] = new long[toBeRemoved.size()];
            for (int i = 0;i < toBeRemoved.size(); i++) {
                uids[i] = toBeRemoved.get(i);
            }
            mailbox.remove(uids);
            response = new POP3Response(POP3Response.OK_RESPONSE, "Apache James POP3 Server signing off.");
        } catch (Exception ex) {
            response = new POP3Response(POP3Response.ERR_RESPONSE, "Some deleted messages were not removed");
            session.getLogger().error("Some deleted messages were not removed", ex);
        }    
        response.setEndSession(true);
        try {
            mailbox.close();
        } catch (IOException e) {
            // ignore on close
        }
        return response;
    }
View Full Code Here

     * @param pass
     * @return response
     */
    protected final Response doAuth(POP3Session session, String user, String pass) {
        try {
            Mailbox mailbox = auth(session, user, pass);

            if (mailbox != null) {
                session.setUserMailbox(mailbox);
                stat(session);

View Full Code Here

    // convert to James Protocols list
    List<MessageMetaData> list = new ArrayList<MessageMetaData>(messages.size());

    for (Map.Entry<UUID, Message> entry : messages.entrySet())
    {
      MessageMetaData md = new MessageMetaData(
          Base64UUIDUtils.encode(entry.getKey()), entry.getValue().getSize());
      list.add(md);
    }
   
    return list;
View Full Code Here

            } catch (NumberFormatException nfe) {
                return SYNTAX_ERROR;
            }
            try {
               
                MessageMetaData data = MessageMetaDataUtils.getMetaData(session, num);
                if (data == null) {
                    StringBuilder responseBuffer = new StringBuilder(64).append("Message (").append(num).append(") does not exist.");
                    return  new POP3Response(POP3Response.ERR_RESPONSE, responseBuffer.toString());
                }
               
                List<String> deletedUidList = (List<String>) session.getAttachment(POP3Session.DELETED_UID_LIST, State.Transaction);

                String uid = data.getUid();
                if (deletedUidList.contains(uid) == false) {

                    InputStream message = new CountingBodyInputStream(new ExtraDotInputStream(new CRLFTerminatedInputStream(session.getUserMailbox().getMessage(uid))), lines);
                    if (message != null) {
                        return new POP3StreamResponse(POP3Response.OK_RESPONSE, "Message follows", message);
View Full Code Here

                num = Integer.parseInt(parameters.trim());
            } catch (Exception e) {
                return SYNTAX_ERROR;
            }
            try {
                MessageMetaData data = MessageMetaDataUtils.getMetaData(session, num);

                if (data == null) {
                    StringBuilder responseBuffer = new StringBuilder(64).append("Message (").append(num).append(") does not exist.");
                    response = new POP3Response(POP3Response.ERR_RESPONSE, responseBuffer.toString());
                    return response;
                }
                List<String> deletedUidList = (List<String>) session.getAttachment(POP3Session.DELETED_UID_LIST, State.Transaction);

                String uid = data.getUid();
                if (deletedUidList.contains(uid) == false) {
                    InputStream content = session.getUserMailbox().getMessage(uid);

                    if (content != null) {
                        InputStream in = new CRLFTerminatedInputStream(new ExtraDotInputStream(content));
View Full Code Here

TOP

Related Classes of org.apache.james.protocols.pop3.mailbox.ImapMessageMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.