KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > armedbear > j > mail > LocalMailboxEntry


1 /*
2  * LocalMailboxEntry.java
3  *
4  * Copyright (C) 2000-2002 Peter Graves
5  * $Id: LocalMailboxEntry.java,v 1.1.1.1 2002/09/24 16:10:12 piso Exp $
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */

21
22 package org.armedbear.j.mail;
23
24 import java.util.List JavaDoc;
25 import org.armedbear.j.Headers;
26 import org.armedbear.j.Log;
27
28 public final class LocalMailboxEntry extends MailboxEntry
29 {
30     private long messageStart;
31     private long nextMessageStart;
32     private String JavaDoc uidl;
33
34     public LocalMailboxEntry(int messageNumber, long messageStart, String JavaDoc s)
35     {
36         this.messageNumber = messageNumber;
37         this.messageStart = messageStart;
38         Headers headers = Headers.parse(s);
39         subject = RFC2047.decode(headers.getValue(Headers.SUBJECT));
40         date = RFC822Date.parseDate(headers.getValue(Headers.DATE));
41         from = MailAddress.parseAddresses(RFC2047.decode(
42             headers.getValue(Headers.FROM)));
43         replyTo = MailAddress.parseAddresses(RFC2047.decode(
44             headers.getValue(Headers.REPLY_TO)));
45         to = MailAddress.parseAddresses(RFC2047.decode(
46             headers.getValue(Headers.TO)));
47         cc = MailAddress.parseAddresses(RFC2047.decode(
48             headers.getValue(Headers.CC)));
49         messageId = headers.getValue(Headers.MESSAGE_ID);
50         inReplyTo = parseInReplyTo(headers.getValue(Headers.IN_REPLY_TO));
51         String JavaDoc refs = headers.getValue(Headers.REFERENCES);
52         if (refs != null)
53             references = parseReferences(refs);
54         uidl = headers.getValue(Headers.X_UIDL);
55         String JavaDoc status = headers.getValue(Headers.X_J_STATUS);
56         if (status != null) {
57             try {
58                 flags = Integer.parseInt(status);
59             }
60             catch (NumberFormatException JavaDoc e) {
61                 Log.error(e);
62             }
63         }
64     }
65
66     public final long getMessageStart()
67     {
68         return messageStart;
69     }
70
71     public final void setMessageStart(long offset)
72     {
73         messageStart = offset;
74     }
75
76     public final long getNextMessageStart()
77     {
78         return nextMessageStart;
79     }
80
81     public final void setNextMessageStart(long offset)
82     {
83         nextMessageStart = offset;
84     }
85
86     public final String JavaDoc getUidl()
87     {
88         return uidl;
89     }
90 }
91
Popular Tags