Source Code Cross Referenced for ReplyToAllCommand.java in  » Mail-Clients » columba-1.4 » org » columba » mail » gui » composer » command » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Mail Clients » columba 1.4 » org.columba.mail.gui.composer.command 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The contents of this file are subject to the Mozilla Public License Version
002:        // 1.1
003:        //(the "License"); you may not use this file except in compliance with the
004:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:        //
006:        //Software distributed under the License is distributed on an "AS IS" basis,
007:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:        //for the specific language governing rights and
009:        //limitations under the License.
010:        //
011:        //The Original Code is "The Columba Project"
012:        //
013:        //The Initial Developers of the Original Code are Frederik Dietz and Timo
014:        // Stich.
015:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016:        //
017:        //All Rights Reserved.
018:        package org.columba.mail.gui.composer.command;
019:
020:        import java.util.Arrays;
021:        import java.util.Collections;
022:        import java.util.Iterator;
023:        import java.util.LinkedList;
024:
025:        import org.columba.api.command.ICommandReference;
026:        import org.columba.mail.composer.MessageBuilderHelper;
027:        import org.columba.mail.config.AccountItem;
028:        import org.columba.mail.config.MailConfig;
029:        import org.columba.mail.folder.IMailbox;
030:        import org.columba.ristretto.message.Address;
031:        import org.columba.ristretto.message.BasicHeader;
032:        import org.columba.ristretto.message.Header;
033:
034:        /**
035:         * Reply to All senders.
036:         * 
037:         * @author fdietz
038:         */
039:        public class ReplyToAllCommand extends ReplyCommand {
040:            protected final String[] headerfields = new String[] { "Subject",
041:                    "From", "To", "Cc", "Reply-To", "Message-ID",
042:                    "In-Reply-To", "References" };
043:
044:            /**
045:             * Constructor for ReplyToAllCommand.
046:             * 
047:             * @param frameMediator
048:             * @param references
049:             */
050:            public ReplyToAllCommand(ICommandReference reference) {
051:                super (reference);
052:            }
053:
054:            protected void initHeader(IMailbox folder, Object[] uids)
055:                    throws Exception {
056:                // get headerfields
057:                Header header = folder.getHeaderFields(uids[0], headerfields);
058:
059:                // From which account is this mail?
060:                Integer accountUid = (Integer) folder.getAttribute(uids[0],
061:                        "columba.accountuid");
062:                AccountItem accountItem = MessageBuilderHelper
063:                        .getAccountItem(accountUid);
064:                Address accountAddress = null;
065:                if (accountItem != null)
066:                    accountAddress = MailConfig.getInstance().getAccountList()
067:                            .uidGet(accountUid.intValue()).getIdentity()
068:                            .getAddress();
069:
070:                BasicHeader rfcHeader = new BasicHeader(header);
071:
072:                // set subject
073:                model.setSubject(MessageBuilderHelper
074:                        .createReplySubject(rfcHeader.getSubject()));
075:
076:                LinkedList toList = new LinkedList();
077:                toList.addAll(Arrays.asList(rfcHeader.getReplyTo()));
078:                toList.add(rfcHeader.getFrom());
079:                toList.addAll(Arrays.asList(rfcHeader.getTo()));
080:
081:                // bug #997560 (fdietz): CC: should be in Cc:, instead of To:
082:                //toList.addAll(Arrays.asList(rfcHeader.getCc()));
083:
084:                // remove duplicates
085:                Collections.sort(toList);
086:
087:                Iterator it = toList.iterator();
088:                Address last = (Address) it.next();
089:
090:                while (it.hasNext()) {
091:                    Address act = (Address) it.next();
092:
093:                    // Remove duplicates or the mail address from the receiver account
094:                    if (last.equals(act)
095:                            || (accountAddress != null && accountAddress
096:                                    .equals(act))) {
097:                        it.remove();
098:                    } else {
099:                        last = act;
100:                    }
101:                }
102:
103:                Address[] to = (Address[]) toList.toArray(new Address[] {});
104:
105:                // Add addresses to the addressbook
106:                MessageBuilderHelper.addAddressesToAddressbook(to);
107:                model.setTo(to);
108:
109:                // bug #997560 (fdietz): CC: should be in Cc:, instead of To:
110:                model.setCc(rfcHeader.getCc());
111:
112:                // create In-Reply-To:, References: headerfields
113:                MessageBuilderHelper
114:                        .createMailingListHeaderItems(header, model);
115:
116:                // select the account this mail was received from
117:                model.setAccountItem(accountItem);
118:            }
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.