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


Java Flags.contains方法代码示例

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


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

示例1: execute

import javax.mail.Flags; //导入方法依赖的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: expungeMessage

import javax.mail.Flags; //导入方法依赖的package包/类
public void expungeMessage(FileInfo fileInfo)
{
    Flags flags = getFlags(fileInfo);
    if (flags.contains(Flags.Flag.DELETED))
    {
        // See MNT-12259
        //fileFolderService.delete(fileInfo.getNodeRef());
        hideAndDelete(fileInfo.getNodeRef());
        messageCache.remove(fileInfo.getNodeRef());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:ImapServiceImpl.java

示例3: getRecentCount

import javax.mail.Flags; //导入方法依赖的package包/类
/**
 * Returns count of messages with {@link javax.mail.Flags.Flag#RECENT} flag.
 * If {@code reset} parameter is {@code true} - removes {@link javax.mail.Flags.Flag#RECENT} flag from
 * the message for current user.
 * 
 * @param reset - if true the {@link javax.mail.Flags.Flag#RECENT} will be deleted for current user if exists.
 * @return returns count of recent messages.
 */
@Override
public int getRecentCount(boolean reset)
{
    int recent = getFolderStatus().recentCount;
    if (reset && recent > 0)
    {
        CommandCallback<Void> command = new CommandCallback<Void>()
        {
            public Void command() throws Throwable
            {
                for (FileInfo fileInfo : folderStatus.search.values())
                {
                    Flags flags = imapService.getFlags(fileInfo);
                    if (flags.contains(Flags.Flag.RECENT))
                    {
                        imapService.setFlag(fileInfo, Flags.Flag.RECENT, false);
                    }
                }
                return null;
            }
        };
        try
        {
            command.run();
        }
        catch (AccessDeniedException ade)
        {
            if (logger.isDebugEnabled())
            {
                logger.debug("Access denied to reset RECENT FLAG");
            }
        }
    }
    return recent;        
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:44,代码来源:AlfrescoImapFolder.java

示例4: format

import javax.mail.Flags; //导入方法依赖的package包/类
/**
 * Returns IMAP formatted String of MessageFlags for named user
 */
public static String format(Flags flags) {
    StringBuffer buf = new StringBuffer();
    buf.append("(");
    if (flags.contains(Flags.Flag.ANSWERED)) {
        buf.append("\\Answered ");
    }
    if (flags.contains(Flags.Flag.DELETED)) {
        buf.append("\\Deleted ");
    }
    if (flags.contains(Flags.Flag.DRAFT)) {
        buf.append("\\Draft ");
    }
    if (flags.contains(Flags.Flag.FLAGGED)) {
        buf.append("\\Flagged ");
    }
    if (flags.contains(Flags.Flag.RECENT)) {
        buf.append("\\Recent ");
    }
    if (flags.contains(Flags.Flag.SEEN)) {
        buf.append("\\Seen ");
    }
    // Remove the trailing space, if necessary.
    if (buf.length() > 1) {
        buf.setLength(buf.length() - 1);
    }
    buf.append(")");
    return buf.toString();
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:32,代码来源:MessageFlags.java

示例5: execute

import javax.mail.Flags; //导入方法依赖的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

示例6: setFlags

import javax.mail.Flags; //导入方法依赖的package包/类
/**
 * Sets flags for this message. Flags not explicitly stored in metadata
 * will be kept in-memory.
 * @param flag The current state of flags for this message.
 */
@Override
public synchronized void setFlags(Flags flag, boolean set) throws MessagingException {
    if (flag.contains(Flag.RECENT))
        setRecent(set);
    if (flag.contains(Flag.SEEN))
        setUnread(!set);
    if (flag.contains(Flag.ANSWERED))
        setReplied(set);
    if (flag.contains(Flag.DELETED))
        setDeleted(set);
    super.setFlags(flag, set);
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:18,代码来源:Email.java

示例7: format

import javax.mail.Flags; //导入方法依赖的package包/类
/**
 * Returns IMAP formatted String of MessageFlags for named user
 */
public static String format(Flags flags) {
    StringBuilder buf = new StringBuilder();
    buf.append('(');
    if (flags.contains(Flags.Flag.ANSWERED)) {
        buf.append("\\Answered ");
    }
    if (flags.contains(Flags.Flag.DELETED)) {
        buf.append("\\Deleted ");
    }
    if (flags.contains(Flags.Flag.DRAFT)) {
        buf.append("\\Draft ");
    }
    if (flags.contains(Flags.Flag.FLAGGED)) {
        buf.append("\\Flagged ");
    }
    if (flags.contains(Flags.Flag.RECENT)) {
        buf.append("\\Recent ");
    }
    if (flags.contains(Flags.Flag.SEEN)) {
        buf.append("\\Seen ");
    }
    String[] userFlags = flags.getUserFlags();
    if(null!=userFlags) {
        for(String uf: userFlags) {
            buf.append(uf).append(' ');
        }
    }
    // Remove the trailing space, if necessary.
    if (buf.length() > 1) {
        buf.setLength(buf.length() - 1);
    }
    buf.append(')');
    return buf.toString();
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:38,代码来源:MessageFlags.java

示例8: toStringArray

import javax.mail.Flags; //导入方法依赖的package包/类
public static String[] toStringArray(final Flags flags) {
    final List<String> flagsL = new ArrayList<String>(10);

    if (flags.contains(Flags.Flag.DELETED)) {
        flagsL.add("Deleted");
    }
    if (flags.contains(Flags.Flag.ANSWERED)) {
        flagsL.add("Answered");
    }
    if (flags.contains(Flags.Flag.DRAFT)) {
        flagsL.add("Draft");
    }
    if (flags.contains(Flags.Flag.FLAGGED)) {
        flagsL.add("Flagged");
    }
    if (flags.contains(Flags.Flag.RECENT)) {
        flagsL.add("Recent");
    }
    if (flags.contains(Flags.Flag.SEEN)) {
        flagsL.add("Seen");
    }

    if (flags.contains(Flags.Flag.USER)) {
        final String[] userFlags = flags.getUserFlags();
        for (int j = 0; j < userFlags.length; j++) {
            flagsL.add(userFlags[j]);
        }
    }

    return flagsL.toArray(new String[flagsL.size()]);
}
 
开发者ID:salyh,项目名称:elasticsearch-imap,代码行数:32,代码来源:IMAPUtils.java


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