Package org.apache.james.mailbox

Examples of org.apache.james.mailbox.MailboxSession


            if (mailbox == null) {
                throw new MailboxException("Session not in SELECTED state");
            }

            final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
            List<MessageRange> ranges = new ArrayList<MessageRange>();

            for (int i = 0; i < idSet.length; i++) {
                MessageRange messageSet = messageRange(session.getSelected(), idSet[i], useUids);
                if (messageSet != null) {
View Full Code Here


        // setMsn(resultMsn);

        // Check if this fetch will cause the "SEEN" flag to be set on this
        // message. If so, update the flags, and ensure that a flags response is
        // included in the response.
        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
        boolean ensureFlagsResponse = false;
        final Flags resultFlags = result.getFlags();
        if (fetch.isSetSeen() && !resultFlags.contains(Flags.Flag.SEEN)) {
            mailbox.setFlags(new Flags(Flags.Flag.SEEN), true, false, MessageRange.one(resultUid), mailboxSession);
            resultFlags.add(Flags.Flag.SEEN);
View Full Code Here

    /*
     * (non-Javadoc)
     * @see org.apache.james.adapter.mailbox.MailboxManagerManagementMBean#deleteMailboxes(java.lang.String)
     */
    public boolean deleteMailboxes(String username) {
        MailboxSession session = null;
        try {
            session = mailboxManager.createSystemSession(username, log);
            mailboxManager.startProcessingRequest(session);
            List<MailboxMetaData> mList = mailboxManager.search(new MailboxQuery(MailboxPath.inbox(username), "", '*', '%'), session);
            for (int i = 0; i < mList.size(); i++) {
View Full Code Here

     * (non-Javadoc)
     * @see org.apache.james.adapter.mailbox.MailboxManagerManagementMBean#listMailboxes(java.lang.String)
     */
    public List<String> listMailboxes(String username) {
        List<String> boxes = new ArrayList<String>();
        MailboxSession session = null;
        try {
            session = mailboxManager.createSystemSession(username, log);
            mailboxManager.startProcessingRequest(session);
            List<MailboxMetaData> mList = mailboxManager.search(new MailboxQuery(MailboxPath.inbox(username), "", '*', '%'), session);
            for (int i = 0; i < mList.size(); i++) {
View Full Code Here

        return UnknownCmdHandler.COMMAND_NAME;
    }

    @Override
    public void onLine(POP3Session session, byte[] line) {
        MailboxSession mSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);

        // notify the mailboxmanager about the start of the processing
        manager.startProcessingRequest(mSession);

        // do the processing
View Full Code Here

        POP3Response response = null;
        String parameters = request.getArgument();
        List<Long> uidList = (List<Long>) session.getState().get(POP3Session.UID_LIST);
        List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);

        MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
        if (session.getHandlerState() == POP3Session.TRANSACTION) {
            if (parameters == null) {

                try {
                    long size = 0;
View Full Code Here

     * transaction state to initialize the handler copies of the user inbox.
     *
     */
    protected void stat(POP3Session session) {
        try {
            MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);

            List<Long> uids = new ArrayList<Long>();
            Iterator<MessageResult> it = session.getUserMailbox().getMessages(MessageRange.all(), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);
            while (it.hasNext()) {
                uids.add(it.next().getUid());
View Full Code Here

        if (session.getHandlerState() == POP3Session.AUTHENTICATION_READY || session.getHandlerState() == POP3Session.AUTHENTICATION_USERSET) {
            response = new POP3Response(POP3Response.OK_RESPONSE, "Apache James POP3 Server signing off.");
            response.setEndSession(true);
            return response;
        }
        MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);

        List<Long> toBeRemoved = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);
        try {
            MessageManager mailbox = session.getUserMailbox();
View Full Code Here

                List<Long> uidList = (List<Long>) session.getState().get(POP3Session.UID_LIST);
                List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);
                long size = 0;
                int count = 0;
                if (uidList.isEmpty() == false) {
                    MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
                    Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.range(uidList.get(0), uidList.get(uidList.size() - 1)), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);

                    List<MessageResult> validResults = new ArrayList<MessageResult>();
                    while (results.hasNext()) {
                        MessageResult result = results.next();
View Full Code Here

            }
            try {
                List<Long> uidList = (List<Long>) session.getState().get(POP3Session.UID_LIST);
                List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);

                MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
                Long uid = uidList.get(num - 1);
                if (deletedUidList.contains(uid) == false) {
                    FetchGroupImpl fetchGroup = new FetchGroupImpl(FetchGroup.BODY_CONTENT);
                    fetchGroup.or(FetchGroup.HEADERS);
                    Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.one(uid), fetchGroup, mailboxSession);
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.MailboxSession

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.