01: // The contents of this file are subject to the Mozilla Public License Version
02: // 1.1
03: //(the "License"); you may not use this file except in compliance with the
04: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
05: //
06: //Software distributed under the License is distributed on an "AS IS" basis,
07: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
08: //for the specific language governing rights and
09: //limitations under the License.
10: //
11: //The Original Code is "The Columba Project"
12: //
13: //The Initial Developers of the Original Code are Frederik Dietz and Timo
14: // Stich.
15: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16: //
17: //All Rights Reserved.
18: package org.columba.mail.composer;
19:
20: import java.io.IOException;
21: import java.io.InputStream;
22: import java.util.List;
23:
24: import org.columba.core.io.CloneStreamMaster;
25: import org.columba.mail.message.ColumbaMessage;
26: import org.columba.ristretto.io.SourceInputStream;
27:
28: public class SendableMessage extends ColumbaMessage {
29: private CloneStreamMaster sourceStream;
30:
31: public SendableMessage() {
32: super ();
33: }
34:
35: /**
36: * Constructs the SendableMessage.java.
37: *
38: * @param m
39: */
40: public SendableMessage(ColumbaMessage m) {
41: super (m);
42:
43: try {
44: setSourceStream(new SourceInputStream(m.getSource()));
45: } catch (IOException e) {
46: e.printStackTrace();
47: }
48: }
49:
50: public int getAccountUid() {
51: return ((Integer) columbaHeader.getAttributes().get(
52: "columba.accountuid")).intValue();
53: }
54:
55: public List getRecipients() {
56: return (List) columbaHeader.getAttributes().get(
57: "columba.recipients");
58: }
59:
60: public void setAccountUid(int uid) {
61: columbaHeader.getAttributes().put("columba.accountuid",
62: new Integer(uid));
63: }
64:
65: public void setRecipients(List rcpt) {
66: columbaHeader.getAttributes().put("columba.recipients", rcpt);
67: }
68:
69: /**
70: * @return Returns the sourceStream.
71: */
72: public InputStream getSourceStream() {
73: if (sourceStream == null) {
74: return new SourceInputStream(getSource());
75: }
76:
77: return sourceStream.getClone();
78: }
79:
80: /**
81: * @param sourceStream
82: * The sourceStream to set.
83: */
84: public void setSourceStream(InputStream sourceStream)
85: throws IOException {
86: this .sourceStream = new CloneStreamMaster(sourceStream);
87: }
88: }
|