1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.mercury.imap.response;
14
15 import javax.mail.Folder;
16 import javax.mail.MessagingException;
17 import org.abstracthorizon.mercury.imap.IMAPSession;
18
19
20
21
22
23
24 public class ListResponse extends MnemonicResponse {
25
26
27 protected String msg;
28
29
30
31
32
33
34
35 public ListResponse(IMAPSession session, Folder f) throws MessagingException {
36 this(session, "LIST", f);
37 }
38
39
40
41
42
43
44
45
46 protected ListResponse(IMAPSession session, String mnemonic, Folder f) throws MessagingException {
47 super(session, Response.UNTAGGED_RESPONSE, mnemonic, composeMessage(f));
48 }
49
50
51
52
53
54
55
56 public static final String composeMessage(Folder f) throws MessagingException {
57 String flags = "";
58 if ((f.getType() & Folder.HOLDS_FOLDERS) == 0) {
59 flags = "\\Noinferiors";
60 } else if ((f.getType() & Folder.HOLDS_MESSAGES) == 0) {
61 flags = "\\Noselect";
62 }
63 return "("+flags+") \""+f.getSeparator()+"\" \""+f.getFullName()+"\"";
64 }
65
66 }