当前位置: 首页>>代码示例>>Java>>正文


Java Pop3State.getFolder方法代码示例

本文整理汇总了Java中com.icegreen.greenmail.pop3.Pop3State.getFolder方法的典型用法代码示例。如果您正苦于以下问题:Java Pop3State.getFolder方法的具体用法?Java Pop3State.getFolder怎么用?Java Pop3State.getFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.icegreen.greenmail.pop3.Pop3State的用法示例。


在下文中一共展示了Pop3State.getFolder方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state, String cmd) {
    conn.println("+OK");
    try {
        MailFolder inbox = state.getFolder();
        List msgList = inbox.getMessages();
        int count = 0;
        for(int i=0;i<msgList.size();i++) {
            SimpleStoredMessage msg = (SimpleStoredMessage) msgList.get(i);
            Flags flags = msg.getFlags();
            if (flags.contains(Flags.Flag.DELETED)) {
                count++;
                flags.remove(Flags.Flag.DELETED);
            }
        }

        conn.println("+OK maildrop has "+count+" messages undeleted.");
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:21,代码来源:RsetCommand.java

示例2: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        String[] cmdLine = cmd.split(" ");

        String msgNumStr = cmdLine[1];
        List msgList = inbox.getMessages(new MsgRangeFilter(msgNumStr, false));
        if (msgList.size() != 1) {
            conn.println("-ERR no such message");

            return;
        }

        SimpleStoredMessage msg = (SimpleStoredMessage) msgList.get(0);
        String email = GreenMailUtil.getWholeMessage(msg.getMimeMessage());
        conn.println("+OK");
        conn.print(new StringReader(email));
        conn.println();
        conn.println(".");
        msg.getFlags().add(Flags.Flag.SEEN);
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:26,代码来源:RetrCommand.java

示例3: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder folder = state.getFolder();
        if (folder != null) {
            folder.expunge();

        }

        conn.println("+OK bye see you soon");
        conn.quit();
    } catch (FolderException me) {
        conn.println("+OK Signing off, but message deletion failed");
        conn.quit();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:17,代码来源:QuitCommand.java

示例4: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        String[] cmdLine = cmd.split(" ");

        String msgNumStr = cmdLine[1];
        List msgList = inbox.getMessages(new MsgRangeFilter(msgNumStr, false));
        if (msgList.size() != 1) {
            conn.println("-ERR no such message");

            return;
        }

        SimpleStoredMessage msg = (SimpleStoredMessage) msgList.get(0);
        Flags flags = msg.getFlags();

        if (flags.contains(Flags.Flag.DELETED)) {
            conn.println("-ERR message already deleted");

            return;
        }

        flags.add(Flags.Flag.DELETED);

        conn.println("+OK message scheduled for deletion");
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:31,代码来源:DeleCommand.java

示例5: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
@Override
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        String[] cmdLine = cmd.split(" ");

        String msgNumStr = cmdLine[1];
        List<StoredMessage> msgList = inbox.getMessages(new MsgRangeFilter(msgNumStr, false));
        if (msgList.size() != 1) {
            conn.println("-ERR no such message");

            return;
        }

        StoredMessage msg = msgList.get(0);
        String email = GreenMailUtil.getWholeMessage(msg.getMimeMessage());
        conn.println("+OK");
        conn.print(new StringReader(email));
        conn.println();
        conn.println(".");
        msg.setFlag(Flags.Flag.SEEN, true);
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:27,代码来源:RetrCommand.java

示例6: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
@Override
public void execute(Pop3Connection conn, Pop3State state, String cmd) {
    conn.println("+OK");
    try {
        MailFolder inbox = state.getFolder();
        List<StoredMessage> msgList = inbox.getMessages();
        int count = 0;
        for (StoredMessage msg : msgList) {
            if (msg.isSet(Flags.Flag.DELETED)) {
                count++;
                msg.setFlag(Flags.Flag.DELETED, false);
            }
        }

        conn.println("+OK maildrop has "+count+" messages undeleted.");
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:20,代码来源:RsetCommand.java

示例7: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
@Override
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder folder = state.getFolder();
        if (folder != null) {
            folder.expunge();

        }

        conn.println("+OK bye see you soon");
        conn.quit();
    } catch (FolderException me) {
        conn.println("+OK Signing off, but message deletion failed");
        conn.quit();
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:18,代码来源:QuitCommand.java

示例8: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        List messages = inbox.getNonDeletedMessages();
        long size = sumMessageSizes(messages);
        conn.println("+OK " + messages.size() + " " + size);
    } catch (Exception me) {
        conn.println("-ERR " + me);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:12,代码来源:StatCommand.java

示例9: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        String[] cmdLine = cmd.split(" ");
        if (cmdLine.length < 3)
            throw new IllegalArgumentException("range and line count required");

        String msgNumStr = cmdLine[1];
        List msgList = inbox.getMessages(new MsgRangeFilter(msgNumStr, false));
        if (msgList.size() != 1) {
            conn.println("-ERR no such message");

            return;
        }

        SimpleStoredMessage msg = (SimpleStoredMessage) msgList.get(0);

        int numLines = Integer.parseInt(cmdLine[2]);

        BufferedReader in = new BufferedReader(new StringReader(GreenMailUtil.getWholeMessage(msg.getMimeMessage())));

        conn.println("+OK");

        copyHeaders(in, conn);
        copyLines(in, conn, numLines);
        in.close();
        conn.println(".");
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:33,代码来源:TopCommand.java

示例10: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
@Override
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        String[] cmdLine = cmd.split(" ");

        String msgNumStr = cmdLine[1];
        List<StoredMessage> msgList = inbox.getMessages(new MsgRangeFilter(msgNumStr, false));
        if (msgList.size() != 1) {
            conn.println("-ERR no such message");

            return;
        }

        StoredMessage msg = msgList.get(0);
        if (msg.isSet(Flags.Flag.DELETED)) {
            conn.println("-ERR message already deleted");
            return;
        }

        msg.setFlag(Flags.Flag.DELETED, true);

        conn.println("+OK message scheduled for deletion");
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:29,代码来源:DeleCommand.java

示例11: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
@Override
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        List<StoredMessage> messages = inbox.getNonDeletedMessages();
        long size = sumMessageSizes(messages);
        conn.println("+OK " + messages.size() + " " + size);
    } catch (Exception me) {
        conn.println("-ERR " + me);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:13,代码来源:StatCommand.java

示例12: execute

import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
@Override
public void execute(Pop3Connection conn, Pop3State state,
                    String cmd) {
    try {
        MailFolder inbox = state.getFolder();
        String[] cmdLine = cmd.split(" ");
        if (cmdLine.length < 3)
            throw new IllegalArgumentException("range and line count required");

        String msgNumStr = cmdLine[1];
        List<StoredMessage> msgList = inbox.getMessages(new MsgRangeFilter(msgNumStr, false));
        if (msgList.size() != 1) {
            conn.println("-ERR no such message");

            return;
        }

        StoredMessage msg = msgList.get(0);

        int numLines = Integer.parseInt(cmdLine[2]);

        try (BufferedReader in = new BufferedReader(
                new StringReader(GreenMailUtil.getWholeMessage(msg.getMimeMessage())))) {
            conn.println("+OK");

            copyHeaders(in, conn);
            copyLines(in, conn, numLines);
        }
        conn.println(".");
    } catch (Exception e) {
        conn.println("-ERR " + e);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:34,代码来源:TopCommand.java


注:本文中的com.icegreen.greenmail.pop3.Pop3State.getFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。