Package org.apache.james.mime4j.field.address

Examples of org.apache.james.mime4j.field.address.AddressList


                        // Check if we can index the the address in the right manner
                        if (field != null) {
                            try {
                                // not sure if we really should reparse it. It maybe be better to check just for the right type.
                                // But this impl was easier in the first place
                                AddressList aList = AddressList.parse(MimeUtil.unfold(f.getBody()));
                                for (int i = 0; i < aList.size(); i++) {
                                    Address address = aList.get(i);
                                    if (address instanceof org.apache.james.mime4j.field.address.Mailbox) {
                                        org.apache.james.mime4j.field.address.Mailbox mailbox = (org.apache.james.mime4j.field.address.Mailbox) address;
                                        String value = mailbox.getEncodedString().toUpperCase(Locale.ENGLISH);
                                        doc.add(new Field(field, value, Store.NO, Index.ANALYZED));
                                        if (i == 0) {
View Full Code Here


     * @param headerValue
     * @return display
     */
    public static String getDisplayAddress(String headerValue) {
        try {
            AddressList addressList = AddressList.parse(MimeUtil.unfold(headerValue));
            if (addressList != null && addressList.isEmpty() == false) {
                Address address = addressList.get(0);
                if (address instanceof Mailbox) {
                    return getDisplayAddress((Mailbox) address);
                } else if (address instanceof Group) {
                    Group group = (Group) address;
                    if (group != null) {
View Full Code Here

     * @param headerValue
     * @return mailbox
     */
    public static String getMailboxAddress(String headerValue) {
        try {
            AddressList aList = AddressList.parse(headerValue);
            for (int i = 0; i < aList.size(); i++) {
                Address address = aList.get(i);
                if (address instanceof Mailbox) {
                    Mailbox m = (Mailbox) address;
                    String mailboxName = m.getLocalPart();
                    if (mailboxName == null) {
                        mailboxName ="";
View Full Code Here

        for (Header header:headers) {
            final String name = header.getName();
            if (headerName.equalsIgnoreCase(name)) {
                final String value = header.getValue();
                try {
                    AddressList aList = AddressList.parse(value);
                    for (int i = 0; i < aList.size(); i++) {
                        Address address = aList.get(i);
                        if (address instanceof Mailbox) {
                            if (((Mailbox) address).getEncodedString().toUpperCase(Locale.ENGLISH).contains(text)) {
                                return true;
                            }
                        } else if (address instanceof Group) {
View Full Code Here

    public static class Parser implements FieldParser {
        private static Log log = LogFactory.getLog(Parser.class);

        public Field parse(final String name, final String body, final String raw) {
            AddressList addressList = null;
            ParseException parseException = null;
            try {
                addressList = AddressList.parse(body);
            }
            catch (ParseException e) {
View Full Code Here

            if ("".equals(value.trim())) {
                results = null;
            } else {

                try {
                    AddressList addressList = AddressList.parse(value);
                    final int size = addressList.size();
                    final List<FetchResponse.Envelope.Address> addresses = new ArrayList<FetchResponse.Envelope.Address>(size);
                    for (int i = 0; i < size; i++) {
                        final Address address = addressList.get(i);
                        if (address instanceof Group) {
                            final Group group = (Group) address;
                            addAddresses(group, addresses);

                        } else if (address instanceof org.apache.james.mime4j.field.address.Mailbox) {
View Full Code Here

        for (Header header:headers) {
            final String name = header.getFieldName();
            if (headerName.equalsIgnoreCase(name)) {
                final String value = header.getValue();
                try {
                    AddressList aList = AddressList.parse(value);
                    for (int i = 0; i < aList.size(); i++) {
                        Address address = aList.get(i);
                        if (address instanceof Mailbox) {
                            if (((Mailbox) address).getEncodedString().toLowerCase(Locale.US).contains(text)) {
                                return true;
                            }
                        } else if (address instanceof Group) {
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.field.address.AddressList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.