01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo
13: // Stich.
14: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
15: //Portions created by Celso Pinto are Copyright (C) 2004.
16: //All Rights Reserved.
17: package org.columba.mail.gui.message.util;
18:
19: import java.net.URL;
20:
21: /**
22: * This class is a substitute for java.net.URL. It allows one to add specific
23: * properties depending on the URL's protocol.<br>
24: * At the moment only handles mailto: protocol.<br>
25: * I.E.: URL might be mailto:cpinto@yimports.com and sender is Celso Pinto,
26: * resulting on getEmailAddress()==cpinto@yimports.com and getSender() on Celso Pinto.
27: *
28: * @author Celso Pinto <cpinto@yimports.com>
29: */
30: public class ColumbaURL {
31:
32: private URL iRealURL = null;
33: private String iSender = "";
34:
35: public ColumbaURL(URL aRealURL) {
36: iRealURL = aRealURL;
37: }
38:
39: public String getEmailAddress() {
40: if (iRealURL == null)
41: return "";
42:
43: return iRealURL.getFile();
44: }
45:
46: public void setRealURL(URL aRealURL) {
47: iRealURL = aRealURL;
48: }
49:
50: public URL getRealURL() {
51: return iRealURL;
52: }
53:
54: public String getSender() {
55: return iSender;
56: }
57:
58: public void setSender(String aSender) {
59: iSender = aSender;
60: }
61:
62: public boolean isMailTo() {
63: return iRealURL.getProtocol().equalsIgnoreCase("mailto");
64: }
65:
66: }
|