01: /*
02: * LocalMailboxEntry.java
03: *
04: * Copyright (C) 2000-2002 Peter Graves
05: * $Id: LocalMailboxEntry.java,v 1.1.1.1 2002/09/24 16:10:12 piso Exp $
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * 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;
25: import org.armedbear.j.Headers;
26: import org.armedbear.j.Log;
27:
28: public final class LocalMailboxEntry extends MailboxEntry {
29: private long messageStart;
30: private long nextMessageStart;
31: private String uidl;
32:
33: public LocalMailboxEntry(int messageNumber, long messageStart,
34: String s) {
35: this .messageNumber = messageNumber;
36: this .messageStart = messageStart;
37: Headers headers = Headers.parse(s);
38: subject = RFC2047.decode(headers.getValue(Headers.SUBJECT));
39: date = RFC822Date.parseDate(headers.getValue(Headers.DATE));
40: from = MailAddress.parseAddresses(RFC2047.decode(headers
41: .getValue(Headers.FROM)));
42: replyTo = MailAddress.parseAddresses(RFC2047.decode(headers
43: .getValue(Headers.REPLY_TO)));
44: to = MailAddress.parseAddresses(RFC2047.decode(headers
45: .getValue(Headers.TO)));
46: cc = MailAddress.parseAddresses(RFC2047.decode(headers
47: .getValue(Headers.CC)));
48: messageId = headers.getValue(Headers.MESSAGE_ID);
49: inReplyTo = parseInReplyTo(headers
50: .getValue(Headers.IN_REPLY_TO));
51: String refs = headers.getValue(Headers.REFERENCES);
52: if (refs != null)
53: references = parseReferences(refs);
54: uidl = headers.getValue(Headers.X_UIDL);
55: String status = headers.getValue(Headers.X_J_STATUS);
56: if (status != null) {
57: try {
58: flags = Integer.parseInt(status);
59: } catch (NumberFormatException e) {
60: Log.error(e);
61: }
62: }
63: }
64:
65: public final long getMessageStart() {
66: return messageStart;
67: }
68:
69: public final void setMessageStart(long offset) {
70: messageStart = offset;
71: }
72:
73: public final long getNextMessageStart() {
74: return nextMessageStart;
75: }
76:
77: public final void setNextMessageStart(long offset) {
78: nextMessageStart = offset;
79: }
80:
81: public final String getUidl() {
82: return uidl;
83: }
84: }
|